Add support for setting security labels(e.g. smack or selinux labels) to
devtmpfs device nodes. In this manner, drivers can specify desired security
label in their device_type->devnode or class->devnode method.

Signed-off-by: Namjae Jeon <namjae.j...@samsung.com>
Signed-off-by: Vivek Trivedi <t.vi...@samsung.com>
---
 arch/x86/kernel/cpuid.c                    |  2 +-
 arch/x86/kernel/msr.c                      |  2 +-
 block/bsg.c                                |  2 +-
 block/genhd.c                              |  2 +-
 drivers/base/core.c                        |  9 +++++----
 drivers/base/devtmpfs.c                    | 23 +++++++++++++++++------
 drivers/block/aoe/aoechr.c                 |  2 +-
 drivers/block/pktcdvd.c                    |  2 +-
 drivers/char/mem.c                         |  2 +-
 drivers/char/misc.c                        |  2 +-
 drivers/char/raw.c                         |  2 +-
 drivers/char/tile-srom.c                   |  2 +-
 drivers/gpu/drm/drm_sysfs.c                |  2 +-
 drivers/hid/usbhid/hiddev.c                |  2 +-
 drivers/infiniband/core/cm.c               |  2 +-
 drivers/infiniband/core/user_mad.c         |  2 +-
 drivers/infiniband/core/uverbs_main.c      |  2 +-
 drivers/input/input.c                      |  2 +-
 drivers/media/dvb-core/dvbdev.c            |  2 +-
 drivers/media/pci/ddbridge/ddbridge-core.c |  2 +-
 drivers/misc/cxl/file.c                    |  2 +-
 drivers/s390/char/hmcdrv_dev.c             |  2 +-
 drivers/tty/tty_io.c                       |  2 +-
 drivers/usb/class/usblp.c                  |  2 +-
 drivers/usb/core/file.c                    |  4 ++--
 drivers/usb/core/usb.c                     |  3 ++-
 drivers/usb/misc/iowarrior.c               |  2 +-
 drivers/usb/misc/legousbtower.c            |  2 +-
 drivers/vfio/vfio.c                        |  2 +-
 fs/pstore/pmsg.c                           |  2 +-
 include/linux/device.h                     |  7 ++++---
 include/linux/usb.h                        |  2 +-
 sound/sound_core.c                         |  2 +-
 33 files changed, 58 insertions(+), 44 deletions(-)

diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
index 7153cb7..1623e4c 100644
--- a/arch/x86/kernel/cpuid.c
+++ b/arch/x86/kernel/cpuid.c
@@ -176,7 +176,7 @@ static struct notifier_block __refdata 
cpuid_class_cpu_notifier =
 };
 
 static char *cpuid_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        return kasprintf(GFP_KERNEL, "cpu/%u/cpuid", MINOR(dev->devt));
 }
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index fcbd718..29b143b 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -240,7 +240,7 @@ static struct notifier_block __refdata 
msr_class_cpu_notifier = {
 };
 
 static char *msr_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        return kasprintf(GFP_KERNEL, "cpu/%u/msr", MINOR(dev->devt));
 }
diff --git a/block/bsg.c b/block/bsg.c
index 6eef206..ee383b2 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -1041,7 +1041,7 @@ EXPORT_SYMBOL_GPL(bsg_register_queue);
 static struct cdev bsg_cdev;
 
 static char *bsg_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        return kasprintf(GFP_KERNEL, "bsg/%s", dev_name(dev));
 }
