can: j1939: fix memory leak if filters was set
diff mbox series

Message ID 20191010105031.3507-1-o.rempel@pengutronix.de
State Awaiting Upstream
Delegated to: David Miller
Headers show
Series
  • can: j1939: fix memory leak if filters was set
Related show

Commit Message

Oleksij Rempel Oct. 10, 2019, 10:50 a.m. UTC
Filters array is coped from user space and linked to the j1939 socket.
On socket release this memory was not freed.

Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol")
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 net/can/j1939/socket.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Marc Kleine-Budde Oct. 10, 2019, 11:55 a.m. UTC | #1
On 10/10/19 12:50 PM, Oleksij Rempel wrote:
> Filters array is coped from user space and linked to the j1939 socket.
> On socket release this memory was not freed.
> 
> Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol")
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>

Applied to linux-can.

Tnx,
Marc

Patch
diff mbox series

diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c
index 5c6eabcb5df1..4d8ba701e15d 100644
--- a/net/can/j1939/socket.c
+++ b/net/can/j1939/socket.c
@@ -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;