summaryrefslogtreecommitdiff
path: root/drivers/base/devtmpfs.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-11 22:43:29 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-11 22:43:29 +0400
commit4e4098a3e08783cfd75f9fcdab276dc1d46931da (patch)
treed0befddb4d6f999a443ef60ae8af327bed046fd5 /drivers/base/devtmpfs.c
parentd81c8d19da8fb6514c75d5c19334f4236856c561 (diff)
downloadlinux-4e4098a3e08783cfd75f9fcdab276dc1d46931da.tar.xz
driver core: handle user namespaces properly with the uid/gid devtmpfs change
Now that devtmpfs is caring about uid/gid, we need to use the correct internal types so users who have USER_NS enabled will have things work properly for them. Thanks to Eric for pointing this out, and the patch review. Reported-by: Eric W. Biederman <ebiederm@xmission.com> Cc: Kay Sievers <kay@vrfy.org> Cc: Ming Lei <ming.lei@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/devtmpfs.c')
-rw-r--r--drivers/base/devtmpfs.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index abd4eee61d27..7413d065906b 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -42,8 +42,8 @@ static struct req {
int err;
const char *name;
umode_t mode; /* 0 => delete */
- uid_t uid;
- gid_t gid;
+ kuid_t uid;
+ kgid_t gid;
struct device *dev;
} *requests;
@@ -88,8 +88,8 @@ int devtmpfs_create_node(struct device *dev)
return 0;
req.mode = 0;
- req.uid = 0;
- req.gid = 0;
+ req.uid = GLOBAL_ROOT_UID;
+ req.gid = GLOBAL_ROOT_GID;
req.name = device_get_devnode(dev, &req.mode, &req.uid, &req.gid, &tmp);
if (!req.name)
return -ENOMEM;
@@ -192,8 +192,8 @@ static int create_path(const char *nodepath)
return err;
}
-static int handle_create(const char *nodename, umode_t mode, uid_t uid,
- gid_t gid, struct device *dev)
+static int handle_create(const char *nodename, umode_t mode, kuid_t uid,
+ kgid_t gid, struct device *dev)
{
struct dentry *dentry;
struct path path;
@@ -212,8 +212,8 @@ static int handle_create(const char *nodename, umode_t mode, uid_t uid,
struct iattr newattrs;
newattrs.ia_mode = mode;
- newattrs.ia_uid = KUIDT_INIT(uid);
- newattrs.ia_gid = KGIDT_INIT(gid);
+ newattrs.ia_uid = uid;
+ newattrs.ia_gid = gid;
newattrs.ia_valid = ATTR_MODE|ATTR_UID|ATTR_GID;
mutex_lock(&dentry->d_inode->i_mutex);
notify_change(dentry, &newattrs);
@@ -364,7 +364,7 @@ int devtmpfs_mount(const char *mntdir)
static DECLARE_COMPLETION(setup_done);
-static int handle(const char *name, umode_t mode, uid_t uid, gid_t gid,
+static int handle(const char *name, umode_t mode, kuid_t uid, kgid_t gid,
struct device *dev)
{
if (mode)