From 1e9657a43a3e3b0965d0733de06c8364a54f5d05 Mon Sep 17 00:00:00 2001 From: Nicolas Morey-Chaisemartin Date: Apr 04 2022 11:52:17 +0000 Subject: RDMA/hns: Validate the pkey index (git-fixes) --- diff --git a/patches.suse/RDMA-hns-Validate-the-pkey-index.patch b/patches.suse/RDMA-hns-Validate-the-pkey-index.patch new file mode 100644 index 0000000..a8858c4 --- /dev/null +++ b/patches.suse/RDMA-hns-Validate-the-pkey-index.patch @@ -0,0 +1,36 @@ +From 2a67fcfa0db6b4075515bd23497750849b88850f Mon Sep 17 00:00:00 2001 +From: Kamal Heib +Date: Wed, 17 Nov 2021 16:59:54 +0200 +Subject: [PATCH 1/1] RDMA/hns: Validate the pkey index +Git-commit: 2a67fcfa0db6b4075515bd23497750849b88850f +Patch-mainline: v5.17 +References: git-fixes + +Before query pkey, make sure that the queried index is valid. + +Fixes: 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver") +Link: https://lore.kernel.org/r/20211117145954.123893-1-kamalheib1@gmail.com +Signed-off-by: Kamal Heib +Signed-off-by: Jason Gunthorpe +Acked-by: Nicolas Morey-Chaisemartin +--- + drivers/infiniband/hw/hns/hns_roce_main.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c +index 4194b626f3c6..8233bec053ee 100644 +--- a/drivers/infiniband/hw/hns/hns_roce_main.c ++++ b/drivers/infiniband/hw/hns/hns_roce_main.c +@@ -298,6 +298,9 @@ static enum rdma_link_layer hns_roce_get_link_layer(struct ib_device *device, + static int hns_roce_query_pkey(struct ib_device *ib_dev, u8 port, u16 index, + u16 *pkey) + { ++ if (index > 0) ++ return -EINVAL; ++ + *pkey = PKEY_ID; + + return 0; +-- +2.35.0 + diff --git a/series.conf b/series.conf index 02f89a7..5b40330 100644 --- a/series.conf +++ b/series.conf @@ -60808,6 +60808,7 @@ patches.suse/0002-usb-Introduce-Xen-pvUSB-frontend-xen-hcd.patch patches.suse/usb-host-xen-hcd-add-missing-unlock-in-error-path.patch patches.suse/RDMA-bnxt_re-Scan-the-whole-bitmap-when-checking-if-.patch + patches.suse/RDMA-hns-Validate-the-pkey-index.patch patches.suse/scsi-ufs-Fix-race-conditions-related-to-driver-data patches.suse/scsi-lpfc-Fix-leaked-lpfc_dmabuf-mbox-allocations-wi.patch patches.suse/scsi-lpfc-Change-return-code-on-I-Os-received-during.patch