From: Kevin Wolf <kwolf@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: qemu-block@nongnu.org, 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: Fri, 24 Jan 2020 14:45:04 +0100 [thread overview]
Message-ID: <20200124134504.GE4732@dhcp-200-226.str.redhat.com> (raw)
In-Reply-To: <dd893da2-2c1a-ff9f-a176-dfda1cc229c4@redhat.com>
Am 23.01.2020 um 21:37 hat John Snow geschrieben:
> 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?
Even if iscsi allowed it, it would be a useless response, because it
means that you didn't get the block status of any block.
bdrv_co_block_status() may only return *pnum == 0 at EOF, so I don't
think we have any other option than returning an error. (We could retry,
but if a target returns a useless response once, why should we trust it
do behave better the second time?)
> Anyway, this is better than accessing junk memory, so:
>
> Reviewed-by: John Snow <jsnow@redhat.com>
Thanks!
Kevin
next prev parent reply other threads:[~2020-01-24 13:46 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
2020-01-23 21:07 ` Felipe Franciosi
2020-01-23 22:48 ` Peter Lieven
2020-01-24 13:45 ` Kevin Wolf [this message]
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=20200124134504.GE4732@dhcp-200-226.str.redhat.com \
--to=kwolf@redhat.com \
--cc=felipe@nutanix.com \
--cc=jsnow@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).