Skip to contentSkip to conversation

net: enetc: check the index of the SFI rather than the handle

PATCH Applied [email protected] 3 participants 3 messages May 4, 2023 – May 5, 2023

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 net: enetc: check the index of the SFI rather than the handle

From: Wei Fang <[email protected]>

We should check whether the current SFI (Stream Filter Instance) table is full before creating a new SFI entry. However, the previous logic checks the handle by mistake and might lead to unpredictable behavior.

Fixes 888ae5a3952b ("net: enetc: add tc flower psfp offload driver")
---
 drivers/net/ethernet/freescale/enetc/enetc_qos.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/enetc/enetc_qos.c +1 -1
index 130ebf6853e6..83c27bbbc6ed 100644
@@ -1247,7 +1247,7 @@ static int enetc_psfp_parse_clsflower(struct enetc_ndev_priv *priv,
 		int index;
 
 		index = enetc_get_free_index(priv);
-		if (sfi->handle < 0) {
+		if (index < 0) {
 			NL_SET_ERR_MSG_MOD(extack, "No Stream Filter resource!");
 			err = -ENOSPC;
 			goto free_fmi;
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · On Thu, May 04, 2023 at 04:03:59PM +0800, [email protected] wrote:

From: Wei Fang <[email protected]>

We should check whether the current SFI (Stream Filter Instance) table is full before creating a new SFI entry. However, the previous logic checks the handle by mistake and might lead to unpredictable behavior.

Quoted 6 lines
Fixes 888ae5a3952b ("net: enetc: add tc flower psfp offload driver")
---
 drivers/net/ethernet/freescale/enetc/enetc_qos.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks,

#2 lore raw
In reply to [email protected]
This patch was applied to netdev/net.git (main) by David S. Miller <[email protected]>:

Hello:

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

Quoted 10 lines · On Thu, 4 May 2023 16:03:59 +0800 you wrote:

From: Wei Fang <[email protected]>

We should check whether the current SFI (Stream Filter Instance) table is full before creating a new SFI entry. However, the previous logic checks the handle by mistake and might lead to unpredictable behavior.

Fixes 888ae5a3952b ("net: enetc: add tc flower psfp offload driver")

[...]

Here is the summary with links:
- [net] net: enetc: check the index of the SFI rather than the handle

    https://git.kernel.org/netdev/net/c/299efdc2380a

You are awesome, thank you!

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