* [PATCH net-next v2] net: bcmgenet: reject undersized RX classification rule buffers
@ 2026-11-22 8:22 Artemii Mashanov
2026-11-22 16:46 ` Nicolai Buchwitz
2026-11-29 16:30 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Artemii Mashanov @ 2026-11-22 8:22 UTC (permalink / raw)
To: netdev
Cc: Doug Berger, Florian Fainelli, Nicolai Buchwitz,
Broadcom internal kernel review list, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
The rule list can grow between ETHTOOL_GRXCLSRLCNT and
ETHTOOL_GRXCLSRLALL. If the supplied array is too small,
bcmgenet_get_rxnfc() currently reports success with only the rule
locations that fit.
Return -EMSGSIZE when another location cannot fit so callers can
detect an incomplete dump. On success, continue reporting the number
of locations copied.
Signed-off-by: Artemii Mashanov <ralerrdirsardx@gmail.com>
---
Changes in v2:
- Retarget to net-next as requested by Nicolai.
- Clarify the commit message and drop the Fixes and test lines.
- No code changes.
v1: https://lore.kernel.org/netdev/20261121001550.732679-1-ralerrdirsardx@gmail.com/
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 6545caf..a84c8ce 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -1664,7 +1664,7 @@ static int bcmgenet_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
struct bcmgenet_priv *priv = netdev_priv(dev);
struct bcmgenet_rxnfc_rule *rule;
int err = 0;
- int i = 0;
+ u32 i = 0;
switch (cmd->cmd) {
case ETHTOOL_GRXCLSRLCNT:
@@ -1675,9 +1675,11 @@ static int bcmgenet_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
err = bcmgenet_get_flow(dev, cmd, cmd->fs.location);
break;
case ETHTOOL_GRXCLSRLALL:
- list_for_each_entry(rule, &priv->rxnfc_list, list)
- if (i < cmd->rule_cnt)
- rule_locs[i++] = rule->fs.location;
+ list_for_each_entry(rule, &priv->rxnfc_list, list) {
+ if (i == cmd->rule_cnt)
+ return -EMSGSIZE;
+ rule_locs[i++] = rule->fs.location;
+ }
cmd->rule_cnt = i;
cmd->data = MAX_NUM_OF_FS_RULES;
break;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v2] net: bcmgenet: reject undersized RX classification rule buffers
2026-11-22 8:22 [PATCH net-next v2] net: bcmgenet: reject undersized RX classification rule buffers Artemii Mashanov
@ 2026-11-22 16:46 ` Nicolai Buchwitz
2026-11-29 16:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Nicolai Buchwitz @ 2026-11-22 16:46 UTC (permalink / raw)
To: Artemii Mashanov
Cc: netdev, Doug Berger, Florian Fainelli,
Broadcom internal kernel review list, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Hi Artemii
On 22.11.2026 09:22, Artemii Mashanov wrote:
> The rule list can grow between ETHTOOL_GRXCLSRLCNT and
> ETHTOOL_GRXCLSRLALL. If the supplied array is too small,
> bcmgenet_get_rxnfc() currently reports success with only the rule
> locations that fit.
>
> Return -EMSGSIZE when another location cannot fit so callers can
> detect an incomplete dump. On success, continue reporting the number
> of locations copied.
>
> Signed-off-by: Artemii Mashanov <ralerrdirsardx@gmail.com>
> ---
> Changes in v2:
> - Retarget to net-next as requested by Nicolai.
> - Clarify the commit message and drop the Fixes and test lines.
> - No code changes.
>
> v1:
> https://lore.kernel.org/netdev/20261121001550.732679-1-ralerrdirsardx@gmail.com/
> [...]
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Thanks,
Nicolai
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v2] net: bcmgenet: reject undersized RX classification rule buffers
2026-11-22 8:22 [PATCH net-next v2] net: bcmgenet: reject undersized RX classification rule buffers Artemii Mashanov
2026-11-22 16:46 ` Nicolai Buchwitz
@ 2026-11-29 16:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-11-29 16:30 UTC (permalink / raw)
To: Artemii Mashanov
Cc: netdev, opendmb, florian.fainelli, nb, bcm-kernel-feedback-list,
andrew+netdev, davem, edumazet, kuba, pabeni
Hello:
This patch was applied to netdev/net-next.git (main)
by Willem de Bruijn <willemb@google.com>:
On Sun, 22 Nov 2026 11:22:22 +0300 you wrote:
> The rule list can grow between ETHTOOL_GRXCLSRLCNT and
> ETHTOOL_GRXCLSRLALL. If the supplied array is too small,
> bcmgenet_get_rxnfc() currently reports success with only the rule
> locations that fit.
>
> Return -EMSGSIZE when another location cannot fit so callers can
> detect an incomplete dump. On success, continue reporting the number
> of locations copied.
>
> [...]
Here is the summary with links:
- [net-next,v2] net: bcmgenet: reject undersized RX classification rule buffers
https://git.kernel.org/netdev/net-next/c/20f01aee2184
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-29 16:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 8:22 [PATCH net-next v2] net: bcmgenet: reject undersized RX classification rule buffers Artemii Mashanov
2026-11-22 16:46 ` Nicolai Buchwitz
2026-11-29 16:30 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox