Skip to content
Commit d6c11251 authored by Vaishnav Achath's avatar Vaishnav Achath Committed by Xulin Sun
Browse files

spi: cadence-quadspi: Remove spi_master_put() in probe failure path

commit b117e42c648a4f16ea5f885a7d652f8b521f4a9d from
git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git



commit 8523c968 upstream.

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: 606e5d40 ("spi: cadence-quadspi: Handle spi_unregister_master() in remove()")

Signed-off-by: default avatarVaishnav Achath <vaishnav.a@ti.com>
Link: https://lore.kernel.org/r/20220601071611.11853-1-vaishnav.a@ti.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarVignesh Raghavendra <vigneshr@ti.com>
Signed-off-by: default avatarXulin Sun <xulin.sun@windriver.com>
parent eb96b18d
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