Commit 8266602033d6adc6d10cb8811c1fd694767909b0
1 parent
77e69dac3c
Exists in
master
and in
4 other branches
[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 <viro@zeniv.linux.org.uk>
Showing 1 changed file with 3 additions and 1 deletions Side-by-side Diff
fs/block_dev.c
... | ... | @@ -941,8 +941,10 @@ |
941 | 941 | * hooks: /n/, see "layering violations". |
942 | 942 | */ |
943 | 943 | ret = devcgroup_inode_permission(bdev->bd_inode, perm); |
944 | - if (ret != 0) | |
944 | + if (ret != 0) { | |
945 | + bdput(bdev); | |
945 | 946 | return ret; |
947 | + } | |
946 | 948 | |
947 | 949 | ret = -ENXIO; |
948 | 950 | file->f_mapping = bdev->bd_inode->i_mapping; |