mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	
				Christian Brauner reported that even after MSG_OOB data is consumed,
calling close() on the receiver socket causes the peer's recv() to
return -ECONNRESET:
  1. send() and recv() an OOB data.
    >>> from socket import *
    >>> s1, s2 = socketpair(AF_UNIX, SOCK_STREAM)
    >>> s1.send(b'x', MSG_OOB)
    1
    >>> s2.recv(1, MSG_OOB)
    b'x'
  2. close() for s2 sets ECONNRESET to s1->sk_err even though
     s2 consumed the OOB data
    >>> s2.close()
    >>> s1.recv(10, MSG_DONTWAIT)
    ...
    ConnectionResetError: [Errno 104] Connection reset by peer
Even after being consumed, the skb holding the OOB 1-byte data stays in
the recv queue to mark the OOB boundary and break recv() at that point.
This must be considered while close()ing a socket.
Let's skip the leading consumed OOB skb while checking the -ECONNRESET
condition in unix_release_sock().
Fixes: 
		
	
					 | 
			||
|---|---|---|
| .. | ||
| af_unix.c | ||
| af_unix.h | ||
| diag.c | ||
| garbage.c | ||
| Kconfig | ||
| Makefile | ||
| sysctl_net_unix.c | ||
| unix_bpf.c | ||