All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: "Usyskin, Alexander" <alexander.usyskin@intel.com>
Cc: Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Tudor Ambarus <tudor.ambarus@linaro.org>,
	Pratyush Yadav <pratyush@kernel.org>,
	"Michael Walle" <michael@walle.cc>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	"Winkler, Tomas" <tomas.winkler@intel.com>,
	Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Subject: Re: [PATCH v2] mtd: Fix refcounting with MTD_PARTITIONED_MASTER
Date: Fri, 4 Aug 2023 08:44:50 +0200	[thread overview]
Message-ID: <20230804084450.5b46aa8b@xps-13> (raw)
In-Reply-To: <CY5PR11MB63664273EC02BE1A9AC05D7EED0AA@CY5PR11MB6366.namprd11.prod.outlook.com>

Hi Alexander,

alexander.usyskin@intel.com wrote on Tue, 1 Aug 2023 08:45:47 +0000:

> Hi Miquel,
> 
> > -----Original Message-----
> > From: Miquel Raynal <miquel.raynal@bootlin.com>
> > Sent: Monday, July 31, 2023 12:09
> > To: Richard Weinberger <richard@nod.at>; Vignesh Raghavendra
> > <vigneshr@ti.com>; Tudor Ambarus <tudor.ambarus@linaro.org>; Pratyush
> > Yadav <pratyush@kernel.org>; Michael Walle <michael@walle.cc>; linux-
> > mtd@lists.infradead.org
> > Cc: Miquel Raynal <miquel.raynal@bootlin.com>; Winkler, Tomas
> > <tomas.winkler@intel.com>; Usyskin, Alexander
> > <alexander.usyskin@intel.com>; Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
> > Subject: [PATCH v2] mtd: Fix refcounting with MTD_PARTITIONED_MASTER
> > 
> > The logic is way too convoluted, let's clean the kref_get/put section to
> > clarify what this block does, hopefully solving the refcounting issue
> > when using CONFIG_MTD_PARTITIONED_MASTER at the same time:
> > - Iterate through all the parent mtd devices
> > - Grab a reference over them all but the master
> > - Only grab the master whith CONFIG_MTD_PARTITIONED_MASTER
> > Same logic must apply in the put path, otherwise it would be broken.
> > 
> > Cc: Tomas Winkler <tomas.winkler@intel.com>
> > Cc: Alexander Usyskin <alexander.usyskin@intel.com>
> > Cc: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
> > Fixes: 19bfa9ebebb5 ("mtd: use refcount to prevent corruption")
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> >   
> 
> I've put it on top of my "[PATCH v2] mtd: fix use-after-free in mtd release",
> looks ok, but I have had no problems with refcounting before...
> IMO, we need both this patch and my patch as they fix different issues.
> 
> Tested-by: Alexander Usyskin <alexander.usyskin@intel.com>
> 

Actually I don't think this patch fixes anything, besides the
simplification of the helpers which are (IMHO) more readable now.

Zhang, are you sure you test on the latest mtd/next branch? Because I
see no refcounting issue here, with/without PARTITIONED_MASTER.

Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  parent reply	other threads:[~2023-08-04  6:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-31  9:09 [PATCH v2] mtd: Fix refcounting with MTD_PARTITIONED_MASTER Miquel Raynal
2023-08-01  8:45 ` Usyskin, Alexander
2023-08-01  8:58   ` Miquel Raynal
2023-08-04  6:44   ` Miquel Raynal [this message]
2023-08-04  7:03 ` Miquel Raynal

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=20230804084450.5b46aa8b@xps-13 \
    --to=miquel.raynal@bootlin.com \
    --cc=alexander.usyskin@intel.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=michael@walle.cc \
    --cc=pratyush@kernel.org \
    --cc=richard@nod.at \
    --cc=tomas.winkler@intel.com \
    --cc=tudor.ambarus@linaro.org \
    --cc=vigneshr@ti.com \
    --cc=zhangxiaoxu5@huawei.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 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.