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")
Cc: [email protected]

Signed-off-by: Alexey Simakov <[email protected]>
Signed-off-by: Mark Bulatov <[email protected]>
---
 drivers/net/qede/qede_main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c
index fd63262f3a..1aa30a0462 100644
--- a/drivers/net/qede/qede_main.c
+++ b/drivers/net/qede/qede_main.c
@@ -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;
-- 
2.39.5

Reply via email to