Thread View: linux.kernel.netdev
2 messages
2 total messages
Started by Thomas Fourier
Wed, 04 Nov 2026 12:02
[PATCH net] net: mvpp2: fix double free of the replaced rule in mvpp2_ethtool_cls_rule_ins()
Author: Thomas Fourier
Date: Wed, 04 Nov 2026 12:02
Date: Wed, 04 Nov 2026 12:02
31 lines
12155 bytes
12155 bytes
When a rule already exists at the requested location,
mvpp2_ethtool_cls_rule_ins() removes it from the hardware and frees it,
but leaves port->rfs_rules[loc] pointing at the freed structure. If
inserting the new rule then fails, the next rule insertion will free the
rule once again.
Clear the slot as soon as the old rule has been freed.
This bug was statically found and theoretical. Compile tested only.
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Fixes: 90b509b39ac9 ("net: mvpp2: cls: Add Classification offload support")
---
drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
index 80d15d7a5ec3..8ec94387cb57 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
@@ -1405,6 +1405,7 @@ int mvpp2_ethtool_cls_rule_ins(struct mvpp2_port *port,
if (ret)
goto clean_eth_rule;
kfree(old_efs);
+ port->rfs_rules[efs->rule.loc] = NULL;
port->n_rfs_rules--;
}
--
2.53.0
Re: [PATCH net] net: mvpp2: fix double free of the replaced rule in mvpp2_ethtool_cls_rule_ins()
Author: patchwork-bot+netdevbpf
Date: Tue, 10 Nov 2026 02:55
Date: Tue, 10 Nov 2026 02:55
25 lines
8756 bytes
8756 bytes
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 4 Nov 2026 13:02:23 +0100 you wrote:
> When a rule already exists at the requested location,
> mvpp2_ethtool_cls_rule_ins() removes it from the hardware and frees it,
> but leaves port->rfs_rules[loc] pointing at the freed structure. If
> inserting the new rule then fails, the next rule insertion will free the
> rule once again.
>
> Clear the slot as soon as the old rule has been freed.
>
> [...]
Here is the summary with links:
- [net] net: mvpp2: fix double free of the replaced rule in mvpp2_ethtool_cls_rule_ins()
https://git.kernel.org/netdev/net-next/c/d26955e57475
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads