On Fri, Feb 22, 2019 at 10:25:09AM -0800, Eric Dumazet wrote:
>
>
> On 02/22/2019 09:57 AM, Eric Biggers wrote:
>
> > ->setattr() is called under inode_lock(), which __sock_release() also
> > takes. So
> > the uses of sock->sk are serialized. See commit 6d8c50dcb029 ("socket:
> > close
> > race condition between sock_close() and sockfs_setattr()").
>
> Oh right, we added another inode_lock()/inode_unlock() for sock_close()
An interesting question is whether anything else will be confused by
sock->sk && sock->sk->sk_socket != sock
I'd still like to figure out if we could simply make sock_orphan()
do something like
if (likely(sk->sk_socket))
sk->sk_socket->sk = NULL;
just before sk_set_socket(sk, NULL);
That would make for much easier rules; the question is whether anything
relies upon the windows when linkage between socket and sock is not
symmetrical...