ses: Fix problems with simple enclosures
authorJames Bottomley <James.Bottomley@HansenPartnership.com>
Tue, 8 Dec 2015 17:00:31 +0000 (09:00 -0800)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 22 Jan 2016 21:40:04 +0000 (21:40 +0000)
commit25ef938516d26c3db9cb1f5b927ad7ee95be1022
tree4d1a9ce3cefa759bf93b20cc85836c59f2fcd44d
parent6f23bc6f6be370267332a0278a4646126836baee
ses: Fix problems with simple enclosures

commit 3417c1b5cb1fdc10261dbed42b05cc93166a78fd upstream.

Simple enclosure implementations (mostly USB) are allowed to return only
page 8 to every diagnostic query.  That really confuses our
implementation because we assume the return is the page we asked for and
end up doing incorrect offsets based on bogus information leading to
accesses outside of allocated ranges.  Fix that by checking the page
code of the return and giving an error if it isn't the one we asked for.
This should fix reported bugs with USB storage by simply refusing to
attach to enclosures that behave like this.  It's also good defensive
practise now that we're starting to see more USB enclosures.

Reported-by: Andrea Gelmini <andrea.gelmini@gelma.net>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/scsi/ses.c