diff options
| author | Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> | 2026-11-01 13:08:39 +0100 |
|---|---|---|
| committer | Krzysztof Kozlowski <krzk@kernel.org> | 2026-11-03 11:22:00 +0100 |
| commit | a78ee2e05f7c7dd09e58ea615960105f78dc3c75 (patch) | |
| tree | 663b13661530620d7332aa9fd2ca84eec8b71f91 /tools/perf/scripts/python | |
| parent | c3cc990de568e949bf6a3cc93c8950bc1bd58dc1 (diff) | |
memory: fsl_ifc: Clear fsl_ifc_ctrl_dev on probe failure and removal
Global fsl_ifc_ctrl_dev is allocated with devm_kzalloc(), so it is freed
when probe fails or when the device is unbound, but the exported global
pointer is never reset. Subsequent calls to fsl_ifc_find() or probing
of fsl_ifc_nand would then pass the NULL check and dereference freed
memory. Issue is mostly theoretical, because there are no users/calls
to fsl_ifc_find().
Rework the logic, so the global fsl_ifc_ctrl_dev is assigned only after
device state is properly initialized in probe(), except requesting
interrupts. This makes sure that early call to fsl_ifc_find() will not
use the device driver while it is not fully initialized.
Clear the global pointer on exit and error paths, to fix the possible
use-after-free.
Reported-by: Reid Downing <skibletz@gmail.com>
Closes: https://lore.kernel.org/all/20261025170833.1316443-1-skibletz@gmail.com/
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-72f58ab4-9f9d-4b00-949c-00929918a3b3
Fixes: 8e0d09b1232d ("memory: fsl_ifc: fix leak of private memory on probe failure")
Fixes: a20cbdeffce2 ("powerpc/fsl: Add support for Integrated Flash Controller")
Cc: stable@vger.kernel.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://patch.msgid.link/20261101120838.36227-2-krzysztof.kozlowski@oss.qualcomm.com
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
