From patchwork Sun Oct 29 21:22:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 159418 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp1860869vqb; Sun, 29 Oct 2023 14:24:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFlSIXafbAM6ZYeHNlj83srjCYLvdvAaw65VtePUqmeJVlWV7XukdUqsrbMf8knrFGjYaht X-Received: by 2002:aca:2202:0:b0:3ac:b12b:9acc with SMTP id b2-20020aca2202000000b003acb12b9accmr9391563oic.43.1698614645863; Sun, 29 Oct 2023 14:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698614645; cv=none; d=google.com; s=arc-20160816; b=lacuD7dw1ce66CGzT1JSCO60u0qy91YoZbEMO0WOjO8Cqv8dQbFrgH4SSqMYdj1bXP B4qlLM8JXVBrTXFvloN2y8zAKo/gtl9EBjDQT1EZq/WvddgkGNuejqGbz1iNhmmHOcVb dJR1qt3qzXyOWj7yV2RZGOvBVXIHsixFn4TILK6PLh3Pt4vmxpJU6O4LdljKC5OivKp8 HP1F5gT4B1AWgxpHxusF5sjHmh44s5jujs0CEzCNn8rYyLMoNNp8E/NWe36ARMtRflvA yscxuPVSDscV0GdlBCl73RaZysNbpU/Si9vAz/Rr8kw0lmnHsIQ/zCWdpH37CMeZt/Bp PryQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=cYudL/+VuVwczFaR6V/ZH5x7fhb37FxDE0rQ3yQscdQ=; fh=SXPRxVGed35u/qlqQ4PpR8jxHSJDYghCgIedl6vnXI4=; b=HHQFiddUpV5u2LfRHS6yyfhYZXtdTz97a0jEfTd7/T6W3K5mSSUVe31kCGBKYFf580 VdbKxcTsyuyo+MviJISWgTbAqoJwBgrLg+EfbjfjQKT3XAk6a6pKl+YvuxWefmDaNdy4 WdvEdR1lJZ8fNUP/Ni2NYj4SaBOxO92oycamMxIhjnv1IlTH8hETzo24gpPIw6TLUS9+ +C0hzXgwey8KUgZYHAdnjE/15e5xyv/SFNsPn2IkGPCPCiaAarnCpd4I0A4fVRP7tF8+ lqFmu12FijQgVALmEffCKbt2Q2Uvufz76CjJmTXVHaf8Mje8CFt7+Ci+T9A/nMqvK/yF Y3kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b="i4AF/4ka"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id v10-20020a63f20a000000b005b8ece78a96si4080714pgh.691.2023.10.29.14.24.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 14:24:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b="i4AF/4ka"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id A0F818065CC8; Sun, 29 Oct 2023 14:24:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230299AbjJ2VXI (ORCPT + 31 others); Sun, 29 Oct 2023 17:23:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbjJ2VXH (ORCPT ); Sun, 29 Oct 2023 17:23:07 -0400 Received: from smtp.smtpout.orange.fr (smtp-27.smtpout.orange.fr [80.12.242.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C86B0C0 for ; Sun, 29 Oct 2023 14:23:04 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id xDFLqNd5aaLS1xDFLqPqM9; Sun, 29 Oct 2023 22:23:01 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1698614581; bh=cYudL/+VuVwczFaR6V/ZH5x7fhb37FxDE0rQ3yQscdQ=; h=From:To:Cc:Subject:Date; b=i4AF/4kaLpgPF5GFykgjj0Fq6GL8kJ0whYcQI40Za4SZvoG8S7/LPDoVe/T1ldEFo xdJ/j4JtagGl66mjtb3rsd1aN3nbGORUBHisFIFCtlfU9sVGsB/6c1peOaEqggVLZC BmsQQLmLRNTmtC4POzvKQ8U0UuqDCQWJA5JBz1fdacvSUeQMeccHgGrRYa5ZuK06jm bOCkbTHiBuItwotvdlRE8Adk7aPno13mRQi88rdW7QooKrDY7OTCX+zSBdMYbW76Fi zGIrAT9iuCrsODqlvM938TU4e7spCdRAtGuwIlv1uqUNNpiPSPVWhc7Hor55mNe8UY 9DUNhvXcUmb3w== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 29 Oct 2023 22:23:01 +0100 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Hannes Reinecke Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-nvme@lists.infradead.org Subject: [PATCH] nvme-tcp: Fix a memory leak Date: Sun, 29 Oct 2023 22:22:57 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Sun, 29 Oct 2023 14:24:03 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781126551153803169 X-GMAIL-MSGID: 1781126551153803169 All error handling path end to the error handling path, except this one. Go to the error handling branch as well here, otherwise 'icreq' and 'icresp' will leak. Fixes: 2837966ab2a8 ("nvme-tcp: control message handling for recvmsg()") Signed-off-by: Christophe JAILLET Reviewed-by: Christoph Hellwig Reviewed-by: Hannes Reinecke Reviewed-by: Sagi Grimberg --- drivers/nvme/host/tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index 4714a902f4ca..3c35c37112e6 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -1429,7 +1429,8 @@ static int nvme_tcp_init_connection(struct nvme_tcp_queue *queue) if (ctype != TLS_RECORD_TYPE_DATA) { pr_err("queue %d: unhandled TLS record %d\n", nvme_tcp_queue_id(queue), ctype); - return -ENOTCONN; + ret = -ENOTCONN; + goto free_icresp; } } ret = -EINVAL;