WSL2-Linux-Kernel/drivers/gpu/drm/nouveau
Jianglei Nie 5ab84b1596 drm/nouveau/nouveau_bo: fix potential memory leak in nouveau_bo_alloc()
[ Upstream commit 6dc548745d ]

nouveau_bo_alloc() allocates a memory chunk for "nvbo" with kzalloc().
When some error occurs, "nvbo" should be released. But when
WARN_ON(pi < 0)) equals true, the function return ERR_PTR without
releasing the "nvbo", which will lead to a memory leak.

We should release the "nvbo" with kfree() if WARN_ON(pi < 0)) equals true.

Signed-off-by: Jianglei Nie <niejianglei2021@163.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220705094306.2244103-1-niejianglei2021@163.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-10-26 12:35:38 +02:00
..
dispnv04 drm/nouveau/kms/nv04: use vzalloc for nv04_display 2022-01-27 11:05:11 +01:00
dispnv50 drm/nouveau/kms/nv50-: atom: fix an incorrect NULL check on list iterator 2022-06-09 10:23:25 +02:00
include drm/nouveau/subdev/bus: Ratelimit logging for fault errors 2022-06-09 10:23:24 +02:00
nvif drm/nouveau: rip out nvkm_client.super 2021-08-18 19:00:15 +10:00
nvkm drm/nouveau: recognise GA103 2022-08-25 11:39:54 +02:00
Kbuild
Kconfig drm/gem: Use struct dma_buf_map in GEM vmap ops and convert GEM backends 2020-11-09 09:19:24 +01:00
nouveau_abi16.c drm/nouveau: rip out nvkm_client.super 2021-08-18 19:00:15 +10:00
nouveau_abi16.h
nouveau_acpi.c drm/nouveau: Remove references to struct drm_device.pdev 2021-01-13 09:04:04 +01:00
nouveau_acpi.h
nouveau_backlight.c drm/nouveau: Fix a potential theorical leak in nouveau_get_backlight_name() 2022-05-18 10:26:49 +02:00
nouveau_bios.c drm/nouveau: remove set but not used variable ‘pdev’ in nouveau_bios_init 2021-02-09 17:16:57 +01:00
nouveau_bios.h
nouveau_bo.c drm/nouveau/nouveau_bo: fix potential memory leak in nouveau_bo_alloc() 2022-10-26 12:35:38 +02:00
nouveau_bo.h drm/ttm: device naming cleanup 2021-01-21 14:51:45 +01:00
nouveau_bo0039.c
nouveau_bo74c1.c
nouveau_bo85b5.c
nouveau_bo90b5.c
nouveau_bo5039.c
nouveau_bo9039.c
nouveau_boa0b5.c
nouveau_chan.c drm/nouveau/ga102-: support ttm buffer moves via copy engine 2021-10-06 11:05:45 +02:00
nouveau_chan.h
nouveau_connector.c drm/nouveau/kms/nv140-: Disable interlacing 2022-10-26 12:34:34 +02:00
nouveau_connector.h drm/nouveau/kms/nv50-: Add basic DPCD backlight support for nouveau 2021-06-09 13:35:56 -04:00
nouveau_crtc.h
nouveau_debugfs.c drm/nouveau/debugfs: fix file release memory leak 2021-10-06 11:12:29 +02:00
nouveau_debugfs.h
nouveau_display.c drm/nouveau/acpi: Don't print error when we get -EINPROGRESS from pm_runtime 2022-08-17 14:22:54 +02:00
nouveau_display.h drm/nouveau: Use drm_gem_ttm_dumb_map_offset() 2021-04-11 20:15:13 +02:00
nouveau_dma.c
nouveau_dma.h
nouveau_dmem.c nouveau/svm: Fix to migrate all requested pages 2022-08-03 12:03:42 +02:00
nouveau_dmem.h
nouveau_dp.c drm/nouveau/kms/nv50-: Fix clock checking algorithm in nv50_dp_mode_valid() 2020-10-30 09:34:13 +10:00
nouveau_drm.c drm/nouveau: clean up all clients on device removal 2021-11-25 09:49:05 +01:00
nouveau_drv.h drm/nouveau: Add a dedicated mutex for the clients list 2021-11-25 09:49:05 +01:00
nouveau_encoder.h drm/nouveau/kms/nv50-: Add basic DPCD backlight support for nouveau 2021-06-09 13:35:56 -04:00
nouveau_fbcon.c drm/nouveau: Don't pm_runtime_put_sync(), only pm_runtime_put_autosuspend() 2022-08-17 14:22:53 +02:00
nouveau_fbcon.h
nouveau_fence.c drm/nouveau: wait for the exclusive fence after the shared ones v2 2022-01-05 12:42:38 +01:00
nouveau_fence.h
nouveau_gem.c drm/ttm: remove ttm_bo_vm_insert_huge() 2021-11-18 19:17:08 +01:00
nouveau_gem.h drm/gem: Use struct dma_buf_map in GEM vmap ops and convert GEM backends 2020-11-09 09:19:24 +01:00
nouveau_hwmon.c
nouveau_hwmon.h
nouveau_ioc32.c
nouveau_ioctl.h
nouveau_led.c
nouveau_led.h
nouveau_mem.c drm/nouveau: rip out nvkm_client.super 2021-08-18 19:00:15 +10:00
nouveau_mem.h drm/ttm: flip the switch for driver allocated resources v2 2021-06-04 15:16:46 +02:00
nouveau_nvif.c drm/nouveau: rip out nvkm_client.super 2021-08-18 19:00:15 +10:00
nouveau_platform.c
nouveau_platform.h
nouveau_prime.c drm/nouveau: fix a use-after-free in nouveau_gem_prime_import_sg_table() 2022-10-26 12:34:34 +02:00
nouveau_reg.h
nouveau_sgdma.c drm/ttm: device naming cleanup 2021-01-21 14:51:45 +01:00
nouveau_svm.c drm/nouveau/svm: Fix refcount leak bug and missing check against null bug 2021-11-18 19:17:07 +01:00
nouveau_svm.h
nouveau_ttm.c swiotlb: Update is_swiotlb_active to add a struct device argument 2021-07-13 20:04:41 -04:00
nouveau_ttm.h drm/nouveau: Implement mmap as GEM object function 2021-05-26 20:56:33 +02:00
nouveau_usif.c drm/nouveau: block a bunch of classes from userspace 2021-08-18 19:00:13 +10:00
nouveau_usif.h
nouveau_vga.c vgaarb: don't pass a cookie to vga_client_register 2021-07-21 10:29:10 +02:00
nouveau_vga.h
nouveau_vmm.c drm/ttm: rename bo->mem and make it a pointer 2021-06-02 11:07:25 +02:00
nouveau_vmm.h
nv04_fbcon.c
nv04_fence.c
nv10_fence.c
nv10_fence.h
nv17_fence.c drm/ttm: rename bo->mem and make it a pointer 2021-06-02 11:07:25 +02:00
nv50_display.h
nv50_fbcon.c
nv50_fence.c drm/ttm: rename bo->mem and make it a pointer 2021-06-02 11:07:25 +02:00
nv84_fence.c drm/nouveau/ga102-: support ttm buffer moves via copy engine 2021-10-06 11:05:45 +02:00
nvc0_fbcon.c
nvc0_fence.c