From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 754C9424331; Sat, 28 Feb 2026 17:46:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772300779; cv=none; b=qAflvvClW5oSzlR0HSc+63ifN13Lh0urPNI+JX6kziTygUlVJ2yMIahUYzVjcLiczeK9z8ORWa+rhzJOULh5NkyVCi6rr5FzUU00vm0Tm0lHGNw2DyyIcUHTjr6pbA2Q3HeXU6ezyQYrg53hw1L9XDGn9J7D04qzAtE8RWajnPE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772300779; c=relaxed/simple; bh=M8MWHRNU2U3V/ORthrQefka7sZGGqMMKX/UwrSEEr04=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qg2kymO7ZFjcqBtHnyg6tJDJLy9Hr8bxQjsIHUaRBFXPZ8v5D+hm/pK0y2Z7eXQ0oGf7OmwnAK8UN8eoGzzsbZPZFFv8pXfh7U25blEqmHVh1kG+RlWM6cw52cAvLMWlyBJRJwRAVEYCP8bTuyKj3U7UityyDmuzeQx92oCj9fE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Uft/8JNL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Uft/8JNL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1D0CC116D0; Sat, 28 Feb 2026 17:46:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772300779; bh=M8MWHRNU2U3V/ORthrQefka7sZGGqMMKX/UwrSEEr04=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uft/8JNLcimCPmle/E8K6YPVnxo6RP1hXDGjIzQnv8O4di0UjpHEDaHn+hIUMl8W5 uwcr3diQXcsIff5yaoTxbz1VTAp8pMZ63TVDnWpXJJDcf4J0XrU0g5evSjVCZfczaN V0SBVopKd5gO1FvnnC0fS1z2doJH/a167rNrlOjcOUVQRqQBf+t39u2vJfj15MIytn mcJnzUqASor/XQcYjPXrUWFS6YhNrj/GxDESdthdD/Hhrc/SekHYcBeeQpNsKEJlBK LYsSiGqNAcpwS00h1Qg0DWMnV6PyPLDeW33q1ybwcuNcE8erEeCVAkOxPbzRuSfuc9 jKogJ8hd6SiMg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Weigang He , Helge Deller , Sasha Levin Subject: [PATCH 6.19 810/844] fbdev: of: display_timing: fix refcount leak in of_get_display_timings() Date: Sat, 28 Feb 2026 12:32:03 -0500 Message-ID: <20260228173244.1509663-811-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260228173244.1509663-1-sashal@kernel.org> References: <20260228173244.1509663-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Weigang He [ Upstream commit eacf9840ae1285a1ef47eb0ce16d786e542bd4d7 ] of_parse_phandle() returns a device_node with refcount incremented, which is stored in 'entry' and then copied to 'native_mode'. When the error paths at lines 184 or 192 jump to 'entryfail', native_mode's refcount is not decremented, causing a refcount leak. Fix this by changing the goto target from 'entryfail' to 'timingfail', which properly calls of_node_put(native_mode) before cleanup. Fixes: cc3f414cf2e4 ("video: add of helper for display timings/videomode") Cc: stable@vger.kernel.org Signed-off-by: Weigang He Signed-off-by: Helge Deller Signed-off-by: Sasha Levin --- drivers/video/of_display_timing.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/of_display_timing.c b/drivers/video/of_display_timing.c index a4cd446ac5a59..a6ec392253c3e 100644 --- a/drivers/video/of_display_timing.c +++ b/drivers/video/of_display_timing.c @@ -181,7 +181,7 @@ struct display_timings *of_get_display_timings(const struct device_node *np) if (disp->num_timings == 0) { /* should never happen, as entry was already found above */ pr_err("%pOF: no timings specified\n", np); - goto entryfail; + goto timingfail; } disp->timings = kcalloc(disp->num_timings, @@ -189,7 +189,7 @@ struct display_timings *of_get_display_timings(const struct device_node *np) GFP_KERNEL); if (!disp->timings) { pr_err("%pOF: could not allocate timings array\n", np); - goto entryfail; + goto timingfail; } disp->num_timings = 0; -- 2.51.0