[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0de89a50-6d5c-1d7b-19f5-9a13465bcebd@gmail.com>
Date: Fri, 22 Feb 2019 10:25:09 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: Eric Biggers <ebiggers@...nel.org>,
Eric Dumazet <eric.dumazet@...il.com>
Cc: 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>,
Al Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH net] net: socket: set sock->sk to NULL after calling
proto_ops::release()
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()
>
> The issue now is that if ->setattr() happens *after* __sock_release() (which is
> possible if fchownat() gets the reference to the file's 'struct path', then the
> file is close()d by another thread, then fchownat() continues), it will see
> stale sock->sk because for many socket types it wasn't set to NULL earlier.
>
> - Eric
>
Powered by blists - more mailing lists