Skip to content

Commit eb6d938

Browse files
committed
Merge tag 'for-gkh' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
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
2 parents fa520c4 + a3671a4 commit eb6d938

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

drivers/infiniband/core/ucm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
#include <linux/mutex.h>
4747
#include <linux/slab.h>
4848

49+
#include <linux/nospec.h>
50+
4951
#include <linux/uaccess.h>
5052

5153
#include <rdma/ib.h>
@@ -1120,6 +1122,7 @@ static ssize_t ib_ucm_write(struct file *filp, const char __user *buf,
11201122

11211123
if (hdr.cmd >= ARRAY_SIZE(ucm_cmd_table))
11221124
return -EINVAL;
1125+
hdr.cmd = array_index_nospec(hdr.cmd, ARRAY_SIZE(ucm_cmd_table));
11231126

11241127
if (hdr.in + sizeof(hdr) > len)
11251128
return -EINVAL;

drivers/infiniband/core/ucma.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
#include <linux/module.h>
4545
#include <linux/nsproxy.h>
4646

47+
#include <linux/nospec.h>
48+
4749
#include <rdma/rdma_user_cm.h>
4850
#include <rdma/ib_marshall.h>
4951
#include <rdma/rdma_cm.h>
@@ -1676,6 +1678,7 @@ static ssize_t ucma_write(struct file *filp, const char __user *buf,
16761678

16771679
if (hdr.cmd >= ARRAY_SIZE(ucma_cmd_table))
16781680
return -EINVAL;
1681+
hdr.cmd = array_index_nospec(hdr.cmd, ARRAY_SIZE(ucma_cmd_table));
16791682

16801683
if (hdr.in + sizeof(hdr) > len)
16811684
return -EINVAL;

0 commit comments

Comments
 (0)