From: Jeff Moyer <jmoyer@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, Jens Axboe <axboe@kernel.dk>
Subject: Re: [PATCH] block: fix bogus EFAULT error from SG_IO ioctl
Date: Fri, 26 Jun 2015 10:09:59 -0400 [thread overview]
Message-ID: <x49zj3mef2g.fsf@segfault.boston.devel.redhat.com> (raw)
In-Reply-To: <1435311886-30834-1-git-send-email-pbonzini@redhat.com> (Paolo Bonzini's message of "Fri, 26 Jun 2015 11:44:46 +0200")
Paolo Bonzini <pbonzini@redhat.com> writes:
> Whenever blk_fill_sghdr_rq fails, its errno code is ignored and changed to
> EFAULT. This can cause very confusing errors:
>
> $ sg_persist -k /dev/sda
> persistent reservation in: pass through os error: Bad address
>
> The fix is trivial, just propagate the return value from
> blk_fill_sghdr_rq.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Jeff Moyer <jmoyer@redhat.com>
> ---
> block/scsi_ioctl.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
> index 55b6f15dac90..dda653ce7b24 100644
> --- a/block/scsi_ioctl.c
> +++ b/block/scsi_ioctl.c
> @@ -326,8 +326,8 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk,
> goto out_put_request;
> }
>
> - ret = -EFAULT;
> - if (blk_fill_sghdr_rq(q, rq, hdr, mode))
> + ret = blk_fill_sghdr_rq(q, rq, hdr, mode);
> + if (ret < 0)
> goto out_free_cdb;
>
> ret = 0;
next prev parent reply other threads:[~2015-06-26 14:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-26 9:44 Paolo Bonzini
2015-06-26 14:09 ` Jeff Moyer [this message]
2015-06-27 17:43 ` Jens Axboe
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=x49zj3mef2g.fsf@segfault.boston.devel.redhat.com \
--to=jmoyer@redhat.com \
--cc=axboe@kernel.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.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
all inboxes | Powered by JetHome®