Message ID | 23168336f18a9f6cb1a5b47130fc134dc0510d7f.1698648980.git.christophe.jaillet@wanadoo.fr |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2023832vqb; Sun, 29 Oct 2023 23:57:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHKLPqOcQrqMir6TWlPjnROETWcBO/XQgRTapOiPSXSwpdFGi85XDCZzy6N1fCylk9Z+pTI X-Received: by 2002:a05:6a00:2d09:b0:68a:52ec:3d36 with SMTP id fa9-20020a056a002d0900b0068a52ec3d36mr7327043pfb.31.1698649052857; Sun, 29 Oct 2023 23:57:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698649052; cv=none; d=google.com; s=arc-20160816; b=lBVFvaCQSb4lzksnn28atXW95QjN8rcHH4YQHGwowZkeuvOhuGWQ4hY2hXeuayVDtx 9G+RCzaVu7v50ExOnctH3RFl7epCGfFmmGzMlxskGVqNEGnDktkVXCPVGV9ym7zfI5sE ysv0l0ZcHFGO88hA/OLBi4YGIkCe008uhFo+hgMDy66pdg7dDBcRk3dIj6IUOpzMxxyw 8tEhHklGwdQngzdricK6mCHuX1Gfdtt48tLq6LfTDHCD5ElkGy5niBx+sadOHx13s3CU ZFbyZQIPVADY9jLCBQQqUNgff5gadPWjX5aDjt9LuytwGCpq1foSOnO8YScD0uWPWBUC VjBw== 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=KkbJNouXf1jB9o5VmPFQMXyslZ7BV0Kwtr1ZfMOhED0=; fh=HXtoumapmAmswO4cTSuR/j3y/lAjt2tMts7TuS6YgBY=; b=MgpFq+FWkzzrUrBrvO79Iy4cqkROdEPtnqk2OWUNK81TRrnBpx83LDE48euGjaUeJg 0WYyot+EeeFIFZ7rsaKj1tPE52Es0jihTZfRS8MPVhTKTqHZ3WxC/wihjCYHZAe3q+/W sgz0jBU8mYyFesTuqCJX9d2hgeoFZV0UjEBQ8LGajmdwPhTCZI81dA1wz1KnFmBz3Cez nDH388UeNNndZ/9f+5F248owG0M8UDo6HmsqivXIq+zca+aB29QytYMRR2LWnMiJPZVN FLT4CZ8XAfLuOQPr0Mm/TDZbDVmWQT1FIqD8C6dF28uP1xqntknnmE+0TjL0xTz2qKxf TB4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=EoVYKNhn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id s18-20020a056a0008d200b006c128a7f813si511940pfu.177.2023.10.29.23.57.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 23:57:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=EoVYKNhn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id C2CBC8054B53; Sun, 29 Oct 2023 23:57:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231928AbjJ3G5H (ORCPT <rfc822;chrisjones.unixmen@gmail.com> + 32 others); Mon, 30 Oct 2023 02:57:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231835AbjJ3G47 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 30 Oct 2023 02:56:59 -0400 Received: from smtp.smtpout.orange.fr (smtp-14.smtpout.orange.fr [80.12.242.14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB9BBD4D for <linux-kernel@vger.kernel.org>; Sun, 29 Oct 2023 23:56:47 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id xMCXqf3ZpdFbKxMCYqfBpU; Mon, 30 Oct 2023 07:56:44 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1698649004; bh=KkbJNouXf1jB9o5VmPFQMXyslZ7BV0Kwtr1ZfMOhED0=; h=From:To:Cc:Subject:Date; b=EoVYKNhntLWgaYt3lWeEflSOZ13HEfu/PRa3sOcgLqsK3MV7pxUJifqbTgmfk2O7/ vWjc7K1Z2Qbu21SmYAlk9rUHOYm6MlHCVJqFw2G2qJgljuXyc/CRI+92VrdCXZMPrZ AlYLANf8MBiak0D//G9tr+2KOybPtRV2adO1fED9zi91KE9VoSKzeC1xY2I3szqAMw zbdBSRWA2TkEOCnTLeTZxt6bUvI6AGzHTeiErlLWZpoDYhc83ym9e859FZQFnQ6rey hwbvzwcgRfI5Zf2LSKh96lQUMWAsMjF7ZLWt/OZl4BWM/Cd6WfZuzttBDWgfGm6Eek WvVUEnoMFaTiw== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 30 Oct 2023 07:56:44 +0100 X-ME-IP: 86.243.2.178 From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> To: Heikki Krogerus <heikki.krogerus@linux.intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Abdel Alkuor <abdelalkuor@geotab.com> Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET <christophe.jaillet@wanadoo.fr>, linux-usb@vger.kernel.org Subject: [PATCH] USB: typec: tps6598x: Fix a memory leak in an error handling path Date: Mon, 30 Oct 2023 07:56:40 +0100 Message-Id: <23168336f18a9f6cb1a5b47130fc134dc0510d7f.1698648980.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sun, 29 Oct 2023 23:57:30 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781162629250603038 X-GMAIL-MSGID: 1781162629250603038 |
Series |
USB: typec: tps6598x: Fix a memory leak in an error handling path
|
|
Commit Message
Christophe JAILLET
Oct. 30, 2023, 6:56 a.m. UTC
All error handling end to the error handling path, except these ones.
Go to 'release_fw' as well here, otherwise 'fw' is leaking.
Fixes: 7e7a3c815d22 ("USB: typec: tps6598x: Add TPS25750 support")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/usb/typec/tipd/core.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
Comments
On Mon, Oct 30, 2023 at 07:56:40AM +0100, Christophe JAILLET wrote: > All error handling end to the error handling path, except these ones. > Go to 'release_fw' as well here, otherwise 'fw' is leaking. > > Fixes: 7e7a3c815d22 ("USB: typec: tps6598x: Add TPS25750 support") > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> > --- > drivers/usb/typec/tipd/core.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c > index 0e867f531d34..b0184be06c3d 100644 > --- a/drivers/usb/typec/tipd/core.c > +++ b/drivers/usb/typec/tipd/core.c > @@ -968,16 +968,17 @@ static int tps25750_start_patch_burst_mode(struct tps6598x *tps) > ret = of_property_match_string(np, "reg-names", "patch-address"); > if (ret < 0) { > dev_err(tps->dev, "failed to get patch-address %d\n", ret); > - return ret; > + goto release_fw; > } > > ret = of_property_read_u32_index(np, "reg", ret, &addr); > if (ret) > - return ret; > + goto release_fw; > > if (addr == 0 || (addr >= 0x20 && addr <= 0x23)) { > dev_err(tps->dev, "wrong patch address %u\n", addr); > - return -EINVAL; > + ret = -EINVAL; > + goto release_fw; > } > > bpms_data.addr = (u8)addr; > -- > 2.34.1
diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index 0e867f531d34..b0184be06c3d 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -968,16 +968,17 @@ static int tps25750_start_patch_burst_mode(struct tps6598x *tps) ret = of_property_match_string(np, "reg-names", "patch-address"); if (ret < 0) { dev_err(tps->dev, "failed to get patch-address %d\n", ret); - return ret; + goto release_fw; } ret = of_property_read_u32_index(np, "reg", ret, &addr); if (ret) - return ret; + goto release_fw; if (addr == 0 || (addr >= 0x20 && addr <= 0x23)) { dev_err(tps->dev, "wrong patch address %u\n", addr); - return -EINVAL; + ret = -EINVAL; + goto release_fw; } bpms_data.addr = (u8)addr;