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

Staging: iio: fix up world writable sysfs files.

You should not be able to write to sysfs files from any user.

Cc: Graf Yang <graf.yang@analog.com>
Cc: Michael Hennerich <michael.hennerich@analog.com>
Cc: Jonathan Cameron <jic23@cam.ac.uk>
Cc: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

+15 -15
+14 -14
drivers/staging/iio/resolver/ad2s1210.c
··· 661 661 static IIO_CONST_ATTR(description, 662 662 "Variable Resolution, 10-Bit to 16Bit R/D\n\ 663 663 Converter with Reference Oscillator"); 664 - static IIO_DEVICE_ATTR(raw_io, S_IRUGO | S_IWUGO, 664 + static IIO_DEVICE_ATTR(raw_io, S_IRUGO | S_IWUSR, 665 665 ad2s1210_show_raw, ad2s1210_store_raw, 0); 666 - static IIO_DEVICE_ATTR(reset, S_IWUGO, 666 + static IIO_DEVICE_ATTR(reset, S_IWUSR, 667 667 NULL, ad2s1210_store_softreset, 0); 668 - static IIO_DEVICE_ATTR(fclkin, S_IRUGO | S_IWUGO, 668 + static IIO_DEVICE_ATTR(fclkin, S_IRUGO | S_IWUSR, 669 669 ad2s1210_show_fclkin, ad2s1210_store_fclkin, 0); 670 - static IIO_DEVICE_ATTR(fexcit, S_IRUGO | S_IWUGO, 670 + static IIO_DEVICE_ATTR(fexcit, S_IRUGO | S_IWUSR, 671 671 ad2s1210_show_fexcit, ad2s1210_store_fexcit, 0); 672 - static IIO_DEVICE_ATTR(control, S_IRUGO | S_IWUGO, 672 + static IIO_DEVICE_ATTR(control, S_IRUGO | S_IWUSR, 673 673 ad2s1210_show_control, ad2s1210_store_control, 0); 674 - static IIO_DEVICE_ATTR(bits, S_IRUGO | S_IWUGO, 674 + static IIO_DEVICE_ATTR(bits, S_IRUGO | S_IWUSR, 675 675 ad2s1210_show_resolution, ad2s1210_store_resolution, 0); 676 - static IIO_DEVICE_ATTR(fault, S_IRUGO | S_IWUGO, 676 + static IIO_DEVICE_ATTR(fault, S_IRUGO | S_IWUSR, 677 677 ad2s1210_show_fault, ad2s1210_clear_fault, 0); 678 678 static IIO_DEVICE_ATTR(pos, S_IRUGO, 679 679 ad2s1210_show_pos, NULL, 0); ··· 681 681 ad2s1210_show_vel, NULL, 0); 682 682 static IIO_DEVICE_ATTR(pos_vel, S_IRUGO, 683 683 ad2s1210_show_pos_vel, NULL, 0); 684 - static IIO_DEVICE_ATTR(los_thrd, S_IRUGO | S_IWUGO, 684 + static IIO_DEVICE_ATTR(los_thrd, S_IRUGO | S_IWUSR, 685 685 ad2s1210_show_reg, ad2s1210_store_reg, REG_LOS_THRD); 686 - static IIO_DEVICE_ATTR(dos_ovr_thrd, S_IRUGO | S_IWUGO, 686 + static IIO_DEVICE_ATTR(dos_ovr_thrd, S_IRUGO | S_IWUSR, 687 687 ad2s1210_show_reg, ad2s1210_store_reg, REG_DOS_OVR_THRD); 688 - static IIO_DEVICE_ATTR(dos_mis_thrd, S_IRUGO | S_IWUGO, 688 + static IIO_DEVICE_ATTR(dos_mis_thrd, S_IRUGO | S_IWUSR, 689 689 ad2s1210_show_reg, ad2s1210_store_reg, REG_DOS_MIS_THRD); 690 - static IIO_DEVICE_ATTR(dos_rst_max_thrd, S_IRUGO | S_IWUGO, 690 + static IIO_DEVICE_ATTR(dos_rst_max_thrd, S_IRUGO | S_IWUSR, 691 691 ad2s1210_show_reg, ad2s1210_store_reg, REG_DOS_RST_MAX_THRD); 692 - static IIO_DEVICE_ATTR(dos_rst_min_thrd, S_IRUGO | S_IWUGO, 692 + static IIO_DEVICE_ATTR(dos_rst_min_thrd, S_IRUGO | S_IWUSR, 693 693 ad2s1210_show_reg, ad2s1210_store_reg, REG_DOS_RST_MIN_THRD); 694 - static IIO_DEVICE_ATTR(lot_high_thrd, S_IRUGO | S_IWUGO, 694 + static IIO_DEVICE_ATTR(lot_high_thrd, S_IRUGO | S_IWUSR, 695 695 ad2s1210_show_reg, ad2s1210_store_reg, REG_LOT_HIGH_THRD); 696 - static IIO_DEVICE_ATTR(lot_low_thrd, S_IRUGO | S_IWUGO, 696 + static IIO_DEVICE_ATTR(lot_low_thrd, S_IRUGO | S_IWUSR, 697 697 ad2s1210_show_reg, ad2s1210_store_reg, REG_LOT_LOW_THRD); 698 698 699 699 static struct attribute *ad2s1210_attributes[] = {
+1 -1
drivers/staging/iio/sysfs.h
··· 111 111 * IIO_DEV_ATTR_RESET: resets the device 112 112 **/ 113 113 #define IIO_DEV_ATTR_RESET(_store) \ 114 - IIO_DEVICE_ATTR(reset, S_IWUGO, NULL, _store, 0) 114 + IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, _store, 0) 115 115 116 116 /** 117 117 * IIO_CONST_ATTR_NAME - constant identifier