Commit cb32eeb4 authored by Lv Yunlong's avatar Lv Yunlong Committed by Zheng Zengkai
Browse files

gpu/xen: Fix a use after free in xen_drm_drv_init



stable inclusion
from stable-5.10.32
commit 7a1cd9044da449f389b9a8b45da7f3c0eff77757
bugzilla: 51796

--------------------------------

[ Upstream commit 52762efa ]

In function displback_changed, has the call chain
displback_connect(front_info)->xen_drm_drv_init(front_info).
We can see that drm_info is assigned to front_info->drm_info
and drm_info is freed in fail branch in xen_drm_drv_init().

Later displback_disconnect(front_info) is called and it calls
xen_drm_drv_fini(front_info) cause a use after free by
drm_info = front_info->drm_info statement.

My patch has done two things. First fixes the fail label which
drm_info = kzalloc() failed and still free the drm_info.
Second sets front_info->drm_info to NULL to avoid uaf.

Signed-off-by: default avatarLv Yunlong <lyl2019@mail.ustc.edu.cn>
Reviewed-by: default avatarOleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: default avatarOleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210323014656.10068-1-lyl2019@mail.ustc.edu.cn


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarChen Jun <chenjun102@huawei.com>
Acked-by: default avatarWeilong Chen <chenweilong@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 4657c286
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment