[PATCH] mmc: fix refcount leak in power_ro_lock_show

From: Namjae Jeon
Date: Sat Apr 27 2013 - 20:07:11 EST

From: Namjae Jeon <namjae.jeon@xxxxxxxxxxx>

when user does
cat /sys/block/mmcblk0boot0/ro_lock_until_next_power_on

power_ro_lock_show increments md->usage by calling mmc_blk_get
but it forgets to call mmc_blk_put to restore md->usage

Signed-off-by: Namjae Jeon <namjae.jeon@xxxxxxxxxxx>
Signed-off-by: Vivek Trivedi <t.vivek@xxxxxxxxxxx>
drivers/mmc/card/block.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index e12a03c..ae8e1de 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -201,6 +201,7 @@ static ssize_t power_ro_lock_show(struct device *dev,
locked = 1;

ret = snprintf(buf, PAGE_SIZE, "%d\n", locked);
+ mmc_blk_put(md);

return ret;

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/