public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vincent Whitchurch <Vincent.Whitchurch@axis.com>
To: Vincent Whitchurch <Vincent.Whitchurch@axis.com>,
	"hch@infradead.org" <hch@infradead.org>
Cc: kernel <kernel@axis.com>, "vigneshr@ti.com" <vigneshr@ti.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"miquel.raynal@bootlin.com" <miquel.raynal@bootlin.com>,
	"richard@nod.at" <richard@nod.at>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>
Subject: Re: [PATCH 2/2] ubi: block: Fix deadlock on remove
Date: Wed, 24 May 2023 13:36:39 +0000	[thread overview]
Message-ID: <fa2a06491cf2d90eb35c95042f888cd49df119fe.camel@axis.com> (raw)
In-Reply-To: <ZG2o4rrfqWGbYziq@infradead.org>

On Tue, 2023-05-23 at 23:04 -0700, Christoph Hellwig wrote:
> If you imlement ->free_disk, the list_del and kfree can move into
> that, and we don't really care if a new opener raced with the delete.

Moving the kfree() to ->free_disk() works, but the list_del() still
needs to be in ubiblock_remove() since otherwise ubiblock_remove() could
attempt to remove the same device twice.

I assumed the current code really wanted to prevent new openers racing
with delete, but if that is not needed, yes, we don't need to add a
->removing flag if we move the kfree() to ->free_disk().  I'll re-spin
this based on your suggestions.  Thanks.


  reply	other threads:[~2023-05-24 13:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-23 13:12 [PATCH 0/2] ubi: block: fix use-after-free and deadlock Vincent Whitchurch
2023-05-23 13:12 ` [PATCH 1/2] ubi: block: Fix use-after-free of gendisk Vincent Whitchurch
2023-05-24  5:58   ` Christoph Hellwig
2023-05-23 13:12 ` [PATCH 2/2] ubi: block: Fix deadlock on remove Vincent Whitchurch
2023-05-24  6:04   ` Christoph Hellwig
2023-05-24 13:36     ` Vincent Whitchurch [this message]
2023-05-25  9:50       ` hch

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=fa2a06491cf2d90eb35c95042f888cd49df119fe.camel@axis.com \
    --to=vincent.whitchurch@axis.com \
    --cc=hch@infradead.org \
    --cc=kernel@axis.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