Skip to contentSkip to conversation

net/qede: initialize ptt to prevent derefence

PATCH New Bulatov Mark 1 participant 1 message Nov 13 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/qede: initialize ptt to prevent derefence

From: Mark Bulatov <[email protected]>

In the qed_fill_dev_info() function, ptt is passed as NULL into the else block, which will lead to a null pointer dereference in ecore_ptt_get_hw_addr().

Fix this by adding ptt initialization.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes 86a2265e59 ("qede: add SRIOV support")
---
 drivers/net/qede/qede_main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/qede/qede_main.c +4 -2
index fd63262f3a..1aa30a0462 100644
@@ -415,8 +415,10 @@ qed_fill_dev_info(struct ecore_dev *edev, struct qed_dev_info *dev_info)
 			ecore_ptt_release(ECORE_LEADING_HWFN(edev), ptt);
 		}
 	} else {
-		ecore_mcp_get_mfw_ver(ECORE_LEADING_HWFN(edev), ptt,
-				      &dev_info->mfw_rev, NULL);
+		ptt = ecore_ptt_acquire(ECORE_LEADING_HWFN(edev));
+		if (ptt)
+			ecore_mcp_get_mfw_ver(ECORE_LEADING_HWFN(edev), ptt,
+					      &dev_info->mfw_rev, NULL);
 	}
 
 	return 0;
Signature · 1 line
2.39.5