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:	Fri, 05 Oct 2012 13:28:04 -0700
From:	ebiederm@...ssion.com (Eric W. Biederman)
To:	김재극 <jaegeuk.kim@...sung.com>
Cc:	viro@...iv.linux.org.uk, 'Theodore Ts'o' <tytso@....edu>,
	gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
	chur.lee@...sung.com, cm224.lee@...sung.com,
	jooyoung.hwang@...sung.com
Subject: Re: [PATCH 10/16] f2fs: add core inode operations

김재극 <jaegeuk.kim@...sung.com> writes:

> This adds core functions to get, read, write, and evict an inode.

As is this code won't compile if user namespace support is enabled.
Suggested fixes below.

Eric


> +static int do_read_inode(struct inode *inode)
> +{
> +	struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
> +	struct f2fs_inode_info *fi = F2FS_I(inode);
> +	struct page *node_page;
> +	struct f2fs_node *rn;
> +	struct f2fs_inode *ri;
> +
> +	/* Check if ino is within scope */
> +	check_nid_range(sbi, inode->i_ino);
> +
> +	node_page = get_node_page(sbi, inode->i_ino);
> +	if (IS_ERR(node_page))
> +		return PTR_ERR(node_page);
> +
> +	rn = page_address(node_page);
> +	ri = &(rn->i);
> +
> +	inode->i_mode = le16_to_cpu(ri->i_mode);
> +	inode->i_uid = le32_to_cpu(ri->i_uid);
> +	inode->i_gid = le32_to_cpu(ri->i_gid);

Could you make this:
	i_uid_write(inode, le32_to_cpu(ri->i_uid));
	i_gid_write(inode, le32_to_cpu(ri->i_gid));

> +	set_nlink(inode, le32_to_cpu(ri->i_links));
> +	inode->i_size = le64_to_cpu(ri->i_size);
> +	inode->i_blocks = le64_to_cpu(ri->i_blocks);
> +
> +	inode->i_atime.tv_sec = le32_to_cpu(ri->i_atime);
> +	inode->i_ctime.tv_sec = le32_to_cpu(ri->i_ctime);
> +	inode->i_mtime.tv_sec = le32_to_cpu(ri->i_mtime);
> +	inode->i_atime.tv_nsec = 0;
> +	inode->i_ctime.tv_nsec = 0;
> +	inode->i_mtime.tv_nsec = 0;
> +	fi->current_depth = le32_to_cpu(ri->current_depth);
> +	fi->i_xattr_nid = le32_to_cpu(ri->i_xattr_nid);
> +	fi->i_flags = le32_to_cpu(ri->i_flags);
> +	fi->flags = 0;
> +	fi->data_version = le64_to_cpu(F2FS_CKPT(sbi)->checkpoint_ver) - 1;
> +	get_extent_info(&fi->ext, ri->i_ext);
> +	f2fs_put_page(node_page, 1);
> +	return 0;
> +}

> +void update_inode(struct inode *inode, struct page *node_page)
> +{
> +	struct f2fs_node *rn;
> +	struct f2fs_inode *ri;
> +
> +	wait_on_page_writeback(node_page);
> +
> +	rn = page_address(node_page);
> +	ri = &(rn->i);
> +
> +	ri->i_mode = cpu_to_le16(inode->i_mode);
> +	ri->i_uid = cpu_to_le32(inode->i_uid);
> +	ri->i_gid = cpu_to_le32(inode->i_gid);
And make this:
	i_uid_write(inode, le32_to_cpu(ri->i_uid));
	i_gid_write(inode, le32_to_cpu(ri->i_gid));

> +	ri->i_links = cpu_to_le32(inode->i_nlink);
> +	ri->i_size = cpu_to_le64(i_size_read(inode));
> +	ri->i_blocks = cpu_to_le64(inode->i_blocks);
> +	set_raw_extent(&F2FS_I(inode)->ext, &ri->i_ext);
> +
> +	ri->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec);
> +	ri->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec);
> +	ri->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
> +	ri->current_depth = cpu_to_le32(F2FS_I(inode)->current_depth);
> +	ri->i_xattr_nid = cpu_to_le32(F2FS_I(inode)->i_xattr_nid);
> +	ri->i_flags = cpu_to_le32(F2FS_I(inode)->i_flags);
> +	set_page_dirty(node_page);
> +}
--
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