linux-edac.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] drivers: edac: edac_pci_sysfs.c: memory leak in edac_pci_create_instance_kobj
@ 2021-08-01  6:27 nil Yi
  2021-08-01  8:20 ` Borislav Petkov
  0 siblings, 1 reply; 2+ messages in thread
From: nil Yi @ 2021-08-01  6:27 UTC (permalink / raw)
  To: bp, mchehab, tony.luck, james.morse, rric; +Cc: linux-edac

Hi,
there is a memory leak in edac_pci_create_instance_kobj in v5.14-rc3.

in edac_pci_create_instance_kobj:
174: err = kobject_init_and_add(&pci->kobj, &ktype_pci_instance,
edac_pci_top_main_kobj, "pci%d", idx);

kobject_init_and_add() should be handled when it return an error,
because kobject_init_and_add() takes reference even when it fails.
If this function returns an error, kobject_put() must be called to
properly clean up the memory associated with the object pci->kobj.

Any feedback would be appreciated, thanks :)


Best wishes,
Lin Yi

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [BUG] drivers: edac: edac_pci_sysfs.c: memory leak in edac_pci_create_instance_kobj
  2021-08-01  6:27 [BUG] drivers: edac: edac_pci_sysfs.c: memory leak in edac_pci_create_instance_kobj nil Yi
@ 2021-08-01  8:20 ` Borislav Petkov
  0 siblings, 0 replies; 2+ messages in thread
From: Borislav Petkov @ 2021-08-01  8:20 UTC (permalink / raw)
  To: nil Yi; +Cc: mchehab, tony.luck, james.morse, rric, linux-edac

On Sun, Aug 01, 2021 at 02:27:08PM +0800, nil Yi wrote:
> Any feedback would be appreciated, thanks :)

Yes, I guess the couple of kobject_init_and_add() calls in EDAC-land
should be fixed similar to what

17ed808ad243 ("EDAC: Fix reference count leaks")

did.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-01  8:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-01  6:27 [BUG] drivers: edac: edac_pci_sysfs.c: memory leak in edac_pci_create_instance_kobj nil Yi
2021-08-01  8:20 ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).