Skip to contentSkip to conversation

octeontx2-pf: handle otx2_mbox_get_rsp errors

PATCH Applied Chenyuan Yang 4 participants 4 messages Apr 12, 2025 – Apr 16, 2025

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

PATCH 1/1 octeontx2-pf: handle otx2_mbox_get_rsp errors

Adding error pointer check after calling otx2_mbox_get_rsp().

This is similar to the commit bd3110bc102a ("octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_flows.c").

Fixes 6c40ca957fe5 ("octeontx2-pf: Adds TC offload support")
---
 drivers/net/ethernet/marvell/octeontx2/nic/rep.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/marvell/octeontx2/nic/rep.c +2 -0
index 04e08e06f30f..7153a71dfc86 100644
@@ -67,6 +67,8 @@ static int rvu_rep_mcam_flow_init(struct rep_dev *rep)
 
 		rsp = (struct npc_mcam_alloc_entry_rsp *)otx2_mbox_get_rsp
 			(&priv->mbox.mbox, 0, &req->hdr);
+		if (IS_ERR(rsp))
+			goto exit;
 
 		for (ent = 0; ent < rsp->count; ent++)
 			rep->flow_cfg->flow_ent[ent + allocated] = rsp->entry_list[ent];
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Chenyuan Yang

Adding error pointer check after calling otx2_mbox_get_rsp().

This is similar to the commit bd3110bc102a ("octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_flows.c").

Fixes 6c40ca957fe5 ("octeontx2-pf: Adds TC offload support")
---
 drivers/net/ethernet/marvell/octeontx2/nic/rep.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/marvell/octeontx2/nic/rep.c +0 -0
index 04e08e06f30f..7153a71dfc86 100644

drivers/net/ethernet/marvell/octeontx2/nic/rep.c static int rvu_rep_mcam_flow_init(struct rep_dev *rep) · line 71

Quoted 5 lines
drivers/net/ethernet/marvell/octeontx2/nic/rep.c +2 -0
@@ -67,6 +67,8 @@ static int rvu_rep_mcam_flow_init(struct rep_dev *rep)
 
 		rsp = (struct npc_mcam_alloc_entry_rsp *)otx2_mbox_get_rsp
 			(&priv->mbox.mbox, 0, &req->hdr);
+		if (IS_ERR(rsp))
+			goto exit;

Changes looks fine:

BTW, looks like now you can use break instead of goto exit, as exit label is just after the while loop.

Quoted 5 lines
drivers/net/ethernet/marvell/octeontx2/nic/rep.c +0 -0
 		for (ent = 0; ent < rsp->count; ent++)
 			rep->flow_cfg->flow_ent[ent + allocated] = rsp->entry_list[ent];
Signature · 1 line
2.34.1
reviewer
#2 lore raw
Quoted 24 lines · Michal Swiatkowski
Quoted 16 lines · Chenyuan Yang

Adding error pointer check after calling otx2_mbox_get_rsp().

This is similar to the commit bd3110bc102a ("octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_flows.c").

Fixes 6c40ca957fe5 ("octeontx2-pf: Adds TC offload support")
---
 drivers/net/ethernet/marvell/octeontx2/nic/rep.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/marvell/octeontx2/nic/rep.c +0 -0
index 04e08e06f30f..7153a71dfc86 100644

drivers/net/ethernet/marvell/octeontx2/nic/rep.c static int rvu_rep_mcam_flow_init(struct rep_dev *rep) · line 71

Quoted 5 lines
drivers/net/ethernet/marvell/octeontx2/nic/rep.c +2 -0
@@ -67,6 +67,8 @@ static int rvu_rep_mcam_flow_init(struct rep_dev *rep)
 
 		rsp = (struct npc_mcam_alloc_entry_rsp *)otx2_mbox_get_rsp
 			(&priv->mbox.mbox, 0, &req->hdr);
+		if (IS_ERR(rsp))
+			goto exit;

Changes looks fine:

Quoted 4 lines

BTW, looks like now you can use break instead of goto exit, as exit label is just after the while loop.

True. My suggestion would be to keep this patch as-is. And, once it has hit net-next, send a follow-up to remove the exit label.

Quoted 7 lines
Quoted 6 lines
drivers/net/ethernet/marvell/octeontx2/nic/rep.c +0 -0
 		for (ent = 0; ent < rsp->count; ent++)
 			rep->flow_cfg->flow_ent[ent + allocated] = rsp->entry_list[ent];
Signature · 1 line
2.34.1
#3 lore raw
In reply to Chenyuan Yang
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Sat, 12 Apr 2025 13:33:27 -0500 you wrote:

Adding error pointer check after calling otx2_mbox_get_rsp().

This is similar to the commit bd3110bc102a ("octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_flows.c").

Fixes 6c40ca957fe5 ("octeontx2-pf: Adds TC offload support")

[...]

Here is the summary with links:
- octeontx2-pf: handle otx2_mbox_get_rsp errors

    https://git.kernel.org/netdev/net/c/688abe1027d0

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html