[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20190225.104156.1331861489514486019.davem@davemloft.net>
Date: Mon, 25 Feb 2019 10:41:56 -0800 (PST)
From: David Miller <davem@...emloft.net>
To: ebiggers@...nel.org
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
maowenan@...wei.com, xiyou.wangcong@...il.com, lorenzo@...gle.com,
penguin-kernel@...ove.sakura.ne.jp, viro@...iv.linux.org.uk
Subject: Re: [PATCH net] net: socket: set sock->sk to NULL after calling
proto_ops::release()
From: Eric Biggers <ebiggers@...nel.org>
Date: Thu, 21 Feb 2019 14:13:56 -0800
> From: Eric Biggers <ebiggers@...gle.com>
>
> Commit 9060cb719e61 ("net: crypto set sk to NULL when af_alg_release.")
> fixed a use-after-free in sockfs_setattr() when an AF_ALG socket is
> closed concurrently with fchownat(). However, it ignored that many
> other proto_ops::release() methods don't set sock->sk to NULL and
> therefore allow the same use-after-free:
...
> Rather than fixing all these and relying on every socket type to get
> this right forever, just make __sock_release() set sock->sk to NULL
> itself after calling proto_ops::release().
>
> Reproducer that produces the KASAN splat when any of these socket types
> are configured into the kernel:
...
> Fixes: 86741ec25462 ("net: core: Add a UID field to struct sock.")
> Signed-off-by: Eric Biggers <ebiggers@...gle.com>
Applied and queued up for -stable, thanks Eric.
Powered by blists - more mailing lists