Commit b9b73f7c authored by Eric W. Biederman's avatar Eric W. Biederman

userns: Convert usb functionfs to use kuid/kgid where appropriate

Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: default avatarFelipe Balbi <balbi@ti.com>
Acked-by: default avatarSerge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
parent 32d639c6
...@@ -220,8 +220,8 @@ struct ffs_data { ...@@ -220,8 +220,8 @@ struct ffs_data {
/* File permissions, written once when fs is mounted */ /* File permissions, written once when fs is mounted */
struct ffs_file_perms { struct ffs_file_perms {
umode_t mode; umode_t mode;
uid_t uid; kuid_t uid;
gid_t gid; kgid_t gid;
} file_perms; } file_perms;
/* /*
...@@ -1143,10 +1143,19 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts) ...@@ -1143,10 +1143,19 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts)
break; break;
case 3: case 3:
if (!memcmp(opts, "uid", 3)) if (!memcmp(opts, "uid", 3)) {
data->perms.uid = value; data->perms.uid = make_kuid(current_user_ns(), value);
if (!uid_valid(data->perms.uid)) {
pr_err("%s: unmapped value: %lu\n", opts, value);
return -EINVAL;
}
}
else if (!memcmp(opts, "gid", 3)) else if (!memcmp(opts, "gid", 3))
data->perms.gid = value; data->perms.gid = make_kgid(current_user_ns(), value);
if (!gid_valid(data->perms.gid)) {
pr_err("%s: unmapped value: %lu\n", opts, value);
return -EINVAL;
}
else else
goto invalid; goto invalid;
break; break;
...@@ -1175,8 +1184,8 @@ ffs_fs_mount(struct file_system_type *t, int flags, ...@@ -1175,8 +1184,8 @@ ffs_fs_mount(struct file_system_type *t, int flags,
struct ffs_sb_fill_data data = { struct ffs_sb_fill_data data = {
.perms = { .perms = {
.mode = S_IFREG | 0600, .mode = S_IFREG | 0600,
.uid = 0, .uid = GLOBAL_ROOT_UID,
.gid = 0 .gid = GLOBAL_ROOT_GID,
}, },
.root_mode = S_IFDIR | 0500, .root_mode = S_IFDIR | 0500,
}; };
......
...@@ -932,7 +932,6 @@ config UIDGID_CONVERTED ...@@ -932,7 +932,6 @@ config UIDGID_CONVERTED
depends on NET_9P = n depends on NET_9P = n
# Filesystems # Filesystems
depends on USB_FUNCTIONFS = n
depends on DEVTMPFS = n depends on DEVTMPFS = n
depends on XENFS = n depends on XENFS = n
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment