Commit 73d5fe0
spi: cadence-quadspi: Remove spi_master_put() in probe failure path
Currently the spi_master is allocated by devm_spi_alloc_master()
and devres core manages the deallocation, but in probe failure
path spi_master_put() is being handled manually which causes
"refcount underflow use-after-free" warning when probe failure happens
after allocating spi_master.
Trimmed backtrace during failure:
refcount_t: underflow; use-after-free.
pc : refcount_warn_saturate+0xf4/0x144
Call trace:
refcount_warn_saturate
kobject_put
put_device
devm_spi_release_controller
devres_release_all
This commit makes relevant changes to remove spi_master_put() from probe
failure path.
Fixes: 606e5d4 ("spi: cadence-quadspi: Handle spi_unregister_master() in remove()")
Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com>
Link: https://lore.kernel.org/r/20220601071611.11853-1-vaishnav.a@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>1 parent a77c46f commit 73d5fe0
1 file changed
Lines changed: 7 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1578 | 1578 | | |
1579 | 1579 | | |
1580 | 1580 | | |
1581 | | - | |
1582 | | - | |
| 1581 | + | |
1583 | 1582 | | |
1584 | 1583 | | |
1585 | 1584 | | |
1586 | 1585 | | |
1587 | 1586 | | |
1588 | 1587 | | |
1589 | 1588 | | |
1590 | | - | |
| 1589 | + | |
1591 | 1590 | | |
1592 | 1591 | | |
1593 | 1592 | | |
| |||
1596 | 1595 | | |
1597 | 1596 | | |
1598 | 1597 | | |
1599 | | - | |
| 1598 | + | |
1600 | 1599 | | |
1601 | 1600 | | |
1602 | 1601 | | |
| |||
1605 | 1604 | | |
1606 | 1605 | | |
1607 | 1606 | | |
1608 | | - | |
| 1607 | + | |
1609 | 1608 | | |
1610 | 1609 | | |
1611 | 1610 | | |
| |||
1614 | 1613 | | |
1615 | 1614 | | |
1616 | 1615 | | |
1617 | | - | |
1618 | | - | |
1619 | | - | |
1620 | | - | |
| 1616 | + | |
| 1617 | + | |
1621 | 1618 | | |
1622 | 1619 | | |
1623 | 1620 | | |
1624 | 1621 | | |
1625 | | - | |
| 1622 | + | |
1626 | 1623 | | |
1627 | 1624 | | |
1628 | 1625 | | |
| |||
1716 | 1713 | | |
1717 | 1714 | | |
1718 | 1715 | | |
1719 | | - | |
1720 | | - | |
1721 | 1716 | | |
1722 | 1717 | | |
1723 | 1718 | | |
| |||
0 commit comments