Prev: [55/89] hwmon: (fschmd) Fix a memleak on multiple opens of /dev/watchdog
Next: [61/89] mm: replace various uses of num_physpages by totalram_pages
From: Greg KH on 30 Mar 2010 20:30 2.6.31-stable review patch. If anyone has any objections, please let us know. ------------------ From: James Bottomley <James.Bottomley(a)suse.de> commit cc9b2e9f6603190c009e5d2629ce8e3f99571346 upstream. Based on patch originally by Jeff Mahoney <jeffm(a)suse.com> enclosure_status is expected to be a NULL terminated array of strings but isn't actually NULL terminated. When writing an invalid value to /sys/class/enclosure/.../.../status, it goes off the end of the array and Oopses. Fix by making the assumption true and adding NULL at the end. Reported-by: Artur Wojcik <artur.wojcik(a)intel.com> Signed-off-by: James Bottomley <James.Bottomley(a)suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh(a)suse.de> --- drivers/misc/enclosure.c | 1 + include/linux/enclosure.h | 2 ++ 2 files changed, 3 insertions(+) --- a/drivers/misc/enclosure.c +++ b/drivers/misc/enclosure.c @@ -362,6 +362,7 @@ static const char *const enclosure_statu [ENCLOSURE_STATUS_NOT_INSTALLED] = "not installed", [ENCLOSURE_STATUS_UNKNOWN] = "unknown", [ENCLOSURE_STATUS_UNAVAILABLE] = "unavailable", + [ENCLOSURE_STATUS_MAX] = NULL, }; static const char *const enclosure_type [] = { --- a/include/linux/enclosure.h +++ b/include/linux/enclosure.h @@ -42,6 +42,8 @@ enum enclosure_status { ENCLOSURE_STATUS_NOT_INSTALLED, ENCLOSURE_STATUS_UNKNOWN, ENCLOSURE_STATUS_UNAVAILABLE, + /* last element for counting purposes */ + ENCLOSURE_STATUS_MAX }; /* SFF-8485 activity light settings */ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |