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 | #include <linux/mutex.h> | 46 | #include <linux/mutex.h> |
| 47 | #include <linux/slab.h> | 47 | #include <linux/slab.h> |
| 48 | 48 | ||
| 49 | #include <linux/nospec.h> | ||
| 50 | |||
| 49 | #include <linux/uaccess.h> | 51 | #include <linux/uaccess.h> |
| 50 | 52 | ||
| 51 | #include <rdma/ib.h> | 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 | if (hdr.cmd >= ARRAY_SIZE(ucm_cmd_table)) | 1123 | if (hdr.cmd >= ARRAY_SIZE(ucm_cmd_table)) |
| 1122 | return -EINVAL; | 1124 | return -EINVAL; |
| 1125 | hdr.cmd = array_index_nospec(hdr.cmd, ARRAY_SIZE(ucm_cmd_table)); | ||
| 1123 | 1126 | ||
| 1124 | if (hdr.in + sizeof(hdr) > len) | 1127 | if (hdr.in + sizeof(hdr) > len) |
| 1125 | return -EINVAL; | 1128 | return -EINVAL; |
| @@ -44,6 +44,8 @@ · 43 unmodified lines | |||
| 44 | #include <linux/module.h> | 44 | #include <linux/module.h> |
| 45 | #include <linux/nsproxy.h> | 45 | #include <linux/nsproxy.h> |
| 46 | 46 | ||
| 47 | #include <linux/nospec.h> | ||
| 48 | |||
| 47 | #include <rdma/rdma_user_cm.h> | 49 | #include <rdma/rdma_user_cm.h> |
| 48 | #include <rdma/ib_marshall.h> | 50 | #include <rdma/ib_marshall.h> |
| 49 | #include <rdma/rdma_cm.h> | 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 | if (hdr.cmd >= ARRAY_SIZE(ucma_cmd_table)) | 1679 | if (hdr.cmd >= ARRAY_SIZE(ucma_cmd_table)) |
| 1678 | return -EINVAL; | 1680 | return -EINVAL; |
| 1681 | hdr.cmd = array_index_nospec(hdr.cmd, ARRAY_SIZE(ucma_cmd_table)); | ||
| 1679 | 1682 | ||
| 1680 | if (hdr.in + sizeof(hdr) > len) | 1683 | if (hdr.in + sizeof(hdr) > len) |
| 1681 | return -EINVAL; | 1684 | return -EINVAL; |