From: John Snow <jsnow@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Cc: pl@kamp.de, qemu-devel@nongnu.org, mreitz@redhat.com,
ronniesahlberg@gmail.com, felipe@nutanix.com,
pbonzini@redhat.com
Subject: Re: [PATCH] iscsi: Don't access non-existent scsi_lba_status_descriptor
Date: Thu, 23 Jan 2020 15:37:56 -0500 [thread overview]
Message-ID: <dd893da2-2c1a-ff9f-a176-dfda1cc229c4@redhat.com> (raw)
In-Reply-To: <20200123170544.30117-1-kwolf@redhat.com>
On 1/23/20 12:05 PM, Kevin Wolf wrote:
> In iscsi_co_block_status(), we may have received num_descriptors == 0
> from the iscsi server. Therefore, we can't unconditionally access
> lbas->descriptors[0]. Add the missing check.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> block/iscsi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/iscsi.c b/block/iscsi.c
> index cbd57294ab..c8feaa2f0e 100644
> --- a/block/iscsi.c
> +++ b/block/iscsi.c
> @@ -753,7 +753,7 @@ retry:
> }
>
> lbas = scsi_datain_unmarshall(iTask.task);
> - if (lbas == NULL) {
> + if (lbas == NULL || lbas->num_descriptors == 0) {
> ret = -EIO;
> goto out_unlock;
> }
>
Naive question: Does the specification allow for such a response? Is
this inherently an error?
Anyway, this is better than accessing junk memory, so:
Reviewed-by: John Snow <jsnow@redhat.com>
next prev parent reply other threads:[~2020-01-23 20:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-23 17:05 [PATCH] iscsi: Don't access non-existent scsi_lba_status_descriptor Kevin Wolf
2020-01-23 20:36 ` Felipe Franciosi
2020-01-23 20:37 ` John Snow [this message]
2020-01-23 21:07 ` Felipe Franciosi
2020-01-23 22:48 ` Peter Lieven
2020-01-24 13:45 ` Kevin Wolf
2020-01-23 21:19 ` Philippe Mathieu-Daudé
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=dd893da2-2c1a-ff9f-a176-dfda1cc229c4@redhat.com \
--to=jsnow@redhat.com \
--cc=felipe@nutanix.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=pl@kamp.de \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=ronniesahlberg@gmail.com \
/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).