Skip to content

Commit

Permalink
can: fix missing decrement of j1939_proto.inuse_idx
Browse files Browse the repository at this point in the history
Like other protocols on top of AF_CAN family, also j1939_proto.inuse_idx
needs to be decremented on socket dismantle.

Fixes: 6bffe88 ("can: add protocol counter for AF_CAN sockets")
Reported-by: Oliver Hartkopp <socketcan@hartkopp.net>
Closes: https://lore.kernel.org/linux-can/7e35b13f-bbc4-491e-9081-fb939e1b8df0@hartkopp.net/
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://patch.msgid.link/09ce71f281b9e27d1e3d1104430bf3fceb8c7321.1742292636.git.dcaratti@redhat.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
  • Loading branch information
Davide Caratti authored and Marc Kleine-Budde committed Apr 15, 2025
1 parent 65d9119 commit 8b18794
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions net/can/j1939/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,7 @@ static int j1939_sk_release(struct socket *sock)
sock->sk = NULL;

release_sock(sk);
sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
sock_put(sk);

return 0;
Expand Down

0 comments on commit 8b18794

Please sign in to comment.