Skip to content

Commit 7d8e8f3

Browse files
idoschdavem330
authored andcommitted
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: 93c1edb ("mlxsw: Introduce Mellanox switch driver core") Signed-off-by: Ido Schimmel <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ec4f5b3 commit 7d8e8f3

File tree

1 file changed

+4
-2
lines changed
  • drivers/net/ethernet/mellanox/mlxsw

1 file changed

+4
-2
lines changed

drivers/net/ethernet/mellanox/mlxsw/core.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,11 +2051,13 @@ void mlxsw_core_skb_receive(struct mlxsw_core *mlxsw_core, struct sk_buff *skb,
20512051
break;
20522052
}
20532053
}
2054-
rcu_read_unlock();
2055-
if (!found)
2054+
if (!found) {
2055+
rcu_read_unlock();
20562056
goto drop;
2057+
}
20572058

20582059
rxl->func(skb, local_port, rxl_item->priv);
2060+
rcu_read_unlock();
20592061
return;
20602062

20612063
drop:

0 commit comments

Comments
 (0)