* [PATCH net] net: bcmgenet: reject undersized RX classification rule buffers
@ 2026-11-21 0:15 Artemii Mashanov
2026-11-21 0:17 ` netdev-bot+sinfo
0 siblings, 1 reply; 2+ messages in thread
From: Artemii Mashanov @ 2026-11-21 0:15 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
bcmgenet_get_rxnfc() returns success with an incomplete list of RX
classification rules when ETHTOOL_GRXCLSRLALL receives fewer slots
than the number of installed rules.
Return -EMSGSIZE when the next rule cannot fit in the caller's
buffer. On success, report the actual number of copied rules.
The source-extracted ASan/UBSan regression tests passed.
Fixes: 3e370952287c ("net: bcmgenet: add support for ethtool rxnfc flows")
Signed-off-by: Artemii Mashanov <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 4d2be2a..6a4a7fd 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;
--
2.56.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] net: bcmgenet: reject undersized RX classification rule buffers
2026-11-21 0:15 [PATCH net] net: bcmgenet: reject undersized RX classification rule buffers Artemii Mashanov
@ 2026-11-21 0:17 ` netdev-bot+sinfo
0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sinfo @ 2026-11-21 0:17 UTC (permalink / raw)
To: Artemii Mashanov
Cc: netdev, Doug Berger, Florian Fainelli, Nicolai Buchwitz,
Broadcom internal kernel review list, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
- Whether the issue was actually triggered, or is only theoretical
(e.g. found by LLM and not proven at runtime). If it was triggered
please include the symptoms, like the stack trace or kernel messages.
- What hardware the change was tested on. For driver fixes please
mention the device (and if relevant firmware version) used for
testing, or say that the change was not tested on real hardware.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.
*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
--
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-21 0:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-21 0:15 [PATCH net] net: bcmgenet: reject undersized RX classification rule buffers Artemii Mashanov
2026-11-21 0:17 ` netdev-bot+sinfo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox