netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: j1939: fix memory leak if filters was set
@ 2019-10-10 10:50 Oleksij Rempel
  2019-10-10 11:55 ` Marc Kleine-Budde
  0 siblings, 1 reply; 2+ messages in thread
From: Oleksij Rempel @ 2019-10-10 10:50 UTC (permalink / raw)
  To: dev.kurt, mkl, wg; +Cc: Oleksij Rempel, kernel, linux-can, netdev

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(+)

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;
 
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] can: j1939: fix memory leak if filters was set
  2019-10-10 10:50 [PATCH] can: j1939: fix memory leak if filters was set Oleksij Rempel
@ 2019-10-10 11:55 ` Marc Kleine-Budde
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2019-10-10 11:55 UTC (permalink / raw)
  To: Oleksij Rempel, dev.kurt, wg; +Cc: kernel, linux-can, netdev


[-- Attachment #1.1: Type: text/plain, Size: 612 bytes --]

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

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-10 11:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-10 10:50 [PATCH] can: j1939: fix memory leak if filters was set Oleksij Rempel
2019-10-10 11:55 ` Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).