Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[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>

authored by

Jun'ichi Nomura and committed by
Linus Torvalds
bcb55165 a7aacdf9

+4 -1
+4 -1
fs/block_dev.c
··· 751 751 752 752 mutex_lock_nested(&bdev->bd_mutex, BD_MUTEX_PARTITION); 753 753 res = bd_claim(bdev, holder); 754 - if (res == 0) 754 + if (res == 0) { 755 755 res = add_bd_holder(bdev, bo); 756 + if (res) 757 + bd_release(bdev); 758 + } 756 759 if (res) 757 760 free_bd_holder(bo); 758 761 mutex_unlock(&bdev->bd_mutex);