diff options
-rw-r--r-- | block/genhd.c | 2 | ||||
-rw-r--r-- | drivers/base/core.c | 14 | ||||
-rw-r--r-- | drivers/base/devtmpfs.c | 18 | ||||
-rw-r--r-- | drivers/usb/core/usb.c | 2 | ||||
-rw-r--r-- | include/linux/device.h | 4 |
5 files changed, 20 insertions, 20 deletions
diff --git a/block/genhd.c b/block/genhd.c index dfcec431ceea..20625eed5511 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -1112,7 +1112,7 @@ struct class block_class = { | |||
1112 | }; | 1112 | }; |
1113 | 1113 | ||
1114 | static char *block_devnode(struct device *dev, umode_t *mode, | 1114 | static char *block_devnode(struct device *dev, umode_t *mode, |
1115 | uid_t *uid, gid_t *gid) | 1115 | kuid_t *uid, kgid_t *gid) |
1116 | { | 1116 | { |
1117 | struct gendisk *disk = dev_to_disk(dev); | 1117 | struct gendisk *disk = dev_to_disk(dev); |
1118 | 1118 | ||
diff --git a/drivers/base/core.c b/drivers/base/core.c index 8a428b51089d..f88d9e259a32 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -283,8 +283,8 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj, | |||
283 | const char *tmp; | 283 | const char *tmp; |
284 | const char *name; | 284 | const char *name; |
285 | umode_t mode = 0; | 285 | umode_t mode = 0; |
286 | uid_t uid = 0; | 286 | kuid_t uid = GLOBAL_ROOT_UID; |
287 | gid_t gid = 0; | 287 | kgid_t gid = GLOBAL_ROOT_GID; |
288 | 288 | ||
289 | add_uevent_var(env, "MAJOR=%u", MAJOR(dev->devt)); | 289 | add_uevent_var(env, "MAJOR=%u", MAJOR(dev->devt)); |
290 | add_uevent_var(env, "MINOR=%u", MINOR(dev->devt)); | 290 | add_uevent_var(env, "MINOR=%u", MINOR(dev->devt)); |
@@ -293,10 +293,10 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj, | |||
293 | add_uevent_var(env, "DEVNAME=%s", name); | 293 | add_uevent_var(env, "DEVNAME=%s", name); |
294 | if (mode) | 294 | if (mode) |
295 | add_uevent_var(env, "DEVMODE=%#o", mode & 0777); | 295 | add_uevent_var(env, "DEVMODE=%#o", mode & 0777); |
296 | if (uid) | 296 | if (!uid_eq(uid, GLOBAL_ROOT_UID)) |
297 | add_uevent_var(env, "DEVUID=%u", uid); | 297 | add_uevent_var(env, "DEVUID=%u", from_kuid(&init_user_ns, uid)); |
298 | if (gid) | 298 | if (!gid_eq(gid, GLOBAL_ROOT_GID)) |
299 | add_uevent_var(env, "DEVGID=%u", gid); | 299 | add_uevent_var(env, "DEVGID=%u", from_kgid(&init_user_ns, gid)); |
300 | kfree(tmp); | 300 | kfree(tmp); |
301 | } | 301 | } |
302 | } | 302 | } |
@@ -1297,7 +1297,7 @@ static struct device *next_device(struct klist_iter *i) | |||
1297 | * freed by the caller. | 1297 | * freed by the caller. |
1298 | */ | 1298 | */ |
1299 | const char *device_get_devnode(struct device *dev, | 1299 | const char *device_get_devnode(struct device *dev, |
1300 | umode_t *mode, uid_t *uid, gid_t *gid, | 1300 | umode_t *mode, kuid_t *uid, kgid_t *gid, |
1301 | const char **tmp) | 1301 | const char **tmp) |
1302 | { | 1302 | { |
1303 | char *s; | 1303 | char *s; |
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) |
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 17002832abd9..e092b414dc50 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -318,7 +318,7 @@ static const struct dev_pm_ops usb_device_pm_ops = { | |||
318 | 318 | ||
319 | 319 | ||
320 | static char *usb_devnode(struct device *dev, | 320 | static char *usb_devnode(struct device *dev, |
321 | umode_t *mode, uid_t *uid, gid_t *gid) | 321 | umode_t *mode, kuid_t *uid, kgid_t *gid) |
322 | { | 322 | { |
323 | struct usb_device *usb_dev; | 323 | struct usb_device *usb_dev; |
324 | 324 | ||
diff --git a/include/linux/device.h b/include/linux/device.h index 851b85c7101e..88615ccaf23a 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -467,7 +467,7 @@ struct device_type { | |||
467 | const struct attribute_group **groups; | 467 | const struct attribute_group **groups; |
468 | int (*uevent)(struct device *dev, struct kobj_uevent_env *env); | 468 | int (*uevent)(struct device *dev, struct kobj_uevent_env *env); |
469 | char *(*devnode)(struct device *dev, umode_t *mode, | 469 | char *(*devnode)(struct device *dev, umode_t *mode, |
470 | uid_t *uid, gid_t *gid); | 470 | kuid_t *uid, kgid_t *gid); |
471 | void (*release)(struct device *dev); | 471 | void (*release)(struct device *dev); |
472 | 472 | ||
473 | const struct dev_pm_ops *pm; | 473 | const struct dev_pm_ops *pm; |
@@ -845,7 +845,7 @@ extern int device_rename(struct device *dev, const char *new_name); | |||
845 | extern int device_move(struct device *dev, struct device *new_parent, | 845 | extern int device_move(struct device *dev, struct device *new_parent, |
846 | enum dpm_order dpm_order); | 846 | enum dpm_order dpm_order); |
847 | extern const char *device_get_devnode(struct device *dev, | 847 | extern const char *device_get_devnode(struct device *dev, |
848 | umode_t *mode, uid_t *uid, gid_t *gid, | 848 | umode_t *mode, kuid_t *uid, kgid_t *gid, |
849 | const char **tmp); | 849 | const char **tmp); |
850 | extern void *dev_get_drvdata(const struct device *dev); | 850 | extern void *dev_get_drvdata(const struct device *dev); |
851 | extern int dev_set_drvdata(struct device *dev, void *data); | 851 | extern int dev_set_drvdata(struct device *dev, void *data); |