public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Winkler, Tomas" <tomas.winkler@intel.com>
To: Richard Weinberger <richard@nod.at>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd <linux-mtd@lists.infradead.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] mtd: use refcount to prevent corruption
Date: Wed, 27 Jan 2021 20:55:46 +0000	[thread overview]
Message-ID: <c8d0f22c5fdf443cb8dda1f996b148d9@intel.com> (raw)
In-Reply-To: <9732911.325628.1611780400338.JavaMail.zimbra@nod.at>


> Subject: Re: [PATCH] mtd: use refcount to prevent corruption
> 
> Tomas,
> 
> ----- Ursprüngliche Mail -----
> > Von: "Tomas Winkler" <tomas.winkler@intel.com>
> > An: "Miquel Raynal" <miquel.raynal@bootlin.com>, "richard"
> > <richard@nod.at>, "Vignesh Raghavendra" <vigneshr@ti.com>, "linux-mtd"
> > <linux-mtd@lists.infradead.org>, "linux-kernel"
> > <linux-kernel@vger.kernel.org>
> > CC: "Tomas Winkler" <tomas.winkler@intel.com>
> > Gesendet: Mittwoch, 27. Januar 2021 21:03:19
> > Betreff: [PATCH] mtd: use refcount to prevent corruption
> 
> > When underlying device is removed mtd core will crash in case user
> > space is still holding an open handle to a mtd device node.
> > A proper refcounting is needed so device is release only when a
> > partition has no active users. The current simple counter is not
> > sufficient.
> 
> Can you please explain a little more what devices are involved?
> Does it implement _get_device() and _put_device()?
No this is not connected to those handlers of the underlying device and those won't help. 
I have a spi device provided by MFD framework so it can go away anytime. 
My solution tries to  replace the current simple partition reference counting.  In previous solution it will return -EBUSY on partition that is held but will remove the actual parent device, leading to crash.
Also w/o reference counting there is no process to actually remove the partition that was previously busy.

Thanks
Tomas



> 
> Thanks,
> //richard

  reply	other threads:[~2021-01-27 20:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-27 20:03 [PATCH] mtd: use refcount to prevent corruption Tomas Winkler
2021-01-27 20:46 ` Richard Weinberger
2021-01-27 20:55   ` Winkler, Tomas [this message]
2021-01-27 21:17     ` Richard Weinberger
2021-01-28  6:33       ` Winkler, Tomas
2021-01-28  7:47         ` Richard Weinberger
2021-01-28  8:53           ` Winkler, Tomas
2021-01-28  9:00             ` Miquel Raynal
2021-01-28 17:57               ` Winkler, Tomas
2021-01-28 20:23                 ` Richard Weinberger
2021-02-13 17:09                   ` Winkler, Tomas
2021-02-15 13:43                     ` Richard Weinberger

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=c8d0f22c5fdf443cb8dda1f996b148d9@intel.com \
    --to=tomas.winkler@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.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