Commit 81122fb
of: fix reference count leak in of_alias_scan()
of_find_node_by_path() returns a device_node with its refcount
incremented. When kstrtoint() fails or dt_alloc() fails, the function
continues to the next iteration without calling of_node_put(), causing
a reference count leak.
Add of_node_put(np) before continue on both error paths to properly
release the device_node reference.
Fixes: 611cad7 ("dt: add of_alias_scan and of_alias_get_id")
Cc: stable@vger.kernel.org
Signed-off-by: Weigang He <geoffreyhe2@gmail.com>
Link: https://patch.msgid.link/20260117091238.481243-1-geoffreyhe2@gmail.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>1 parent 48e6a9c commit 81122fb
1 file changed
+6
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1942 | 1942 | | |
1943 | 1943 | | |
1944 | 1944 | | |
1945 | | - | |
| 1945 | + | |
| 1946 | + | |
1946 | 1947 | | |
| 1948 | + | |
1947 | 1949 | | |
1948 | 1950 | | |
1949 | 1951 | | |
1950 | | - | |
| 1952 | + | |
| 1953 | + | |
1951 | 1954 | | |
| 1955 | + | |
1952 | 1956 | | |
1953 | 1957 | | |
1954 | 1958 | | |
| |||
0 commit comments