From patchwork Wed Jul 11 14:46:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Battersby X-Patchwork-Id: 10520055 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 3332E601D4 for ; Wed, 11 Jul 2018 14:46:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 203B1292C6 for ; Wed, 11 Jul 2018 14:46:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 14507292C9; Wed, 11 Jul 2018 14:46:08 +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 AB652292C6 for ; Wed, 11 Jul 2018 14:46:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732445AbeGKOur (ORCPT ); Wed, 11 Jul 2018 10:50:47 -0400 Received: from mail.cybernetics.com ([173.71.130.66]:35982 "EHLO mail.cybernetics.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726729AbeGKOur (ORCPT ); Wed, 11 Jul 2018 10:50:47 -0400 X-ASG-Debug-ID: 1531320363-0fb3b01fb32af380001-ziuLRu Received: from cybernetics.com ([10.157.1.126]) by mail.cybernetics.com with ESMTP id Pv54EidSK1Ye9k9f (version=SSLv3 cipher=DES-CBC3-SHA bits=112 verify=NO); Wed, 11 Jul 2018 10:46:03 -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 8275527; Wed, 11 Jul 2018 10:46:03 -0400 Subject: [PATCH v2] bsg: fix bogus EINVAL on non-data commands To: Christoph Hellwig , FUJITA Tomonori , Jens Axboe , linux-scsi , linux-block@vger.kernel.org X-ASG-Orig-Subj: [PATCH v2] bsg: fix bogus EINVAL on non-data commands Cc: Hannes Reinecke , Johannes Thumshirn References: <7730dcb2-7e69-3fc5-7eeb-4bbcf5091f14@cybernetics.com> <20180711063716.GA7934@lst.de> From: Tony Battersby Message-ID: <21524c51-7b58-19c2-dd13-eca592824185@cybernetics.com> Date: Wed, 11 Jul 2018 10:46:03 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180711063716.GA7934@lst.de> Content-Language: en-US X-Barracuda-Connect: UNKNOWN[10.157.1.126] X-Barracuda-Start-Time: 1531320363 X-Barracuda-Encrypted: DES-CBC3-SHA X-Barracuda-URL: https://10.157.1.122:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 751 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 diff --git a/block/bsg.c b/block/bsg.c index 66602c4..3da540f 100644 --- a/block/bsg.c +++ b/block/bsg.c @@ -267,8 +267,6 @@ bsg_map_hdr(struct request_queue *q, str } else if (hdr->din_xfer_len) { 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); } if (ret)