From: Christoph Hellwig <hch@lst.de>
To: Logan Gunthorpe <logang@deltatee.com>
Cc: Song Liu <song@kernel.org>, Christoph Hellwig <hch@lst.de>,
linux-raid@vger.kernel.org, linux-block@vger.kernel.org
Subject: Re: [PATCH] md: Ensure mddev object is cleaned up with kobject_put on error path
Date: Thu, 14 Jul 2022 07:06:50 +0200 [thread overview]
Message-ID: <20220714050650.GA23332@lst.de> (raw)
In-Reply-To: <20220713210623.14705-1-logang@deltatee.com>
On Wed, Jul 13, 2022 at 03:06:23PM -0600, Logan Gunthorpe wrote:
> The documentation for kobject_init() clearly states that the new
> object must be cleaned up with a call to kobject_put(), not a
> kfree() call directly.
>
> However, the error path in mddev_alloc() frees the newly allocated
> mddev object directly with kfree() after kobject_init() is called
> in mddev_init().
>
> Fix this by changing the kfree() call to a kobject_put().
I think the right answer is to only initialize the kobject just
before we add it. I'll send an updated patch for that in a bit.
prev parent reply other threads:[~2022-07-14 5:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-13 21:06 [PATCH] md: Ensure mddev object is cleaned up with kobject_put on error path Logan Gunthorpe
2022-07-14 5:06 ` Christoph Hellwig [this message]
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=20220714050650.GA23332@lst.de \
--to=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=logang@deltatee.com \
--cc=song@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.