Linux-NVDIMM Archive on lore.kernel.org
 help / color / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: linux-nvdimm <linux-nvdimm@lists.01.org>
Subject: Re: [bug report] libnvdimm, nvdimm: dimm driver and base libnvdimm device-driver infrastructure
Date: Wed, 5 Feb 2020 23:18:34 +0300
Message-ID: <20200205201834.GF24804@kadam> (raw)
In-Reply-To: <CAPcyv4gySPR0+sC1-xQsXirprX96Kyk764kUOuada+6djTXUjQ@mail.gmail.com>

On Wed, Feb 05, 2020 at 12:04:15PM -0800, Dan Williams wrote:
> On Wed, Feb 5, 2020 at 11:28 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >
> > On Wed, Feb 05, 2020 at 11:16:22AM -0800, Dan Williams wrote:
> > > Ugh, sorry I thought you were pointing out that there's too many
> > > put_device() not the use after free. Yes, the use after free is a bug
> > > that needs fixing.
> >
> > I am complaining about the device_puts...  If we call device_put()
> > twice then it cause a problem in __nvdimm_create()
> >
> > drivers/nvdimm/dimm_devs.c
> >    506          nvdimm->sec.flags = nvdimm_security_flags(nvdimm, NVDIMM_USER);
> >    507          nvdimm->sec.ext_flags = nvdimm_security_flags(nvdimm, NVDIMM_MASTER);
> >    508          nd_device_register(dev);
> >    509
> >    510          return nvdimm;
> >                        ^^^^^^
> > If we call device_put() twice then we this pointer within 4 seconds.
> 
> "we this pointer"? We "what" this pointer. 4 seconds is relative to a
> runtime test case?
> 

Sorry.  I meant we *free* it.  The second device_put() leads to a
nvdimm_release(dev) where dev is "&nvdimm->dev" within 0-4 seconds.

Most times it will free it immediately but if you have
CONFIG_DEBUG_KOBJECT_RELEASE enabled then it will wait between 1-4
seconds and then free nvdimm.  It's a config option, not a runtime
thing.

regards,
dan carpenter
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

      reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-05 12:38 Dan Carpenter
2020-02-05 17:47 ` Dan Williams
2020-02-05 18:10   ` Dan Carpenter
2020-02-05 18:23     ` Dan Williams
2020-02-05 19:08       ` Dan Carpenter
2020-02-05 19:16         ` Dan Williams
2020-02-05 19:28           ` Dan Carpenter
2020-02-05 20:04             ` Dan Williams
2020-02-05 20:18               ` Dan Carpenter [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=20200205201834.GF24804@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-nvdimm@lists.01.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

Linux-NVDIMM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-nvdimm/0 linux-nvdimm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-nvdimm linux-nvdimm/ https://lore.kernel.org/linux-nvdimm \
		linux-nvdimm@lists.01.org
	public-inbox-index linux-nvdimm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.01.lists.linux-nvdimm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git