[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yn0r2Dd7Pgr0DrMd@zn.tnic>
Date: Thu, 12 May 2022 17:46:32 +0200
From: Borislav Petkov <bp@...en8.de>
To: Miaoqian Lin <linmq006@...il.com>
Cc: Mauro Carvalho Chehab <mchehab@...nel.org>,
Tony Luck <tony.luck@...el.com>,
James Morse <james.morse@....com>,
Robert Richter <rric@...nel.org>,
Greg Kroah-Hartman <gregkh@...e.de>,
Doug Thompson <dougthompson@...ssion.com>,
linux-edac@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] EDAC: Fix some refcount leaks
On Thu, May 12, 2022 at 11:59:06AM +0400, Miaoqian Lin wrote:
> kobject_init_and_add() takes reference even when it fails.
> According to the doc of kobject_init_and_add()
>
> If this function returns an error, kobject_put() must be called to
> properly clean up the memory associated with the object.
>
> Fix this by calling kobject_put() when kobject_init_and_add() fails.
$ git grep -w kobject_init_and_add drivers/edac/
drivers/edac/edac_device_sysfs.c:259: err = kobject_init_and_add(&edac_dev->kobj, &ktype_device_ctrl,
drivers/edac/edac_device_sysfs.c:538: err = kobject_init_and_add(&block->kobj, &ktype_block_ctrl,
drivers/edac/edac_device_sysfs.c:637: err = kobject_init_and_add(&instance->kobj, &ktype_instance_ctrl,
drivers/edac/edac_pci_sysfs.c:175: err = kobject_init_and_add(&pci->kobj, &ktype_pci_instance,
drivers/edac/edac_pci_sysfs.c:372: err = kobject_init_and_add(edac_pci_top_main_kobj,
Wanna audit them all, make sure they all put the kobject properly and do
a single patch fixing those which need fixing?
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists