diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2009-09-18 17:01:12 -0400 |
---|---|---|
committer | Live-CD User <linux@linux.site> | 2009-09-19 15:50:38 -0400 |
commit | e454cea20bdcff10ee698d11b8882662a0153a47 (patch) | |
tree | f44581fe57787aef0a4f4dc00993a90ea8e688f6 /drivers/block | |
parent | 78f28b7c555359c67c2a0d23f7436e915329421e (diff) |
Driver-Core: extend devnode callbacks to provide permissions
This allows subsytems to provide devtmpfs with non-default permissions
for the device node. Instead of the default mode of 0600, null, zero,
random, urandom, full, tty, ptmx now have a mode of 0666, which allows
non-privileged processes to access standard device nodes in case no
other userspace process applies the expected permissions.
This also fixes a wrong assignment in pktcdvd and a checkpatch.pl complain.
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/aoe/aoechr.c | 4 | ||||
-rw-r--r-- | drivers/block/pktcdvd.c | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c index 19888354188f..62141ec09a22 100644 --- a/drivers/block/aoe/aoechr.c +++ b/drivers/block/aoe/aoechr.c | |||
@@ -266,7 +266,7 @@ static const struct file_operations aoe_fops = { | |||
266 | .owner = THIS_MODULE, | 266 | .owner = THIS_MODULE, |
267 | }; | 267 | }; |
268 | 268 | ||
269 | static char *aoe_nodename(struct device *dev) | 269 | static char *aoe_devnode(struct device *dev, mode_t *mode) |
270 | { | 270 | { |
271 | return kasprintf(GFP_KERNEL, "etherd/%s", dev_name(dev)); | 271 | return kasprintf(GFP_KERNEL, "etherd/%s", dev_name(dev)); |
272 | } | 272 | } |
@@ -288,7 +288,7 @@ aoechr_init(void) | |||
288 | unregister_chrdev(AOE_MAJOR, "aoechr"); | 288 | unregister_chrdev(AOE_MAJOR, "aoechr"); |
289 | return PTR_ERR(aoe_class); | 289 | return PTR_ERR(aoe_class); |
290 | } | 290 | } |
291 | aoe_class->nodename = aoe_nodename; | 291 | aoe_class->devnode = aoe_devnode; |
292 | 292 | ||
293 | for (i = 0; i < ARRAY_SIZE(chardevs); ++i) | 293 | for (i = 0; i < ARRAY_SIZE(chardevs); ++i) |
294 | device_create(aoe_class, NULL, | 294 | device_create(aoe_class, NULL, |
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 95f11cdef203..fd5bb8ad59a9 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -2857,7 +2857,7 @@ static struct block_device_operations pktcdvd_ops = { | |||
2857 | .media_changed = pkt_media_changed, | 2857 | .media_changed = pkt_media_changed, |
2858 | }; | 2858 | }; |
2859 | 2859 | ||
2860 | static char *pktcdvd_nodename(struct gendisk *gd) | 2860 | static char *pktcdvd_devnode(struct gendisk *gd, mode_t *mode) |
2861 | { | 2861 | { |
2862 | return kasprintf(GFP_KERNEL, "pktcdvd/%s", gd->disk_name); | 2862 | return kasprintf(GFP_KERNEL, "pktcdvd/%s", gd->disk_name); |
2863 | } | 2863 | } |
@@ -2914,7 +2914,7 @@ static int pkt_setup_dev(dev_t dev, dev_t* pkt_dev) | |||
2914 | disk->fops = &pktcdvd_ops; | 2914 | disk->fops = &pktcdvd_ops; |
2915 | disk->flags = GENHD_FL_REMOVABLE; | 2915 | disk->flags = GENHD_FL_REMOVABLE; |
2916 | strcpy(disk->disk_name, pd->name); | 2916 | strcpy(disk->disk_name, pd->name); |
2917 | disk->nodename = pktcdvd_nodename; | 2917 | disk->devnode = pktcdvd_devnode; |
2918 | disk->private_data = pd; | 2918 | disk->private_data = pd; |
2919 | disk->queue = blk_alloc_queue(GFP_KERNEL); | 2919 | disk->queue = blk_alloc_queue(GFP_KERNEL); |
2920 | if (!disk->queue) | 2920 | if (!disk->queue) |
@@ -3070,7 +3070,7 @@ static const struct file_operations pkt_ctl_fops = { | |||
3070 | static struct miscdevice pkt_misc = { | 3070 | static struct miscdevice pkt_misc = { |
3071 | .minor = MISC_DYNAMIC_MINOR, | 3071 | .minor = MISC_DYNAMIC_MINOR, |
3072 | .name = DRIVER_NAME, | 3072 | .name = DRIVER_NAME, |
3073 | .name = "pktcdvd/control", | 3073 | .nodename = "pktcdvd/control", |
3074 | .fops = &pkt_ctl_fops | 3074 | .fops = &pkt_ctl_fops |
3075 | }; | 3075 | }; |
3076 | 3076 | ||