diff --git a/block/genhd.c b/block/genhd.c
index 59d18b6..7cff560 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1121,7 +1121,7 @@ struct class block_class = {
 };
 
 static char *block_devnode(struct device *dev, umode_t *mode,
-                          kuid_t *uid, kgid_t *gid)
+                          kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        struct gendisk *disk = dev_to_disk(dev);
 
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 4e7546d..0007bc3 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -311,7 +311,7 @@ static int dev_uevent(struct kset *kset, struct kobject 
*kobj,
 
                add_uevent_var(env, "MAJOR=%u", MAJOR(dev->devt));
                add_uevent_var(env, "MINOR=%u", MINOR(dev->devt));
-               name = device_get_devnode(dev, &mode, &uid, &gid, &tmp);
+               name = device_get_devnode(dev, &mode, &uid, &gid, NULL, &tmp);
                if (name) {
                        add_uevent_var(env, "DEVNAME=%s", name);
                        if (mode)
@@ -1271,6 +1271,7 @@ static struct device *next_device(struct klist_iter *i)
  * @mode: returned file access mode
  * @uid: returned file owner
  * @gid: returned file group
+ * @xattr: returned file xattr
  * @tmp: possibly allocated string
  *
  * Return the relative path of a possible device node.
@@ -1280,7 +1281,7 @@ static struct device *next_device(struct klist_iter *i)
  */
 const char *device_get_devnode(struct device *dev,
                               umode_t *mode, kuid_t *uid, kgid_t *gid,
-                              const char **tmp)
+                              struct xattr *xattr, const char **tmp)
 {
        char *s;
 
@@ -1288,13 +1289,13 @@ const char *device_get_devnode(struct device *dev,
 
        /* the device type may provide a specific name */
        if (dev->type && dev->type->devnode)
-               *tmp = dev->type->devnode(dev, mode, uid, gid);
+               *tmp = dev->type->devnode(dev, mode, uid, gid, xattr);
        if (*tmp)
                return *tmp;
 
        /* the class may provide a specific name */
        if (dev->class && dev->class->devnode)
-               *tmp = dev->class->devnode(dev, mode, uid, gid);
+               *tmp = dev->class->devnode(dev, mode, uid, gid, xattr);
        if (*tmp)
                return *tmp;
 
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index 68f0314..c628afb 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -44,6 +44,7 @@ static struct req {
        umode_t mode;   /* 0 => delete */
        kuid_t uid;
        kgid_t gid;
+       struct xattr xattr;
        struct device *dev;
 } *requests;
 
@@ -90,7 +91,12 @@ int devtmpfs_create_node(struct device *dev)
        req.mode = 0;
        req.uid = GLOBAL_ROOT_UID;
        req.gid = GLOBAL_ROOT_GID;
-       req.name = device_get_devnode(dev, &req.mode, &req.uid, &req.gid, &tmp);
+       req.xattr.value = kmalloc(XATTR_SIZE_MAX, GFP_KERNEL);
+       if (!req.xattr.value)
+               return -ENOMEM;
+       req.xattr.value_len = 0;
+       req.name = device_get_devnode(dev, &req.mode, &req.uid, &req.gid,
+                       &req.xattr, &tmp);
        if (!req.name)
                return -ENOMEM;
 
@@ -113,6 +119,7 @@ int devtmpfs_create_node(struct device *dev)
        wake_up_process(thread);
        wait_for_completion(&req.done);
 
+       kfree(req.xattr.value);
        kfree(tmp);
 
        return req.err;
@@ -126,7 +133,7 @@ int devtmpfs_delete_node(struct device *dev)
        if (!thread)
                return 0;
 
-       req.name = device_get_devnode(dev, NULL, NULL, NULL, &tmp);
+       req.name = device_get_devnode(dev, NULL, NULL, NULL, NULL, &tmp);
        if (!req.name)
                return -ENOMEM;
 
@@ -193,7 +200,7 @@ static int create_path(const char *nodepath)
 }
 
 static int handle_create(const char *nodename, umode_t mode, kuid_t uid,
-                        kgid_t gid, struct device *dev)
+                        kgid_t gid, struct xattr xattr, struct device *dev)
 {
        struct dentry *dentry;
        struct path path;
@@ -221,6 +228,9 @@ static int handle_create(const char *nodename, umode_t 
mode, kuid_t uid,
 
                /* mark as kernel-created inode */
                d_inode(dentry)->i_private = &thread;
+               if (xattr.value_len > 0)
+                       vfs_setxattr(dentry, xattr.name, xattr.value,
+                                       xattr.value_len, 0);
        }
        done_path_create(&path, dentry);
        return err;
@@ -365,10 +375,10 @@ int devtmpfs_mount(const char *mntdir)
 static DECLARE_COMPLETION(setup_done);
 
 static int handle(const char *name, umode_t mode, kuid_t uid, kgid_t gid,
-                 struct device *dev)
+               struct xattr xattr, struct device *dev)
 {
        if (mode)
-               return handle_create(name, mode, uid, gid, dev);
+               return handle_create(name, mode, uid, gid, xattr, dev);
        else
                return handle_remove(name, dev);
 }
@@ -395,7 +405,8 @@ static int devtmpfsd(void *p)
                        while (req) {
                                struct req *next = req->next;
                                req->err = handle(req->name, req->mode,
-                                                 req->uid, req->gid, req->dev);
+                                                 req->uid, req->gid,
+                                                 req->xattr, req->dev);
                                complete(&req->done);
                                req = next;
                        }
