diff options
author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2022-01-05 16:18:11 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-01-27 13:03:50 +0300 |
commit | 21bdddc9648b9b44868e496103adfa16d55aaf69 (patch) | |
tree | 52cf4b16d3e825c9be83a4554488cbe72ca9a45d /net | |
parent | 6dab20da69f9b92ebbdd8beed45002ecb3c83cda (diff) | |
download | linux-21bdddc9648b9b44868e496103adfa16d55aaf69.tar.xz |
net: dsa: fix incorrect function pointer check for MRP ring roles
[ Upstream commit ff91e1b68490b97c18c649b769618815eb945f11 ]
The cross-chip notifier boilerplate code meant to check the presence of
ds->ops->port_mrp_add_ring_role before calling it, but checked
ds->ops->port_mrp_add instead, before calling
ds->ops->port_mrp_add_ring_role.
Therefore, a driver which implements one operation but not the other
would trigger a NULL pointer dereference.
There isn't any such driver in DSA yet, so there is no reason to
backport the change. Issue found through code inspection.
Cc: Horatiu Vultur <horatiu.vultur@microchip.com>
Fixes: c595c4330da0 ("net: dsa: add MRP support")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/dsa/switch.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/dsa/switch.c b/net/dsa/switch.c index 44558fbdc65b..fb69f2f14234 100644 --- a/net/dsa/switch.c +++ b/net/dsa/switch.c @@ -644,7 +644,7 @@ static int dsa_switch_mrp_add_ring_role(struct dsa_switch *ds, struct dsa_notifier_mrp_ring_role_info *info) { - if (!ds->ops->port_mrp_add) + if (!ds->ops->port_mrp_add_ring_role) return -EOPNOTSUPP; if (ds->index == info->sw_index) @@ -658,7 +658,7 @@ static int dsa_switch_mrp_del_ring_role(struct dsa_switch *ds, struct dsa_notifier_mrp_ring_role_info *info) { - if (!ds->ops->port_mrp_del) + if (!ds->ops->port_mrp_del_ring_role) return -EOPNOTSUPP; if (ds->index == info->sw_index) |