Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp188296imn; Tue, 2 Aug 2022 23:17:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR7Z54Wao11/9aKNixUBapxeRuYVAq4BVOErRJFYxEif6bqaB7LA+vkQHYPE7VbHr7K6UJR7 X-Received: by 2002:a17:902:e952:b0:16d:2552:f2eb with SMTP id b18-20020a170902e95200b0016d2552f2ebmr24848627pll.76.1659507439428; Tue, 02 Aug 2022 23:17:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659507439; cv=none; d=google.com; s=arc-20160816; b=Lmfq6Sgi0w3mR0ca+WhN9/kZSm799zJ7GmuGUUZwwrGq+5wa9sDZJD9L8pRklWwRjg M1K/XAEa+K7LjsD10bAMUA/vRMI4I+8K0D3SVyC6ZEyKMruH39dCyztxYQ9LxQE2ZGFa 6fNMOs8fD8rSdGL2efTgWusi+vlh3lxylCAQs8SNrtGZuOAW1h/kAaIiRVTJ82Y3vJrl Dx/9bs2rRN/1ChcTVoqmhXC/ZoU1HPicepNgrU2NYvEITe/6hbp1Oeaw5WxqC/ManwKk Ce2/8zwxOFWfnYmBUsU38RFK+UZp30x8NpkQPnnWT8d8PHKFN6B9c8ac3WBJa8OlZNJj CBfw== 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; bh=XN0ZBxePvcLBHLpYay3TyUCAUEjU2GOxhlYbr6pQGcc=; b=LMDp/ZPtBC4QGdLC/vipixIpCF76Am0VAxoY4dVlr9PFKILUJFdQWm+Xl2xLdO8zOq Wk6piT4PZPjCD3zXcZm6d/aHI/Wwlgrh5rixEdxggr8EtbEfkdT2NPM30YxOJECVe1Wc 1M2b+ng1Dr/M9L+u+ZW8b4Qvqdhjf+WcwNdlMUXgCm+E16sithKxnkYhWbOKzbYzrmRf 80Nv0CBNv2PhCGolkajxTsRWCUTujzoLMpOSp4+J5ZZOZ9+XwuZhxEqEXBJlFKTrychb iUFHKAEzycZUNQP6qf+WPwtwWLSlzTDJMJa6qkQ/Su4x/mjyn5WQAe8oMlrt02/dYDIn 5Esg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w21-20020a631615000000b0041b698ead1asi3135620pgl.794.2022.08.02.23.17.04; Tue, 02 Aug 2022 23:17:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233906AbiHCGA4 (ORCPT + 99 others); Wed, 3 Aug 2022 02:00:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229789AbiHCGAz (ORCPT ); Wed, 3 Aug 2022 02:00:55 -0400 Received: from smtp.smtpout.orange.fr (smtp08.smtpout.orange.fr [80.12.242.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBF331707A for ; Tue, 2 Aug 2022 23:00:53 -0700 (PDT) Received: from pop-os.home ([90.11.190.129]) by smtp.orange.fr with ESMTPA id J7R0oDBQPnnjOJ7R0oabzZ; Wed, 03 Aug 2022 08:00:52 +0200 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Wed, 03 Aug 2022 08:00:52 +0200 X-ME-IP: 90.11.190.129 From: Christophe JAILLET To: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King , Sascha Hauer , Heikki Krogerus , Marek Vasut , Igor Grinberg , Felipe Balbi Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: pxa: Fix a memory leak in pxa310_otg_exit() Date: Wed, 3 Aug 2022 08:00:44 +0200 Message-Id: <890e3e7329b020356206262e9c3ee57378648e1c.1659506415.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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When otg_ulpi_create() is called, 2 kzalloc() are performed. Only one is freed in pxa310_otg_exit(). The second kzalloc() has been introduced in the commit in the Fixes: tag. Add the missing kfree(). Fixes: 298b083cf9dd ("usb: otg: ulpi: Start using struct usb_otg") Signed-off-by: Christophe JAILLET --- This patch is NOT compile tested (I never cross compile even if I've been tolled many times that it was easy...) Another solution is to use devm_otg_ulpi_create() and further simplify arch/arm/mach-pxa/pxa3xx-ulpi.c. This would remove the only caller of otg_ulpi_create() and could also simplify drivers/usb/phy/phy-ulpi.[ch] --- arch/arm/mach-pxa/pxa3xx-ulpi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-pxa/pxa3xx-ulpi.c b/arch/arm/mach-pxa/pxa3xx-ulpi.c index c29a7f0fa1b0..82b4e2706f86 100644 --- a/arch/arm/mach-pxa/pxa3xx-ulpi.c +++ b/arch/arm/mach-pxa/pxa3xx-ulpi.c @@ -229,6 +229,7 @@ static int pxa310_otg_init(struct pxa3xx_u2d_platform_data *pdata) static void pxa310_otg_exit(void) { + kfree(u2d->otg->otg); kfree(u2d->otg); } #else -- 2.34.1