Commit bc5acde
af_unix: Use unix_recvq_full_lockless() in unix_stream_connect().
[ Upstream commit 45d872f ]
Once sk->sk_state is changed to TCP_LISTEN, it never changes.
unix_accept() takes advantage of this characteristics; it does not
hold the listener's unix_state_lock() and only acquires recvq lock
to pop one skb.
It means unix_state_lock() does not prevent the queue length from
changing in unix_stream_connect().
Thus, we need to use unix_recvq_full_lockless() to avoid data-race.
Now we remove unix_recvq_full() as no one uses it.
Note that we can remove READ_ONCE() for sk->sk_max_ack_backlog in
unix_recvq_full_lockless() because of the following reasons:
(1) For SOCK_DGRAM, it is a written-once field in unix_create1()
(2) For SOCK_STREAM and SOCK_SEQPACKET, it is changed under the
listener's unix_state_lock() in unix_listen(), and we hold
the lock in unix_stream_connect()
Fixes: 1da177e ("Linux-2.6.12-rc2")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 355d2bb commit bc5acde
1 file changed
+2
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | 224 | | |
230 | 225 | | |
231 | | - | |
232 | | - | |
| 226 | + | |
233 | 227 | | |
234 | 228 | | |
235 | 229 | | |
| |||
1527 | 1521 | | |
1528 | 1522 | | |
1529 | 1523 | | |
1530 | | - | |
| 1524 | + | |
1531 | 1525 | | |
1532 | 1526 | | |
1533 | 1527 | | |
| |||
0 commit comments