diff --git a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c
index a71332f..41612e4 100644
--- a/drivers/block/aoe/aoechr.c
+++ b/drivers/block/aoe/aoechr.c
@@ -276,7 +276,7 @@ static const struct file_operations aoe_fops = {
 };
 
 static char *aoe_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        return kasprintf(GFP_KERNEL, "etherd/%s", dev_name(dev));
 }
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 5f5c462..3fd2251 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -2732,7 +2732,7 @@ static const struct block_device_operations pktcdvd_ops = 
{
 };
 
 static char *pktcdvd_devnode(struct gendisk *gd, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        return kasprintf(GFP_KERNEL, "pktcdvd/%s", gd->disk_name);
 }
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index f16b511..57ffee6 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -832,7 +832,7 @@ static const struct file_operations memory_fops = {
 };
 
 static char *mem_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        if (mode && devlist[MINOR(dev->devt)].mode)
                *mode = devlist[MINOR(dev->devt)].mode;
diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index 9a960ab..63fb739 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -268,7 +268,7 @@ EXPORT_SYMBOL(misc_register);
 EXPORT_SYMBOL(misc_deregister);
 
 static char *misc_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        struct miscdevice *c = dev_get_drvdata(dev);
 
diff --git a/drivers/char/raw.c b/drivers/char/raw.c
index d6714ee..ba8566e 100644
--- a/drivers/char/raw.c
+++ b/drivers/char/raw.c
@@ -306,7 +306,7 @@ static const struct file_operations raw_ctl_fops = {
 static struct cdev raw_cdev;
 
 static char *raw_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        return kasprintf(GFP_KERNEL, "raw/%s", dev_name(dev));
 }
diff --git a/drivers/char/tile-srom.c b/drivers/char/tile-srom.c
index 1b6f655..fae0008 100644
--- a/drivers/char/tile-srom.c
+++ b/drivers/char/tile-srom.c
@@ -311,7 +311,7 @@ static struct attribute *srom_dev_attrs[] = {
 ATTRIBUTE_GROUPS(srom_dev);
 
 static char *srom_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        *mode = S_IRUGO | S_IWUSR;
        return kasprintf(GFP_KERNEL, "srom/%s", dev_name(dev));
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index 48ec1b6..6afd5cbd 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -100,7 +100,7 @@ static const struct dev_pm_ops drm_class_dev_pm_ops = {
 };
 
 static char *drm_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev));
 }
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index a40204b..b5176cc 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -861,7 +861,7 @@ static const struct file_operations hiddev_fops = {
 };
 
 static char *hiddev_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev));
 }
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 13621fd4..551d990 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -3692,7 +3692,7 @@ static struct kobj_type cm_port_obj_type = {
 };
 
 static char *cm_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        if (mode)
                *mode = 0666;
