Skip to contentSkip to conversation

i40e: Fix NULL pointer dereference in i40e_dbg_dump_desc

PATCH Superseded Mateusz Palczewski 2 participants 2 messages Nov 17, 2021 – Nov 19, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i40e: Fix NULL pointer dereference in i40e_dbg_dump_desc

From: Norbert Zulinski <[email protected]>

When trying to dump VFs VSI RX/TX descriptors using debugfs there was a crash
due to NULL pointer dereference in i40e_dbg_dump_desc. Added a check to i40e_dbg_dump_desc that checks if VSI type is correct for dumping RX/TX descriptors.

Fixes 02e9c290814c ("i40e: debugfs interface")
---
 drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_debugfs.c +8 -0
index 291e61a..2c1b1da 100644
@@ -553,6 +553,14 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n,
 		dev_info(&pf->pdev->dev, "vsi %d not found\n", vsi_seid);
 		return;
 	}
+	if (vsi->type != I40E_VSI_MAIN &&
+	    vsi->type != I40E_VSI_FDIR &&
+	    vsi->type != I40E_VSI_VMDQ2) {
+		dev_info(&pf->pdev->dev,
+			 "vsi %d type %d descriptor rings not available\n",
+			 vsi_seid, vsi->type);
+		return;
+	}
 	if (type == RING_TYPE_XDP && !i40e_enabled_xdp_vsi(vsi)) {
 		dev_info(&pf->pdev->dev, "XDP not enabled on VSI %d\n", vsi_seid);
 		return;
Signature · 1 line
2.27.0
#1 lore raw

PATCH 1/1 i40e: Fix NULL pointer dereference in i40e_dbg_dump_desc

Quoted 11 lines · Mateusz Palczewski

From: Norbert Zulinski <[email protected]>

When trying to dump VFs VSI RX/TX descriptors using debugfs there was a crash
due to NULL pointer dereference in i40e_dbg_dump_desc. Added a check to i40e_dbg_dump_desc that checks if VSI type is correct for dumping RX/TX descriptors.

Fixes 02e9c290814c ("i40e: debugfs interface")

There is no Signed-off-by from the author.