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]
Message-ID: <87haqq8et5.fsf@devron.myhome.or.jp>
Date:	Sat, 22 Sep 2012 20:41:58 +0900
From:	OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
To:	Namjae Jeon <linkinjeon@...il.com>
Cc:	akpm@...ux-foundation.org, bfields@...ldses.org,
	viro@...iv.linux.org.uk, linux-kernel@...r.kernel.org,
	Namjae Jeon <namjae.jeon@...sung.com>,
	Ravishankar N <ravi.n1@...sung.com>,
	Amit Sahrawat <a.sahrawat@...sung.com>
Subject: Re: [PATCH v3 3/5] fat (exportfs): rebuild inode if ilookup() fails

Namjae Jeon <linkinjeon@...il.com> writes:

> +	if (inode == NULL && MSDOS_SB(sb)->options.nfs == FAT_NFS_LIMITED) {
> +		struct buffer_head *bh = NULL;
> +		struct msdos_dir_entry *de ;
> +		loff_t i_pos = (loff_t)ino;
> +		int bits = MSDOS_SB(sb)->dir_per_block_bits;
> +		loff_t blocknr = i_pos >> bits;
> +		bh = sb_bread(sb, blocknr);
> +		if (!bh) {
> +			fat_msg(sb, KERN_ERR,
> +				 "unable to read block(%llu) for building NFS inode",
> +				(llu)blocknr);
> +			return inode;
> +		}
> +		de = (struct msdos_dir_entry *)bh->b_data;
> +		/* If a file is deleted on server and client is not updated
> +		 * yet, we must not build the inode upon a lookup call.
> +		 */
> +		if (de[i_pos&((1<<bits)-1)].name[0] == DELETED_FLAG)

IS_FREE() would be better.

> +
> +			inode = NULL;
> +		else
> +			inode = fat_build_inode(sb, &de[i_pos&((1<<bits)-1)],
> +					i_pos);
> +		brelse(bh);
> +	}
>  
>  	return inode;
>  }

1 << bits == sbi->dir_per_block

It would be better to add helper to decode i_pos to blocknr and offset.
And it should be shared on fat_write_inode and this.
-- 
OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
--
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