Skip to content

Commit 4926698

Browse files
jukkarfabiobaltieri
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 ffd82b7 commit 4926698

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
@@ -1541,6 +1541,8 @@ void net_if_start_rs(struct net_if *iface)
15411541
goto out;
15421542
}
15431543

1544+
net_if_unlock(iface);
1545+
15441546
NET_DBG("Starting ND/RS for iface %p", iface);
15451547

15461548
if (!net_ipv6_start_rs(iface)) {
@@ -1556,6 +1558,7 @@ void net_if_start_rs(struct net_if *iface)
15561558
}
15571559
}
15581560

1561+
return;
15591562
out:
15601563
net_if_unlock(iface);
15611564
}

0 commit comments

Comments
 (0)