[PATCH 4/4] userns: eofblocks: convert project id from user to kernel space

Gao feng
2013-09-04T06:37:27Z

Convert project id from user to kernel space in
xfs_fs_eofblocks_from_user.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
---
fs/xfs/xfs_icache.h | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_icache.h b/fs/xfs/xfs_icache.h
index 8a89f7d..aeedfc8 100644
--- a/fs/xfs/xfs_icache.h
+++ b/fs/xfs/xfs_icache.h
@@ -80,7 +80,6 @@ xfs_fs_eofblocks_from_user(
return EINVAL;

dst->eof_flags = src->eof_flags;
- dst->eof_prid = src->eof_prid;
dst->eof_min_file_size = src->eof_min_file_size;

dst->eof_uid = INVALID_UID;
@@ -96,6 +95,14 @@ xfs_fs_eofblocks_from_user(
if (!gid_valid(dst->eof_gid))
return EINVAL;
}
+
+ dst->eof_prid = src->eof_prid;
+ if (src->eof_flags & XFS_EOF_FLAGS_PRID) {
+ if (xfs_convert_to_kernel_projid(src->eof_prid,
+ &dst->eof_prid) < 0)
+ return EINVAL;
+ }
+
return 0;
}