Skip to content

Commit 012796f

Browse files
jgunthorpegregkh
authored andcommitted
RDMA/mana: Validate rx_hash_key_len
commit 6dd2d4a upstream. Sashiko points out that rx_hash_key_len comes from a uAPI structure and is blindly passed to memcpy, allowing the userspace to trash kernel memory. Bounds check it so the memcpy cannot overflow. Cc: stable@vger.kernel.org Fixes: 0266a17 ("RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter") Link: https://sashiko.dev/#/patchset/0-v2-1c49eeb88c48%2B91-rdma_udata_rep_jgg%40nvidia.com?part=1 Link: https://patch.msgid.link/r/4-v1-41f3135e5565+9d2-rdma_ai_fixes1_jgg@nvidia.com Reviewed-by: Long Li <longli@microsoft.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9ef65af commit 012796f

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

  • drivers/infiniband/hw/mana

drivers/infiniband/hw/mana/qp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ static int mana_ib_cfg_vport_steering(struct mana_ib_dev *dev,
2121

2222
gc = mdev_to_gc(dev);
2323

24+
if (rx_hash_key_len > sizeof(req->hashkey))
25+
return -EINVAL;
26+
2427
req_buf_size = struct_size(req, indir_tab, MANA_INDIRECT_TABLE_DEF_SIZE);
2528
req = kzalloc(req_buf_size, GFP_KERNEL);
2629
if (!req)

0 commit comments

Comments
 (0)