Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: Ben Hutchings <ben.hutchings@codethink.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sasha Levin <Alexander.Levin@microsoft.com>,
	stable <stable@vger.kernel.org>
Subject: Re: [PATCH 4.9] sr: pass down correctly sized SCSI sense buffer
Date: Mon, 10 Dec 2018 17:58:40 -0500	[thread overview]
Message-ID: <20181210225840.GF97256@sasha-vm> (raw)
In-Reply-To: <20181210181416.3kspglynxfm36lm5@xylophone.i.decadent.org.uk>

On Mon, Dec 10, 2018 at 06:14:16PM +0000, Ben Hutchings wrote:
>From: Jens Axboe <axboe@kernel.dk>
>
>commit f7068114d45ec55996b9040e98111afa56e010fe upstream.
>
>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.
>
>Reported-by: Piotr Gabriel Kosinski <pg.kosinski@gmail.com>
>Reported-by: Daniel Shapira <daniel@twistlock.com>
>Tested-by: Kees Cook <keescook@chromium.org>
>Fixes: 82ed4db499b8 ("block: split scsi_request out of struct request")
>Signed-off-by: Jens Axboe <axboe@kernel.dk>
>[bwh: Despite what the "Fixes" field says, a buffer overrun was already
> possible if the sense data was really > 64 bytes long.
> Backported to 4.9:
> - We always need to allocate a sense buffer in order to call
>   scsi_normalize_sense()
> - Remove the existing conditional heap-allocation of the sense buffer]
>Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>

Queued for 4.9, thank you.

--
Thanks,
Sasha

      reply	other threads:[~2018-12-10 22:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10 18:14 [PATCH 4.9] sr: pass down correctly sized SCSI sense buffer Ben Hutchings
2018-12-10 22:58 ` Sasha Levin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181210225840.GF97256@sasha-vm \
    --to=sashal@kernel.org \
    --cc=Alexander.Levin@microsoft.com \
    --cc=ben.hutchings@codethink.co.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox