]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net/x25: Fix null-ptr-deref in x25_connect
authorMartin Schiller <ms@dev.tdt.de>
Mon, 9 Nov 2020 06:54:49 +0000 (07:54 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Nov 2020 18:18:51 +0000 (19:18 +0100)
commit889a5da9ddf7c3669263c6d342898c5075d5d13c
treeead68719038a57ce150fadbd20fbb5eba5c4826a
parentbd73928fa9561a25144be6ed9313493bd9fb9ce3
net/x25: Fix null-ptr-deref in x25_connect

[ Upstream commit 361182308766a265b6c521879b34302617a8c209 ]

This fixes a regression for blocking connects introduced by commit
4becb7ee5b3d ("net/x25: Fix x25_neigh refcnt leak when x25 disconnect").

The x25->neighbour is already set to "NULL" by x25_disconnect() now,
while a blocking connect is waiting in
x25_wait_for_connection_establishment(). Therefore x25->neighbour must
not be accessed here again and x25->state is also already set to
X25_STATE_0 by x25_disconnect().

Fixes: 4becb7ee5b3d ("net/x25: Fix x25_neigh refcnt leak when x25 disconnect")
Signed-off-by: Martin Schiller <ms@dev.tdt.de>
Reviewed-by: Xie He <xie.he.0141@gmail.com>
Link: https://lore.kernel.org/r/20201109065449.9014-1-ms@dev.tdt.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/x25/af_x25.c