* [PATCH] fpga: region: fix use-after-free in child_regions_with_firmware()
@ 2026-04-08 15:45 Wentao Liang
2026-05-04 11:22 ` Xu Yilun
0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-04-08 15:45 UTC (permalink / raw)
To: Moritz Fischer, Xu Yilun
Cc: Tom Rix, linux-fpga, linux-kernel, Wentao Liang, stable
Move of_node_put(child_region) after the error print to avoid accessing
freed memory when pr_err() references child_region.
Fixes: ef3acdd82075 ("fpga: region: move device tree support to of-fpga-region.c")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/fpga/of-fpga-region.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/fpga/of-fpga-region.c b/drivers/fpga/of-fpga-region.c
index caa091224dc5..9107a5b461d3 100644
--- a/drivers/fpga/of-fpga-region.c
+++ b/drivers/fpga/of-fpga-region.c
@@ -168,11 +168,10 @@ static int child_regions_with_firmware(struct device_node *overlay)
fpga_region_of_match);
}
- of_node_put(child_region);
-
if (ret)
pr_err("firmware-name not allowed in child FPGA region: %pOF",
child_region);
+ of_node_put(child_region);
return ret;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] fpga: region: fix use-after-free in child_regions_with_firmware()
2026-04-08 15:45 [PATCH] fpga: region: fix use-after-free in child_regions_with_firmware() Wentao Liang
@ 2026-05-04 11:22 ` Xu Yilun
0 siblings, 0 replies; 2+ messages in thread
From: Xu Yilun @ 2026-05-04 11:22 UTC (permalink / raw)
To: Wentao Liang
Cc: Moritz Fischer, Xu Yilun, Tom Rix, linux-fpga, linux-kernel,
stable
On Wed, Apr 08, 2026 at 03:45:34PM +0000, Wentao Liang wrote:
> Move of_node_put(child_region) after the error print to avoid accessing
> freed memory when pr_err() references child_region.
>
> Fixes: ef3acdd82075 ("fpga: region: move device tree support to of-fpga-region.c")
The Fixes tag should identify the commit that introduced the problem, so
it should be:
Fixes: 0fa20cdfcc1f ("fpga: fpga-region: device tree control for FPGA")
I fixed it in place.
Reviewed-by: Xu Yilun <yilun.xu@intel.com>
Applied to for-next
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-04 11:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-08 15:45 [PATCH] fpga: region: fix use-after-free in child_regions_with_firmware() Wentao Liang
2026-05-04 11:22 ` Xu Yilun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox