From: Al Viro Date: Fri, 1 Aug 2008 09:32:04 +0000 (-0400) Subject: [PATCH] fix bdev leak in block_dev.c do_open() X-Git-Tag: v2.6.27-rc2~105^2~6 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=8266602033d6adc6d10cb8811c1fd694767909b0;p=linux-2.6-omap-h63xx.git [PATCH] fix bdev leak in block_dev.c do_open() Callers expect it to drop reference to bdev on all failure exits. Signed-off-by: Al Viro --- diff --git a/fs/block_dev.c b/fs/block_dev.c index dcf37cada36..e664b0b7048 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -941,8 +941,10 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part) * hooks: /n/, see "layering violations". */ ret = devcgroup_inode_permission(bdev->bd_inode, perm); - if (ret != 0) + if (ret != 0) { + bdput(bdev); return ret; + } ret = -ENXIO; file->f_mapping = bdev->bd_inode->i_mapping;