public inbox for linux-edac@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Miaoqian Lin <linmq006@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Tony Luck <tony.luck@intel.com>,
	James Morse <james.morse@arm.com>,
	Robert Richter <rric@kernel.org>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Doug Thompson <dougthompson@xmission.com>,
	linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] EDAC: Fix some refcount leaks
Date: Thu, 12 May 2022 17:46:32 +0200	[thread overview]
Message-ID: <Yn0r2Dd7Pgr0DrMd@zn.tnic> (raw)
In-Reply-To: <20220512075906.21915-1-linmq006@gmail.com>

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

  reply	other threads:[~2022-05-12 15:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-12  7:59 [PATCH v2] EDAC: Fix some refcount leaks Miaoqian Lin
2022-05-12 15:46 ` Borislav Petkov [this message]
2022-08-11  8:29 ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yn0r2Dd7Pgr0DrMd@zn.tnic \
    --to=bp@alien8.de \
    --cc=dougthompson@xmission.com \
    --cc=gregkh@suse.de \
    --cc=james.morse@arm.com \
    --cc=linmq006@gmail.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rric@kernel.org \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox