mbox series

[0/3] can: fix same memory leaks in can drivers

Message ID cover.1627311383.git.paskripkin@gmail.com (mailing list archive)
Headers show
Series can: fix same memory leaks in can drivers | expand

Message

Pavel Skripkin July 26, 2021, 3:29 p.m. UTC
Hi, Marc and can drivers maintainers/reviewers!

A long time ago syzbot reported memory leak in mcba_usb can driver[1]. It was
using strange pattern for allocating coherent buffers, which was leading to
memory leaks. Yesterday I got a report, that mcba_usb stopped working since my commit.
I came up with quick fix and all started working well.

There are at least 3 more drivers with this pattern, I decided to fix leaks
in them too, since code is actually the same (I guess, driver authors just copy pasted
code parts). Each of following patches is combination of 91c02557174b
("can: mcba_usb: fix memory leak in mcba_usb") and my yesterday fix [2].


Dear maintainers/reviewers, if You have one of these hardware pieces, please, test
these patches and report any errors you will find.

[1] https://syzkaller.appspot.com/bug?id=c94c1c23e829d5ac97995d51219f0c5a0cd1fa54
[2] https://lore.kernel.org/netdev/20210725103630.23864-1-paskripkin@gmail.com/


With regards,
Pavel Skripkin

Pavel Skripkin (3):
  can: usb_8dev: fix memory leak
  can: ems_usb: fix memory leak
  can: esd_usb2: fix memory leak

 drivers/net/can/usb/ems_usb.c  | 14 +++++++++++++-
 drivers/net/can/usb/esd_usb2.c | 16 +++++++++++++++-
 drivers/net/can/usb/usb_8dev.c | 15 +++++++++++++--
 3 files changed, 41 insertions(+), 4 deletions(-)

Comments

Pavel Skripkin July 26, 2021, 5:29 p.m. UTC | #1
On Mon, 26 Jul 2021 18:29:38 +0300
Pavel Skripkin <paskripkin@gmail.com> wrote:

> Hi, Marc and can drivers maintainers/reviewers!
> 

I reread this I found out, that I missed logic here.

I mean:

> A long time ago syzbot reported memory leak in mcba_usb can
> driver[1]. It was using strange pattern for allocating coherent
> buffers, which was leading to memory leaks.

I fixed this wrong pattern in mcba_usb driver and 

> Yesterday I got a report,
> that mcba_usb stopped working since my commit. I came up with quick
> fix and all started working well.
> 
> There are at least 3 more drivers with this pattern, I decided to fix
> leaks in them too, since code is actually the same (I guess, driver
> authors just copy pasted code parts). Each of following patches is
> combination of 91c02557174b ("can: mcba_usb: fix memory leak in
> mcba_usb") and my yesterday fix [2].
> 
> 
> Dear maintainers/reviewers, if You have one of these hardware pieces,
> please, test these patches and report any errors you will find.
> 
> [1]
> https://syzkaller.appspot.com/bug?id=c94c1c23e829d5ac97995d51219f0c5a0cd1fa54
> [2]
> https://lore.kernel.org/netdev/20210725103630.23864-1-paskripkin@gmail.com/
> 
> 
> With regards,
> Pavel Skripkin
> 
> Pavel Skripkin (3):
>   can: usb_8dev: fix memory leak
>   can: ems_usb: fix memory leak
>   can: esd_usb2: fix memory leak
> 
>  drivers/net/can/usb/ems_usb.c  | 14 +++++++++++++-
>  drivers/net/can/usb/esd_usb2.c | 16 +++++++++++++++-
>  drivers/net/can/usb/usb_8dev.c | 15 +++++++++++++--
>  3 files changed, 41 insertions(+), 4 deletions(-)
> 



With regards,
Pavel Skripkin
Marc Kleine-Budde July 26, 2021, 8:02 p.m. UTC | #2
On 26.07.2021 20:29:16, Pavel Skripkin wrote:
> On Mon, 26 Jul 2021 18:29:38 +0300
> Pavel Skripkin <paskripkin@gmail.com> wrote:
> 
> > Hi, Marc and can drivers maintainers/reviewers!
> > 
> 
> I reread this I found out, that I missed logic here.
> 
> I mean:
> 
> > A long time ago syzbot reported memory leak in mcba_usb can
> > driver[1]. It was using strange pattern for allocating coherent
> > buffers, which was leading to memory leaks.
> 
> I fixed this wrong pattern in mcba_usb driver and

Thanks for your patches! Please resend them with an updated description
and the fixed patch 3.

Marc