From patchwork Tue May 23 23:48:46 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: 9744459 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 848ED6037F for ; Tue, 23 May 2017 23:49:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 775E828818 for ; Tue, 23 May 2017 23:49:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C48628854; Tue, 23 May 2017 23:49:45 +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 D867328818 for ; Tue, 23 May 2017 23:49:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031385AbdEWXto (ORCPT ); Tue, 23 May 2017 19:49:44 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:17952 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968111AbdEWXt0 (ORCPT ); Tue, 23 May 2017 19:49:26 -0400 X-IronPort-AV: E=Sophos;i="5.38,383,1491235200"; d="scan'208";a="21079234" Received: from mail-sn1nam02lp0017.outbound.protection.outlook.com (HELO NAM02-SN1-obe.outbound.protection.outlook.com) ([216.32.180.17]) by ob1.hgst.iphmx.com with ESMTP; 24 May 2017 07:49:09 +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=yupOEVT8Ytms0r5ykRdAcSCz5/hWMdjW4xPVNThKByU=; b=tQbioel82hENYYUm2oWtU+9CrO+OsSKEkEGPhQ0fqvx90G+0tgmkZOexVnfkhagfvfNBkA7spgzaMU+yJwlvDo8qmMD9gkSqx61g6D3QJS30Qa90LeY8h3K1+x1u2W47ekCagST2Wsw5CEyEvVgZUdAdlxSes2uumHGZYmhqoo4= Received: from BLUPR0401CA0021.namprd04.prod.outlook.com (10.162.114.159) by CY4PR04MB0504.namprd04.prod.outlook.com (10.173.190.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:07 +0000 Received: from CO1NAM04FT016.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4d::201) by BLUPR0401CA0021.outlook.office365.com (2a01:111:e400:525a::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1124.9 via Frontend Transport; Tue, 23 May 2017 23:49:06 +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 CO1NAM04FT016.mail.protection.outlook.com (10.152.90.168) 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:06 +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 EB.D1.45291.07AC4295; Tue, 23 May 2017 16:49:04 -0700 (PDT) Received: from milsmgip12.sandisk.com (10.177.9.6) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Tue, 23 May 2017 16:48:59 -0700 X-AuditID: 0ac94369-166ac9800001b0eb-09-5924ca700d30 Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 02.03.18148.A6AC4295; Tue, 23 May 2017 16:48:58 -0700 (PDT) From: Bart Van Assche To: Nicholas Bellinger CC: , Bart Van Assche , Christoph Hellwig , Hannes Reinecke , David Disseldorp , Subject: [PATCH 25/33] target/iscsi: Avoid overflowing the receive buffer Date: Tue, 23 May 2017 16:48:46 -0700 Message-ID: <20170523234854.21452-26-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+NgFnrKLMWRmVeSWpSXmKPExsXCddJ5kW7BKZVIg2sHZSy+/p/OYrHgzV42 i5WrjzJZtK0+w2ixYOMjRovWpW+ZHNg87m8/wuSx+2YDm8f6LVdZPDafrvb4vEkugDWKyyYl NSezLLVI3y6BK+P6136WgmcyFd9ezWFqYOyV6GLk5JAQMJFY3nSEtYuRi0NIYCmTxNMT15gg nG2MEqverGaEqTow7xhU1UZGic/rXrOBJNgEjCS+vZ/JAmKLCOhIzLr7gh2kiFngIqPEh2en mEASwgKeElsf/gazWQRUJY78eM8KYvMKOEgcf/qIGWKDvMTZLTvBbE6g+Mo924BsDqBt9hKX vyuDzJQQmMcqcX3VBzaIXkGJkzOfgC1mFpCQOPjiBVivkIC6xMkl85kmMArNQlI2C0nZAkam VYxiuZk5xbnpqQWGpnrFiXkpmcXZesn5uZsYIYGfuYPx7hPvQ4wCHIxKPLwJDiqRQqyJZcWV uYcYJTiYlUR4l28ACvGmJFZWpRblxxeV5qQWH2KU5mBREuc9JzM1QkggPbEkNTs1tSC1CCbL xMEp1cDoKr6q5cID+bdT5ivPYRFoOTXJNXNG5/nSp5dXOSu/fzxzhuJ2zvzrzvU151/sMI2S eOD/97WhpLXG987qbIepuVZmrSWV12Y+uqWx64WGzPIz7V+YzP1X8TTvYbaPP/jvSopQ/64C ncO2C++mRRlHJbWueHHS/KLWrGMm+Y/+T3TQca/8LGetxFKckWioxVxUnAgAmGL1VHgCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCJMWRmVeSWpSXmKPExsXCtZGTTTfrlEqkwe7nZhYHf7YxWnz9P53F YsGbvWwWK1cfZbJoW32G0WLBxkeMFq1L3zI5sHvc336EyWP3zQY2j2lrzjN5rN9ylcVj8+lq j8+b5ALYorhsUlJzMstSi/TtErgyrn/tZyl4JlPx7dUcpgbGXokuRk4OCQETiQPzjrF2MXJx CAmsZ5Tof7CeGSTBJmAk8e39TBYQW0RAR2LW3RfsIEXMApcZJTZeuAiWEBbwlNj68DcTiM0i oCpx5Md7VhCbV8BB4teXf+wQG+Qlzm7ZCTaUEyi+cs82IJsDaJu9xOXvyhMYuRcwMqxiFMvN zCnOTc8sMDTSK07MS8ksztZLzs/dxAgJl6gdjNcnmh9iZOLglGpgXHcqttKCnyvuSugvTuZp YmYLvzir/tdetMd+xflXE95bL7Z7xGStoP/wzj0/tTOaKyaef3DluPhW2aevN9l8/tuTMqFf LmLr84Knlzd/T16iyj/z6GoxcW4N9375RTZlbx5P62S4ep/DakvzpP4PcQ83anNf3C10Qe/U /tNFToJuyTr/V0t/uKbEUpyRaKjFXFScCACDE934xwEAAA== 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)(39860400002)(39840400002)(39450400003)(39400400002)(39410400002)(2980300002)(438002)(189002)(199003)(9170700003)(4326008)(36756003)(6666003)(2950100002)(6916009)(5003940100001)(106466001)(50226002)(2906002)(8676002)(110136004)(8936002)(50986999)(48376002)(38730400002)(356003)(33646002)(81166006)(47776003)(53936002)(50466002)(77096006)(72206003)(5660300001)(1076002)(86362001)(478600001)(305945005)(76176999)(189998001)(54906002); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR04MB0504; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM04FT016; 1:J4m2K5syz+Ax4a2ZPhaUjS5Uk2U0vh2F4ppR1hnYEPtEgV3bn7paKtb7tUkUhazJm6ggxkY5ot+3jO6ZOR67r04M/X6uSjpf+LcVU2v1b8LRHmXWFX4dmDcAqVkP4zQnmB3J64t7g0rvBs9An/o2q92POuqUYnY9Rp5cybSyR/m+HP0Xp/uG9cKPepy6Y/VX8dZqKqO1QWrrp3mXWMEC3+R6KmnM88fDuQWmereFDA4VX7P/fUd3r4o0UhOpsJcL6Jrax/YekSqWVCMIgCfxEICw1wt/38vgUtiJD2FG1njaknDFwHwwAAZzMoOrKK9uRTCsk7zTGdaAxVFNQzmzOL12928ba6ri/dM8wru2Vx2b99lWytX3dH6cHoeMibalXiLn2ONH2/3ItvhW0ltlLl7C0QI5OFk1NneiC5Jecr9iWBxOGeAsWrFJ2JDSQJahD+JInBNyHMfxZd8FDG3vetD6h5QhlKg1j1FpzKZ+LUG+RW/Yc7khJDAXzdE6oz9IfkxbLtzmG0vDHZgjExI61O4MneiR3Z41G6B/ueukGm0= X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PR04MB0504: X-MS-Office365-Filtering-Correlation-Id: ff235756-992f-480e-fdbe-08d4a2364cce X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081); SRVR:CY4PR04MB0504; X-Microsoft-Exchange-Diagnostics: 1; CY4PR04MB0504; 3:LdcGUhuN1Z9ahQUWZh1G2iwxmMLslWLmKs/nLKar98Vkd9pJqL8iRDPgb5UefGNkY/u84FSO7UYqnrG3irqaySLacxLeW0zkS2gbNH33kUq2lmyr6tR3/JQy2gLByzP6sp0Ek7mAPeZHdIokST716ViuLrcvSh5jlyHAxTtoMwjyplM9pepKzCCscfALyHNRPsRaVReJog1TX/BUbWA1BdrIuBek7Q/RwyWfRgoUdXWqzJuSF8KlZx0JJvj2Vdtfrkqjg7G/AKuprfE0z5rmRSCzeFS9D85d/kBxPFtHiP1e2aZLTb73vOpW1DfrudXYfT9C6m11MIPqy1uidI1eaSZ25yp3HWzrm4Vuwb9Jiby8oRSjYzbX3L2a24AIpqb6IZ5CUhwc1qkoFPhv1iJ3JQ1I3gL32PnC4IjaZAn89lgqDWZPPygNJvL0sCpreiod0R1MStnuBJ91aEgCGa8c7V6PO0veOOIpFdzKufsJG8LQKKv/S1sNI+gFwEbvNs9t X-Microsoft-Exchange-Diagnostics: 1; CY4PR04MB0504; 25:v6If/ENAanGpPjmUXd5DmmNTvBZpH0Y1O1u1cii/PU5buFtWkEzje5lZ1fU7GXYqOupqwkqjCPC7UO03WK28b1J6Gad8uCFccqG6ZcdGkH7FBR5nUzhPEfTddWh/bqdasa8NEXQoOblxUnPTWaG1cmVT93Y4PkWOLt4DIB+TnmmC92lRnoGZvV6mUPeRHdNisvzAp/AD7wiWORPLncKQUecPBi+dDHY4yzOtBcAlHJvXEB5JaPxBLIfjmZzm41o9BKliqoKus+lXbGmOPyEcaVHnlyIuEt4DsTxJ2vBVovoKnFuMPObdT9wRiPmzEtOzWt6ADeL5kt87lsfs+RXIPgpHKm3BBsGbryx0nvHT+rmPDro+pOMaZKbgArTTlzyF3l30MO0dyZP+eejel6I78Axq99KiYrLt5H5dlWjwibVwEe11Cd0wdXB6Su4C6y3Qf6XpUNX1Qzxr8GBQ7JTEGC6xkg6pQAuPzuQUt//7njw=; 31:djtCxOSBZb4NW8L4xVjWonpz3ykJI6BZwYPw1OQHQ+OzQxmdZDteXyhTXYg4roi4WGmd25nh8mcnzoE6eIjVoU/OOXrybKKM03SgmUGqrk82osn3m3GZz6/XYixOPQ0SMJHSdW1jGHO18LKHZZB0yNQn1IcD8VQuhVofXnZEHzM/bwcvY+om0CljFyvgFmW6IWQ1Y0MDNVjFLAMhW/W+YwP6cZREX8sF3B1KowQYHvvSeSL14+wCl5JjrPfqUIQESgMqR5ON3K+z94OBYCBQeA== WDCIPOUTBOUND: EOP-TRUE X-Microsoft-Exchange-Diagnostics: 1; CY4PR04MB0504; 20:XJGtInsJX2TqdLNh5jxgyBZDZxhDo29X+P0I3+p1voee84iFg/rPFdqE9kqCULVticD5qtZO1qOdQU/VI7BwCXaMArX1LS8h5GwUTs5SlzM/kHqsQ/gFcm4brKFQtHjl5uWN7zJ0Yl85TCypTlG7Nyki8HpLrkvGly+6v1XeNvFiuTASa/bxGa3oKEqePOl9ngJMnTmlyIv5ezoQkcD+uOGIbs/kIU62b0CQkXgDKBgDfjF5vfmzR9XMBsVuc4ZxF7zF93MtLbrjZqpq4CZXYtvDVvPIy7bUcmobXOTQim0Pl5RzmW/zOhmeNY+dtdFmggYgnAY4GfTTelKMp3RoC9vaYjy6drP3tcoyQiNrRehK93+CHtaKSO237TrfpVGLjZYgMSEeYp6UDKy1OZSY8buNqc8BYL8v+tmmqQSX9VlB8gebK0yY/WOSEAi1O1b0yjtAoLxn6EvHaAODnoAZ7EiyykFrF86NOXGV4CLzLjlxlkvqMsHhWMgbabkrzsOi X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(13018025)(5005006)(13016025)(10201501046)(93006095)(93004095)(3002001)(6055026)(6041248)(20161123562025)(20161123558100)(20161123564025)(20161123560025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148); SRVR:CY4PR04MB0504; BCL:0; PCL:0; RULEID:; SRVR:CY4PR04MB0504; X-Microsoft-Exchange-Diagnostics: 1; CY4PR04MB0504; 4:fM9JYLmLnxOVdZ6Jo3aeh+UGDMVupmQPcULdo8qmNqIevUpaD/K6cjObTmAEnLyUvzKam53MAqsRVKMwvRf98nHqS2XIj+Im33XXMO39RtFI+VDclDalJLlfW2+h0Chy9j6BWUV18VNqB6ohxfSyhHXhCW/kt2H0QPS/TTPC5j7GC3gseDDhCweDw07oAWEeK5I3rnZR144vyWhOromkdcSMmU4WK3q7dypTxXs0seQEL6WWRMl1aQZirHFH7FucnoHiPCBpWnHvK16AnNs2YoMGEbVm674Jl517sdYGJ1DP+B4UJ4Yj8fF+nqklpQeHqdJAIwo7s9kYCXr5OA5tA+00TeW3SReuuN96+p1ukhssePlDG9tSqfX/kQHXKC9UZf692NWHVYc9AcnF7d0nz5slWI3jCQOjDg4ANG+o/e5576iwrwp7B0OxPio6v5f81y8Xuz6G7SbDIlEcDD3IMZPICYmrqiOnimCIC91/8uCOWk/h6oKl1To7CA0Oh3lGHloY0a5tfrHRnThcugGw7R4C1FCDlKmn6/hbPcaNxi89wLfQHDbwn/fpYGSlQnxzf1VEI7DR/KMIqOODwyfy6B+Fw9KDyT+9by0bXEwDMqbMNCw3+aZY1JXuMNQXwGpxCCyC59g4gIGa98JdB63+fq+fzL70am+hAdVcbY29OZC21fK/BC1eebpiJe1OvhzCxmv4uROQwxsi4yu1zTiH5MC8oeCOta03DPgMIuO0spQpstYodaFjATiYuZRdJFOzU72quxbuQ8mRHL1UnQCr43Aostw5VlC5Tuv7jSMwdZOxsOriuMYOOZAEod3Oyoeab2bCo1uqjt9Je+NUEKmlD1OflYq2ahX6k2lrrlJFAmO9kDQtdewaVfrFMrV+uo7g0bHTVkR4FaQluRmbQoveSqlHX4XRLZ8WFlR8LPZV/h s= X-Forefront-PRVS: 0316567485 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR04MB0504; 23:h0aKqVItDY+wMd41ycfJBBS3FWa53pQmFrw8YGPoE?= =?us-ascii?Q?KyAjpWSspbXoZLtCDswktDyDfHKUNQiuYgwoLMsgQ34R7rrWMhTqHgdp5JDQ?= =?us-ascii?Q?Jg/BaXdvrKen0p2PS1KZnK2Sy575ZmOIIm1KyWAItN+msUkStCftFs3M3BdQ?= =?us-ascii?Q?MdaXxmR399GgscdbQJ70jGdFETkGlK60+SAvBLGGfZzICs5Km5rIfNgWTLhy?= =?us-ascii?Q?GbfzpbiqAkXw7xOL6ju9D4AXK7ZttuUpBEYMEnH6CQ/HnpPerBT822hIpo57?= =?us-ascii?Q?W7+KvZnKQxRXjcyG0xKFaL/+kFncijJxuFRcmsZ2q7q3m84ziAw2S0k0nv2F?= =?us-ascii?Q?rhyQjZmcd3l0azIdP/r61FE69pgwP/cKvUImQ/WZEcwdlZUi4oexURYhx7E8?= =?us-ascii?Q?TiZRUYh4EKU6/Ps3S9HgqtauBZQwOT1wbUHL+r3ynj+nAJJ5BVluThFhqkaJ?= =?us-ascii?Q?BB5uG1VdJF1K+xm1EndFwsXfnBctSXHdWhOtrG3M6Iw/EXJBWqb7ngkgIxCl?= =?us-ascii?Q?JA6gwhWrFEfc9CBPA+Hro9r46upw8pck5f/jw0lWKfhCRDEU+Fr+uzBmkUK/?= =?us-ascii?Q?4gQOT2ocbXOqkC3KHAVzhw2qzNgr8Tq4DAXHicO5tSkGDIoZKAW8zUjBY3q/?= =?us-ascii?Q?2psqEvi3ILzLyywfYPB4w53sP3ig9xloEu8+p5fx89+KHTzG3wDpkANABW/L?= =?us-ascii?Q?983uNMBSa1bwWB9IMuciHkr0Bkd/PZt05eMGbjdsxqj17lIbBsdq7gj+IoKj?= =?us-ascii?Q?O2RawHa7ZPP1QqzQVeseW5G7xmTh1GpghD7gB9Ilybx7h+Qho6GK/fp6hwX+?= =?us-ascii?Q?1o/ZqQg+KvYXgfRG0VVKsT6rM/63zm2ybjvJqoixjjD9Zp6J42SbINYZ/GVx?= =?us-ascii?Q?Dw4/JTvMBRe5nutZ+uOPHIKX9O2ptmsSYP5uvee5qH3ee/DghHttFQykZ63I?= =?us-ascii?Q?5LN8Bb/MEwPk18BVGtJWe8GV+3h5HcJA7wMldW8s5QW+Qon3vKr0uYEKQ1Cm?= =?us-ascii?Q?tHtl6x03/eS4YeeIRiHSPAKSjQCdAkcFsacGwRt2cLBA5GOcMrO/2410P0vw?= =?us-ascii?Q?uduyYOU05Os4UyXWpTNg9dCvlXYaQsYoiuJAqt8VfBi2j6azg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY4PR04MB0504; 6:O0YE2AWDCBSJ8amCVEQ8dZLDT4/6Vp13Oqudl3qYO8MZVNPtvPKlWfAycxfG8MyY6b/gPcOGQbMZ4pn9HWY46zU9gkUQOMW0mdjJ/ehmBwaFoRw3BMNmoz9TkOfQBmVlKjDQVlDrEgW++mb6IKU5yFcZj4WIlgkqeF+MvznDoqVaYsxjyTJmUUwVXgAcFc8qwbVVDAgNdE/1W7kVU+zFxqXA1aHHyNfjY+ycwT6DvKWtd1YnYmOTP4ep5xVkagiKGNeFDzq3k1Cn3wft0ITql/nJc+cGPkkEPU6O2rB847Tro0JqVfMTww9PXxP+JR10+oDCYgh6fkqPDISTc6VfrtDwSVGGr9bMj4Wvfyip/RLEN0ugK32z8Pb68KlmBshUYVO8H9KLL+spuxonI1y8EB6P3xtLOSLRGwZyucIi/wfdBhUV/Mvi5sm3CPTlnrhSmezd6obKTQOcyEfguzgiBflO393LBVVQeHvBiIzeGI8SyUEB6OKjjcFVv1xKKsn6dxvxfy0HdwixdncfTz2b1Zw+NFrn2qdm34RRJuW3U4c=; 5:07Y0MhAy4/TOmkp4Gs64CzMNs8qipLV6rhwIAVqFm3JUkXMcEj83vGy70+ysiqdT+0cy2/8BJP7RU28Hl+vbKVdZVuv2AiuqZSN8BDi+WM1i9Aa+U49Nps6Ic8/XRst+aVvZ4+S9vJoa3EClkd19jQ==; 24:tn3M917KE8r3Aiv/gmaMDJLEHqBGmmNwG5HhKuOMmA8Y39pVm/l4jNG7hfBnVsHYzdqaG0C45dRfJ5kmsOk1SnRemJ74HQSLoSMf+XfGWPI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR04MB0504; 7:RGu+OAbG//wHmDN7xMijOnn3YNPLIqKQ8VybcyAPlkak+twjabh9TtXWbz7Pt/5aa68sS4P5N+UmrXYynybwdYfDMbaJRTgM1jOtLa2UQuKS8rg8+t4qF8nDOulZsBQBPvVEChhkNCEwUg4E41Oj70WmXkQ3RRWOrg86+wPoAtKegMTrTVUi592lzPAYTxv1cPM7/wWRReLfdlDRuS4TfCZYfaeF1qlFotG9uK+6RyTlaDFEqwJ7AxKuvGk7DJXorDEMbZ/LQNYtWM/Zphu6sCAC7dOCf81kMrAOI81o3yN8DPHWtkpMhN7mewNKgotfT37eR7/0jzV7muIKsKpwcA==; 20:ZeiPvljyNRcbmG5dGxrJGvTifQWN7tL0lCc9bcv2239ZpJz8NwzptpC3/bzKR08XG08Vnzco3GQEwiGns0YXdD0IwQwUp1Ily8YoQjAESRuwIaQBCuIhu2nXWptRd2fYkAOJFlAUCV+C6vfnIsrnSG2mLXG4rGK09smpjhhT+ak= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2017 23:49:06.2899 (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: CY4PR04MB0504 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 Since target_alloc_sgl() and iscsit_allocate_iovecs() allocate buffer space for se_cmd.data_length bytes and since that number can be smaller than the iSCSI Expected Data Transfer Length (EDTL), ensure that the iSCSI target driver does not attempt to receive more bytes than what fits in the receive buffer. Always receive the full immediate data buffer. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: David Disseldorp Cc: --- drivers/target/iscsi/iscsi_target.c | 27 ++++++++++++++++++++++++--- drivers/target/iscsi/iscsi_target_util.c | 1 + include/target/iscsi/iscsi_target_core.h | 1 + 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 86acf81c1cf9..c91604feca18 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -1564,9 +1564,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]; @@ -2577,14 +2579,33 @@ static int iscsit_handle_immediate_data( u32 checksum, iov_count = 0, padding = 0; struct iscsi_conn *conn = cmd->conn; struct kvec *iov; + void *overflow_buf = NULL; - iov_ret = iscsit_map_iovec(cmd, cmd->iov_data, cmd->write_data_done, length); + BUG_ON(cmd->write_data_done > cmd->se_cmd.data_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). + */ + overflow_buf = kmalloc(length - rx_size, GFP_KERNEL); + if (!overflow_buf) { + iscsit_unmap_iovec(cmd); + return IMMEDIATE_DATA_CANNOT_RECOVER; + } + cmd->overflow_buf = overflow_buf; + iov[iov_count].iov_base = overflow_buf; + iov[iov_count].iov_len = length - rx_size; + iov_count++; + rx_size = length; + } padding = ((-length) & 3); if (padding != 0) { diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index 1e36f83b5961..68371a7e54d8 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c @@ -705,6 +705,7 @@ void iscsit_release_cmd(struct iscsi_cmd *cmd) kfree(cmd->pdu_list); kfree(cmd->seq_list); kfree(cmd->tmr_req); + kfree(cmd->overflow_buf); kfree(cmd->iov_data); kfree(cmd->text_in_ptr); diff --git a/include/target/iscsi/iscsi_target_core.h b/include/target/iscsi/iscsi_target_core.h index 275581d483dd..968825200ecb 100644 --- a/include/target/iscsi/iscsi_target_core.h +++ b/include/target/iscsi/iscsi_target_core.h @@ -462,6 +462,7 @@ struct iscsi_cmd { struct timer_list dataout_timer; /* Iovecs for SCSI data payload RX/TX w/ kernel level sockets */ struct kvec *iov_data; + void *overflow_buf; /* Iovecs for miscellaneous purposes */ #define ISCSI_MISC_IOVECS 5 struct kvec iov_misc[ISCSI_MISC_IOVECS];