mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-08 02:15:20 +02:00
firmware: arm_scmi: Fix double free in OPTEE transport
[ Upstream commite98dba934b
] Channels can be shared between protocols, avoid freeing the same channel descriptors twice when unloading the stack. Fixes:5f90f189a0
("firmware: arm_scmi: Add optee transport") Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Tested-by: Peng Fan <peng.fan@nxp.com> #i.MX95 19x19 EVK Reviewed-by: Peng Fan <peng.fan@nxp.com> Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Message-Id: <20240812173340.3912830-2-cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
bd7fa63736
commit
6699567b0b
|
@ -467,6 +467,13 @@ static int scmi_optee_chan_free(int id, void *p, void *data)
|
|||
struct scmi_chan_info *cinfo = p;
|
||||
struct scmi_optee_channel *channel = cinfo->transport_info;
|
||||
|
||||
/*
|
||||
* Different protocols might share the same chan info, so a previous
|
||||
* call might have already freed the structure.
|
||||
*/
|
||||
if (!channel)
|
||||
return 0;
|
||||
|
||||
mutex_lock(&scmi_optee_private->mu);
|
||||
list_del(&channel->link);
|
||||
mutex_unlock(&scmi_optee_private->mu);
|
||||
|
|
Loading…
Reference in New Issue
Block a user