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>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 22 Sep 2010 19:22:31 +0200
From:	Jarek Poplawski <jarkao2@...il.com>
To:	Frederic Weisbecker <fweisbec@...il.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, reiserfs-devel@...r.kernel.org,
	Christoph Hellwig <hch@....de>,
	Al Viro <viro@...iv.linux.org.uk>
Subject: Re: Re: [Bug] possible circular locking in reiserfs_unpack

On Wed, Sep 22, 2010 at 03:49:48PM +0200, Frederic Weisbecker wrote:
> 
> I can reproduce your first case, but not this one.
> 
> So, I hope you can give a try to the following fix,
> 
> Thanks!
> 

With this patch I don't have any lockdep warnings during lilo writes.

Well done, thanks!

Tested-by: Jarek Poplawski <jarkao2@...il.com>

> 
> diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c
> index f53505d..90a757b 100644
> --- a/fs/reiserfs/ioctl.c
> +++ b/fs/reiserfs/ioctl.c
> @@ -170,7 +170,7 @@ int reiserfs_prepare_write(struct file *f, struct page *page,
>  int reiserfs_unpack(struct inode *inode, struct file *filp)
>  {
>  	int retval = 0;
> -	int index;
> +	int index, depth;
>  	struct page *page;
>  	struct address_space *mapping;
>  	unsigned long write_from;
> @@ -185,11 +185,12 @@ int reiserfs_unpack(struct inode *inode, struct file *filp)
>  		return 0;
>  	}
>  
> +	depth = reiserfs_write_lock_once(inode->i_sb);
> +
>  	/* we need to make sure nobody is changing the file size beneath
>  	 ** us
>  	 */
> -	mutex_lock(&inode->i_mutex);
> -	reiserfs_write_lock(inode->i_sb);
> +	reiserfs_mutex_lock_safe(&inode->i_mutex, inode->i_sb);
>  
>  	write_from = inode->i_size & (blocksize - 1);
>  	/* if we are on a block boundary, we are already unpacked.  */
> @@ -224,6 +225,6 @@ int reiserfs_unpack(struct inode *inode, struct file *filp)
>  
>        out:
>  	mutex_unlock(&inode->i_mutex);
> -	reiserfs_write_unlock(inode->i_sb);
> +	reiserfs_write_unlock_once(inode->i_sb, depth);
>  	return retval;
>  }
> 
--
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