linux-uconsole/drivers/firmware/arm_scmi
Wen Yang 372098d54b firmware: arm_scmi: Avoid double free in error flow
[ Upstream commit 8305e90a89 ]

If device_register() fails, both put_device() and kfree() are called,
ending with a double free of the scmi_dev.

Calling kfree() is needed only when a failure happens between the
allocation of the scmi_dev and its registration, so move it to there
and remove it from the error flow.

Fixes: 46edb8d132 ("firmware: arm_scmi: provide the mandatory device release callback")
Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-17 20:35:52 +01:00
..
base.c firmware: arm_scmi: use strlcpy to ensure NULL-terminated strings 2019-11-20 18:46:14 +01:00
bus.c firmware: arm_scmi: Avoid double free in error flow 2019-12-17 20:35:52 +01:00
clock.c firmware: arm_scmi: use strlcpy to ensure NULL-terminated strings 2019-11-20 18:46:14 +01:00
common.h firmware: arm_scmi: drop unused con_priv structure member 2018-05-10 10:51:58 +01:00
driver.c firmware: arm_scmi: Check if platform has released shmem before using 2019-10-05 13:09:39 +02:00
Makefile firmware: arm_scmi: add device power domain support using genpd 2018-02-28 16:37:57 +00:00
perf.c firmware: arm_scmi: use strlcpy to ensure NULL-terminated strings 2019-11-20 18:46:14 +01:00
power.c firmware: arm_scmi: use strlcpy to ensure NULL-terminated strings 2019-11-20 18:46:14 +01:00
scmi_pm_domain.c firmware: arm_scmi: add device power domain support using genpd 2018-02-28 16:37:57 +00:00
sensors.c firmware: arm_scmi: use strlcpy to ensure NULL-terminated strings 2019-11-20 18:46:14 +01:00