diff options
author | James Bottomley <James.Bottomley@suse.de> | 2009-11-26 09:50:20 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-01-25 10:49:37 -0800 |
commit | 8cef765ff1eafb77cc40e8dad7a7a00190d9a6fc (patch) | |
tree | 6d79504253ca90aa17f163c7ad9f014d596a5277 /include | |
parent | 5f0ab2dfbf84454894568377e4dd6578ef3938f3 (diff) |
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/enclosure.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/enclosure.h b/include/linux/enclosure.h index 90d1c218411..9a33c5f7e12 100644 --- 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 */ |