[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2fa6c8ec-c25f-5338-ac78-eee422935ab8@opensource.wdc.com>
Date: Thu, 16 Mar 2023 16:53:08 +0900
From: Damien Le Moal <damien.lemoal@...nsource.wdc.com>
To: Ondrej Zary <linux@...y.sk>
Cc: Christoph Hellwig <hch@....de>,
Sergey Shtylyov <s.shtylyov@....ru>, linux-ide@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] pata_parport: fix memory leaks
On 3/15/23 07:58, Ondrej Zary wrote:
> When ida_alloc() fails, "pi" is not freed although the misleading
> comment says otherwise.
> Move the ida_alloc() call up so we really don't have to free "pi" in
> case of ida_alloc() failure.
>
> Also move ida_free() call from pi_remove_one() to
> pata_parport_dev_release(). It was dereferencing already freed dev
> pointer.
>
> Testing revealed leak even in non-failure case which was tracked down
> to missing put_device() call after bus_find_device_by_name(). As a
> result, pata_parport_dev_release() was never called.
>
> Reported-by: kernel test robot <lkp@...el.com>
> Reported-by: Dan Carpenter <error27@...il.com>
> Link: https://lore.kernel.org/r/202303111822.IHNchbkp-lkp@intel.com/
> Signed-off-by: Ondrej Zary <linux@...y.sk>
Applied to for-6.3-fixes. Thanks !
--
Damien Le Moal
Western Digital Research
Powered by blists - more mailing lists