From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD60842B32A; Tue, 21 Jul 2026 19:19:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784661549; cv=none; b=SwHZeF6Sy8yr+Z38VnhDcyl7XyAXDfEne9BStXmazAwncFPTXuQ2DRgHa0AZed7cErbCc8nbhAZUEvleMkd46ujlmkuoXWUDIPk1s08Ib5XJhLOGh7yplgY/D5nxF1umlUajiYIK+O0d9UYHSjSfcoW5LAIYYk8y9okea/XWaOk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784661549; c=relaxed/simple; bh=nx+Nz97XTbjDwRhWa2Xz/7c0k7xV+ZVaf/RUtIiUVP8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e3KWZSQcApH9LxkHuuo2Soi7JLoKvIyY8qQ+DMO1OLXEALKU2YUmfzdX9On3lNLvHYq/e579AtMZY3+iY5R+yLND6XPByCAmiMWmzJq0JQsw0WuHHnV323xG3vpknsy2aD3GiK8WQt8zHqAE4Bn4imf567sQnLPUmRtR7BF+pdI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=L4HXqTTP; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="L4HXqTTP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 504451F000E9; Tue, 21 Jul 2026 19:19:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784661547; bh=c0I4Az0ohg1dQRwXNlXRqT5ntXG4GFF0+OVCZUIt8Ho=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=L4HXqTTPjLjN9DEMuErkBTQR+nVpBPn+co8AzJfyaR/PV7AR8N+Hd39505cUrmAvv oCI/o4jodIeeeuU3CyhhUVelTUnIu+3hb9tBKtY2PKGPZarjHbdzMmNGZ41VMOK+w/ e05vtmWICvX+2fRpT1jHMVYjU1oimyESt8SQ4/ic= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Felix Gu , Andre Przywara , Linus Walleij , Sasha Levin Subject: [PATCH 6.12 0091/1276] pinctrl: sunxi: fix regulator leak in sunxi_pmx_request() error path Date: Tue, 21 Jul 2026 17:08:54 +0200 Message-ID: <20260721152448.133148315@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152446.065700225@linuxfoundation.org> References: <20260721152446.065700225@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Felix Gu [ Upstream commit 334f7bcbdc79dc8e5b938ac3372453a5368221cf ] In the error path of sunxi_pmx_request(), the code calls regulator_put(s_reg->regulator) to release the regulator. However, s_reg->regulator is only assigned after a successful regulator_enable(). This causes a memory leak: the regulator obtained via regulator_get() is never properly released when regulator_enable() fails. Fixes: dc1445584177 ("pinctrl: sunxi: Fix and simplify pin bank regulator handling") Signed-off-by: Felix Gu Reviewed-by: Andre Przywara Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c index 8fbbdcc52debb1..ce811cb43651b7 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c @@ -880,7 +880,7 @@ static int sunxi_pmx_request(struct pinctrl_dev *pctldev, unsigned offset) return 0; out: - regulator_put(s_reg->regulator); + regulator_put(reg); return ret; } -- 2.53.0