Doug writes: "Really final for-rc pull request for 4.19 Ok, so last week I thought we had sent our final pull request for 4.19. Well, wouldn't ya know someone went and found a couple Spectre v1 fixes were needed :-/. So, a couple *very* small specter patches for this (hopefully) final -rc week." * tag 'for-gkh' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: RDMA/ucma: Fix Spectre v1 vulnerability IB/ucm: Fix Spectre v1 vulnerability
Unified · Split
| @@ -46,6 +46,8 @@ · 45 unmodified lines | ||
| 46 | 46 | #include <linux/mutex.h> |
| 47 | 47 | #include <linux/slab.h> |
| 48 | 48 | |
| 49 | +#include <linux/nospec.h> | |
| 50 | + | |
| 49 | 51 | #include <linux/uaccess.h> |
| 50 | 52 | |
| 51 | 53 | #include <rdma/ib.h> |
| @@ -1120,6 +1122,7 @@ static ssize_t ib_ucm_write(struct file *filp, const char __user *buf, · 1068 unmodified lines | ||
| 1120 | 1122 | |
| 1121 | 1123 | if (hdr.cmd >= ARRAY_SIZE(ucm_cmd_table)) |
| 1122 | 1124 | return -EINVAL; |
| 1125 | + hdr.cmd = array_index_nospec(hdr.cmd, ARRAY_SIZE(ucm_cmd_table)); | |
| 1123 | 1126 | |
| 1124 | 1127 | if (hdr.in + sizeof(hdr) > len) |
| 1125 | 1128 | return -EINVAL; |
| @@ -44,6 +44,8 @@ · 43 unmodified lines | ||
| 44 | 44 | #include <linux/module.h> |
| 45 | 45 | #include <linux/nsproxy.h> |
| 46 | 46 | |
| 47 | +#include <linux/nospec.h> | |
| 48 | + | |
| 47 | 49 | #include <rdma/rdma_user_cm.h> |
| 48 | 50 | #include <rdma/ib_marshall.h> |
| 49 | 51 | #include <rdma/rdma_cm.h> |
| @@ -1676,6 +1678,7 @@ static ssize_t ucma_write(struct file *filp, const char __user *buf, · 1626 unmodified lines | ||
| 1676 | 1678 | |
| 1677 | 1679 | if (hdr.cmd >= ARRAY_SIZE(ucma_cmd_table)) |
| 1678 | 1680 | return -EINVAL; |
| 1681 | + hdr.cmd = array_index_nospec(hdr.cmd, ARRAY_SIZE(ucma_cmd_table)); | |
| 1679 | 1682 | |
| 1680 | 1683 | if (hdr.in + sizeof(hdr) > len) |
| 1681 | 1684 | return -EINVAL; |