mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 19:43:40 +02:00
mtd_blkdevs: don't hold del_mtd_blktrans_dev in blktrans_{open, release}
There is nothing that this protects against except for slightly reducing the window when new opens can appear just before calling del_gendisk. Reported-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Christoph Hellwig <hch@lst.de> Tested-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210823073359.705281-2-hch@lst.de
This commit is contained in:
parent
a89d69a44e
commit
799ae31c58
|
|
@ -207,7 +207,6 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
|
|||
if (!dev)
|
||||
return -ERESTARTSYS; /* FIXME: busy loop! -arnd*/
|
||||
|
||||
mutex_lock(&mtd_table_mutex);
|
||||
mutex_lock(&dev->lock);
|
||||
|
||||
if (dev->open)
|
||||
|
|
@ -233,7 +232,6 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
|
|||
unlock:
|
||||
dev->open++;
|
||||
mutex_unlock(&dev->lock);
|
||||
mutex_unlock(&mtd_table_mutex);
|
||||
blktrans_dev_put(dev);
|
||||
return ret;
|
||||
|
||||
|
|
@ -244,7 +242,6 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
|
|||
module_put(dev->tr->owner);
|
||||
kref_put(&dev->ref, blktrans_dev_release);
|
||||
mutex_unlock(&dev->lock);
|
||||
mutex_unlock(&mtd_table_mutex);
|
||||
blktrans_dev_put(dev);
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -256,7 +253,6 @@ static void blktrans_release(struct gendisk *disk, fmode_t mode)
|
|||
if (!dev)
|
||||
return;
|
||||
|
||||
mutex_lock(&mtd_table_mutex);
|
||||
mutex_lock(&dev->lock);
|
||||
|
||||
if (--dev->open)
|
||||
|
|
@ -272,7 +268,6 @@ static void blktrans_release(struct gendisk *disk, fmode_t mode)
|
|||
}
|
||||
unlock:
|
||||
mutex_unlock(&dev->lock);
|
||||
mutex_unlock(&mtd_table_mutex);
|
||||
blktrans_dev_put(dev);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user