Commit 7d8e8f34 authored by Ido Schimmel's avatar Ido Schimmel Committed by David S. Miller

mlxsw: core: Increase scope of RCU read-side critical section

The lifetime of the Rx listener item ('rxl_item') is managed using RCU,
but is dereferenced outside of RCU read-side critical section, which can
lead to a use-after-free.

Fix this by increasing the scope of the RCU read-side critical section.

Fixes: 93c1edb2 ("mlxsw: Introduce Mellanox switch driver core")
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ec4f5b36
...@@ -2051,11 +2051,13 @@ void mlxsw_core_skb_receive(struct mlxsw_core *mlxsw_core, struct sk_buff *skb, ...@@ -2051,11 +2051,13 @@ void mlxsw_core_skb_receive(struct mlxsw_core *mlxsw_core, struct sk_buff *skb,
break; break;
} }
} }
rcu_read_unlock(); if (!found) {
if (!found) rcu_read_unlock();
goto drop; goto drop;
}
rxl->func(skb, local_port, rxl_item->priv); rxl->func(skb, local_port, rxl_item->priv);
rcu_read_unlock();
return; return;
drop: drop:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment