Skip to content

Commit

Permalink
can: j1939: fix memory leak if filters was set
Browse files Browse the repository at this point in the history
Filters array is coped from user space and linked to the j1939 socket.
On socket release this memory was not freed.

Fixes: 9d71dd0 ("can: add support of SAE J1939 protocol")
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
  • Loading branch information
olerem authored and marckleinebudde committed Nov 4, 2019
1 parent db1a804 commit 896daf7
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 @@ -580,6 +580,7 @@ static int j1939_sk_release(struct socket *sock)
j1939_netdev_stop(priv);
}

kfree(jsk->filters);
sock_orphan(sk);
sock->sk = NULL;

Expand Down

0 comments on commit 896daf7

Please sign in to comment.