Skip to content
Commit 29afbd76 authored by Dan Carpenter's avatar Dan Carpenter Committed by Vinod Koul
Browse files

phy: cadence: Sierra: fix error handling bugs in probe()

There are two bugs in the error handling:
1: If devm_of_phy_provider_register() fails then there was no cleanup.
2: The error handling called of_node_put(child) improperly leading to
   a use after free.  We are only holding the reference inside the loop
   so the last two gotos after the loop lead to a use after free bug.
   Fix this by cleaning up the partial allocations (or partial iterations)
   in the loop before doing the goto.

Fixes: a43f72ae ("phy: cadence: Sierra: Change MAX_LANES of Sierra to 16")
Fixes: 44d30d62

 ("phy: cadence: Add driver for Sierra PHY")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20220115115146.GC7552@kili


Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 6d1e6bcb
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment