driver: core: add uid gid to class devnode
Subsystems (23)
PATCH 1/3 driver: core: add uid gid to class devnode
Add support for setting uid gid to devtmpfs device nodes. In this manner, drivers can specify desired uid gid in their class->devnode method.
This is extension of existing method of setting uid gid by drivers using device_type->devnode method:3c2670e6515cf584810f417db9b00992c8b2d75a
"driver core: add uid and gid to devtmpfs"
--- arch/x86/kernel/cpuid.c | 3 ++- arch/x86/kernel/msr.c | 3 ++- block/bsg.c | 3 ++- drivers/base/core.c | 2 +- drivers/block/aoe/aoechr.c | 3 ++- drivers/block/pktcdvd.c | 3 ++- drivers/char/mem.c | 3 ++- drivers/char/misc.c | 3 ++- drivers/char/raw.c | 3 ++- drivers/char/tile-srom.c | 3 ++- drivers/gpu/drm/drm_sysfs.c | 3 ++- drivers/hid/usbhid/hiddev.c | 3 ++- drivers/infiniband/core/cm.c | 3 ++- drivers/infiniband/core/user_mad.c | 3 ++- drivers/infiniband/core/uverbs_main.c | 3 ++- drivers/input/input.c | 3 ++- drivers/media/dvb-core/dvbdev.c | 3 ++- drivers/media/pci/ddbridge/ddbridge-core.c | 3 ++- drivers/misc/cxl/file.c | 3 ++- drivers/s390/char/hmcdrv_dev.c | 3 ++- drivers/tty/tty_io.c | 3 ++- drivers/usb/class/usblp.c | 3 ++- drivers/usb/core/file.c | 5 +++-- drivers/usb/misc/iowarrior.c | 3 ++- drivers/usb/misc/legousbtower.c | 3 ++- drivers/vfio/vfio.c | 3 ++- fs/pstore/pmsg.c | 3 ++- include/linux/device.h | 3 ++- include/linux/usb.h | 3 ++- sound/sound_core.c | 3 ++- 30 files changed, 60 insertions(+), 31 deletions(-)
arch/x86/kernel/cpuid.c +2 -1
@@ -175,7 +175,8 @@ static struct notifier_block __refdata cpuid_class_cpu_notifier = .notifier_call = cpuid_class_cpu_callback, }; -static char *cpuid_devnode (struct device *dev,umode_t *mode) +static char *cpuid_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {return kasprintf (GFP_KERNEL ,"cpu/%u/cpuid" ,MINOR (dev->devt)); }
arch/x86/kernel/msr.c +2 -1
@@ -239,7 +239,8 @@ static struct notifier_block __refdata msr_class_cpu_notifier = { .notifier_call = msr_class_cpu_callback, }; -static char *msr_devnode (struct device *dev,umode_t *mode) +static char *msr_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {return kasprintf (GFP_KERNEL ,"cpu/%u/msr" ,MINOR (dev->devt)); }
block/bsg.c +2 -1
@@ -1040,7 +1040,8 @@ EXPORT_SYMBOL_GPL(bsg_register_queue);static struct cdev bsg_cdev; -static char *bsg_devnode (struct device *dev,umode_t *mode) +static char *bsg_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {return kasprintf (GFP_KERNEL ,"bsg/%s" ,dev_name (dev)); }
drivers/base/core.c +1 -1
@@ -1294,7 +1294,7 @@ const char *device_get_devnode(struct device *dev,/* the class may provide a specific name */ if (dev->class && dev->class->devnode) - *tmp = dev->class->devnode (dev, mode); + *tmp = dev->class->devnode (dev, mode, uid, gid);if (*tmp)return *tmp;
drivers/block/aoe/aoechr.c +2 -1
@@ -275,7 +275,8 @@ static const struct file_operations aoe_fops = { .llseek = noop_llseek, }; -static char *aoe_devnode (struct device *dev,umode_t *mode) +static char *aoe_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {return kasprintf (GFP_KERNEL ,"etherd/%s" ,dev_name (dev)); }
drivers/block/pktcdvd.c +2 -1
@@ -2731,7 +2731,8 @@ static const struct block_device_operations pktcdvd_ops = { .check_events = pkt_check_events, }; -static char *pktcdvd_devnode (struct gendisk *gd,umode_t *mode) +static char *pktcdvd_devnode (struct gendisk *gd,umode_t *mode, +kuid_t *uid,kgid_t *gid) {return kasprintf (GFP_KERNEL ,"pktcdvd/%s" , gd->disk_name); }
drivers/char/mem.c +2 -1
@@ -831,7 +831,8 @@ static const struct file_operations memory_fops = { .llseek = noop_llseek, }; -static char *mem_devnode (struct device *dev,umode_t *mode) +static char *mem_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {if (mode && devlist[MINOR (dev->devt)].mode) *mode = devlist[MINOR (dev->devt)].mode;
drivers/char/misc.c +2 -1
@@ -267,7 +267,8 @@ int misc_deregister(struct miscdevice *misc)EXPORT_SYMBOL (misc_register);EXPORT_SYMBOL (misc_deregister); -static char *misc_devnode (struct device *dev,umode_t *mode) +static char *misc_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {struct miscdevice *c =dev_get_drvdata (dev);
drivers/char/raw.c +2 -1
@@ -305,7 +305,8 @@ static const struct file_operations raw_ctl_fops = {static struct cdev raw_cdev; -static char *raw_devnode (struct device *dev,umode_t *mode) +static char *raw_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {return kasprintf (GFP_KERNEL ,"raw/%s" ,dev_name (dev)); }
drivers/char/tile-srom.c +2 -1
@@ -310,7 +310,8 @@ static struct attribute *srom_dev_attrs[] = { };ATTRIBUTE_GROUPS (srom_dev); -static char *srom_devnode (struct device *dev,umode_t *mode) +static char *srom_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) { *mode =S_IRUGO |S_IWUSR ;return kasprintf (GFP_KERNEL ,"srom/%s" ,dev_name (dev));
drivers/gpu/drm/drm_sysfs.c +2 -1
@@ -99,7 +99,8 @@ static const struct dev_pm_ops drm_class_dev_pm_ops = { .freeze = drm_class_freeze, }; -static char *drm_devnode (struct device *dev,umode_t *mode) +static char *drm_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {return kasprintf (GFP_KERNEL ,"dri/%s" ,dev_name (dev)); }
drivers/hid/usbhid/hiddev.c +2 -1
@@ -860,7 +860,8 @@ static const struct file_operations hiddev_fops = { .llseek = noop_llseek, }; -static char *hiddev_devnode (struct device *dev,umode_t *mode) +static char *hiddev_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {return kasprintf (GFP_KERNEL ,"usb/%s" ,dev_name (dev)); }
drivers/infiniband/core/cm.c +2 -1
@@ -3691,7 +3691,8 @@ static struct kobj_type cm_port_obj_type = { .release = cm_release_port_obj }; -static char *cm_devnode (struct device *dev,umode_t *mode) +static char *cm_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {if (mode) *mode =0666 ;
drivers/infiniband/core/user_mad.c +2 -1
@@ -1332,7 +1332,8 @@ static void ib_umad_remove_one(struct ib_device *device)kobject_put (&umad_dev->kobj); } -static char *umad_devnode (struct device *dev,umode_t *mode) +static char *umad_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {return kasprintf (GFP_KERNEL ,"infiniband/%s" ,dev_name (dev)); }
drivers/infiniband/core/uverbs_main.c +2 -1
@@ -968,7 +968,8 @@ static void ib_uverbs_remove_one(struct ib_device *device)kfree (uverbs_dev); } -static char *uverbs_devnode (struct device *dev,umode_t *mode) +static char *uverbs_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {if (mode) *mode =0666 ;
drivers/input/input.c +2 -1
@@ -1759,7 +1759,8 @@ static struct device_type input_dev_type = {#endif }; -static char *input_devnode (struct device *dev,umode_t *mode) +static char *input_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {return kasprintf (GFP_KERNEL ,"input/%s" ,dev_name (dev)); }
drivers/media/dvb-core/dvbdev.c +2 -1
@@ -584,7 +584,8 @@ static int dvb_uevent(struct device *dev, struct kobj_uevent_env *env)return 0 ; } -static char *dvb_devnode (struct device *dev,umode_t *mode) +static char *dvb_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {struct dvb_device *dvbdev =dev_get_drvdata (dev);
drivers/media/pci/ddbridge/ddbridge-core.c +2 -1
@@ -1476,7 +1476,8 @@ static const struct file_operations ddb_fops = { .open = ddb_open, }; -static char *ddb_devnode (struct device *device,umode_t *mode) +static char *ddb_devnode (struct device *device,umode_t *mode, +kuid_t *uid,kgid_t *gid) {struct ddb *dev =dev_get_drvdata (device);
drivers/misc/cxl/file.c +2 -1
@@ -408,7 +408,8 @@ const struct file_operations afu_master_fops = { }; -static char *cxl_devnode (struct device *dev,umode_t *mode) +static char *cxl_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {if (CXL_DEVT_IS_CARD (dev->devt)) {/*
drivers/s390/char/hmcdrv_dev.c +2 -1
@@ -89,7 +89,8 @@ static dev_t hmcdrv_dev_no; /* device number (major/minor) */* * Return: recommended device file name in /dev */ -static char *hmcdrv_dev_name (struct device *dev,umode_t *mode) +static char *hmcdrv_dev_name (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {char *nodename =NULL ;const char *devname =dev_name (dev);/* kernel device name */
drivers/tty/tty_io.c +2 -1
@@ -3528,7 +3528,8 @@ void __init console_init(void) } } -static char *tty_devnode (struct device *dev,umode_t *mode) +static char *tty_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {if (!mode)return NULL ;
drivers/usb/class/usblp.c +2 -1
@@ -1058,7 +1058,8 @@ static const struct file_operations usblp_fops = { .llseek = noop_llseek, }; -static char *usblp_devnode (struct device *dev,umode_t *mode) +static char *usblp_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {return kasprintf (GFP_KERNEL ,"usb/%s" ,dev_name (dev)); }
drivers/usb/core/file.c +3 -2
@@ -58,14 +58,15 @@ static struct usb_class {struct class *class; } *usb_class; -static char *usb_devnode (struct device *dev,umode_t *mode) +static char *usb_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {struct usb_class_driver *drv; drv =dev_get_drvdata (dev);if (!drv || !drv->devnode)return NULL ; -return drv->devnode (dev, mode); +return drv->devnode (dev, mode, uid, gid); }static int init_usb_class (void )
drivers/usb/misc/iowarrior.c +2 -1
@@ -729,7 +729,8 @@ static const struct file_operations iowarrior_fops = { .llseek = noop_llseek, }; -static char *iowarrior_devnode (struct device *dev,umode_t *mode) +static char *iowarrior_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {return kasprintf (GFP_KERNEL ,"usb/%s" ,dev_name (dev)); }
drivers/usb/misc/legousbtower.c +2 -1
@@ -253,7 +253,8 @@ static const struct file_operations tower_fops = { .llseek = tower_llseek, }; -static char *legousbtower_devnode (struct device *dev,umode_t *mode) +static char *legousbtower_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {return kasprintf (GFP_KERNEL ,"usb/%s" ,dev_name (dev)); }
drivers/vfio/vfio.c +2 -1
@@ -1519,7 +1519,8 @@ EXPORT_SYMBOL_GPL(vfio_external_check_extension);/** * Module/class support */ -static char *vfio_devnode (struct device *dev,umode_t *mode) +static char *vfio_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {return kasprintf (GFP_KERNEL ,"vfio/%s" ,dev_name (dev)); }
fs/pstore/pmsg.c +2 -1
@@ -73,7 +73,8 @@ static int pmsg_major;#undef pr_fmt#define pr_fmt (fmt) PMSG_NAME ": " fmt -static char *pmsg_devnode (struct device *dev,umode_t *mode) +static char *pmsg_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {if (mode) *mode =0220 ;
include/linux/device.h +2 -1
@@ -389,7 +389,8 @@ struct class {struct kobject *dev_kobj;int (*dev_uevent)(struct device *dev,struct kobj_uevent_env *env); -char *(*devnode)(struct device *dev,umode_t *mode); +char *(*devnode)(struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid);void (*class_release)(struct class *class);void (*dev_release)(struct device *dev);
include/linux/usb.h +2 -1
@@ -1157,7 +1157,8 @@ extern struct bus_type usb_bus_type;*/ struct usb_class_driver {char *name; -char *(*devnode)(struct device *dev,umode_t *mode); +char *(*devnode)(struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid);const struct file_operations *fops;int minor_base; };
sound/sound_core.c +2 -1
@@ -29,7 +29,8 @@ MODULE_DESCRIPTION("Core sound module");MODULE_AUTHOR ("Alan Cox" );MODULE_LICENSE ("GPL" ); -static char *sound_devnode (struct device *dev,umode_t *mode) +static char *sound_devnode (struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid) {if (MAJOR (dev->devt) ==SOUND_MAJOR )return NULL ;
Signature · 1 line
1.8.5.5
'Greg Kroah-Hartman'
maintainerQuoted 11 lines · Namjae Jeon
Add support for setting uid gid to devtmpfs device nodes. In this manner, drivers can specify desired uid gid in their
class->devnodemethod.This is extension of existing method of setting uid gid by drivers using
device_type->devnodemethod:3c2670e6515cf584810f417db9b00992c8b2d75a
"driver core: add uid and gid to devtmpfs"Signed-off-by Namjae Jeon <[email protected]>Signed-off-by Vivek Trivedi <[email protected]>
You add new parameters to these functions, yet never use them. Sorry, I need an actual user before I can accept api changes like this.
Same for the other 2 patches in this series, I can't accept api changes without a real user of them, otherwise I'll just have to rip them out again to simplify the code.
sorry,
greg k-h
Quoted 13 lines · Namjae Jeon
Quoted 11 lines
Add support for setting uid gid to devtmpfs device nodes. In this manner, drivers can specify desired uid gid in their
class->devnodemethod.This is extension of existing method of setting uid gid by drivers using
device_type->devnodemethod:3c2670e6515cf584810f417db9b00992c8b2d75a
"driver core: add uid and gid to devtmpfs"Signed-off-by Namjae Jeon <[email protected]>Signed-off-by Vivek Trivedi <[email protected]>
Quoted 6 lines
You add new parameters to these functions, yet never use them. Sorry, I need an actual user before I can accept api changes like this.
Same for the other 2 patches in this series, I can't accept api changes without a real user of them, otherwise I'll just have to rip them out again to simplify the code.
Hi Greg,
In closed embedded systems like Tizen or Android, It is needed to set uid/gid and xattr without shell script and daemon like udevd. This api change can make it easier to set these parameters
Thanks.
Quoted 4 lines
sorry,
greg k-h
'Greg Kroah-Hartman'
maintainerQuoted 16 lines · Namjae Jeon
Quoted 16 lines · Namjae Jeon
Quoted 11 lines
Add support for setting uid gid to devtmpfs device nodes. In this manner, drivers can specify desired uid gid in their
class->devnodemethod.This is extension of existing method of setting uid gid by drivers using
device_type->devnodemethod:3c2670e6515cf584810f417db9b00992c8b2d75a
"driver core: add uid and gid to devtmpfs"Signed-off-by Namjae Jeon <[email protected]>Signed-off-by Vivek Trivedi <[email protected]>You add new parameters to these functions, yet never use them. Sorry, I need an actual user before I can accept api changes like this.
Quoted 8 lines
Quoted 3 lines
Same for the other 2 patches in this series, I can't accept api changes without a real user of them, otherwise I'll just have to rip them out again to simplify the code.
Hi Greg,
In closed embedded systems like Tizen or Android, It is needed to set uid/gid and xattr without shell script and daemon like udevd. This api change can make it easier to set these parameters
And exactly how will that happen? I don't see a user of these changes in the kernel, so I can't accept it, sorry.
greg k-h
'Greg Kroah-Hartman'
maintainerQuoted 8 lines · Namjae Jeon
Add support for setting uid gid to devtmpfs device nodes. In this manner, drivers can specify desired uid gid in their
class->devnodemethod.This is extension of existing method of setting uid gid by drivers using
device_type->devnodemethod:3c2670e6515cf584810f417db9b00992c8b2d75a
"driver core: add uid and gid to devtmpfs"
To follow up on this, what driver wants to do this?
thanks,
greg k-h