infiniband: hw: qedr: add null check before pointer dereference
Subsystems (2)
PATCH 1/1 infiniband: hw: qedr: add null check before pointer dereference
Add null check before dereferencing pointer sgid_attr.ndev inside function rdma_vlan_dev_vlan_id().
Addresses-Coverity-ID: 1373979
--- drivers/infiniband/hw/qedr/qedr_cm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/infiniband/hw/qedr/qedr_cm.c +6 -4
@@ -270,11 +270,13 @@ static inline int qedr_gsi_build_header(struct qedr_dev *dev,return rc; } - vlan_id =rdma_vlan_dev_vlan_id (sgid_attr.ndev); -if (vlan_id <VLAN_CFI_MASK ) - has_vlan = true; -if (sgid_attr.ndev) +if (sgid_attr.ndev) { + vlan_id =rdma_vlan_dev_vlan_id (sgid_attr.ndev); +if (vlan_id <VLAN_CFI_MASK ) + has_vlan = true; +dev_put (sgid_attr.ndev); + }if (!memcmp (&sgid, &zgid,sizeof (sgid))) { DP_ERR(dev, "gsi post send: GID not found GID index %d\n",
Signature · 1 line
2.5.0
Quoted 8 lines · Gustavo A. R. Silva
Add null check before dereferencing pointer sgid_attr.ndev inside function
rdma_vlan_dev_vlan_id().Addresses-Coverity-ID: 1373979
Signed-off-by Gustavo A. R. Silva <garsilva-L1vi/[email protected]>--- drivers/infiniband/hw/qedr/qedr_cm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
+ Ram,
Ram, IB part of qedr driver doesn't exist in MAINTAINERS file.
Quoted 10 lines
drivers/infiniband/hw/qedr/qedr_cm.c +0
-1@@ -270,11 +270,13 @@ static inline int qedr_gsi_build_header(struct qedr_dev *dev,return rc; } - vlan_id =rdma_vlan_dev_vlan_id (sgid_attr.ndev);
drivers/infiniband/hw/qedr/qedr_cm.c static inline int qedr_gsi_build_header(struct qedr_dev *dev, · line 279
Quoted 10 lines
drivers/infiniband/hw/qedr/qedr_cm.c +6
-3-if (vlan_id <VLAN_CFI_MASK ) - has_vlan = true; -if (sgid_attr.ndev) +if (sgid_attr.ndev) { + vlan_id =rdma_vlan_dev_vlan_id (sgid_attr.ndev); +if (vlan_id <VLAN_CFI_MASK ) + has_vlan = true; +dev_put (sgid_attr.ndev); + }
I do agree that it is better than kernel panic trying to access NULL pointer, but I'm not sure that retaining default vlan_id = 0 is correct solution here.
Quoted 6 lines
drivers/infiniband/hw/qedr/qedr_cm.c +0
-1if (!memcmp (&sgid, &zgid,sizeof (sgid))) { DP_ERR(dev, "gsi post send: GID not found GID index %d\n", --2.5.0
Quoted 4 lines
+ Ram,
Ram, IB part of qedr driver doesn't exist in
MAINTAINERSfile.
Weird. I'll fix it.
Thanks,
Ram
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 34 lines
Add null check before dereferencing pointer sgid_attr.ndev inside function
rdma_vlan_dev_vlan_id().Addresses-Coverity-ID: 1373979
Signed-off-by Gustavo A. R. Silva <[email protected]>--- drivers/infiniband/hw/qedr/qedr_cm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)drivers/infiniband/hw/qedr/qedr_cm.c +6
-5@@ -270,11 +270,13 @@ static inline int qedr_gsi_build_header(struct qedr_dev *dev,return rc; } - vlan_id =rdma_vlan_dev_vlan_id (sgid_attr.ndev); -if (vlan_id <VLAN_CFI_MASK ) - has_vlan = true; -if (sgid_attr.ndev) +if (sgid_attr.ndev) { + vlan_id =rdma_vlan_dev_vlan_id (sgid_attr.ndev); +if (vlan_id <VLAN_CFI_MASK ) + has_vlan = true; +dev_put (sgid_attr.ndev); + }if (!memcmp (&sgid, &zgid,sizeof (sgid))) { DP_ERR(dev, "gsi post send: GID not found GID index %d\n", --2.5.0
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Thanks.
Doug Ledford
AppliedQuoted 6 lines · Gustavo A. R. Silva
Add null check before dereferencing pointer sgid_attr.ndev inside function
rdma_vlan_dev_vlan_id().Addresses-Coverity-ID: 1373979
Signed-off-by Gustavo A. R. Silva <garsilva-L1vi/[email protected]>---
Thanks, applied.
Signature · 9 lines
Doug Ledford <[email protected]> GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html