From patchwork Wed May 10 20:37:36 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: 9720647 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 16F336035D for ; Wed, 10 May 2017 20:38:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E5872862A for ; Wed, 10 May 2017 20:38:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 231352862B; Wed, 10 May 2017 20:38:07 +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 01DC928646 for ; Wed, 10 May 2017 20:38:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751208AbdEJUiF (ORCPT ); Wed, 10 May 2017 16:38:05 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:21247 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753586AbdEJUhz (ORCPT ); Wed, 10 May 2017 16:37:55 -0400 X-IronPort-AV: E=Sophos;i="5.38,320,1491235200"; d="scan'208";a="16703581" Received: from mail-by2nam01lp0181.outbound.protection.outlook.com (HELO NAM01-BY2-obe.outbound.protection.outlook.com) ([216.32.181.181]) by ob1.hgst.iphmx.com with ESMTP; 11 May 2017 04:37:47 +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=eQ9gr3+7LajiY1eXUtrhup0ksQcE0TXBHHr4L9gii9M=; b=AQfrNzIhbQohJhheM7jyrbSRqQSWaF4JMCKEbj1eTdCazUFqxZIpIcoiT6+IZFkCbu6PB8U5q+I1bjTh3EcvXg51XAt/Jm/zDnb5AN1WtTJQutaWqLq6VH3bFL/XERcjn4FzkqqOyxAFhFM9n1q/TNPHmrzbObYt56NEVRunnK4= Received: from CO2PR04CA012.namprd04.prod.outlook.com (10.141.240.140) by CY1PR0401MB1212.namprd04.prod.outlook.com (10.160.166.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1084.16; Wed, 10 May 2017 20:37:46 +0000 Received: from SN1NAM04FT061.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4c::203) by CO2PR04CA012.outlook.office365.com (2a01:111:e400:1428::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1084.16 via Frontend Transport; Wed, 10 May 2017 20:37:45 +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 SN1NAM04FT061.mail.protection.outlook.com (10.152.89.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1047.9 via Frontend Transport; Wed, 10 May 2017 20:37:44 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com (Unknown_Domain [10.201.67.162]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id D4.18.29323.71A73195; Wed, 10 May 2017 13:37:43 -0700 (PDT) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Wed, 10 May 2017 13:37:40 -0700 X-AuditID: 0ac94369-548749800000728b-28-59137a17534b Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 2F.3F.18148.31A73195; Wed, 10 May 2017 13:37:39 -0700 (PDT) From: Bart Van Assche To: Nicholas Bellinger CC: , Bart Van Assche , Christoph Hellwig , Hannes Reinecke , David Disseldorp Subject: [PATCH v2 6/6] target: Fix overflow/underflow handling of commands with a Data-Out buffer Date: Wed, 10 May 2017 13:37:36 -0700 Message-ID: <20170510203736.12462-7-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170510203736.12462-1-bart.vanassche@sandisk.com> References: <20170510203736.12462-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPLMWRmVeSWpSXmKPExsXCddJ5ka54lXCkwdWfohZf/09nsVjwZi+b xcrVR5ks2lafYbRoXfqWyYHV4/72I0weu282sHms33KVxWPz6WqPz5vkAlijuGxSUnMyy1KL 9O0SuDI+nW1iKnjBV3Fhfxd7A+Nkni5GTg4JAROJpgML2boYuTiEBJYySSy+9IgFwtnBKDH7 zxJ2mKoJ07uYIBKbGSU2XDrPCJJgEzCS+PZ+JguILSKgIzHr7gt2kCJmge2MEm8/d4ElhAWS JFrvfwOyOThYBFQlPl7IAgnzCthLvDm+jwVigbzE2S07mUFsTgEHiatzVoAtFgKqudH1ghGi ZhqrRNdhRoheQYmTM5+A9TILSEgcfPGCGaJeXeLkkvlMExiFZiEpm4WkbAEj0ypGsdzMnOLc 9NQCQ1O94sS8lMzibL3k/NxNjJBgz9zBePeJ9yFGAQ5GJR5eBS7hSCHWxLLiytxDjBIczEoi vEkZQCHelMTKqtSi/Pii0pzU4kOM0hwsSuK852SmRggJpCeWpGanphakFsFkmTg4pRoYQ7Ik zP5xndr0UldLjpWp8KLQfBmxhCsem9+rxyWV9EWxJlrOM2QrsNmkvM2/a94u1dpcXoHSKxmH nGefd43zYFhgMXmPx2uWKxYOW7ZYl7v8O/VAIifK6/Xr18X23i39cdMy9K/6zFWdLJRy9JLq W4aIHxpRAeV8qW5eHg/jRazX86cbaSmxFGckGmoxFxUnAgCKrgRIcgIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrPJMWRmVeSWpSXmKPExsXCtZEjRVe4SjjSYO9TfYuDP9sYLb7+n85i seDNXjaLlauPMlm0rT7DaNG69C2TA5vH/e1HmDx232xg85i25jyTx/otV1k8Np+u9vi8SS6A LYrLJiU1J7MstUjfLoEr49PZJqaCF3wVF/Z3sTcwTubpYuTkkBAwkZgwvYupi5GLQ0hgI6PE u5ZJbCAJNgEjiW/vZ7KA2CICOhKz7r5gByliFtjJKLH+7xlWkISwQJJE6/1vQEUcHCwCqhIf L2SBhHkF7CWudRxjhFggL3F2y05mEJtTwEHi6pwV7CC2EFDNja4XjBMYuRcwMqxiFMvNzCnO Tc8sMDTSK07MS8ksztZLzs/dxAgOEs6oHYzXJ5ofYmTi4JRqYEztn1QXYmzhct63rkt2cl2F V8TlECfhIp2k3gVW/cr/tWr8/5pt/VQd51AWF1TywOan46WdpZNf6pTyrzl2T6kgIuSlw1tD 1n6ZuKrOiqfJ+6xmrZjTWbd+s/ip0lPa8yy+OJRWhtjckbogn+5bKVPnqL9IhjWk1yXg7KU1 RVZvppQeLhdUYinOSDTUYi4qTgQAOcPR6sIBAAA= 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)(39400400002)(39860400002)(39410400002)(39840400002)(2980300002)(438002)(199003)(189002)(9170700003)(356003)(77096006)(5003940100001)(76176999)(50986999)(53936002)(5660300001)(305945005)(4326008)(54906002)(8936002)(50226002)(81166006)(8676002)(2906002)(38730400002)(2950100002)(6916009)(33646002)(189998001)(110136004)(50466002)(478600001)(48376002)(1076002)(86362001)(6666003)(106466001)(36756003)(72206003); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0401MB1212; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SN1NAM04FT061; 1:0aJ4s1vUIit2zYA1D0URIW1Eh2Up5P2vZv0Y3pDrjF1ocmeTOSyLl8iT/Xkgd/ACH+IbcmIRSjVwdMUYlPsoPgIKUxlrZFVeV0R6F6f2dDuyeEmDJYRHgI7ueqq5ak+nD4t/j1IIinNW8xbSqlIkvpBK+LEvVMWUmyP7jSf8gPC2L8Vlz3GsNBHCXoBwyzIv6pkRhvofWanbchegbwL47YXkW0JFuxV8wVqdVlY48t9DRBjySknkg4dUPx3FVWHvyA1QLZw8MkYNBf7Y19PCyv/pNAzf0ILUuayBf5354fvQXeIia2HhjATalyORuxY+njERKGy7Cj/cbueuqPt9hwCulR3dPVNwBVLQtEpAQxgjlIn3t8K343p2wCOSSSIXQzwL8xJrKYcyJ3AZv6PvzPOCulg3pG7e228VI5znk8Vg1D6edBw3lUixuSOruXNKbjd2V4BXw5Qwp0EwRJ8XtGWvMCtjd/nSRFo5LreR292Pfmm4u/55cw6XvLv96IGR X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 754df838-093b-419f-e612-08d497e469e1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081); SRVR:CY1PR0401MB1212; X-Microsoft-Exchange-Diagnost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O6OrJLmwlj6gX8xuPPNJd8Gd+oHWR2sRHfZFHkbb/DD3/tQ1mk5Rb3CI5eO+JYUjNZKy3D4aXT6zbXy337KYleXY5g+hU44bWmTfZpMcCVgge2Ded+Q52ETgDOd081VgOYT2ZK2P4USioSqP2x+EVKLodXqlAICeepa4QaWu0Qy9DirsyEm+tfoNPIouULWYBsN298yuwuxqxwcnIm3Hm0qzniL6IETmOGwlqwzTxGQEwmhct67OASDOPOLNlUu4O4oIZgJwcpepyc5/PA== WDCIPOUTBOUND: EOP-TRUE X-Microsoft-Exchange-Diagnostics: 1; CY1PR0401MB1212; 20:wDpvu8Ht7D7IErVlhkTHE98IySES0DZu+X/pLEz+t9AB+tlHLIq1rnMaCjKrSC7cI+n4j+J5wYLF2d/RkzlMoxIBVEl3Uk8RzejaBCtFboI/4iEcor5DF2wgq7sjEhEje/QGTfIuBykj8dMJwt+4kA0J3ckciGQdVekww3gWjosOfQw5Ve+Uh3FYH1q4B82SejOmBl86R89xHe4fjGcWO2ZX0j22j+9qr9Rqi7yGu7Rr+lf35zSa6IAv3dG+U4Fm8ElZLF4FKKS4G+UcLDERexo+4mZkyd2wVHDGwMV41AGhD1wepUGy1yUF1wNEVA/5ksmdMWKFnkhgcuAa/6KWReu7fj/VkEi3zgucZVm+3rkRUgYp3uhB/RNFxIdatSs6VRkwIlDBnQWmaqCIpr4NkqmPa9qi3qYIjYEP16GsLuj8gDRfo+80rpi+GtebCgdb3kvRuIxEYyMtmQSqER3RIsoCHoM6u/nwO6qiHT2x8IAW/P/yh7nsq3ErNxdNgZ5S 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)(5005006)(13016025)(8121501046)(13018025)(10201501046)(93006095)(93004095)(3002001)(6055026)(6041248)(20161123560025)(20161123558100)(20161123564025)(20161123555025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148); SRVR:CY1PR0401MB1212; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0401MB1212; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0401MB1212; 4:u2uRPgfYU9X3n+33FVHaUuI/zdhm/H4c575e+54HNRPV2YOGrhe6CiekS/pkU3+Pj4W/tdhWKjqfivPgBWMuLQq4EgqXOtuQKhIS2JtNAT0jFH1IRFDJIUpeTsW6wC8yAV2s1tf0Q1wMFfMCQlcq3984CXIYiJBGIlzucFQy1VU1RgzIyZy60N7DAKiq5I/nLO/Wjexr5MfjPbMs/neBr0BZ7ykcwABpXVxrsiF6mwz6IMAe4dHw8bWfl0pYe2/IYAmlTUTv/JzxtOQL0Fuj7/maQfTvG3kNfELC3r1gZCc4ZyaCmkz5KSc513o+/XE4eb/yeHIfFkdv5MPvCJFJ6EN22VvRZP4tLNDIrfNVVIujwZGEjqTiUfMw1/Vou9devNOb+StyxEqlhOjwHSU0qNYb1JUzbJdq1NHOOQldT+3isJJ/DHcNOMHoPLLeGAv1fXM2VlCpvKiLfP3OA+seuiidJwBIEuLB+8NfBc+KbjfPXdRy45G9P/nULoKj9uJSHuCboQGu8Ay2ofcb8mZmIwtlobn8yz3+f3xVngH4QJqKWkhakFYYYL5q+4IQKz++i+fdPuSm6lKqLF6ZMH2LjLW7aunS3oB0AWz6WWcE8gnEnos19/GJMvjiYzvpQhMKX3vw2vFbwYJloO9mbEz0OvEUo6EG64MTHcqDmIe8YzDlTjC5rxM78bUDTDS+Vs5QtMH2kUjO6ONI6SjYAdc/ZJ3jOYFb6Kf5kEBGiqNEQ8MQtb/Raen5ybKSIsWSiD0vZhFGhn/wP8fr7rlvkppmfDvCpym0NpQAyBiInh/cwWruxokYEz20H9jbELhMFCYPGzDUKmBEhmDZox3hcP6/fJF1W11/SnLXfzJCbVD2HbrmYauLPFlyPsJWduBCqpL1 X-Forefront-PRVS: 03030B9493 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0401MB1212; 23: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Output: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR0401MB1212; 7:5Cks2zzC0/iy+L8+h07LWKEr0GGEIda3qEoOqyaisn0uIQ9YZ00pYj/V4d/eXagUA6k+mTzkWWGs3M57D+rHZv1ZgJbukILzIG3nltPmf9bcpDvwtgSWiOO1ORGihcjJlk8ymVJJ8JAEYRQLOdylSFRsu+iGg8IL3yMWoTD5PM1OZNFP6apZIR1b7HpQ9qSHRJTtHDKdXgdwVXPRDICx5Jf/drzKP4dXbB5n5uDSb/P6R12fH1CEO7pMg5lvFwkrPRGxzjE1SMrB1ITz9DVKpI73p69JC9F7VY/BYsmZPN4V6vhYauQIH9tbyzIiP94NKcIb2I6k7fqoAzOBLNw35A==; 20:44x0nDllRQAB39KL7DatQCAI7xr7QhlBQiim8rdf3QnxAWZ5GOaSHmyMHkt4QqIpJTrp6/j8VrQz9K2Jh1wpLmaOCp75xxyk136ZcLk4vgP3GkhA25K54eb/oIbjlBVcSAWBVq1tbueDZUtnPW5mrdaMuHxjxCdjfk1646snCS8= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2017 20:37:44.6144 (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: CY1PR0401MB1212 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 37f57357d4a0..b56d7ac1472b 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