lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Mon, 21 Aug 2006 10:21:27 +1000
From:	Neil Brown <neilb@...e.de>
To:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc:	Rolf Eike Beer <eike-kernel@...tec.de>,
	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>,
	Arjan van de Ven <arjan@...ux.intel.com>,
	Andrew Morton <akpm@...l.org>
Subject: Re: [BUG?] possible recursive locking detected (blkdev_open)

On Friday August 18, a.p.zijlstra@...llo.nl wrote:
> 
> blkdev_open() calls
>   do_open(bdev, ...,BD_MUTEX_NORMAL) and takes
>     mutex_lock_nested(&bdev->bd_mutex, BD_MUTEX_NORMAL)
>     
> then something fails, and we're thrown to:
> 
> out_first: where
>     if (bdev != bdev->bd_contains)
>       blkdev_put(bdev->bd_contains) which is
>         __blkdev_put(bdev->bd_contains, BD_MUTEX_NORMAL) which does
>           mutex_lock_nested(&bdev->bd_contains->bd_mutex, BD_MUTEX_NORMAL) <--- lockdep trigger
> 
> When going to out_first, dbev->bd_contains is either bdev or whole, and
> since we take the branch it must be whole. So it seems to me the
> following patch would be the right one:

Looks sensible to me.

> 
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Acked-by: NeilBrown <neilb@...e.de>

NeilBrown

> ---
>  fs/block_dev.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Index: linux-2.6/fs/block_dev.c
> ===================================================================
> --- linux-2.6.orig/fs/block_dev.c
> +++ linux-2.6/fs/block_dev.c
> @@ -980,7 +980,7 @@ out_first:
>  	bdev->bd_disk = NULL;
>  	bdev->bd_inode->i_data.backing_dev_info = &default_backing_dev_info;
>  	if (bdev != bdev->bd_contains)
> -		blkdev_put(bdev->bd_contains);
> +		__blkdev_put(bdev->bd_contains, BD_MUTEX_WHOLE);
>  	bdev->bd_contains = NULL;
>  	put_disk(disk);
>  	module_put(owner);
> 
> 
> 
> 
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