diff mbox series

mtd: block2mtd: Add a valid holder to blkdev_put()

Message ID 20231021185832.25592-1-richard@nod.at
State Accepted
Headers show
Series mtd: block2mtd: Add a valid holder to blkdev_put() | expand

Commit Message

Richard Weinberger Oct. 21, 2023, 6:58 p.m. UTC
Since commit 2736e8eeb0ccd ("block: use the holder as indication for exclusive opens")
blkdev_put() requires a valid holder argument.
So, do so also in block2mtd to unbreak bdev->bd_holder refcounting.

Cc: Christoph Hellwig <hch@lst.de>
Cc: stable@vger.kernel.org
Fixes: 2736e8eeb0ccd ("block: use the holder as indication for exclusive opens")
Signed-off-by: Richard Weinberger <richard@nod.at>
---
 drivers/mtd/devices/block2mtd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christoph Hellwig Oct. 23, 2023, 5:44 a.m. UTC | #1
On Sat, Oct 21, 2023 at 08:58:32PM +0200, Richard Weinberger wrote:
> Since commit 2736e8eeb0ccd ("block: use the holder as indication for exclusive opens")

Overly long line here.

> blkdev_put() requires a valid holder argument.
> So, do so also in block2mtd to unbreak bdev->bd_holder refcounting.


Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Miquel Raynal Oct. 27, 2023, 5:47 p.m. UTC | #2
On Sat, 2023-10-21 at 18:58:32 UTC, Richard Weinberger wrote:
> Since commit 2736e8eeb0ccd ("block: use the holder as indication for exclusive opens")
> blkdev_put() requires a valid holder argument.
> So, do so also in block2mtd to unbreak bdev->bd_holder refcounting.
> 
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: stable@vger.kernel.org
> Fixes: 2736e8eeb0ccd ("block: use the holder as indication for exclusive opens")
> Signed-off-by: Richard Weinberger <richard@nod.at>
> Reviewed-by: Christoph Hellwig <hch@lst.de>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Miquel
diff mbox series

Patch

diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c
index be106dc20ff3c..8c37650bbce45 100644
--- a/drivers/mtd/devices/block2mtd.c
+++ b/drivers/mtd/devices/block2mtd.c
@@ -209,7 +209,7 @@  static void block2mtd_free_device(struct block2mtd_dev *dev)
 	if (dev->blkdev) {
 		invalidate_mapping_pages(dev->blkdev->bd_inode->i_mapping,
 					0, -1);
-		blkdev_put(dev->blkdev, NULL);
+		blkdev_put(dev->blkdev, dev);
 	}
 
 	kfree(dev);