diff options
Diffstat (limited to 'drivers/usb/gadget/f_fs.c')
-rw-r--r-- | drivers/usb/gadget/f_fs.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 829aba75a6df..a26c43a151fd 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c | |||
@@ -224,8 +224,8 @@ struct ffs_data { | |||
224 | /* File permissions, written once when fs is mounted */ | 224 | /* File permissions, written once when fs is mounted */ |
225 | struct ffs_file_perms { | 225 | struct ffs_file_perms { |
226 | umode_t mode; | 226 | umode_t mode; |
227 | uid_t uid; | 227 | kuid_t uid; |
228 | gid_t gid; | 228 | kgid_t gid; |
229 | } file_perms; | 229 | } file_perms; |
230 | 230 | ||
231 | /* | 231 | /* |
@@ -1147,10 +1147,19 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts) | |||
1147 | break; | 1147 | break; |
1148 | 1148 | ||
1149 | case 3: | 1149 | case 3: |
1150 | if (!memcmp(opts, "uid", 3)) | 1150 | if (!memcmp(opts, "uid", 3)) { |
1151 | data->perms.uid = value; | 1151 | data->perms.uid = make_kuid(current_user_ns(), value); |
1152 | if (!uid_valid(data->perms.uid)) { | ||
1153 | pr_err("%s: unmapped value: %lu\n", opts, value); | ||
1154 | return -EINVAL; | ||
1155 | } | ||
1156 | } | ||
1152 | else if (!memcmp(opts, "gid", 3)) | 1157 | else if (!memcmp(opts, "gid", 3)) |
1153 | data->perms.gid = value; | 1158 | data->perms.gid = make_kgid(current_user_ns(), value); |
1159 | if (!gid_valid(data->perms.gid)) { | ||
1160 | pr_err("%s: unmapped value: %lu\n", opts, value); | ||
1161 | return -EINVAL; | ||
1162 | } | ||
1154 | else | 1163 | else |
1155 | goto invalid; | 1164 | goto invalid; |
1156 | break; | 1165 | break; |
@@ -1179,8 +1188,8 @@ ffs_fs_mount(struct file_system_type *t, int flags, | |||
1179 | struct ffs_sb_fill_data data = { | 1188 | struct ffs_sb_fill_data data = { |
1180 | .perms = { | 1189 | .perms = { |
1181 | .mode = S_IFREG | 0600, | 1190 | .mode = S_IFREG | 0600, |
1182 | .uid = 0, | 1191 | .uid = GLOBAL_ROOT_UID, |
1183 | .gid = 0 | 1192 | .gid = GLOBAL_ROOT_GID, |
1184 | }, | 1193 | }, |
1185 | .root_mode = S_IFDIR | 0500, | 1194 | .root_mode = S_IFDIR | 0500, |
1186 | }; | 1195 | }; |