[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230319002843.GA158280@electric-eye.fr.zoreil.com>
Date: Sun, 19 Mar 2023 01:28:43 +0100
From: Francois Romieu <romieu@...zoreil.com>
To: Li Zetao <lizetao1@...wei.com>
Cc: 3chas3@...il.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] atm: idt77252: fix kmemleak when rmmod idt77252
Li Zetao <lizetao1@...wei.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@...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
Powered by blists - more mailing lists