ses: fix additional element traversal bug
authorJames Bottomley <James.Bottomley@HansenPartnership.com>
Fri, 11 Dec 2015 17:16:38 +0000 (09:16 -0800)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Fri, 11 Dec 2015 19:05:57 +0000 (11:05 -0800)
commit5e1033561da1152c57b97ee84371dba2b3d64c25
treeabae723dc0851525794fcfa5d75691fbdb33ff09
parent3417c1b5cb1fdc10261dbed42b05cc93166a78fd
ses: fix additional element traversal bug

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>
Cc: stable@vger.kernel.org
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/ses.c
include/linux/enclosure.h