Skip to content

Commit 7f9936a

Browse files
committed
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 f001479 commit 7f9936a

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
@@ -1519,6 +1519,8 @@ void net_if_start_rs(struct net_if *iface)
15191519
goto out;
15201520
}
15211521

1522+
net_if_unlock(iface);
1523+
15221524
NET_DBG("Starting ND/RS for iface %p", iface);
15231525

15241526
if (!net_ipv6_start_rs(iface)) {
@@ -1534,6 +1536,7 @@ void net_if_start_rs(struct net_if *iface)
15341536
}
15351537
}
15361538

1539+
return;
15371540
out:
15381541
net_if_unlock(iface);
15391542
}

0 commit comments

Comments
 (0)