mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
fpga: region: fix use-after-free in child_regions_with_firmware()
Move of_node_put(child_region) after the error print to avoid accessing
freed memory when pr_err() references child_region.
Fixes: 0fa20cdfcc ("fpga: fpga-region: device tree control for FPGA")
Cc: [email protected]
Signed-off-by: Wentao Liang <[email protected]>
[ Yilun: Fix the Fixes tag ]
Reviewed-by: Xu Yilun <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Xu Yilun <[email protected]>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user