SCSI: enclosure: fix oops while iterating enclosure_status array
commitd3f1c54adc9e1b127d569d2b947d54d273315e26
authorJames Bottomley <James.Bottomley@suse.de>
Thu, 26 Nov 2009 15:50:20 +0000 (26 09:50 -0600)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 1 Apr 2010 22:55:39 +0000 (1 15:55 -0700)
tree175c589391289209cdea7e64ab4a2a7c35c86816
parent14a2fe817f8ca96cbe718165ec1ffba025ddc556
SCSI: enclosure: fix oops while iterating enclosure_status array

commit cc9b2e9f6603190c009e5d2629ce8e3f99571346 upstream.

Based on patch originally by Jeff Mahoney <jeffm@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@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/misc/enclosure.c
include/linux/enclosure.h