summaryrefslogtreecommitdiff
path: root/net/compat.c
diff options
context:
space:
mode:
authorJianglei Nie <niejianglei2021@163.com>2022-07-05 16:25:46 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-10-26 14:25:17 +0300
commit5d6093c49c098d86c7b136aba9922df44aeb6944 (patch)
tree672dc0f50947de299ba8f53861e04b317d4d9e24 /net/compat.c
parent57f1a89a8e4ea0ffd3ab7321371e226b2dbbd0a5 (diff)
downloadlinux-5d6093c49c098d86c7b136aba9922df44aeb6944.tar.xz
drm/nouveau: fix a use-after-free in nouveau_gem_prime_import_sg_table()
commit 540dfd188ea2940582841c1c220bd035a7db0e51 upstream. nouveau_bo_init() is backed by ttm_bo_init() and ferries its return code back to the caller. On failures, ttm will call nouveau_bo_del_ttm() and free the memory.Thus, when nouveau_bo_init() returns an error, the gem object has already been released. Then the call to nouveau_bo_ref() will use the freed "nvbo->bo" and lead to a use-after-free bug. We should delete the call to nouveau_bo_ref() to avoid the use-after-free. Signed-off-by: Jianglei Nie <niejianglei2021@163.com> Reviewed-by: Lyude Paul <lyude@redhat.com> Signed-off-by: Lyude Paul <lyude@redhat.com> Fixes: 019cbd4a4feb ("drm/nouveau: Initialize GEM object before TTM object") Cc: Thierry Reding <treding@nvidia.com> Cc: <stable@vger.kernel.org> # v5.4+ Link: https://patchwork.freedesktop.org/patch/msgid/20220705132546.2247677-1-niejianglei2021@163.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/compat.c')
0 files changed, 0 insertions, 0 deletions