lkml.org 
[lkml]   [2023]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] atm: idt77252: fix kmemleak when rmmod idt77252
Li Zetao <lizetao1@huawei.com> :
> There are memory leaks reported by kmemleak:
[...]
> diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
> index eec0cc2144e0..060f32b0def3 100644
> --- a/drivers/atm/idt77252.c
> +++ b/drivers/atm/idt77252.c
[...]
> @@ -2952,6 +2953,16 @@ open_card_ubr0(struct idt77252_dev *card)
> return 0;
> }
>
> +static void
> +close_card_ubr0(struct idt77252_dev *card)
> +{
> + struct vc_map *vc;
> +
> + vc = card->vcs[0];

Nit:
+ struct vc_map *vc = card->vcs[0];

I have not found any opportunity for a double free related to the patch.

So, other than the nit above:

Reviewed-by: Francois Romieu <romieu@fr.zoreil.com>

FWIW
- the driver leaks on error in open_card_ubr0.
- some forward declarations (alloc_scq, free_scq, etc.) are useless.
- struct idt77252_dev.next is useless. It was probably cargo-culted from
some driver while hoping to enumerate devices (not that uncommon the
early 2000). PCI driver registeering could thus look more idiomatic.
- deinit_card can be called two times in an error path and trigger a BUG_ON
in atm_dev_deregister.

--
Ueimor

\
 
 \ /
  Last update: 2023-03-27 01:06    [W:0.063 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site