diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 86dbb366415a14a76b3961180cd3f14176f911cc..6986f392624426e0bfa6cb0f6085766f56cae90e 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -103,8 +103,10 @@ static int mmc_blk_open(struct inode *inode, struct file *filp) check_disk_change(inode->i_bdev); ret = 0; - if ((filp->f_mode & FMODE_WRITE) && md->read_only) + if ((filp->f_mode & FMODE_WRITE) && md->read_only) { + mmc_blk_put(md); ret = -EROFS; + } } return ret;