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] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 11 Oct 2007 02:54:27 +0200
From:	Roel Kluin <12o3l@...cali.nl>
To:	David Howells <dhowells@...hat.com>
CC:	hch@...radead.org, viro@....linux.org.uk, torvalds@...l.org,
	akpm@...l.org, linux-kernel@...r.kernel.org,
	linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH 09/31] IGET: Stop BFS from using iget() and read_inode()
 [try	#3]

It is very well possible that I misunderstand the locking order here,
but FWIW:

David Howells wrote:
> diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
> index f346eb1..76798c9 100644
> --- a/fs/bfs/inode.c
> +++ b/fs/bfs/inode.c
> @@ -32,25 +32,29 @@ MODULE_LICENSE("GPL");
>  
>  void dump_imap(const char *prefix, struct super_block * s);
>  
> -static void bfs_read_inode(struct inode * inode)
> +struct inode *bfs_iget(struct super_block *sb, unsigned long ino)
>  {
> -	unsigned long ino = inode->i_ino;
>  	struct bfs_inode * di;
>  	struct buffer_head * bh;
> +	struct inode *inode;
>  	int block, off;
>  
> +	inode = iget_locked(sb, ino);

after this

> +	if (IS_ERR(inode))
> +		return ERR_PTR(-ENOMEM);
> +	if (!(inode->i_state & I_NEW))
> +		return inode;

Don't you have to unlock_new_inode(inode) before returning?

> +
>  	if (ino < BFS_ROOT_INO || ino > BFS_SB(inode->i_sb)->si_lasti) {
>  		printf("Bad inode number %s:%08lx\n", inode->i_sb->s_id, ino);
> -		make_bad_inode(inode);
> -		return;
> +		goto error;
>  	}
>  
>  	block = (ino - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1;
>  	bh = sb_bread(inode->i_sb, block);
>  	if (!bh) {
>  		printf("Unable to read inode %s:%08lx\n", inode->i_sb->s_id, ino);
> -		make_bad_inode(inode);
> -		return;
> +		goto error;
>  	}
>  
>  	off = (ino - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK;
> @@ -85,6 +89,12 @@ static void bfs_read_inode(struct inode * inode)
>  	BFS_I(inode)->i_dsk_ino = le16_to_cpu(di->i_ino); /* can be 0 so we store a copy */
>  
>  	brelse(bh);
> +	unlock_new_inode(inode);
> +	return inode;
> +
> +error:

and also here?

> +	iget_failed(inode);
> +	return ERR_PTR(-EIO);
>  }
-
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