]> git.baikalelectronics.ru Git - kernel.git/commit
net: dsa: fix incorrect function pointer check for MRP ring roles
authorVladimir Oltean <vladimir.oltean@nxp.com>
Wed, 5 Jan 2022 13:18:11 +0000 (15:18 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 5 Jan 2022 15:04:50 +0000 (15:04 +0000)
commita9356efb9dd993e63481ba2ec37227580b5f7515
tree36cff3b5559f227b89192bdfa9f766467639d58f
parent06c7fa694c2fde9220091efa9f7c92b4d6ded40b
net: dsa: fix incorrect function pointer check for MRP ring roles

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: 1e960f653d95 ("net: dsa: add MRP support")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/switch.c