OSDN Git Service

firmware: arm_scmi: Fix chan_free cleanup on SMC
authorCristian Marussi <cristian.marussi@arm.com>
Wed, 19 Jul 2023 17:35:33 +0000 (18:35 +0100)
committerSudeep Holla <sudeep.holla@arm.com>
Thu, 20 Jul 2023 12:31:58 +0000 (13:31 +0100)
commitd1ff11d7ad8704f8d615f6446041c221b2d2ec4d
tree67436a6a3e423e2a11bf9cc22f96ed5cc18edef0
parentda042eb4f061a0b54aedadcaa15391490c48e1ad
firmware: arm_scmi: Fix chan_free cleanup on SMC

SCMI transport based on SMC can optionally use an additional IRQ to
signal message completion. The associated interrupt handler is currently
allocated using devres but on shutdown the core SCMI stack will call
.chan_free() well before any managed cleanup is invoked by devres.
As a consequence, the arrival of a late reply to an in-flight pending
transaction could still trigger the interrupt handler well after the
SCMI core has cleaned up the channels, with unpleasant results.

Inhibit further message processing on the IRQ path by explicitly freeing
the IRQ inside .chan_free() callback itself.

Fixes: dd820ee21d5e ("firmware: arm_scmi: Augment SMC/HVC to allow optional interrupt")
Reported-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Link: https://lore.kernel.org/r/20230719173533.2739319-1-cristian.marussi@arm.com
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
drivers/firmware/arm_scmi/smc.c