diff options
-rw-r--r-- | drivers/usb/gadget/f_fs.c | 23 | ||||
-rw-r--r-- | init/Kconfig | 1 |
2 files changed, 16 insertions, 8 deletions
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 8adc79d1b402..f9ee4e08a4a8 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c | |||
@@ -220,8 +220,8 @@ struct ffs_data { | |||
220 | /* File permissions, written once when fs is mounted */ | 220 | /* File permissions, written once when fs is mounted */ |
221 | struct ffs_file_perms { | 221 | struct ffs_file_perms { |
222 | umode_t mode; | 222 | umode_t mode; |
223 | uid_t uid; | 223 | kuid_t uid; |
224 | gid_t gid; | 224 | kgid_t gid; |
225 | } file_perms; | 225 | } file_perms; |
226 | 226 | ||
227 | /* | 227 | /* |
@@ -1143,10 +1143,19 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts) | |||
1143 | break; | 1143 | break; |
1144 | 1144 | ||
1145 | case 3: | 1145 | case 3: |
1146 | if (!memcmp(opts, "uid", 3)) | 1146 | if (!memcmp(opts, "uid", 3)) { |
1147 | data->perms.uid = value; | 1147 | data->perms.uid = make_kuid(current_user_ns(), value); |
1148 | if (!uid_valid(data->perms.uid)) { | ||
1149 | pr_err("%s: unmapped value: %lu\n", opts, value); | ||
1150 | return -EINVAL; | ||
1151 | } | ||
1152 | } | ||
1148 | else if (!memcmp(opts, "gid", 3)) | 1153 | else if (!memcmp(opts, "gid", 3)) |
1149 | data->perms.gid = value; | 1154 | data->perms.gid = make_kgid(current_user_ns(), value); |
1155 | if (!gid_valid(data->perms.gid)) { | ||
1156 | pr_err("%s: unmapped value: %lu\n", opts, value); | ||
1157 | return -EINVAL; | ||
1158 | } | ||
1150 | else | 1159 | else |
1151 | goto invalid; | 1160 | goto invalid; |
1152 | break; | 1161 | break; |
@@ -1175,8 +1184,8 @@ ffs_fs_mount(struct file_system_type *t, int flags, | |||
1175 | struct ffs_sb_fill_data data = { | 1184 | struct ffs_sb_fill_data data = { |
1176 | .perms = { | 1185 | .perms = { |
1177 | .mode = S_IFREG | 0600, | 1186 | .mode = S_IFREG | 0600, |
1178 | .uid = 0, | 1187 | .uid = GLOBAL_ROOT_UID, |
1179 | .gid = 0 | 1188 | .gid = GLOBAL_ROOT_GID, |
1180 | }, | 1189 | }, |
1181 | .root_mode = S_IFDIR | 0500, | 1190 | .root_mode = S_IFDIR | 0500, |
1182 | }; | 1191 | }; |
diff --git a/init/Kconfig b/init/Kconfig index 633bde28c8ce..e7e0cc15ef68 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -932,7 +932,6 @@ config UIDGID_CONVERTED | |||
932 | depends on NET_9P = n | 932 | depends on NET_9P = n |
933 | 933 | ||
934 | # Filesystems | 934 | # Filesystems |
935 | depends on USB_FUNCTIONFS = n | ||
936 | depends on DEVTMPFS = n | 935 | depends on DEVTMPFS = n |
937 | depends on XENFS = n | 936 | depends on XENFS = n |
938 | 937 | ||