mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
gpu: host1x: Fix potential double free if IOMMU is disabled
[ Upstream commit8466ff24a3] If context device has no IOMMU, the 'cdl->devs' is freed in error path, but host1x_memory_context_list_init() doesn't return an error code, so the module can be loaded successfully, when it's unloading, the host1x_memory_context_list_free() is called in host1x_remove(), it will cause double free. Set the 'cdl->devs' to NULL after freeing it to avoid double free. Fixes:8aa5bcb616("gpu: host1x: Add context device management code") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
62cb9c468d
commit
b81cfee967
@@ -87,6 +87,7 @@ del_devices:
|
||||
device_del(&cdl->devs[i].dev);
|
||||
|
||||
kfree(cdl->devs);
|
||||
cdl->devs = NULL;
|
||||
cdl->len = 0;
|
||||
|
||||
return err;
|
||||
|
||||
Reference in New Issue
Block a user