Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

w1: don't allow arbitrary users to remove w1 devices

The search/pullup/add/remove device attributes were 0666 which would allow
arbitrary users to affect the 1 wire bus. Change to 0664 to prevent that.

I found this patch in the Android tree, apparently this has never been
sent upstream so doing it now.

Signed-off-by: Brian Swetland <swetland@google.com>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Brian Swetland and committed by
Linus Torvalds
12aa4c64 f49d2eb3

+4 -4
+4 -4
drivers/w1/w1.c
··· 517 517 static W1_MASTER_ATTR_RO(attempts, S_IRUGO); 518 518 static W1_MASTER_ATTR_RO(timeout, S_IRUGO); 519 519 static W1_MASTER_ATTR_RO(pointer, S_IRUGO); 520 - static W1_MASTER_ATTR_RW(search, S_IRUGO | S_IWUGO); 521 - static W1_MASTER_ATTR_RW(pullup, S_IRUGO | S_IWUGO); 522 - static W1_MASTER_ATTR_RW(add, S_IRUGO | S_IWUGO); 523 - static W1_MASTER_ATTR_RW(remove, S_IRUGO | S_IWUGO); 520 + static W1_MASTER_ATTR_RW(search, S_IRUGO | S_IWUSR | S_IWGRP); 521 + static W1_MASTER_ATTR_RW(pullup, S_IRUGO | S_IWUSR | S_IWGRP); 522 + static W1_MASTER_ATTR_RW(add, S_IRUGO | S_IWUSR | S_IWGRP); 523 + static W1_MASTER_ATTR_RW(remove, S_IRUGO | S_IWUSR | S_IWGRP); 524 524 525 525 static struct attribute *w1_master_default_attrs[] = { 526 526 &w1_master_attribute_name.attr,