Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2607487rdh; Mon, 30 Oct 2023 02:19:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHmLVJOZs596G+oVf2Qt1/xO51f6aqKNKFFMMQPhaUrr2p/VvVX9XI2RGVvrfmQctUjCtDd X-Received: by 2002:a05:6a20:918f:b0:153:b16e:8db1 with SMTP id v15-20020a056a20918f00b00153b16e8db1mr8250812pzd.10.1698657595595; Mon, 30 Oct 2023 02:19:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698657595; cv=none; d=google.com; s=arc-20160816; b=nJmhvRSZ4kZJGJzcZnwKPxlSM+B0YfLHxBV4PPLZlWP5M5ewnDqRNTpDenqYJiqXWS 3DAcOpvbBRJFvEH3J07HblzBYxEN6kru95EnM09QlwMmFNiTVNDWW6qaFieuaVt4vsDw 8VRxZofolbaECh9GonX5xwbRYU+r/yAbObKvx01cxKQsgr0dtc65TxL212YZKW8HFtoH VEWNuh/7nE8dGJIODz+bwVtYLhEDv/mYk1z4TR+LnFhXqaHR4zuuzX9uA8psA7QpG+IJ QJ8RE4t8pFELeu8NsNHowtrsvkzN/3kuepd3alH7koVIN5HwCG4YHoUGFBDM+35yzYip DKnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RzjPxfK1+5bs+B46lTo/LDVdRF8OUdRmXGZueTf1lpQ=; fh=yR7/4+16Cv3WNVUO43l24W/6ACeJ6F0n8FUXli3IB6w=; b=D5Jh2j83M6GbkHDbVpYuAkaIRIB5XvRCJGGIify6gE1WIq2ImTKleG5h/oMWo/zMOH /klEDlx50u0/RazssFsTAt/zLUIv3WFHfRF+m8o8oa2QHdhOCUXqJ4i2t6+kQIgynZZa s0xc4pntxQtaPu7AYa7rw02vNiyRMQdTUGjUAkdxbGpZM9CzpbJgfeRm2OwxRMXSL3de 9EaKLZ5ljn+7gNTaVZuTbMvc962ubZsh9Mzjwu1M+6i9Ew82DcFNM74r8dhPtV9iZf+8 dy+WjU0Jw8ZOm+Qlal0RetMy5I3Uquh2xZujfPSayBtjIm5DG4ygFQzpzVc+NBbekHnU YU4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hIajnS0M; 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=intel.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id 1-20020a17090a0c0100b002774aec6805si4618192pjs.68.2023.10.30.02.19.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 02:19:55 -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=@intel.com header.s=Intel header.b=hIajnS0M; 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=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 5C389804C6F5; Mon, 30 Oct 2023 02:19:53 -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 S232253AbjJ3JTl (ORCPT + 99 others); Mon, 30 Oct 2023 05:19:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232212AbjJ3JTk (ORCPT ); Mon, 30 Oct 2023 05:19:40 -0400 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E154AA7; Mon, 30 Oct 2023 02:19:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698657578; x=1730193578; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=fyIMF6N+1ePKlbVBfoyWa6vLLpP4q55GWPlHPlpHeeM=; b=hIajnS0M1EbShPOqH37y7u7Qb1+H9XfZklzwvWujMyDuSEBICWZDxZUU w+VjdbwS0O93yWnsYpMutMg1SHk9iWnKqf80AI3kZ4OJhwAABFEzkRctY 5N9GBDmW8UI0qP6epyctDeGSBqrakqmEVECeHoKHJ4YmnyFc83yxwKDfE gjcMXRec/F0/Bs265y3iO3l/fGfz/vT1Y/sJGAuTZ5N+zHhrjRpPZPIQx eWx9luZgU0Vged67J7IU/BI9LoNPFklnO77VqvMN/OB0m73bkPp4gou7C 5RI53Hnm1UTjTPNSXy3tprZEPjTR3ik1G9L+nNORa1KMbpoh+SMWA176P A==; X-IronPort-AV: E=McAfee;i="6600,9927,10878"; a="904238" X-IronPort-AV: E=Sophos;i="6.03,263,1694761200"; d="scan'208";a="904238" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2023 02:19:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10878"; a="1091571992" X-IronPort-AV: E=Sophos;i="6.03,263,1694761200"; d="scan'208";a="1091571992" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmsmga005.fm.intel.com with SMTP; 30 Oct 2023 02:19:34 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Mon, 30 Oct 2023 11:19:33 +0200 Date: Mon, 30 Oct 2023 11:19:33 +0200 From: Heikki Krogerus To: Christophe JAILLET Cc: Greg Kroah-Hartman , Abdel Alkuor , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: [PATCH] USB: typec: tps6598x: Fix a memory leak in an error handling path Message-ID: References: <23168336f18a9f6cb1a5b47130fc134dc0510d7f.1698648980.git.christophe.jaillet@wanadoo.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <23168336f18a9f6cb1a5b47130fc134dc0510d7f.1698648980.git.christophe.jaillet@wanadoo.fr> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,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: 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]); Mon, 30 Oct 2023 02:19:53 -0700 (PDT) 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 Acked-by: Heikki Krogerus > --- > 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 -- heikki