diff --git a/drivers/infiniband/core/user_mad.c 
b/drivers/infiniband/core/user_mad.c
index dc34a45..a51c93f 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -1333,7 +1333,7 @@ static void ib_umad_remove_one(struct ib_device *device)
 }
 
 static char *umad_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        return kasprintf(GFP_KERNEL, "infiniband/%s", dev_name(dev));
 }
diff --git a/drivers/infiniband/core/uverbs_main.c 
b/drivers/infiniband/core/uverbs_main.c
index 86c0311..95b0d37 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -969,7 +969,7 @@ static void ib_uverbs_remove_one(struct ib_device *device)
 }
 
 static char *uverbs_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        if (mode)
                *mode = 0666;
diff --git a/drivers/input/input.c b/drivers/input/input.c
index f4825b7..630c78b 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1760,7 +1760,7 @@ static struct device_type input_dev_type = {
 };
 
 static char *input_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        return kasprintf(GFP_KERNEL, "input/%s", dev_name(dev));
 }
diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
index 5ec225e..4c450d3 100644
--- a/drivers/media/dvb-core/dvbdev.c
+++ b/drivers/media/dvb-core/dvbdev.c
@@ -585,7 +585,7 @@ static int dvb_uevent(struct device *dev, struct 
kobj_uevent_env *env)
 }
 
 static char *dvb_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        struct dvb_device *dvbdev = dev_get_drvdata(dev);
 
diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c 
b/drivers/media/pci/ddbridge/ddbridge-core.c
index 44d9bc6..215550d 100644
--- a/drivers/media/pci/ddbridge/ddbridge-core.c
+++ b/drivers/media/pci/ddbridge/ddbridge-core.c
@@ -1477,7 +1477,7 @@ static const struct file_operations ddb_fops = {
 };
 
 static char *ddb_devnode(struct device *device, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        struct ddb *dev = dev_get_drvdata(device);
 
diff --git a/drivers/misc/cxl/file.c b/drivers/misc/cxl/file.c
index f570d50..7dd8c39 100644
--- a/drivers/misc/cxl/file.c
+++ b/drivers/misc/cxl/file.c
@@ -409,7 +409,7 @@ const struct file_operations afu_master_fops = {
 
 
 static char *cxl_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        if (CXL_DEVT_IS_CARD(dev->devt)) {
                /*
diff --git a/drivers/s390/char/hmcdrv_dev.c b/drivers/s390/char/hmcdrv_dev.c
index ffa582a..1baa752 100644
--- a/drivers/s390/char/hmcdrv_dev.c
+++ b/drivers/s390/char/hmcdrv_dev.c
@@ -90,7 +90,7 @@ 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,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        char *nodename = NULL;
        const char *devname = dev_name(dev); /* kernel device name */
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index a47650a..1333290 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -3529,7 +3529,7 @@ void __init console_init(void)
 }
 
 static char *tty_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        if (!mode)
                return NULL;
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index d672115..312e084 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -1059,7 +1059,7 @@ static const struct file_operations usblp_fops = {
 };
 
 static char *usblp_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev));
 }
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c
index e990b8d..6754de9 100644
--- a/drivers/usb/core/file.c
+++ b/drivers/usb/core/file.c
@@ -59,14 +59,14 @@ static struct usb_class {
 } *usb_class;
 
 static char *usb_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        struct usb_class_driver *drv;
 
        drv = dev_get_drvdata(dev);
        if (!drv || !drv->devnode)
                return NULL;
-       return drv->devnode(dev, mode, uid, gid);
+       return drv->devnode(dev, mode, uid, gid, xattr);
 }
 
 static int init_usb_class(void)
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 8d5b2f4..1f1f5cf 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -373,7 +373,8 @@ static const struct dev_pm_ops usb_device_pm_ops = {
 
 
 static char *usb_devnode(struct device *dev,
-                        umode_t *mode, kuid_t *uid, kgid_t *gid)
+                        umode_t *mode, kuid_t *uid, kgid_t *gid,
+                        struct xattr *xattr)
 {
        struct usb_device *usb_dev;
 
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
index f9d6887..4764d79 100644
--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -730,7 +730,7 @@ static const struct file_operations iowarrior_fops = {
 };
 
 static char *iowarrior_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev));
 }
diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
index d41c1b8..0830f48 100644
--- a/drivers/usb/misc/legousbtower.c
+++ b/drivers/usb/misc/legousbtower.c
@@ -254,7 +254,7 @@ static const struct file_operations tower_fops = {
 };
 
 static char *legousbtower_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev));
 }
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index 58e4e67..757a866 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/vfio.c
@@ -1520,7 +1520,7 @@ EXPORT_SYMBOL_GPL(vfio_external_check_extension);
  * Module/class support
  */
 static char *vfio_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        return kasprintf(GFP_KERNEL, "vfio/%s", dev_name(dev));
 }
diff --git a/fs/pstore/pmsg.c b/fs/pstore/pmsg.c
index 2d7db92..189675d 100644
--- a/fs/pstore/pmsg.c
+++ b/fs/pstore/pmsg.c
@@ -74,7 +74,7 @@ static int pmsg_major;
 #define pr_fmt(fmt) PMSG_NAME ": " fmt
 
 static char *pmsg_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        if (mode)
                *mode = 0220;
diff --git a/include/linux/device.h b/include/linux/device.h
index 220c0b1..135b12d 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -27,6 +27,7 @@
 #include <linux/ratelimit.h>
 #include <linux/uidgid.h>
 #include <linux/gfp.h>
+#include <linux/xattr.h>
 #include <asm/device.h>
 
 struct device;
@@ -390,7 +391,7 @@ struct class {
 
        int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
        char *(*devnode)(struct device *dev, umode_t *mode,
-                       kuid_t *uid, kgid_t *gid);
+                       kuid_t *uid, kgid_t *gid, struct xattr *xattr);
 
        void (*class_release)(struct class *class);
        void (*dev_release)(struct device *dev);
@@ -535,7 +536,7 @@ struct device_type {
        const struct attribute_group **groups;
        int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
        char *(*devnode)(struct device *dev, umode_t *mode,
-                        kuid_t *uid, kgid_t *gid);
+                        kuid_t *uid, kgid_t *gid, struct xattr *xattr);
        void (*release)(struct device *dev);
 
        const struct dev_pm_ops *pm;
@@ -966,7 +967,7 @@ extern int device_move(struct device *dev, struct device 
*new_parent,
                       enum dpm_order dpm_order);
 extern const char *device_get_devnode(struct device *dev,
                                      umode_t *mode, kuid_t *uid, kgid_t *gid,
-                                     const char **tmp);
+                                     struct xattr *xattr, const char **tmp);
 
 static inline bool device_supports_offline(struct device *dev)
 {
diff --git a/include/linux/usb.h b/include/linux/usb.h
index c396dde..4165606 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1158,7 +1158,7 @@ extern struct bus_type usb_bus_type;
 struct usb_class_driver {
        char *name;
        char *(*devnode)(struct device *dev, umode_t *mode,
-                       kuid_t *uid, kgid_t *gid);
+                       kuid_t *uid, kgid_t *gid, struct xattr *xattr);
        const struct file_operations *fops;
        int minor_base;
 };
diff --git a/sound/sound_core.c b/sound/sound_core.c
index 9c01786..b2145f8 100644
--- a/sound/sound_core.c
+++ b/sound/sound_core.c
@@ -30,7 +30,7 @@ MODULE_AUTHOR("Alan Cox");
 MODULE_LICENSE("GPL");
 
 static char *sound_devnode(struct device *dev, umode_t *mode,
-               kuid_t *uid, kgid_t *gid)
+               kuid_t *uid, kgid_t *gid, struct xattr *xattr)
 {
        if (MAJOR(dev->devt) == SOUND_MAJOR)
                return NULL;
-- 
1.8.5.5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to