Skip to content

Commit 3611823

Browse files
sch-mkuba-moo
authored andcommitted
net/x25: Fix null-ptr-deref in x25_connect
This fixes a regression for blocking connects introduced by commit 4becb7e ("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: 4becb7e ("net/x25: Fix x25_neigh refcnt leak when x25 disconnect") Signed-off-by: Martin Schiller <[email protected]> Reviewed-by: Xie He <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent df392ae commit 3611823

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/x25/af_x25.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ static int x25_connect(struct socket *sock, struct sockaddr *uaddr,
825825
sock->state = SS_CONNECTED;
826826
rc = 0;
827827
out_put_neigh:
828-
if (rc) {
828+
if (rc && x25->neighbour) {
829829
read_lock_bh(&x25_list_lock);
830830
x25_neigh_put(x25->neighbour);
831831
x25->neighbour = NULL;

0 commit comments

Comments
 (0)