From: Paolo Bonzini <pbonzini@redhat.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>,
SCSI development list <linux-scsi@vger.kernel.org>,
Hannes Reinecke <hare@suse.de>,
Dmitry Vyukov <dvyukov@google.com>,
richard@r-senior.demon.co.uk, ltuikov@yahoo.com,
Andrey Konovalov <andreyknvl@google.com>,
Kostya Serebryany <kcc@google.com>
Subject: Re: [PATCH] SCSI: Fix potential out-of-bounds access in drivers/scsi/sd.c
Date: Fri, 06 Sep 2013 18:24:11 +0200 [thread overview]
Message-ID: <522A01AB.4010508@redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1309061054390.1165-100000@iolanthe.rowland.org>
Il 06/09/2013 17:49, Alan Stern ha scritto:
> This patch fixes an out-of-bounds error in sd_read_cache_type(), found
> by Google's AddressSanitizer tool. When the loop ends, we know that
> "offset" lies beyond the end of the data in the buffer, so no Caching
> mode page was found. In theory it may be present, but the buffer size
> is limited to 512 bytes.
>
> Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
> Reported-by: Dmitry Vyukov <dvyukov@google.com>
> CC: <stable@vger.kernel.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
>
> ---
>
>
> [as1709]
>
>
> drivers/scsi/sd.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> Index: usb-3.11/drivers/scsi/sd.c
> ===================================================================
> --- usb-3.11.orig/drivers/scsi/sd.c
> +++ usb-3.11/drivers/scsi/sd.c
> @@ -2419,14 +2419,9 @@ sd_read_cache_type(struct scsi_disk *sdk
> }
> }
>
> - if (modepage == 0x3F) {
> - sd_printk(KERN_ERR, sdkp, "No Caching mode page "
> - "present\n");
> - goto defaults;
> - } else if ((buffer[offset] & 0x3f) != modepage) {
> - sd_printk(KERN_ERR, sdkp, "Got wrong page\n");
> - goto defaults;
> - }
> + sd_printk(KERN_ERR, sdkp, "No Caching mode page found\n");
> + goto defaults;
> +
> Page_found:
> if (modepage == 8) {
> sdkp->WCE = ((buffer[offset + 2] & 0x04) != 0);
>
next prev parent reply other threads:[~2013-09-06 16:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-04 0:31 Potential out-of-bounds access in drivers/scsi/sd.c Dmitry Vyukov
2013-09-04 14:32 ` Alan Stern
2013-09-04 14:45 ` Paolo Bonzini
2013-09-04 15:42 ` Alan Stern
2013-09-05 13:38 ` Hannes Reinecke
2013-09-06 15:49 ` [PATCH] SCSI: Fix potential " Alan Stern
2013-09-06 16:24 ` Paolo Bonzini [this message]
2013-09-09 6:25 ` Hannes Reinecke
2013-09-04 15:37 ` Potential " Dmitry Vyukov
2013-09-04 15:42 ` Alan Stern
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=522A01AB.4010508@redhat.com \
--to=pbonzini@redhat.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=andreyknvl@google.com \
--cc=dvyukov@google.com \
--cc=hare@suse.de \
--cc=kcc@google.com \
--cc=linux-scsi@vger.kernel.org \
--cc=ltuikov@yahoo.com \
--cc=richard@r-senior.demon.co.uk \
--cc=stern@rowland.harvard.edu \
/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;
as well as URLs for NNTP newsgroup(s).