Message ID | 20170510203736.12462-2-bart.vanassche@sandisk.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <target-devel-owner@kernel.org> 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 495726035D for <patchwork-target-devel@patchwork.kernel.org>; Wed, 10 May 2017 20:37:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60BA12862A for <patchwork-target-devel@patchwork.kernel.org>; Wed, 10 May 2017 20:37:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5542C28640; Wed, 10 May 2017 20:37:56 +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 6A6A82862A for <patchwork-target-devel@patchwork.kernel.org>; Wed, 10 May 2017 20:37:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753492AbdEJUhw (ORCPT <rfc822;patchwork-target-devel@patchwork.kernel.org>); Wed, 10 May 2017 16:37:52 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:20080 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753479AbdEJUhr (ORCPT <rfc822;target-devel@vger.kernel.org>); Wed, 10 May 2017 16:37:47 -0400 X-IronPort-AV: E=Sophos;i="5.38,320,1491235200"; d="scan'208";a="119286187" Received: from mail-by2nam01lp0182.outbound.protection.outlook.com (HELO NAM01-BY2-obe.outbound.protection.outlook.com) ([216.32.181.182]) by ob1.hgst.iphmx.com with ESMTP; 11 May 2017 04:37:46 +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=i+amCbC0A46RlcgB5We3nnGZXo5O//UgdJUuOEUPam4=; b=cCos0AMT1JzU7bcSSky0f8gWsdVGo0EpL9RRxFKfcinpbwszLgSx5DJ7DVArLfFAAziLDZ7EFLJ/ViNEYwLHW3s4hZ89nns2D2FYXaQ2nzs63Fut6t6rQ0OYAF4RT841qe+ysiLmcndBlBNs9WqSULlcd+ZRy8GVzUHl5Tfp0PY= Received: from CY4PR04CA0032.namprd04.prod.outlook.com (10.172.133.18) by BY1PR0401MB1207.namprd04.prod.outlook.com (10.160.195.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1075.11; Wed, 10 May 2017 20:37:44 +0000 Received: from SN1NAM04FT034.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4c::208) by CY4PR04CA0032.outlook.office365.com (2603:10b6:903:c6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1075.11 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; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.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 SN1NAM04FT034.mail.protection.outlook.com (10.152.88.156) 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:43 +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 44.18.29323.61A73195; Wed, 10 May 2017 13:37:42 -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-26-59137a16f24d Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 0D.3F.18148.31A73195; Wed, 10 May 2017 13:37:39 -0700 (PDT) From: Bart Van Assche <bart.vanassche@sandisk.com> To: Nicholas Bellinger <nab@linux-iscsi.org> CC: <target-devel@vger.kernel.org>, Bart Van Assche <bart.vanassche@sandisk.com>, Christoph Hellwig <hch@lst.de>, Hannes Reinecke <hare@suse.com>, David Disseldorp <ddiss@suse.de>, <stable@vger.kernel.org> Subject: [PATCH v2 1/6] target/iscsi: Avoid overflowing the receive buffer Date: Wed, 10 May 2017 13:37:31 -0700 Message-ID: <20170510203736.12462-2-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+NgFnrGLMWRmVeSWpSXmKPExsXCddJ5ka5YlXCkQcsSS4uv/6ezWCx4s5fN YuXqo0wWbavPMFos2PiI0aJ16VsmBzaP+9uPMHnsvtnA5rF+y1UWj82nqz0+b5ILYI3isklJ zcksSy3St0vgyph8/iBrwUXhituz5rM0MHYJdDFyckgImEhsW3iFsYuRi0NIYCmTxLTNr9gg nB2MErP/LGGHqXozaxITRGI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+9rmdFtzcyU9mealF7tu48OdKo18m12OTOb5V2bWWPZuosKdfYeUsI+4djrOnPteZ yqTppeW50de77wGTEktxRqKhFnNRcSIA5AVop8gBAAA= MIME-Version: 1.0 Content-Type: text/plain 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)(979002)(6009001)(39850400002)(39400400002)(39410400002)(39840400002)(39450400003)(2980300002)(438002)(199003)(189002)(9170700003)(189998001)(4326008)(110136004)(47776003)(38730400002)(478600001)(53936002)(54906002)(6916009)(77096006)(36756003)(2950100002)(76176999)(48376002)(8936002)(33646002)(50466002)(6666003)(1076002)(5660300001)(305945005)(5003940100001)(356003)(2906002)(86362001)(106466001)(72206003)(81166006)(575784001)(50226002)(50986999)(8676002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:BY1PR0401MB1207; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; MLV:ovrnspm; A:1; MX:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SN1NAM04FT034; 1:eZH/sCgiqehVKMvIo8Ji4ALDudXZNXxNbXLCr0H4WGzaWZBhCnPisbEt36jgWtaUPQ6s36jTszMWNY5dtHYvnFvfSUGBTlDSTlnDUvnoyHf4qmlEh7ucJbtRE5KtkFxkIvNWwwjjNk1JxBVvvj7JiFVzSGwReQ9oTYxe4P9Y7w7sPHEBC1acnl7TMzeHfJeHj+gNnGLKVLH454oPFiVWmYx7UXyRt29ZgdW0PiqI/SY+uscURA8uTDHIrRJbGBLtTHnH5ry5lWPpxMphixZxVQji+U+rsgG7hUcXvAkTrkN3AB7xpdCtlW+A3mtWO/dnAhL8UsNT4yV0vz1Yamj2Z07dOQl+Mw86bM1oosXOHFgpOdoZaaR2z765/+lLGYTKh3CYQ/N4wKpvXqnDVXtqHMv81NqdZItjeJP++wVviLqeINPxS+WCV9URjxeHPAwMcq+H8hk7rh4GJNcfpIvPmGkT5qKJuBa/9gZr3SLqFfS9SiSuUOZ5G5ZSCW+9aQcbSu0uZuthzNfyJZSyYCT+jiXl8iABPrASzHJ1reyclgQ= X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 17a25286-773f-439b-d382-08d497e4697f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081); SRVR:BY1PR0401MB1207; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0401MB1207; 3:WmSjvWK3e23LwVjtpXaVud6o3ZZa1trWiPhIQbM8AnYDrsSnUtAWy1jxoWdxpMat3YTcvMqBvc6eV9RVzl9IFr5BPByOvKa0/43lg1vjGJgk+siP2Vm7Vk9wJ6XykUsrLz9qNfNnQmIekCzj38V2Vx6nOWIr4D105+dLDehP7OBqIr/LESsLZyJQFtOEWyMDeasTqZyMoC4iRsS6VgUd4m3GI/+mNbJGAoJjQh66Fux1avaCImp4Hnz/ufERqOIRARneQuDAzf1n6hf+CBzWaJLyE/ZyzDmPrPohX3nJXBWi8p3qgqBu+P2WxpoqCKssxUsIsKYr1z1jcgxveP+VT6Yvgg1emFKD/wknWIMwdhFRXgaIX0THg5Huh0fB4YnuBgqpB2fUBpxWq/OguxMc3ngG+2KstcD71Af5GRU5PeqMjBFJCMrjxkGdqnuBXqyta1VbxDcTSISZN5/Dyys7oFxTK0lcD5zPrmassBRjgtKJV5YPerP142RWvbjFulrx X-Microsoft-Exchange-Diagnostics: 1; BY1PR0401MB1207; 25:tlRh3gDl52PFnExUi7r+DbXFZwMoalG+Hm1QUySmLyKvkrtwdF9SjmaNWIajpoSS4taWclxJJOZ08ak6hqfVGB/EOEa868tbwWYveWbeUBaKCsgeFKQze6GD/yTSCz+G62CiRudRLNWBKWfAoCj75Kqq2fdIUYk0Kz19/RLjiozuqgBzm4XkyoJQTab14ltdfr7RuQ1vHA68gWK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Hp46rHrhWCx3xxb3zucLrvmfFBbACFySu8l1fa9bou8GKrtUFcEgCR4COGPbFmHfTT3ZcZ0940cT2NvweN5ZCbdgfX063yG4j50 X-Microsoft-Antispam-PRVS: <BY1PR0401MB120762EDD87DD7AB22BDAE9C81EC0@BY1PR0401MB1207.namprd04.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(9452136761055)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(13016025)(13018025)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93004095)(6055026)(6041248)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123560025)(20161123555025)(6072148); SRVR:BY1PR0401MB1207; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0401MB1207; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0401MB1207; 4:1/4p6DRLuCAKsGtak0pYcVNTXVXcda65viFRyWaoMX3krjw7ta/ge2yKCS4YBDS9Ftc//XULsqNcsQx9R4qDrYE3T5AML2ZKFZT1/3waSyG/YUdR3F4LwS0vMqPxH3/nwVKSdSvGhdPdPbpBY2WVcKcS7pEswy6XtfEEkyokxKuCO9d6CqwMzLTaSfhyrTNF7Py6BKrT/16uk3BdBloMVMZuF/B1JAe66eSZnjA6DvYyP3lmSr0xI9q5ul1jFPYsDgwV0GKJlg34vYYEJKR6ivMoaz3qp6RXiWMbMzldih8D59DXleZTNH9/l3OeG/H4MUoCvk27K+wmUUv6Z+OAY3iJzt9FqePhsXbsavpBSZMZllZzhv7mDPkhjWruotTlKjLPrs0nCeTDookco4JSG8CPKp3p21bPeoo3WaO7Fp8YXQ5IUFWG240JwPaZYkaQY6RJrsbmplnwgy+BipPC3DXl9NIqz71D5oMoJkWtvxiUJpPfw4uaUJIvsECq+LJksihKPPTVoSH2NRh1NB96cekziCy3X9gAcGOj7acXGd6xEicLv6/nt/2dyf5lOgvXOWj+iueEBkI4R0lXjGjGfbs8msD4eOIV0n8yERXgKNTgBgarqOL08iWd04Wiz4oPrBnHoLKfumadrrnrgQ9kN37NOWAM32BsEjkOU1spVJiw/IAKan5YMbBpXwW8fO8pbHTl30sbx0JdOEWxRAqIXyOnxrf+n/1VxeJK6WEMy3w6agmVQHnkWY76Jmmdb9FY/VPbosv47knPDPbcMC8IwjgqysnanktZQkDb9vDb2JS3WrYZcIkGDEY6afYB0CToVzId+ATxfO95MG+rKjh9BA396hsWr09EQFHZS5AhUYv6G//S2HMcPbS75HZmlHQ2UUhN8JWpvTRCYaa4HGy0Z2GhgmdwS8jWpIoRgV8t QLs= X-Forefront-PRVS: 03030B9493 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0401MB1207; 23:r1NmydjP1amlu+MXcnnmQiMoL1QUjWQDV/osAFc?= =?us-ascii?Q?dHgt+71vDspqkKkBgm1omhDyHdR0cijRNsMOV/GL+bgj0HuhkSExTp25nUHo?= =?us-ascii?Q?pa7d7Gutk3ubqikmq/LkroYgcRDQjxgPQq0LlpiIPKQ4Lpi04i7hviT50AIq?= =?us-ascii?Q?cOnmEIKHkhXYu1r+vFFM5OK+g8vfhuSKeWsQebjjYTnr++LZ4IMVy0ddRJ2J?= =?us-ascii?Q?8TS/AyAGXYw9fI5HsOf7f/jZ/y+JCm5Qum7BThL5yb31GvQnT2b9j0O/YVJP?= =?us-ascii?Q?gjw+OBhCWiPySvTmTIMAJfRE0j/l59M0HiiedZqA3Gh/rvtC9LbrSk7AnCZ+?= =?us-ascii?Q?A4vkC38fXVmEXROqsPu30TZ2zk/ynFc5gstkYWeL689MSlPF5RtFUbaVnNjf?= =?us-ascii?Q?3cLqQIOlo0H/l/ggTw/g6GznTHO8cty/QvCAHyD5GRthlRWF29oJsjVPYcc4?= =?us-ascii?Q?6VaGRkmn8OC85cax2fspuTZjUPY6MrIXpGwqRNmmQBaDwMSax8wPHRzmZmjn?= =?us-ascii?Q?SIxFc1O68dWlqBhEYetv8KPlMcoK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2Txh1vEUBkZMcrlV495IioGwYwuo6R8NcdsUEGdVvVen2jh7V5dkpJlFYd1cxlJ5lkp7trCzjQry84NZGlPqgcytV5LStZTULERiJo9lK+AaVCeIpGGvRTpV7mmvQ= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2017 20:37:43.8936 (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: BY1PR0401MB1207 Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: <target-devel.vger.kernel.org> X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 26a9bcd5ee6a..de872abd0f09 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -1570,9 +1570,11 @@ iscsit_get_dataout(struct iscsi_conn *conn, struct iscsi_cmd *cmd, { struct kvec *iov; u32 checksum, iov_count = 0, padding = 0, rx_got = 0, rx_size = 0; - u32 payload_length = ntoh24(hdr->dlength); + u32 payload_length; int iov_ret, data_crc_failed = 0; + payload_length = min_t(u32, cmd->se_cmd.data_length, + ntoh24(hdr->dlength)); rx_size += payload_length; iov = &cmd->iov_data[0]; @@ -2583,14 +2585,31 @@ static int iscsit_handle_immediate_data( u32 checksum, iov_count = 0, padding = 0; struct iscsi_conn *conn = cmd->conn; struct kvec *iov; + void *dump_buf = NULL; - iov_ret = iscsit_map_iovec(cmd, cmd->iov_data, cmd->write_data_done, length); + rx_size = min(cmd->se_cmd.data_length - cmd->write_data_done, length); + iov_ret = iscsit_map_iovec(cmd, cmd->iov_data, cmd->write_data_done, + rx_size); if (iov_ret < 0) return IMMEDIATE_DATA_CANNOT_RECOVER; - rx_size = length; iov_count = iov_ret; iov = &cmd->iov_data[0]; + if (rx_size < length) { + /* + * Special case: length of immediate data exceeds the data + * buffer size derived from the CDB (overflow). + */ + dump_buf = kmalloc(length - rx_size, GFP_KERNEL); + if (!dump_buf) { + iscsit_unmap_iovec(cmd); + return IMMEDIATE_DATA_CANNOT_RECOVER; + } + iov[iov_count].iov_base = dump_buf; + iov[iov_count].iov_len = length - rx_size; + iov_count++; + rx_size = length; + } padding = ((-length) & 3); if (padding != 0) { @@ -2607,6 +2626,7 @@ static int iscsit_handle_immediate_data( rx_got = rx_data(conn, &cmd->iov_data[0], iov_count, rx_size); + kfree(dump_buf); iscsit_unmap_iovec(cmd); if (rx_got != rx_size) {
Since target_alloc_sgl() and iscsit_allocate_iovecs() allocate buffer space for se_cmd.data_length bytes, ensure that the iSCSI target driver does not attempt to receive more than that number of bytes. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Hannes Reinecke <hare@suse.com> Cc: David Disseldorp <ddiss@suse.de> Cc: <stable@vger.kernel.org> --- drivers/target/iscsi/iscsi_target.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-)