[PATCH] sd: fix memory corruption with broken mode page headers
authorStefan Richter <stefanr@s5r6.in-berlin.de>
Sun, 26 Feb 2006 23:16:10 +0000 (00:16 +0100)
committerChris Wright <chrisw@sous-sol.org>
Wed, 1 Mar 2006 22:36:37 +0000 (14:36 -0800)
commited26c7781107e4d8fd0c654459e61b81096c4ff4
treec6c555776d1c5aa407bf9ee1e61415d077172cd2
parent9809ee9916825087a8729af4713ae9b555917ad5
[PATCH] sd: fix memory corruption with broken mode page headers

sd: fix memory corruption with broken mode page headers

There's a problem in sd where we blindly believe the length of the
headers and block descriptors.  Some devices return insane values for
these and cause our length to end up greater than the actual buffer
size, so check to make sure.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Also removed the buffer size magic number (512) and added DPOFUA of
zero to the defaults

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
rediff for 2.6.15.x without DPOFUA bit, taken from commit
489708007785389941a89fa06aedc5ec53303c96

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
drivers/scsi/sd.c