mirror of
https://github.com/S3NEO/android_kernel_samsung_msm8226.git
synced 2024-11-07 03:47:13 +00:00
[PATCH] fix bd_claim_by_kobject error handling
This fixes bd_claim_by_kobject to release bdev correctly in case that bd_claim succeeds but following add_bd_holder fails. Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
a7aacdf9ea
commit
bcb55165d3
1 changed files with 4 additions and 1 deletions
|
@ -751,8 +751,11 @@ static int bd_claim_by_kobject(struct block_device *bdev, void *holder,
|
|||
|
||||
mutex_lock_nested(&bdev->bd_mutex, BD_MUTEX_PARTITION);
|
||||
res = bd_claim(bdev, holder);
|
||||
if (res == 0)
|
||||
if (res == 0) {
|
||||
res = add_bd_holder(bdev, bo);
|
||||
if (res)
|
||||
bd_release(bdev);
|
||||
}
|
||||
if (res)
|
||||
free_bd_holder(bo);
|
||||
mutex_unlock(&bdev->bd_mutex);
|
||||
|
|
Loading…
Reference in a new issue