From: Jens Axboe Date: Thu, 11 Sep 2014 15:31:18 +0000 (-0600) Subject: Merge branch 'for-linus' into for-3.18/core X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b207892b061da7608878e273ae22ba9bf9be264b;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git Merge branch 'for-linus' into for-3.18/core A bit of churn on the for-linus side that would be nice to have in the core bits for 3.18, so pull it in to catch us up and make forward progress easier. Signed-off-by: Jens Axboe Conflicts: block/scsi_ioctl.c --- b207892b061da7608878e273ae22ba9bf9be264b diff --cc block/scsi_ioctl.c index a8b0d0208448,9b8eaeca6a79..abb2e65b24cc --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c @@@ -317,16 -314,23 +314,23 @@@ static int sg_io(struct request_queue * if (hdr->flags & SG_FLAG_Q_AT_HEAD) at_head = 1; + ret = -ENOMEM; rq = blk_get_request(q, writing ? WRITE : READ, GFP_KERNEL); - if (!rq) - goto out; + if (IS_ERR(rq)) + return PTR_ERR(rq); blk_rq_set_block_pc(rq); - if (blk_fill_sghdr_rq(q, rq, hdr, mode)) { - blk_put_request(rq); - return -EFAULT; + if (hdr->cmd_len > BLK_MAX_CDB) { + rq->cmd = kzalloc(hdr->cmd_len, GFP_KERNEL); + if (!rq->cmd) + goto out_put_request; } + ret = -EFAULT; + if (blk_fill_sghdr_rq(q, rq, hdr, mode)) + goto out_free_cdb; + + ret = 0; if (hdr->iovec_count) { size_t iov_data_len; struct iovec *iov = NULL; @@@ -376,9 -380,14 +380,13 @@@ hdr->duration = jiffies_to_msecs(jiffies - start_time); - return blk_complete_sghdr_rq(rq, hdr, bio); - out: + ret = blk_complete_sghdr_rq(rq, hdr, bio); + + out_free_cdb: + if (rq->cmd != rq->__cmd) + kfree(rq->cmd); + out_put_request: blk_put_request(rq); -out: return ret; } @@@ -448,10 -457,11 +456,11 @@@ int sg_scsi_ioctl(struct request_queue } rq = blk_get_request(q, in_len ? WRITE : READ, __GFP_WAIT); - if (!rq) { - err = -ENOMEM; + if (IS_ERR(rq)) { + err = PTR_ERR(rq); - goto error_free_buffer; + goto error; } + blk_rq_set_block_pc(rq); cmdlen = COMMAND_SIZE(opcode);