[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190222190850.GF2217@ZenIV.linux.org.uk>
Date: Fri, 22 Feb 2019 19:08:50 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: Eric Biggers <ebiggers@...nel.org>, netdev@...r.kernel.org,
"David S . Miller" <davem@...emloft.net>,
linux-kernel@...r.kernel.org, Mao Wenan <maowenan@...wei.com>,
Cong Wang <xiyou.wangcong@...il.com>,
Lorenzo Colitti <lorenzo@...gle.com>,
Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
Subject: Re: [PATCH net] net: socket: set sock->sk to NULL after calling
proto_ops::release()
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...
Powered by blists - more mailing lists