]> git.baikalelectronics.ru Git - kernel.git/commit
sr: pass down correctly sized SCSI sense buffer
authorJens Axboe <axboe@kernel.dk>
Mon, 21 May 2018 18:21:14 +0000 (12:21 -0600)
committerJens Axboe <axboe@kernel.dk>
Mon, 21 May 2018 18:21:14 +0000 (12:21 -0600)
commite1539de0098151eb5aa13414fb013ab064a7982a
tree32c53bcae79c32537ffe622d7654d69f60ebd6f7
parent9245176e1133e253deca0a9319f2a965ae8201cb
sr: pass down correctly sized SCSI sense buffer

We're casting the CDROM layer request_sense to the SCSI sense
buffer, but the former is 64 bytes and the latter is 96 bytes.
As we generally allocate these on the stack, we end up blowing
up the stack.

Fix this by wrapping the scsi_execute() call with a properly
sized sense buffer, and copying back the bits for the CDROM
layer.

Cc: stable@vger.kernel.org
Reported-by: Piotr Gabriel Kosinski <pg.kosinski@gmail.com>
Reported-by: Daniel Shapira <daniel@twistlock.com>
Tested-by: Kees Cook <keescook@chromium.org>
Fixes: e5e0f7fb06a0 ("block: split scsi_request out of struct request")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/scsi/sr_ioctl.c