mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
fpga: stratix10-soc: fix use-after-free on s10_init()
The refcount of fw_np has already been decreased by of_find_matching_node()
so it shouldn't be used anymore.
This patch adds an of_node_get() before of_find_matching_node() to avoid
the use-after-free problem.
Fixes: e7eef1d763 ("fpga: add intel stratix10 soc fpga manager driver")
Signed-off-by: Wen Yang <[email protected]>
Cc: Alan Tull <[email protected]>
Cc: Moritz Fischer <[email protected]>
Cc: Nicolas Saenz Julienne <[email protected]>
Cc: [email protected]
Cc: [email protected]
Reviewed-by: Moritz Fischer <[email protected]>
Reviewed-by: Nicolas Saenz Julienne <[email protected]>
Acked-by: Alan Tull <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
02bd610e85
commit
f5dd87326f
1 changed files with 5 additions and 1 deletions
|
|
@ -507,12 +507,16 @@ static int __init s10_init(void)
|
|||
if (!fw_np)
|
||||
return -ENODEV;
|
||||
|
||||
of_node_get(fw_np);
|
||||
np = of_find_matching_node(fw_np, s10_of_match);
|
||||
if (!np)
|
||||
if (!np) {
|
||||
of_node_put(fw_np);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
of_node_put(np);
|
||||
ret = of_platform_populate(fw_np, s10_of_match, NULL, NULL);
|
||||
of_node_put(fw_np);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue