aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2013-02-06 04:53:25 -0500
committerEric W. Biederman <ebiederm@xmission.com>2013-02-13 10:28:51 -0500
commit4a2c8cf56953a6ebe3c8671433607b7f96f200d5 (patch)
tree307523cb5ac706ab182cd2942a47895dc1647373 /fs
parent6d4a083205c27bc2e2a1c03dff4acf2fe457d1c4 (diff)
cifs: Convert struct cifs_fattr to use kuid and kgids
In cifs_unix_to_basic_fattr only update the cifs_fattr with an id if it is valid after conversion. Cc: Steve French <smfrench@gmail.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/cifsglob.h4
-rw-r--r--fs/cifs/inode.c14
2 files changed, 12 insertions, 6 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 7993a7a07ae2..98312fda0d35 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -1245,8 +1245,8 @@ struct cifs_fattr {
1245 u64 cf_eof; 1245 u64 cf_eof;
1246 u64 cf_bytes; 1246 u64 cf_bytes;
1247 u64 cf_createtime; 1247 u64 cf_createtime;
1248 uid_t cf_uid; 1248 kuid_t cf_uid;
1249 gid_t cf_gid; 1249 kgid_t cf_gid;
1250 umode_t cf_mode; 1250 umode_t cf_mode;
1251 dev_t cf_rdev; 1251 dev_t cf_rdev;
1252 unsigned int cf_nlink; 1252 unsigned int cf_nlink;
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 737643940540..9638233964fc 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -247,15 +247,21 @@ cifs_unix_basic_to_fattr(struct cifs_fattr *fattr, FILE_UNIX_BASIC_INFO *info,
247 fattr->cf_uid = cifs_sb->mnt_uid; 247 fattr->cf_uid = cifs_sb->mnt_uid;
248 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID)) { 248 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID)) {
249 u64 id = le64_to_cpu(info->Uid); 249 u64 id = le64_to_cpu(info->Uid);
250 if (id < ((uid_t)-1)) 250 if (id < ((uid_t)-1)) {
251 fattr->cf_uid = id; 251 kuid_t uid = make_kuid(&init_user_ns, id);
252 if (uid_valid(uid))
253 fattr->cf_uid = uid;
254 }
252 } 255 }
253 256
254 fattr->cf_gid = cifs_sb->mnt_gid; 257 fattr->cf_gid = cifs_sb->mnt_gid;
255 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID)) { 258 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID)) {
256 u64 id = le64_to_cpu(info->Gid); 259 u64 id = le64_to_cpu(info->Gid);
257 if (id < ((gid_t)-1)) 260 if (id < ((gid_t)-1)) {
258 fattr->cf_gid = id; 261 kgid_t gid = make_kgid(&init_user_ns, id);
262 if (gid_valid(gid))
263 fattr->cf_gid = gid;
264 }
259 } 265 }
260 266
261 fattr->cf_nlink = le64_to_cpu(info->Nlinks); 267 fattr->cf_nlink = le64_to_cpu(info->Nlinks);