mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Bo Liu <liubo03@inspur.com>, <dan.j.williams@intel.com>,
	<vishal.l.verma@intel.com>, <dave.jiang@intel.com>,
	<ira.weiny@intel.com>
Cc: <nvdimm@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
	Bo Liu <liubo03@inspur.com>
Subject: RE: [PATCH] nvdimm: Call ida_simple_remove() when failed
Date: Tue, 20 Sep 2022 10:32:02 -0700	[thread overview]
Message-ID: <6329f91293668_2a6ded2948c@dwillia2-xfh.jf.intel.com.notmuch> (raw)
In-Reply-To: <20220810060737.5087-1-liubo03@inspur.com>

Bo Liu wrote:
> In function nvdimm_bus_register(), when code execution fails, we should
> call ida_simple_remove() to free ida.
> 
> Signed-off-by: Bo Liu <liubo03@inspur.com>
> ---
>  drivers/nvdimm/bus.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
> index b38d0355b0ac..3415dc62632b 100644
> --- a/drivers/nvdimm/bus.c
> +++ b/drivers/nvdimm/bus.c
> @@ -371,6 +371,7 @@ struct nvdimm_bus *nvdimm_bus_register(struct device *parent,
>  	return nvdimm_bus;
>   err:
>  	put_device(&nvdimm_bus->dev);
> +	ida_simple_remove(&nd_ida, nvdimm_bus->id);

No, this is a double-free. The put_device() will trigger
nvdimm_bus_release().

      reply	other threads:[~2022-09-20 17:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10  6:07 Bo Liu
2022-09-20 17:32 ` Dan Williams [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=6329f91293668_2a6ded2948c@dwillia2-xfh.jf.intel.com.notmuch \
    --to=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liubo03@inspur.com \
    --cc=nvdimm@lists.linux.dev \
    --cc=vishal.l.verma@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

all inboxes | Powered by JetHome®