* [PATCH] block: fix SG_IO to return a proper error value
@ 2009-04-03 11:49 FUJITA Tomonori
2009-04-13 10:26 ` FUJITA Tomonori
0 siblings, 1 reply; 3+ messages in thread
From: FUJITA Tomonori @ 2009-04-03 11:49 UTC (permalink / raw)
To: Jens.Axboe; +Cc: linux-kernel
blk_rq_unmap_user() returns -EFAULT if a program passes an invalid
address to kernel. SG_IO path needs to pass the returned value to user
space instead of ignoring it.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
block/scsi_ioctl.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 626ee27..84b7f87 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -217,7 +217,7 @@ static int blk_fill_sghdr_rq(struct request_queue *q, struct request *rq,
static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr,
struct bio *bio)
{
- int ret = 0;
+ int r, ret = 0;
/*
* fill in all the output members
@@ -242,7 +242,9 @@ static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr,
ret = -EFAULT;
}
- blk_rq_unmap_user(bio);
+ r = blk_rq_unmap_user(bio);
+ if (!ret)
+ ret = r;
blk_put_request(rq);
return ret;
--
1.6.0.6
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] block: fix SG_IO to return a proper error value
2009-04-03 11:49 [PATCH] block: fix SG_IO to return a proper error value FUJITA Tomonori
@ 2009-04-13 10:26 ` FUJITA Tomonori
2009-04-13 18:02 ` Jens Axboe
0 siblings, 1 reply; 3+ messages in thread
From: FUJITA Tomonori @ 2009-04-13 10:26 UTC (permalink / raw)
To: Jens.Axboe; +Cc: linux-kernel, fujita.tomonori
Ping?
This patch is necessary to return a proper error for applications
issuing READ requests with a bogus buffer.
On Fri, 3 Apr 2009 20:49:03 +0900
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> wrote:
> blk_rq_unmap_user() returns -EFAULT if a program passes an invalid
> address to kernel. SG_IO path needs to pass the returned value to user
> space instead of ignoring it.
>
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> ---
> block/scsi_ioctl.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
> index 626ee27..84b7f87 100644
> --- a/block/scsi_ioctl.c
> +++ b/block/scsi_ioctl.c
> @@ -217,7 +217,7 @@ static int blk_fill_sghdr_rq(struct request_queue *q, struct request *rq,
> static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr,
> struct bio *bio)
> {
> - int ret = 0;
> + int r, ret = 0;
>
> /*
> * fill in all the output members
> @@ -242,7 +242,9 @@ static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr,
> ret = -EFAULT;
> }
>
> - blk_rq_unmap_user(bio);
> + r = blk_rq_unmap_user(bio);
> + if (!ret)
> + ret = r;
> blk_put_request(rq);
>
> return ret;
> --
> 1.6.0.6
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-04-13 18:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-03 11:49 [PATCH] block: fix SG_IO to return a proper error value FUJITA Tomonori
2009-04-13 10:26 ` FUJITA Tomonori
2009-04-13 18:02 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox