ses: fix additional element traversal bug
authorJames Bottomley <James.Bottomley@HansenPartnership.com>
Fri, 11 Dec 2015 17:16:38 +0000 (09:16 -0800)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 22 Jan 2016 21:40:04 +0000 (21:40 +0000)
commit344d6d02690a650607e6372bce8fe40e647a51b5
treef4f38fc5b708c29d39ae6577d67c29619b5ef6dc
parent25ef938516d26c3db9cb1f5b927ad7ee95be1022
ses: fix additional element traversal bug

commit 5e1033561da1152c57b97ee84371dba2b3d64c25 upstream.

KASAN found that our additional element processing scripts drop off
the end of the VPD page into unallocated space.  The reason is that
not every element has additional information but our traversal
routines think they do, leading to them expecting far more additional
information than is present.  Fix this by adding a gate to the
traversal routine so that it only processes elements that are expected
to have additional information (list is in SES-2 section 6.1.13.1:
Additional Element Status diagnostic page overview)

Reported-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Tested-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/scsi/ses.c
include/linux/enclosure.h