All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Alexander Usyskin <alexander.usyskin@intel.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	Tomas Winkler <tomas.winkler@intel.com>,
	Vitaly Lubart <vitaly.lubart@intel.com>,
	Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Subject: Re: [PATCH] mtd: fix use-after-free in mtd release
Date: Thu, 27 Jul 2023 17:20:13 +0200	[thread overview]
Message-ID: <20230727172013.7c85c05d@xps-13> (raw)
In-Reply-To: <ZMKJRNDoQV8p0DH4@smile.fi.intel.com>

Hi Andy,

andriy.shevchenko@linux.intel.com wrote on Thu, 27 Jul 2023 18:12:04
+0300:

> On Thu, Jul 27, 2023 at 05:57:58PM +0300, Alexander Usyskin wrote:
> > I case of partition device_unregister in mtd_device_release  
> 
> In
> 
> device_unregister()
> mtd_device_release()
> 
> > calls mtd_release which frees mtd_info structure for partition.  
> 
> mtd_release()
> 
> > All code after device_unregister in mtd_device_release thus  
> 
> device_unregister()
> mtd_device_release()
> 
> > works already freed memory.  
> 
> uses?
> 
> > Move part of code to mtd_release and restict mtd->dev cleanup  
> 
> mtd_release()

Yup, thanks for all these suggestions, I agree with them.

> > to non-partion object.
> > For partition object such cleanup have no sense as partition
> > mtd_info is removed.
> > 
> > Cc: Miquel Raynal <miquel.raynal@bootlin.com>
> > Cc: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
> > Fixes: 19bfa9ebebb5 ("mtd: use refcount to prevent corruption")  
> 
> Closes: ?

Did I miss a recent update on the use of Fixes? I thought Closes was
supposed to point at a bug report while Fixes would point to the faulty
commit. Right now I feel like Fixes is the right tag, but if you have a
source explaining why we should not longer do it like I am used to,
I would appreciate a link.

Thanks,
Miquèl

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

WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Alexander Usyskin <alexander.usyskin@intel.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	Tomas Winkler <tomas.winkler@intel.com>,
	Vitaly Lubart <vitaly.lubart@intel.com>,
	Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Subject: Re: [PATCH] mtd: fix use-after-free in mtd release
Date: Thu, 27 Jul 2023 17:20:13 +0200	[thread overview]
Message-ID: <20230727172013.7c85c05d@xps-13> (raw)
In-Reply-To: <ZMKJRNDoQV8p0DH4@smile.fi.intel.com>

Hi Andy,

andriy.shevchenko@linux.intel.com wrote on Thu, 27 Jul 2023 18:12:04
+0300:

> On Thu, Jul 27, 2023 at 05:57:58PM +0300, Alexander Usyskin wrote:
> > I case of partition device_unregister in mtd_device_release  
> 
> In
> 
> device_unregister()
> mtd_device_release()
> 
> > calls mtd_release which frees mtd_info structure for partition.  
> 
> mtd_release()
> 
> > All code after device_unregister in mtd_device_release thus  
> 
> device_unregister()
> mtd_device_release()
> 
> > works already freed memory.  
> 
> uses?
> 
> > Move part of code to mtd_release and restict mtd->dev cleanup  
> 
> mtd_release()

Yup, thanks for all these suggestions, I agree with them.

> > to non-partion object.
> > For partition object such cleanup have no sense as partition
> > mtd_info is removed.
> > 
> > Cc: Miquel Raynal <miquel.raynal@bootlin.com>
> > Cc: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
> > Fixes: 19bfa9ebebb5 ("mtd: use refcount to prevent corruption")  
> 
> Closes: ?

Did I miss a recent update on the use of Fixes? I thought Closes was
supposed to point at a bug report while Fixes would point to the faulty
commit. Right now I feel like Fixes is the right tag, but if you have a
source explaining why we should not longer do it like I am used to,
I would appreciate a link.

Thanks,
Miquèl

  reply	other threads:[~2023-07-27 15:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27 14:57 [PATCH] mtd: fix use-after-free in mtd release Alexander Usyskin
2023-07-27 14:57 ` Alexander Usyskin
2023-07-27 15:12 ` Andy Shevchenko
2023-07-27 15:12   ` Andy Shevchenko
2023-07-27 15:20   ` Miquel Raynal [this message]
2023-07-27 15:20     ` Miquel Raynal
2023-07-27 15:58     ` Andy Shevchenko
2023-07-27 15:58       ` Andy Shevchenko
2023-07-27 16:36       ` Miquel Raynal
2023-07-27 16:36         ` Miquel Raynal
2023-07-30 11:10         ` Usyskin, Alexander
2023-07-30 11:10           ` Usyskin, Alexander
2023-07-31  1:35           ` zhangxiaoxu (A)
2023-07-31  1:35             ` zhangxiaoxu (A)
2023-08-02 12:44             ` Miquel Raynal
2023-08-02 12:44               ` Miquel Raynal
2023-08-03 12:06               ` huaweicloud
2023-08-03 12:06                 ` huaweicloud

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=20230727172013.7c85c05d@xps-13 \
    --to=miquel.raynal@bootlin.com \
    --cc=alexander.usyskin@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=tomas.winkler@intel.com \
    --cc=vigneshr@ti.com \
    --cc=vitaly.lubart@intel.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.