Skip to content

Commit 369496d

Browse files
ISCAS-Vulabgregkh
authored andcommitted
fpga: region: fix use-after-free in child_regions_with_firmware()
commit 54f3c56 upstream. Move of_node_put(child_region) after the error print to avoid accessing freed memory when pr_err() references child_region. Fixes: 0fa20cd ("fpga: fpga-region: device tree control for FPGA") Cc: stable@vger.kernel.org Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> [ Yilun: Fix the Fixes tag ] Reviewed-by: Xu Yilun <yilun.xu@intel.com> Link: https://lore.kernel.org/r/20260408154534.404327-1-vulab@iscas.ac.cn Signed-off-by: Xu Yilun <yilun.xu@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b3a3831 commit 369496d

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

drivers/fpga/of-fpga-region.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,10 @@ static int child_regions_with_firmware(struct device_node *overlay)
168168
fpga_region_of_match);
169169
}
170170

171-
of_node_put(child_region);
172-
173171
if (ret)
174172
pr_err("firmware-name not allowed in child FPGA region: %pOF",
175173
child_region);
174+
of_node_put(child_region);
176175

177176
return ret;
178177
}

0 commit comments

Comments
 (0)