Skip to contentSkip to conversation

bnx2x: avoid null pointer dereference when enabling SR-IOV

PATCH Applied Michal Kalderon 2 participants 2 messages Dec 4, 2013 – Dec 6, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bnx2x: avoid null pointer dereference when enabling SR-IOV

Fixed NULL pointer dereference when dynamically activating SR-IOV after vf database failed to be allocated in probe stage (for example due to no ARI support in pci hub).

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +5 -0
index 0216d59..2e46c28 100644
@@ -3114,6 +3114,11 @@ int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs_param)
 {
 	struct bnx2x *bp = netdev_priv(pci_get_drvdata(dev));
 
+	if (!IS_SRIOV(bp)) {
+		BNX2X_ERR("failed to configure SR-IOV since vfdb was not allocated. Check dmesg for errors in probe stage\n");
+		return -EINVAL;
+	}
+
 	DP(BNX2X_MSG_IOV, "bnx2x_sriov_configure called with %d, BNX2X_NR_VIRTFN(bp) was %d\n",
 	   num_vfs_param, BNX2X_NR_VIRTFN(bp));
 
Signature · 1 line
1.8.5.rc3