summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Yang <mmyangfl@gmail.com>2026-06-06 15:52:44 +0300
committerJakub Kicinski <kuba@kernel.org>2026-06-10 03:54:34 +0300
commitea07514700f7a5125db67c9d1cbfb06e65c30a07 (patch)
treea074f7cc0f5ea9c6efecf2182f876b1418273348 /include
parent53a65db20a4f3fe6c01b1f789f9eae6b1244910f (diff)
downloadlinux-ea07514700f7a5125db67c9d1cbfb06e65c30a07.tar.xz
net: mscc: ocelot: validate netdev belongs to switch in .netdev_to_port()
The .netdev_to_port() currently takes only a net_device and returns the port index, without verifying the netdev actually belongs to the switch being operated on. This can cause flower rule parsing to silently resolve to a wrong port on the local hardware. Update both implementations felix_netdev_to_port() and ocelot_netdev_to_port() to validate ownership. Also update the callers in ocelot_flower.c to pass through the ocelot context. Signed-off-by: David Yang <mmyangfl@gmail.com> Link: https://patch.msgid.link/20260606125247.305167-1-mmyangfl@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/soc/mscc/ocelot.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h
index 48d6deb3efd7..05a8191b148e 100644
--- a/include/soc/mscc/ocelot.h
+++ b/include/soc/mscc/ocelot.h
@@ -650,7 +650,7 @@ struct device_node;
struct ocelot_ops {
struct net_device *(*port_to_netdev)(struct ocelot *ocelot, int port);
- int (*netdev_to_port)(struct net_device *dev);
+ int (*netdev_to_port)(struct ocelot *ocelot, struct net_device *dev);
int (*reset)(struct ocelot *ocelot);
u16 (*wm_enc)(u16 value);
u16 (*wm_dec)(u16 value);