Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp870703rdh; Thu, 26 Oct 2023 19:51:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFJMlEJsO8f+5yfDkgiqUCaurKF7poaru2bdh1g9OMN593ssIWG20pz5SeHPvCQaH9OMxtC X-Received: by 2002:a25:285:0:b0:da0:6669:860f with SMTP id 127-20020a250285000000b00da06669860fmr1157434ybc.65.1698375116772; Thu, 26 Oct 2023 19:51:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698375116; cv=none; d=google.com; s=arc-20160816; b=zVwd1UgAoyXyP2l392dtT0oj5hLPi80Ugh1m+OfF2LbCOAalyB8n/ei9cJhb2/s6o9 vloKGKCqMW6LWrS1C9r8vmPehqY1GTcs1f44IbAqFLQZOd5dnCrCaCXccmdqjTbi02wo XgS3ykEWMRLdscHubRJ1RinZmGpZl/eLD5HOibiCcYSqPBk0Fb9sy3Uys4U5TXQQiq2A Ql/gev9uYJ16q4hmXRm5ap/II7Ww+9WZ3TB2PbUm6o73357pDLnYCDVv8ilNtsPEU4k3 EnV48IJugMFTfdrs1LTIEmF0z1V3VB+jWIBbSPNN7jXbzBpUgADzyUhiMGwR+EFdPVfU lOEw== 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=UwGrPcEsgflO09HAy5rdI9eLTEVTJiCucDlbX44V91o=; fh=Pe9iCyfPxZggWuy+EKIM61gV1u8yKPV4UIvItRqyj58=; b=MCI1Z/MK4X2Vo+/doPsgVmuNP/aJn3g4s7SgoCP8lDqXLk9NJBEp8TB7kZOwjLYj7o i3l/edzF++qWfUpEXfiMY2Xm2mfP1f4fPzfhBlIcJg4k+dx3R2QHqLlbT6MLMLzCOs8v 8IW5ym9J84epy1mevpXbqLyWfGYMFZsUyr4eTNG0dteyERtPNqp5RfCte8VlcLTUEmXz M7T1UnXBycXrWVO/fFuVOsmSDc/Wmy7J+ngTG+o2aNWYvpOFz8nefmAmWC3b3emQfw0t +bYDP+LwLcL7SFTzbKUTcQkCKcX9Gk6Oo4Tlup7nWAgb9EiZ8l6i+As2Ys163jTs7lqN nbsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="J/LFoEm9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id c6-20020a5b0bc6000000b00da0ae1e6408si1308706ybr.584.2023.10.26.19.51.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 19:51:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="J/LFoEm9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 64BD78084045; Thu, 26 Oct 2023 19:51:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345181AbjJ0CvR (ORCPT + 99 others); Thu, 26 Oct 2023 22:51:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjJ0CvQ (ORCPT ); Thu, 26 Oct 2023 22:51:16 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84349CA; Thu, 26 Oct 2023 19:51:14 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id d9443c01a7336-1ca3c63d7f0so2861165ad.1; Thu, 26 Oct 2023 19:51:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698375074; x=1698979874; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=UwGrPcEsgflO09HAy5rdI9eLTEVTJiCucDlbX44V91o=; b=J/LFoEm9IdBFsHESIa86vrjGvP9DzQQIDomJWdOx9GHR+YXkk3DMsN9JuCWJVSa+Tp B9S5OGtsKFLqxCnBsL56VL60fGkPQLC740AUhZZw8SIHH1+ED3d5zYDXYpVS3dBhUu1K A9Xnuss0pNiOtNcVTeUcmDK80zoGbJtyrZSFPgG7g6c7iXzD9dBtCtMS/PdmD+Hce/ve EgxI6SxtixaXXTRWv+WI3UPs8j1YSDOzqFnG8ELVSTiKyOSC3QqinWl87WsJoZJE3svZ S6EsKoJx9DN3UydekiCH15tD2h6f6XZ5wziZ2hx5Ziln3X8YO+jzHOrcM6K2aebSdzAv pLoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698375074; x=1698979874; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=UwGrPcEsgflO09HAy5rdI9eLTEVTJiCucDlbX44V91o=; b=qrewUS9Mcp7D0eNrMWwha46/lMZdU/+uhsyq6LidUbmI2WVO0REVuB1SkFIPOxbTxL r7bneqX/XGMiuAxNnYbZkXGUHyhQJ6fenzfs8HdV6iBUbFUDxAmzUWrzUv8SwFG0q8vH 3MXKsm5K8rgRCwbaOCFyH921HnBSU4Z1FSgcjSe69euHZeQc7Vp7al3F/EbW1lUYZOHT 9KW6S+dBkZd844k/jGR/1foRZsDaWQ3GctXqocBJ+i5mW3NSPDhvfPB8VijslbeOzika lr6PPMDFzGd6oAyFozaTzYH9QQR9U5+6V0ZBNXJTW69E3dYzkbe4LVEs/6gO+aoSqqgv mVnA== X-Gm-Message-State: AOJu0YwnImr2MP5pIqcRdlHq0e4p5I4/k3oHabboI+6oTGvgWfQ+6Pt6 iHlsjVTgAJAZP35hbkRduZU= X-Received: by 2002:a17:902:d485:b0:1ca:858d:5bef with SMTP id c5-20020a170902d48500b001ca858d5befmr1401151plg.4.1698375073920; Thu, 26 Oct 2023 19:51:13 -0700 (PDT) Received: from hbh25y.mshome.net (059149129201.ctinets.com. [59.149.129.201]) by smtp.gmail.com with ESMTPSA id r9-20020a170902be0900b001c3be750900sm377882pls.163.2023.10.26.19.51.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 19:51:13 -0700 (PDT) From: Hangyu Hua To: kristo@kernel.org, mturquette@baylibre.com, sboyd@kernel.org, tony@atomide.com, dario.binacchi@amarulasolutions.com, claudiu.beznea@microchip.com, robh@kernel.org, andriy.shevchenko@linux.intel.com Cc: linux-omap@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Hangyu Hua Subject: [PATCH v2] ti: fix possible memory leak in _ti_omap4_clkctrl_setup() Date: Fri, 27 Oct 2023 10:50:57 +0800 Message-Id: <20231027025057.11510-1-hbh25y@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 fry.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 (fry.vger.email [0.0.0.0]); Thu, 26 Oct 2023 19:51:24 -0700 (PDT) kstrndup() and kstrdup_and_replace() in clkctrl_get_name() can perform dynamic memory allocation. So clkctrl_name() needs to be freed when provider->clkdm_name is NULL. Fixes: bd46cd0b802d ("clk: ti: clkctrl: check return value of kasprintf()") Signed-off-by: Hangyu Hua --- v2: fix commit info. drivers/clk/ti/clkctrl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c index 607e34d8e289..cb4aa8a45bb2 100644 --- a/drivers/clk/ti/clkctrl.c +++ b/drivers/clk/ti/clkctrl.c @@ -591,6 +591,7 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node) provider->clkdm_name = kasprintf(GFP_KERNEL, "%s_clkdm", clkctrl_name); if (!provider->clkdm_name) { + kfree(clkctrl_name); kfree(provider); return; } -- 2.34.1