Skip to content

Commit 4ee18c1

Browse files
Xie Hekuba-moo
authored andcommitted
net: x25: Increase refcnt of "struct x25_neigh" in x25_rx_call_request
The x25_disconnect function in x25_subr.c would decrease the refcount of "x25->neighbour" (struct x25_neigh) and reset this pointer to NULL. However, the x25_rx_call_request function in af_x25.c, which is called when we receive a connection request, does not increase the refcount when it assigns the pointer. Fix this issue by increasing the refcount of "struct x25_neigh" in x25_rx_call_request. This patch fixes frequent kernel crashes when using AF_X25 sockets. Fixes: 4becb7e ("net/x25: Fix x25_neigh refcnt leak when x25 disconnect") Cc: Martin Schiller <[email protected]> Signed-off-by: Xie He <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent baee199 commit 4ee18c1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/x25/af_x25.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,6 +1050,7 @@ int x25_rx_call_request(struct sk_buff *skb, struct x25_neigh *nb,
10501050
makex25->lci = lci;
10511051
makex25->dest_addr = dest_addr;
10521052
makex25->source_addr = source_addr;
1053+
x25_neigh_hold(nb);
10531054
makex25->neighbour = nb;
10541055
makex25->facilities = facilities;
10551056
makex25->dte_facilities= dte_facilities;

0 commit comments

Comments
 (0)