In message: [linux-yocto][linux-ycoto-6.18][v6.18/standard/base][PATCH 1/1] 
Revert "mtd_blkdevs: add mtd_table_mutex lock back to blktrans_{open, release} 
to avoid race condition"
on 24/12/2025 Liwei Song wrote:

> This reverts commit 957b188b585a4f1f9f3a39198b06a6fd62d6827d.
> 
> The issue that this patch is trying to resolve has been fixed by
> upstream commit 19bfa9ebebb5 ("mtd: use refcount to prevent corruption")
> so this local patch can be reverted, if not, it will cause an unbalanced
> refcnt issue when open/close mtd device.

merged.

Bruce

> 
> Signed-off-by: Liwei Song <[email protected]>
> ---
>  drivers/mtd/mtd_blkdevs.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
> index 94ebd452d2ef..28e09d080440 100644
> --- a/drivers/mtd/mtd_blkdevs.c
> +++ b/drivers/mtd/mtd_blkdevs.c
> @@ -189,8 +189,6 @@ static int blktrans_open(struct gendisk *disk, blk_mode_t 
> mode)
>  
>       kref_get(&dev->ref);
>  
> -     if (!mutex_trylock(&mtd_table_mutex))
> -             return ret;
>       mutex_lock(&dev->lock);
>  
>       if (dev->open)
> @@ -215,7 +213,6 @@ static int blktrans_open(struct gendisk *disk, blk_mode_t 
> mode)
>  unlock:
>       dev->open++;
>       mutex_unlock(&dev->lock);
> -     mutex_unlock(&mtd_table_mutex);
>       return ret;
>  
>  error_release:
> @@ -224,7 +221,6 @@ static int blktrans_open(struct gendisk *disk, blk_mode_t 
> mode)
>  error_put:
>       module_put(dev->tr->owner);
>       mutex_unlock(&dev->lock);
> -     mutex_unlock(&mtd_table_mutex);
>       blktrans_dev_put(dev);
>       return ret;
>  }
> @@ -233,8 +229,6 @@ static void blktrans_release(struct gendisk *disk)
>  {
>       struct mtd_blktrans_dev *dev = disk->private_data;
>  
> -     if (!mutex_trylock(&mtd_table_mutex))
> -             return;
>       mutex_lock(&dev->lock);
>  
>       if (--dev->open)
> @@ -249,7 +243,6 @@ static void blktrans_release(struct gendisk *disk)
>       }
>  unlock:
>       mutex_unlock(&dev->lock);
> -     mutex_unlock(&mtd_table_mutex);
>       blktrans_dev_put(dev);
>  }
>  
> -- 
> 2.40.0
> 
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#16101): 
https://lists.yoctoproject.org/g/linux-yocto/message/16101
Mute This Topic: https://lists.yoctoproject.org/mt/116926498/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to