diff options
author | Christoph Hellwig <hch@lst.de> | 2014-08-21 20:38:27 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-08-21 20:42:01 -0500 |
commit | 2cada584b20007470931080c49310d85908449b0 (patch) | |
tree | 1e2a191bc3e9017b6b40a961a6efdcb0d804fc54 /block/scsi_ioctl.c | |
parent | aeac31819475ad0980cb3a13d5599f5a1127e83d (diff) | |
download | linux-stable-2cada584b20007470931080c49310d85908449b0.tar.gz linux-stable-2cada584b20007470931080c49310d85908449b0.tar.bz2 linux-stable-2cada584b20007470931080c49310d85908449b0.zip |
block: cleanup error handling in sg_io
Make sure we always clean up through the out label and just have
a single place to put the request.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/scsi_ioctl.c')
-rw-r--r-- | block/scsi_ioctl.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index 51bf5155ee75..ba8706f6cded 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c @@ -279,7 +279,6 @@ static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr, r = blk_rq_unmap_user(bio); if (!ret) ret = r; - blk_put_request(rq); return ret; } @@ -322,10 +321,9 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, return -ENOMEM; blk_rq_set_block_pc(rq); - if (blk_fill_sghdr_rq(q, rq, hdr, mode)) { - blk_put_request(rq); - return -EFAULT; - } + ret = -EFAULT; + if (blk_fill_sghdr_rq(q, rq, hdr, mode)) + goto out; if (hdr->iovec_count) { size_t iov_data_len; @@ -376,7 +374,7 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, hdr->duration = jiffies_to_msecs(jiffies - start_time); - return blk_complete_sghdr_rq(rq, hdr, bio); + ret = blk_complete_sghdr_rq(rq, hdr, bio); out: blk_put_request(rq); return ret; |