diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-04-11 14:43:29 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-04-11 14:43:29 -0400 |
| commit | 4e4098a3e08783cfd75f9fcdab276dc1d46931da (patch) | |
| tree | d0befddb4d6f999a443ef60ae8af327bed046fd5 /drivers/base/devtmpfs.c | |
| parent | d81c8d19da8fb6514c75d5c19334f4236856c561 (diff) | |
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.c | 18 |
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 { | |||
| 42 | int err; | 42 | int err; |
| 43 | const char *name; | 43 | const char *name; |
| 44 | umode_t mode; /* 0 => delete */ | 44 | umode_t mode; /* 0 => delete */ |
| 45 | uid_t uid; | 45 | kuid_t uid; |
| 46 | gid_t gid; | 46 | kgid_t gid; |
| 47 | struct device *dev; | 47 | struct device *dev; |
| 48 | } *requests; | 48 | } *requests; |
| 49 | 49 | ||
| @@ -88,8 +88,8 @@ int devtmpfs_create_node(struct device *dev) | |||
| 88 | return 0; | 88 | return 0; |
| 89 | 89 | ||
| 90 | req.mode = 0; | 90 | req.mode = 0; |
| 91 | req.uid = 0; | 91 | req.uid = GLOBAL_ROOT_UID; |
| 92 | req.gid = 0; | 92 | req.gid = GLOBAL_ROOT_GID; |
| 93 | req.name = device_get_devnode(dev, &req.mode, &req.uid, &req.gid, &tmp); | 93 | req.name = device_get_devnode(dev, &req.mode, &req.uid, &req.gid, &tmp); |
| 94 | if (!req.name) | 94 | if (!req.name) |
| 95 | return -ENOMEM; | 95 | return -ENOMEM; |
| @@ -192,8 +192,8 @@ static int create_path(const char *nodepath) | |||
| 192 | return err; | 192 | return err; |
| 193 | } | 193 | } |
| 194 | 194 | ||
| 195 | static int handle_create(const char *nodename, umode_t mode, uid_t uid, | 195 | static int handle_create(const char *nodename, umode_t mode, kuid_t uid, |
| 196 | gid_t gid, struct device *dev) | 196 | kgid_t gid, struct device *dev) |
| 197 | { | 197 | { |
| 198 | struct dentry *dentry; | 198 | struct dentry *dentry; |
| 199 | struct path path; | 199 | struct path path; |
| @@ -212,8 +212,8 @@ static int handle_create(const char *nodename, umode_t mode, uid_t uid, | |||
| 212 | struct iattr newattrs; | 212 | struct iattr newattrs; |
| 213 | 213 | ||
| 214 | newattrs.ia_mode = mode; | 214 | newattrs.ia_mode = mode; |
| 215 | newattrs.ia_uid = KUIDT_INIT(uid); | 215 | newattrs.ia_uid = uid; |
| 216 | newattrs.ia_gid = KGIDT_INIT(gid); | 216 | newattrs.ia_gid = gid; |
| 217 | newattrs.ia_valid = ATTR_MODE|ATTR_UID|ATTR_GID; | 217 | newattrs.ia_valid = ATTR_MODE|ATTR_UID|ATTR_GID; |
| 218 | mutex_lock(&dentry->d_inode->i_mutex); | 218 | mutex_lock(&dentry->d_inode->i_mutex); |
| 219 | notify_change(dentry, &newattrs); | 219 | notify_change(dentry, &newattrs); |
| @@ -364,7 +364,7 @@ int devtmpfs_mount(const char *mntdir) | |||
| 364 | 364 | ||
| 365 | static DECLARE_COMPLETION(setup_done); | 365 | static DECLARE_COMPLETION(setup_done); |
| 366 | 366 | ||
| 367 | static int handle(const char *name, umode_t mode, uid_t uid, gid_t gid, | 367 | static int handle(const char *name, umode_t mode, kuid_t uid, kgid_t gid, |
| 368 | struct device *dev) | 368 | struct device *dev) |
| 369 | { | 369 | { |
| 370 | if (mode) | 370 | if (mode) |
