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/char/tty_io.c | |
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/char/tty_io.c')
-rw-r--r-- | drivers/char/tty_io.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index a3afa0c387cd..c70d9dabefae 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -3056,11 +3056,22 @@ void __init console_init(void) | |||
3056 | } | 3056 | } |
3057 | } | 3057 | } |
3058 | 3058 | ||
3059 | static char *tty_devnode(struct device *dev, mode_t *mode) | ||
3060 | { | ||
3061 | if (!mode) | ||
3062 | return NULL; | ||
3063 | if (dev->devt == MKDEV(TTYAUX_MAJOR, 0) || | ||
3064 | dev->devt == MKDEV(TTYAUX_MAJOR, 2)) | ||
3065 | *mode = 0666; | ||
3066 | return NULL; | ||
3067 | } | ||
3068 | |||
3059 | static int __init tty_class_init(void) | 3069 | static int __init tty_class_init(void) |
3060 | { | 3070 | { |
3061 | tty_class = class_create(THIS_MODULE, "tty"); | 3071 | tty_class = class_create(THIS_MODULE, "tty"); |
3062 | if (IS_ERR(tty_class)) | 3072 | if (IS_ERR(tty_class)) |
3063 | return PTR_ERR(tty_class); | 3073 | return PTR_ERR(tty_class); |
3074 | tty_class->devnode = tty_devnode; | ||
3064 | return 0; | 3075 | return 0; |
3065 | } | 3076 | } |
3066 | 3077 | ||