linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Christoph Lameter (Ampere)" <cl@gentwo.org>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>,
	Pekka Enberg <penberg@kernel.org>,
	 David Rientjes <rientjes@google.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	 Andrew Morton <akpm@linux-foundation.org>,
	 Roman Gushchin <roman.gushchin@linux.dev>,
	linux-mm@kvack.org
Subject: Re: [RFC PATCH] mm/slab: fix a memory leak on kobject_init_and_add() failure
Date: Mon, 21 Oct 2024 09:27:49 -0700 (PDT)	[thread overview]
Message-ID: <439eed20-d0c7-8332-2f17-d785321d3310@gentwo.org> (raw)
In-Reply-To: <77d5c04b-9b97-4aee-85a9-c5efb2fa21fe@suse.cz>

On Mon, 21 Oct 2024, Vlastimil Babka wrote:

> I think the comment "If this function returns an error, kobject_put() must
> be called" means that *if* you want to destroy it due to the failure, you
> must use kobject_put() and not e.g. kfree(). But IMHO it doesn't mean you
> must destroy it because of the kobject_add() failure.

Right. The simplest solution is to see the sysfs stuff as optional. If it
fails to create the sysfs pieces then write a warning to syslog but let
the cache creation succeed.


  reply	other threads:[~2024-10-21 16:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-21  9:14 Hyeonggon Yoo
2024-10-21 10:13 ` Vlastimil Babka
2024-10-21 16:27   ` Christoph Lameter (Ampere) [this message]
2024-10-22 15:12     ` Vlastimil Babka
2024-10-22 16:08       ` Christoph Lameter (Ampere)
2024-10-23  9:23         ` Hyeonggon Yoo
2024-10-23  9:28           ` Vlastimil Babka
2024-10-23 17:12             ` Vlastimil Babka

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=439eed20-d0c7-8332-2f17-d785321d3310@gentwo.org \
    --to=cl@gentwo.org \
    --cc=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=vbabka@suse.cz \
    /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