diff options
author | Jean Delvare <khali@linux-fr.org> | 2005-04-19 00:16:59 -0400 |
---|---|---|
committer | Greg KH <greg@press.kroah.org> | 2005-04-19 00:16:59 -0400 |
commit | 1d66c64c3cee10a465cd3f8bd9191bbeb718f650 (patch) | |
tree | 1ef3e58b8ff25f850c5bf9bbdce08001751662c5 /drivers/i2c/chips/it87.c | |
parent | 86b5ac878d4a63c772d03c5017b72cc799a8f2f2 (diff) |
[PATCH] I2C: Fix incorrect sysfs file permissions in it87 and via686a drivers
The it87 and via686a hardware monitoring drivers each create a sysfs
file named "alarms" in R/W mode, while they should really create it in
read-only mode. Since we don't provide a store function for these files,
write attempts to these files will do something undefined (I guess) and
bad (I am sure). My own try resulted in a locked terminal (where I
attempted the write) and a 100% CPU load until next reboot.
As a side note, wouldn't it make sense to check, when creating sysfs
files, that readable files have a non-NULL show method, and writable
files have a non-NULL store method? I know drivers are not supposed to
do stupid things, but there is already a BUG_ON for several conditions
in sysfs_create_file, so maybe we could add two more?
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/i2c/chips/it87.c')
-rw-r--r-- | drivers/i2c/chips/it87.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/i2c/chips/it87.c b/drivers/i2c/chips/it87.c index 3d484a7aff1..cf7e6898754 100644 --- a/drivers/i2c/chips/it87.c +++ b/drivers/i2c/chips/it87.c | |||
@@ -668,7 +668,7 @@ static ssize_t show_alarms(struct device *dev, char *buf) | |||
668 | struct it87_data *data = it87_update_device(dev); | 668 | struct it87_data *data = it87_update_device(dev); |
669 | return sprintf(buf,"%d\n", ALARMS_FROM_REG(data->alarms)); | 669 | return sprintf(buf,"%d\n", ALARMS_FROM_REG(data->alarms)); |
670 | } | 670 | } |
671 | static DEVICE_ATTR(alarms, S_IRUGO | S_IWUSR, show_alarms, NULL); | 671 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
672 | 672 | ||
673 | static ssize_t | 673 | static ssize_t |
674 | show_vrm_reg(struct device *dev, char *buf) | 674 | show_vrm_reg(struct device *dev, char *buf) |