[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20230804070335.369834-1-miquel.raynal@bootlin.com>
Date: Fri, 4 Aug 2023 09:03:35 +0200
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Alexander Usyskin <alexander.usyskin@...el.com>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>,
linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org
Cc: Tomas Winkler <tomas.winkler@...el.com>,
Vitaly Lubart <vitaly.lubart@...el.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Zhang Xiaoxu <zhangxiaoxu5@...wei.com>
Subject: Re: [PATCH v2] mtd: fix use-after-free in mtd release
On Mon, 2023-07-31 at 11:58:36 UTC, Alexander Usyskin wrote:
> I case of partition device_unregister() in mtd_device_release()
> calls mtd_release() which frees mtd_info structure for partition.
> All code after device_unregister in mtd_device_release thus
> uses already freed memory.
>
> Move part of code to mtd_release() and restict mtd->dev cleanup
> to non-partion object.
> For partition object such cleanup have no sense as partition
> mtd_info is removed.
>
> Cc: Miquel Raynal <miquel.raynal@...tlin.com>
> Cc: Zhang Xiaoxu <zhangxiaoxu5@...wei.com>
> Fixes: 19bfa9ebebb5 ("mtd: use refcount to prevent corruption")
> Reviewed-by: Tomas Winkler <tomas.winkler@...el.com>
> Signed-off-by: Alexander Usyskin <alexander.usyskin@...el.com>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.
Miquel
Powered by blists - more mailing lists