mirror of
https://github.com/torvalds/linux.git
synced 2026-06-10 15:42:19 +02:00
team: check return value of team_get_port_by_index_rcu() for NULL
[ Upstream commit76c455decb] team_get_port_by_index_rcu() might return NULL due to race between port removal and skb tx path. Panic is easily triggeable when txing packets and adding/removing port in a loop. introduced by commit3d249d4ca"net: introduce ethernet teaming device" and commit753f993911"team: introduce random mode" (for random mode) Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
93f7534497
commit
a50ebefd35
|
|
@ -52,6 +52,8 @@ static bool rr_transmit(struct team *team, struct sk_buff *skb)
|
|||
|
||||
port_index = rr_priv(team)->sent_packets++ % team->port_count;
|
||||
port = team_get_port_by_index_rcu(team, port_index);
|
||||
if (unlikely(!port))
|
||||
goto drop;
|
||||
port = __get_first_port_up(team, port);
|
||||
if (unlikely(!port))
|
||||
goto drop;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user