Skip to content

Commit 9d55a60

Browse files
jukkarnashif
authored andcommitted
net: if: Release the interface lock early in IPv6 RS timeout handler
The net_if.c:rs_timeout() is sending a new IPv6 router solicitation message to network by calling net_if_start_rs(). That function will then acquire iface->lock and call net_ipv6_start_rs() which will try to send the RS message and acquire TX send lock. During this RS send, we might receive TCP data that could try to send an ack to peer. This will then in turn cause also TX lock to be acquired. Depending on timing, the lock ordering between rx thread and system workq might mix which could lead to deadlock. Fix this issue by releasing the iface->lock before starting the RS sending process. The net_if_start_rs() does not really need to keep the interface lock for a long time as it is the only one sending the RS message. Fixes #86499 Signed-off-by: Jukka Rissanen <[email protected]>
1 parent 6ce77c2 commit 9d55a60

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

subsys/net/ip/net_if.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,6 +1493,8 @@ void net_if_start_rs(struct net_if *iface)
14931493
goto out;
14941494
}
14951495

1496+
net_if_unlock(iface);
1497+
14961498
NET_DBG("Starting ND/RS for iface %p", iface);
14971499

14981500
if (!net_ipv6_start_rs(iface)) {
@@ -1508,6 +1510,7 @@ void net_if_start_rs(struct net_if *iface)
15081510
}
15091511
}
15101512

1513+
return;
15111514
out:
15121515
net_if_unlock(iface);
15131516
}

0 commit comments

Comments
 (0)