From nobody Sat Jun 13 03:33:48 2026 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83B4E363093 for ; Mon, 11 May 2026 06:42:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778481749; cv=none; b=bVKp468Scscx3fcvKpHkx9FI0UVSXxV/yyYV5PtOIhsbdhbzXSV8XfQ5Cw/eOrTXYQaqv1K/w6ieMOWC2eivA61+D2RKY40O9IXvljfuRR4RHij50uXpVSEN4Ie9WgtmDHqv7hcSn3Jvab4Lr/Pml3EokZSC29OoLuJlXt5G3IQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778481749; c=relaxed/simple; bh=aqOreI6fX/uZN/lEw3smALiG7YxaCe62+LvjMxRJqj4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=cnA8xbPLt5KMzfJknrICXigst3xMGxVQJOWBAfdCuiFZO4+VI7XrDn6sVcCN9e3kqHqkNbbh1vk8sDpvQ+EnMZI49B5wjpQHQaVUxPbpcIhDgbAmwtKw1wKUGKRY2kpg4QnXLxj/dDKkUZleUtGf4xWGnK17ymIdcJBE/e6Zt4s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cse.iitm.ac.in; spf=pass smtp.mailfrom=cse.iitm.ac.in; dkim=pass (2048-bit key) header.d=cse-iitm-ac-in.20251104.gappssmtp.com header.i=@cse-iitm-ac-in.20251104.gappssmtp.com header.b=G23YYp66; arc=none smtp.client-ip=209.85.210.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cse.iitm.ac.in Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cse.iitm.ac.in Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cse-iitm-ac-in.20251104.gappssmtp.com header.i=@cse-iitm-ac-in.20251104.gappssmtp.com header.b="G23YYp66" Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-82fa8d6425bso1898642b3a.0 for ; Sun, 10 May 2026 23:42:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cse-iitm-ac-in.20251104.gappssmtp.com; s=20251104; t=1778481746; x=1779086546; 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=6WETen+kRNNiAQvSfnOnKOKODS+5kYfhp3vdgbGUFvE=; b=G23YYp66afKKdS1/yKrOpuu7iRiNGvR5H8hQRYpysbYLSad7TZOcUzcOvixDOZvlYD pMoexS4VlqDwwm0WegrMRaUydqdR8F3mmLPyOmsXEpUAnxPGBxBBnZkcmffYpGJyGNVt y1qdrmAKFvX/hKMGxQB+FAHloHYbIYNLeOzMK9edX5a3GxagB+CmDJ9YsgfAGs9Ss4AS XMwjLo/2YsGzzz+1NoDnc98cQoF59DEg3hjQkY6RQ3iqUj+xdOfq1ZLD1BYhxFZ2rUkj qZ0hAhBqzHH3m0/tdUd2MRy/zKYCaKd0E7sQJjKOghfCM6vhGXNUYoxZ8fFGAy+0e9+O kPGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778481746; x=1779086546; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=6WETen+kRNNiAQvSfnOnKOKODS+5kYfhp3vdgbGUFvE=; b=PlPWdZIxgy/BPUJnNaj9BXWU4MVFb2RPrhR1MCzTVA3Zgf2JKa1tqPPJDc6UcIdp5k /K0PaEoFAgGRmr+4TUTiL28zgnGPHlhX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YxEwgBnTCg== X-Received: by 2002:a05:6a00:12d2:b0:837:e9cc:d470 with SMTP id d2e1a72fcca58-83a5bfbd016mr22454757b3a.20.1778481745668; Sun, 10 May 2026 23:42:25 -0700 (PDT) Received: from localhost.localdomain ([103.158.43.41]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-83967dbcf36sm23339343b3a.41.2026.05.10.23.42.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 May 2026 23:42:25 -0700 (PDT) From: Abdun Nihaal To: vireshk@kernel.org Cc: Abdun Nihaal , nm@ti.com, sboyd@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, jcalligeros99@gmail.com, stable@vger.kernel.org Subject: [PATCH] OPP: of: Fix potential memory leak in opp_parse_supplies() Date: Mon, 11 May 2026 12:12:11 +0530 Message-ID: <20260511064213.33638-1-nihaal@cse.iitm.ac.in> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The memory allocated for microvolt, microamp and microwatt is not freed in one of the paths in opp_parse_supplies() which returns directly. Fix that by adding a goto to the error unwind ladder. Fixes: 2eedf62e66c2 ("OPP: decouple dt properties in opp_parse_supplies()") Cc: stable@vger.kernel.org Signed-off-by: Abdun Nihaal --- Compile tested only. Issue found using static analysis. drivers/opp/of.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/opp/of.c b/drivers/opp/of.c index f96adfd5b219..c02e20632fa6 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -673,7 +673,7 @@ static int opp_parse_supplies(struct dev_pm_opp *opp, s= truct device *dev, */ if (unlikely(opp_table->regulator_count =3D=3D -1)) { opp_table->regulator_count =3D 0; - return 0; + goto free_microwatt; } =20 for (i =3D 0, j =3D 0; i < opp_table->regulator_count; i++) { @@ -696,6 +696,7 @@ static int opp_parse_supplies(struct dev_pm_opp *opp, s= truct device *dev, opp->supplies[i].u_watt =3D microwatt[i]; } =20 +free_microwatt: kfree(microwatt); free_microamp: kfree(microamp); --=20 2.43.0