]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
socket: Fix a use-after-free in soclose()
authorMark Johnston <markj@FreeBSD.org>
Fri, 17 Sep 2021 16:26:06 +0000 (12:26 -0400)
committerMark Johnston <markj@FreeBSD.org>
Fri, 17 Sep 2021 18:19:05 +0000 (14:19 -0400)
commitdfcef8771484271f2bccdb1dbc088a838441c5a7
tree84de5918f05701b6ef265d6c0c3f82a4d828f0d1
parentbf25678226f0d9b52c27610c734c97d76a7cae59
socket: Fix a use-after-free in soclose()

After releasing the fd reference to a socket "so", we should avoid
testing SOLISTENING(so) since the socket may have been freed.  Instead,
directly test whether the list of unaccepted sockets is empty.

Fixes: f4bb1869ddd2 ("Consistently use the SOLISTENING() macro")
Pointy hat: markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31973
sys/kern/uipc_socket.c