diff options
author | David Brownell <david-b@pacbell.net> | 2007-11-14 19:58:30 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-14 21:45:36 -0500 |
commit | a4b1d50e6158ecaa8fdb6a716389149bace35b52 (patch) | |
tree | 90649fc6d9bcf2aa2684fde7d982d0f752f1e9f4 /drivers/rtc/rtc-m48t59.c | |
parent | 779d20892f8e716677194dc879eea2b5f1e75678 (diff) |
RTCs: handle NVRAM better
Several of the RTC drivers are exporting binary "nvram" files in sysfs. Such
NVRAM (or on many systems, EEPROM) data is often initialized during system
manufacture to hold data about identity (serial numbers, Ethernet addresses,
etc), configuration, calibration, and so forth.
This patch improves integrity and security of those files:
- Correctly initializes the size in one of the two cases where
that was not yet being done.
- Improves system security/integrity by making this state not
be world-writable by default.
Letting arbitrary userspace code mangle such state by default is at least Not
A Good Thing; and it could sometimes be worse, depending on the particular
data that might be corrupted. (I disregard the paranoiac "don't let anyone
read it either" approach. Anyone storing passwords in such memory doesn't
really care about security.)
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: Torsten Ertbjerg Rasmussen <tr@newtec.dk>
Cc: Mark Zhan <rongkai.zhan@windriver.com>
Cc: Thomas Hommel <thomas.hommel@gefanuc.com>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-m48t59.c')
-rw-r--r-- | drivers/rtc/rtc-m48t59.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c index 2bad1637330a..cd0bbc0e8038 100644 --- a/drivers/rtc/rtc-m48t59.c +++ b/drivers/rtc/rtc-m48t59.c | |||
@@ -353,11 +353,12 @@ static ssize_t m48t59_nvram_write(struct kobject *kobj, | |||
353 | static struct bin_attribute m48t59_nvram_attr = { | 353 | static struct bin_attribute m48t59_nvram_attr = { |
354 | .attr = { | 354 | .attr = { |
355 | .name = "nvram", | 355 | .name = "nvram", |
356 | .mode = S_IRUGO | S_IWUGO, | 356 | .mode = S_IRUGO | S_IWUSR, |
357 | .owner = THIS_MODULE, | 357 | .owner = THIS_MODULE, |
358 | }, | 358 | }, |
359 | .read = m48t59_nvram_read, | 359 | .read = m48t59_nvram_read, |
360 | .write = m48t59_nvram_write, | 360 | .write = m48t59_nvram_write, |
361 | .size = M48T59_NVRAM_SIZE, | ||
361 | }; | 362 | }; |
362 | 363 | ||
363 | static int __devinit m48t59_rtc_probe(struct platform_device *pdev) | 364 | static int __devinit m48t59_rtc_probe(struct platform_device *pdev) |