Skip to content

Commit

Permalink
interconnect: core: fix error return code of icc_link_destroy()
Browse files Browse the repository at this point in the history
When krealloc() fails and new is NULL, no error return code of
icc_link_destroy() is assigned.
To fix this bug, ret is assigned with -ENOMEM hen new is NULL.

Reported-by: TOTE Robot <[email protected]>
Signed-off-by: Jia-Ju Bai <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Georgi Djakov <[email protected]>
  • Loading branch information
XidianGeneral authored and Georgi Djakov committed Mar 8, 2021
1 parent 7c911f9 commit 715ea61
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/interconnect/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,8 @@ int icc_link_destroy(struct icc_node *src, struct icc_node *dst)
GFP_KERNEL);
if (new)
src->links = new;
else
ret = -ENOMEM;

out:
mutex_unlock(&icc_lock);
Expand Down

0 comments on commit 715ea61

Please sign in to comment.