From patchwork Tue May 23 23:48:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9744479 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 268286037F for ; Tue, 23 May 2017 23:50:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19E8E28818 for ; Tue, 23 May 2017 23:50:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E99128854; Tue, 23 May 2017 23:50:01 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 8135D28818 for ; Tue, 23 May 2017 23:50:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932946AbdEWXt7 (ORCPT ); Tue, 23 May 2017 19:49:59 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:1647 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936642AbdEWXtj (ORCPT ); Tue, 23 May 2017 19:49:39 -0400 X-IronPort-AV: E=Sophos;i="5.38,383,1491235200"; d="scan'208";a="19876966" Received: from mail-co1nam03lp0024.outbound.protection.outlook.com (HELO NAM03-CO1-obe.outbound.protection.outlook.com) ([216.32.181.24]) by ob1.hgst.iphmx.com with ESMTP; 24 May 2017 07:49:11 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=J9Ao17cmunyk+Ql8fobxPML+y1B0dWURu6HPbUNrivs=; b=tSGiRQfXnD3ZyEe75U/zwkLqAJ76NQOqMXw/kB5A7ufZdq4V/Nyj73hextZS9vK9mjhdWbYSOSqxYWjBsMaKgMILsM8BlmjFB71tbVVyc+gAePU0bJEk1NNvi+z/Lx21qGVvtc8KlqQ249wVP/tCXz5ljeYM+Afqv6yEqZY8uyU= Received: from CY4PR04CA0037.namprd04.prod.outlook.com (10.172.133.23) by MWHPR04MB0512.namprd04.prod.outlook.com (10.173.49.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1101.14; Tue, 23 May 2017 23:49:08 +0000 Received: from BN3NAM04FT032.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4e::202) by CY4PR04CA0037.outlook.office365.com (2603:10b6:903:c6::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1101.14 via Frontend Transport; Tue, 23 May 2017 23:49:08 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; linux-iscsi.org; dkim=none (message not signed) header.d=none;linux-iscsi.org; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.21 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.21; helo=milsmgep15.sandisk.com; Received: from milsmgep15.sandisk.com (63.163.107.21) by BN3NAM04FT032.mail.protection.outlook.com (10.152.92.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1075.5 via Frontend Transport; Tue, 23 May 2017 23:49:07 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com (Unknown_Domain [10.201.67.162]) by (Symantec Messaging Gateway) with SMTP id EE.D1.45291.17AC4295; Tue, 23 May 2017 16:49:05 -0700 (PDT) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.319.2; Tue, 23 May 2017 16:48:59 -0700 X-AuditID: 0ac94369-166ac9800001b0eb-13-5924ca717ddc Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 54.03.18148.A6AC4295; Tue, 23 May 2017 16:48:59 -0700 (PDT) From: Bart Van Assche To: Nicholas Bellinger CC: , Bart Van Assche , Christoph Hellwig , Hannes Reinecke , David Disseldorp Subject: [PATCH 30/33] target: Fix overflow/underflow handling of commands with a Data-Out buffer Date: Tue, 23 May 2017 16:48:51 -0700 Message-ID: <20170523234854.21452-31-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170523234854.21452-1-bart.vanassche@sandisk.com> References: <20170523234854.21452-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrALMWRmVeSWpSXmKPExsXCddJ5kW7hKZVIg1k3BSy+/p/OYrHgzV42 i5WrjzJZtK0+w2jRuvQtkwOrx/3tR5g8dt9sYPNYv+Uqi8fm09UenzfJBbBGcdmkpOZklqUW 6dslcGVcX3OQpeAFX8X9I33MDYyTeboYOTkkBEwkrj/vZexi5OIQEjjAKPFmySl2CGcHo8TM 1ROZYKp+b+hhgUhsZJS4tGMjC0iCTcBI4tv7mWC2iICOxKy7L8C6mQW2M0q8/dwFlhAWSJS4 /vkiM4jNIqAq8fLOH0YQm1fAQWLWvuksEBvkJc5u2QlWwwkUX7lnG5DNAbTNXuLyd2WQmRIC k1glNm5ayAzRKyhxcuYTsF5mAQmJgy9egMWFBNQlTi6ZzzSBUWgWkrJZSMoWMDKtYhTLzcwp zk1PLTA01StOzEvJLM7WS87P3cQICffMHYx3n3gfYhTgYFTi4U1wUIkUYk0sK67MPcQowcGs JMK7fANQiDclsbIqtSg/vqg0J7X4EKM0B4uSOO85makRQgLpiSWp2ampBalFMFkmDk6pBkbZ OS+Ld786ML+SpZyl2WzW/58dvxtTX9ksL92cWW5a63nIstHimp7zksPZDQt/axU2amUevHFS 5+xHcUHlg68Sr65IzTZe/0tpgYvXDIHkHdzGuk8Zdd+qL/rHv1U2T/J5dHH13BeXYu1m83Mc PawW2flyxoI981aJq30Py2BZHtEfcbXmxxslluKMREMt5qLiRAA0Dh6VcwIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrHJMWRmVeSWpSXmKPExsXCtZGTTTf7lEqkwaEqi4M/2xgtvv6fzmKx 4M1eNouVq48yWbStPsNo0br0LZMDm8f97UeYPHbfbGDzmLbmPJPH+i1XWTw2n672+LxJLoAt issmJTUnsyy1SN8ugSvj+pqDLAUv+CruH+ljbmCczNPFyMkhIWAi8XtDD0sXIxeHkMB6Rom3 +xrZQBJsAkYS397PZAGxRQR0JGbdfcEOUsQssJNRYv3fM6wgCWGBRInrny8yg9gsAqoSL+/8 YQSxeQUcJF7828UMsUFe4uyWnWA2J1B85Z5tQDYH0DZ7icvflScwci9gZFjFKJabmVOcm55Z YGikV5yYl5JZnK2XnJ+7iRESIlE7GK9PND/EyMTBKdXAuOfMLvsv/gaqeRe+s0Wnbz+Z2PeB q0wgOy32dMYfQfsKHQPWO7FMrhZtFTHPV90yMDKIzvQumJTJ86vmlev8hcIvp/Utkuz23uZ2 veGLl/a3Cw0ie2PN+y788fGf0SBb/7zk2vT73Vd0rOX/lbM+Velxb2J7MFXt+vz41Kq9BY/z IgKC9kxTYinOSDTUYi4qTgQAXwBOIsEBAAA= MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(39850400002)(39410400002)(39400400002)(39860400002)(39450400003)(39840400002)(2980300002)(438002)(199003)(189002)(9170700003)(356003)(36756003)(50986999)(38730400002)(76176999)(110136004)(106466001)(77096006)(50226002)(86362001)(6916009)(8676002)(54906002)(2950100002)(81166006)(5003940100001)(53936002)(6666003)(72206003)(2906002)(5660300001)(305945005)(8936002)(1076002)(33646002)(189998001)(47776003)(4326008)(48376002)(478600001)(50466002); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0512; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN3NAM04FT032; 1:9s10XFfYzJN3WyKC0+S1HbDsOzAxQ3tj11aMwgTVaVg4ZQJUafTfCoEymgyug+sE497iTAS4JA1lcNXpxyLHSM3HghpAQqgEiJLbZIhzxNH8bhJDL52SbjwEJhKMQ9gQJZTCZ8lE/Tzw78Xk5usWALWNzlu4g3gObfJnXuZ6Ee5cqkxDBobpfkEwicNlW9ybdCavdQtWfUNHLQlhz+bBpjfovtpgGG0r8amaHmZ495lzze3/XSKufx6v28MeO2Amq4hEuwHKFgOGDrwdffjLMzVKryg67qgPk/2qPQH8vFYKzE6HxPrliK0Ao83nWLF1UFk7BAo74EAtYpTv9zcEGnQ6K4GAdMZV/b845boGQ11CmmnF679Wk0H+vYWt7PsTPxUWNlic9UxmRI6RJJjWsir/ay89JCpHBraRUCzLh1u3efbr57BQW3QFw7b+7Mlx8uRhzdEGygUoASHl1g1RIMknEahEdrkB06LJmJgMUB74+RK7e78+OQSLFi9Dvels X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR04MB0512: X-MS-Office365-Filtering-Correlation-Id: 3b2dee27-ecca-45ad-70f7-08d4a2364db2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081); SRVR:MWHPR04MB0512; X-Microsoft-Exchange-Diagnostics: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Rizh8FLMOg/qryYPuwYc1bxRwWGub5syt2YUW6USgrjL8W46g8cZuJSNgz4u2qKxpiXW6SfV8p7JWHP55xYZ20djGhWvnvllO9oGa1tIOx4YFy8pTHls3rCwbhxbF310PAdXyJ/kcUfrJtw0INqS94vWWY4/oMcMGbBu1VW965liKjJkVPt8l2P52ZFQ1bCsv/2oxR3A3ZfZB7Oj9KnzQPXbU8xxnjX6mOgnHX8oIzqCpQ76NXuqeTC4cUkSw2IbwyULGrb4+aSxYIg== WDCIPOUTBOUND: EOP-TRUE X-Microsoft-Exchange-Diagnostics: 1; MWHPR04MB0512; 20:dtKwWL8ijToqm/kF60s0cVDf2WRJHdUOg35TQKfB+ULhoxTTZHE31dheLb0EQYZORexCGkARC6ooAWUe2TcT9k3XVAnW6NsAYAHXfBiSgIu7bMULjUlLapJyH+Wvv4x7Sm8gw5j3SJBhA1i43VoYNu1+ebDtdOd+rvhrPKcUEp7kqj9E0UsDeIv+OdNGqL12z3hpfmX8M5tXiA6/J5pa6IP8NdgMH62n4GsgFQgO93fU+4AAkaVjnZQcubb+y17RUWPg3tyZ6OEtow1/hg6sEJZdpm9Iisy/ISKeZs2V9w04NyhndIyV8kfxAtZvzdgr/YktmltTbhjYhld24tkyWVCYD+kf14eGA4dyyR6APZd3DTU23tm9dGAE6uC8FkclUvLzZKvj9FSAnt7zxmi461eiuI/DNJk/BGf8ZQeTSA9uc26gv5NFkoru8+iqcZmlELWP5KTIhgsKl9nrfOsZxTXFcUeRHBbUnv5oSrjGTF/0YYeJdqP2TvQ4j146zLOy X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(13018025)(13016025)(5005006)(93006095)(93004095)(10201501046)(3002001)(6055026)(6041248)(20161123555025)(20161123558100)(20161123564025)(20161123562025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148); SRVR:MWHPR04MB0512; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0512; X-Microsoft-Exchange-Diagnostics: 1; MWHPR04MB0512; 4:pwLd9T4W53oBV90WXjSVx52vLvjM/1hUW0oPJvnZP/oF3blaqgE8oRj4uu9pHyK053eVawbPzfZSQgi1xy4SA1ugIUVaj5VgDWkGRzlyGF/mURqgkAkEG6CgnKFzzyr7H2+mNtx2VVnYUf/K9lY6ATDwVa96y3OE62Y0nd1isUFBHcI4rTdKonMwzOz52lxLpkp5+mVEJXXAV+Dd0fyixBMlyTX/MdpRlJ5mxL+U1lochG+C6UZhrEorzG+qx8PAp/10+0ijMHkglwMGYPXjI59GuXrnOVFUAfNkWn1r291Q0ivHZgQNbCkJc8Q1guZuyba/jKJgWQi0hnUiNAxIo/ntKGOL2E95FF/rdxZpzw2pWQyMuPC48YbNSi+LMsSnMeMyEAZZn0VLtpufjeLhs1IBlJpOo8RLdfaoO1RMjIRZizNfdPgQ1zhZsIIowsBMSszxdCFq9+KLPbFVYw8v5XMxDiv2iMNfQZ5sdgDckIjwH2CSoNz9ab5sjB60ee0tdsZdhfKw+/oKERclfSw2CE3zxtETNwB9GldbgTJaEL+OOgMf00iUlcOPWd86KqBA94dknbmgFNTUfTdWO8kjJBXgA79VqdK3g6ETwUB1fs+y4YCF3dmJo/aTBNlCMkuvXtmCSBZFvrBi87cY1XvrX0AeZnkXZi0+RD2al5IUc+YvlWobIkhzfxbtQ0icF/QOm9/0mQ4GhP4RZFZo/KUv6lp38A+L9PsfJ/EuLYfWJr5Knq2KC8kA8g0s4TSlEibtBe61NVlYPIOu5Kx7wUxC4irEYz7i62tyPFq5Vqj/WxpCt5/zt4PofXT2dC2f1dAIXxZ7XvBmb/0NFy+wuaORRDq71GA9CSfylLXYlIYCkyNMAQDV2ZD+LOqlz4vzQ6BN X-Forefront-PRVS: 0316567485 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR04MB0512; 23:9UbxDEh28IzkG7v37KR8q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j4pkhw4l+ozpQ40ZpHVWz1WN7qVp1qOj+EpohNjVmUZMcFKNSvpoY+wmJkrzpf+0lojZf1RnR1CEncTKz0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR04MB0512; 7:O1btlPyMpPG/mdYIpR+RhpE/Qy1VusWg9pVvt5Udj1Spvuj6lhvMn0CD0NgJqOln4Yfu+XOMYIHGKVBKrMBDA9EjbLqnQE2uhZ7VTUaVqGaDQXWpiMov3UqcSv6T4mNi3QZJl3zHJjM/GNLcfQd6U0/qo+61izCM62V+GGQgqel95ZeNd3pKf/kxcns1uvuB3eM+KOHnO/bTuPffGEEi027f6Pdna/vhv5HoO4gIZni6K6BaWo2oC2zaSx5Q/3sxQjge9Jyk/ITl+DumYSssJjXjkSGnJ+EE7GrpD/yKObv44sJC4xazDfoBDpqaasOVn3elg5iXWkzEeEug6y7A9g==; 20:ayCGNTogoAkyQCTjJ9szzxJd39E8FY0Mk+cR0gNvw9cp7yQN0WeMDeKHb+lHhk22olliMaDjOd1LympI9VpfkoTK8y1bdiD51dcDUqAJkP8nhLqfLcj20EGWYQ/keTTf+4yqU3KyhzazPKTVEeHniEpTRqAEmx+seDNNnWFnHHk= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2017 23:49:07.6399 (UTC) X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=b61c8803-16f3-4c35-9b17-6f65f441df86; Ip=[63.163.107.21]; Helo=[milsmgep15.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0512 Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As required by the SCSI specs, report READ and WRITE commands with a Data-Out buffer that has another size than what is specified in the CDB as overflow or underflow instead of "invalid field in CDB". Although this patch does not change the behavior for regular SCSI initiators, this patch is helpful because it reduces the number of compliance failures reported by the libiscsi test tool. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: David Disseldorp --- drivers/target/target_core_transport.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index c28e3b58150b..6cd49fe578a7 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1164,23 +1164,6 @@ target_cmd_size_check(struct se_cmd *cmd, unsigned int size) " %u does not match SCSI CDB Length: %u for SAM Opcode:" " 0x%02x\n", cmd->se_tfo->get_fabric_name(), cmd->data_length, size, cmd->t_task_cdb[0]); - - if (cmd->data_direction == DMA_TO_DEVICE && - cmd->se_cmd_flags & SCF_SCSI_DATA_CDB) { - pr_err("Rejecting underflow/overflow WRITE data\n"); - return TCM_INVALID_CDB_FIELD; - } - /* - * Reject READ_* or WRITE_* with overflow/underflow for - * type SCF_SCSI_DATA_CDB. - */ - if (dev->dev_attrib.block_size != 512) { - pr_err("Failing OVERFLOW/UNDERFLOW for LBA op" - " CDB on non 512-byte sector setup subsystem" - " plugin: %s\n", dev->transport->name); - /* Returns CHECK_CONDITION + INVALID_CDB_FIELD */ - return TCM_INVALID_CDB_FIELD; - } /* * For the overflow case keep the existing fabric provided * ->data_length. Otherwise for the underflow case, reset