From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
andrew+netdev@lunn.ch, horms@kernel.org, olteanv@gmail.com,
Jakub Kicinski <kuba@kernel.org>,
andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com
Subject: [PATCH net-next 2/2] net: dsa: mv88e6xxx: check the port when deleting a policy rule
Date: Fri, 18 Sep 2026 11:53:26 -0700 [thread overview]
Message-ID: <20260918185326.3940857-3-kuba@kernel.org> (raw)
In-Reply-To: <20260918185326.3940857-1-kuba@kernel.org>
ETHTOOL_SRXCLSRLDEL removes the policy the location names out of the
switch-wide IDR without checking which port owns it, then hands it to
mv88e6xxx_policy_apply() along with the port the request arrived on.
Deleting another port's rule therefore purges an ATU entry on and clears
the policy register of the requesting port, while the owning port keeps
its hardware policy - and, with the software object freed, no longer has
a location that can be used to remove it.
Initially I thought that we're just able to delete a rule from one port
using another port as a handle. But if the reading of the code outlined
above is correct, this is just borken, not a "feature" someone could
depend on.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: andrew@lunn.ch
CC: olteanv@gmail.com
CC: f.fainelli@gmail.com
CC: vivien.didelot@gmail.com
---
drivers/net/dsa/mv88e6xxx/chip.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index daef7c78b860..7b34cae9c542 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -2503,8 +2503,9 @@ static int mv88e6xxx_set_rxnfc(struct dsa_switch *ds, int port,
break;
case ETHTOOL_SRXCLSRLDEL:
err = -ENOENT;
- policy = idr_remove(&chip->policies, fs->location);
- if (policy) {
+ policy = idr_find(&chip->policies, fs->location);
+ if (policy && policy->port == port) {
+ idr_remove(&chip->policies, fs->location);
policy->action = MV88E6XXX_POLICY_ACTION_NORMAL;
err = mv88e6xxx_policy_apply(chip, port, policy);
devm_kfree(chip->dev, policy);
--
2.55.0
next prev parent reply other threads:[~2026-09-18 18:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 18:53 [PATCH net-next 0/2] net: dsa: mv88e6xxx: ethtool n-tuple follow ups Jakub Kicinski
2026-09-18 18:53 ` [PATCH net-next 1/2] net: dsa: mv88e6xxx: check the port when reading back a policy rule Jakub Kicinski
2026-09-21 18:55 ` netdev-bot+sashiko
2026-09-18 18:53 ` Jakub Kicinski [this message]
2026-09-21 18:55 ` [PATCH net-next 2/2] net: dsa: mv88e6xxx: check the port when deleting " netdev-bot+sashiko
2026-09-22 11:40 ` [PATCH net-next 0/2] net: dsa: mv88e6xxx: ethtool n-tuple follow ups patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260918185326.3940857-3-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=horms@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=vivien.didelot@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox