Commit 29afbd7
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: a43f72a ("phy: cadence: Sierra: Change MAX_LANES of Sierra to 16")
Fixes: 44d30d6 ("phy: cadence: Add driver for Sierra PHY")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20220115115146.GC7552@kili
Signed-off-by: Vinod Koul <vkoul@kernel.org>1 parent 6d1e6bc commit 29afbd7
1 file changed
Lines changed: 21 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1338 | 1338 | | |
1339 | 1339 | | |
1340 | 1340 | | |
1341 | | - | |
| 1341 | + | |
1342 | 1342 | | |
1343 | 1343 | | |
1344 | 1344 | | |
| |||
1416 | 1416 | | |
1417 | 1417 | | |
1418 | 1418 | | |
1419 | | - | |
| 1419 | + | |
| 1420 | + | |
1420 | 1421 | | |
1421 | 1422 | | |
1422 | 1423 | | |
1423 | 1424 | | |
1424 | 1425 | | |
1425 | 1426 | | |
1426 | 1427 | | |
1427 | | - | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
1428 | 1431 | | |
1429 | 1432 | | |
1430 | 1433 | | |
| |||
1434 | 1437 | | |
1435 | 1438 | | |
1436 | 1439 | | |
1437 | | - | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
1438 | 1443 | | |
1439 | 1444 | | |
1440 | 1445 | | |
| |||
1446 | 1451 | | |
1447 | 1452 | | |
1448 | 1453 | | |
1449 | | - | |
| 1454 | + | |
1450 | 1455 | | |
1451 | 1456 | | |
1452 | 1457 | | |
1453 | 1458 | | |
1454 | 1459 | | |
1455 | 1460 | | |
1456 | | - | |
| 1461 | + | |
1457 | 1462 | | |
1458 | 1463 | | |
1459 | 1464 | | |
1460 | 1465 | | |
1461 | | - | |
1462 | | - | |
1463 | | - | |
1464 | | - | |
1465 | | - | |
1466 | | - | |
1467 | | - | |
1468 | | - | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
1469 | 1476 | | |
1470 | 1477 | | |
1471 | 1478 | | |
| |||
0 commit comments