From patchwork Tue Jul 10 16:52:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Battersby X-Patchwork-Id: 10517967 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E3A3C6020F for ; Tue, 10 Jul 2018 19:41:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD5EC284D1 for ; Tue, 10 Jul 2018 19:41:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD2F7291C1; Tue, 10 Jul 2018 19:41:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CD2D284D1 for ; Tue, 10 Jul 2018 19:41:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732851AbeGJTm2 (ORCPT ); Tue, 10 Jul 2018 15:42:28 -0400 Received: from mail.cybernetics.com ([173.71.130.66]:42846 "EHLO mail.cybernetics.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732332AbeGJTm2 (ORCPT ); Tue, 10 Jul 2018 15:42:28 -0400 X-Greylist: delayed 9036 seconds by postgrey-1.27 at vger.kernel.org; Tue, 10 Jul 2018 15:42:28 EDT X-ASG-Debug-ID: 1531241544-0fb3b01fb32a6c40001-ziuLRu Received: from cybernetics.com ([10.157.1.126]) by mail.cybernetics.com with ESMTP id qQkP9WK28EWPotko (version=SSLv3 cipher=DES-CBC3-SHA bits=112 verify=NO); Tue, 10 Jul 2018 12:52:24 -0400 (EDT) X-Barracuda-Envelope-From: tonyb@cybernetics.com X-ASG-Whitelist: Client Received: from [10.157.2.224] (account tonyb HELO [192.168.200.1]) by cybernetics.com (CommuniGate Pro SMTP 5.1.14) with ESMTPSA id 8273856; Tue, 10 Jul 2018 12:52:24 -0400 To: FUJITA Tomonori , Jens Axboe , Christoph Hellwig , linux-scsi , linux-block@vger.kernel.org Cc: Hannes Reinecke , Johannes Thumshirn From: Tony Battersby Subject: [PATCH] bsg: fix bogus EINVAL on non-data commands Message-ID: <7730dcb2-7e69-3fc5-7eeb-4bbcf5091f14@cybernetics.com> X-ASG-Orig-Subj: [PATCH] bsg: fix bogus EINVAL on non-data commands Date: Tue, 10 Jul 2018 12:52:24 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 Content-Language: en-US X-Barracuda-Connect: UNKNOWN[10.157.1.126] X-Barracuda-Start-Time: 1531241544 X-Barracuda-Encrypted: DES-CBC3-SHA X-Barracuda-URL: https://10.157.1.122:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 729 X-Virus-Scanned: by bsmtpd at cybernetics.com X-Barracuda-BRTS-Status: 1 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix a regression introduced in Linux kernel 4.17 where sending a SCSI command that does not transfer data (such as TEST UNIT READY) via /dev/bsg/* results in EINVAL. Fixes: 17cb960f29c2 ("bsg: split handling of SCSI CDBs vs transport requeues") Cc: # 4.17+ Signed-off-by: Tony Battersby Reviewed-by: Christoph Hellwig diff --git a/block/bsg.c b/block/bsg.c index 66602c4..b16ab6f 100644 --- a/block/bsg.c +++ b/block/bsg.c @@ -268,7 +268,7 @@ bsg_map_hdr(struct request_queue *q, str ret = blk_rq_map_user(q, rq, NULL, uptr64(hdr->din_xferp), hdr->din_xfer_len, GFP_KERNEL); } else { - ret = blk_rq_map_user(q, rq, NULL, NULL, 0, GFP_KERNEL); + ret = 0; } if (ret)