All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.4 01/55] drm/virtio: fix NULL pointer dereference in virtio_gpu_conn_get_modes
@ 2022-05-30 13:46 ` Sasha Levin
  0 siblings, 0 replies; 89+ messages in thread
From: Sasha Levin @ 2022-05-30 13:46 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sasha Levin, airlied, Liu Zixian, dri-devel, virtualization, daniel

From: Liu Zixian <liuzixian4@huawei.com>

[ Upstream commit 194d250cdc4a40ccbd179afd522a9e9846957402 ]

drm_cvt_mode may return NULL and we should check it.

This bug is found by syzkaller:

FAULT_INJECTION stacktrace:
[  168.567394] FAULT_INJECTION: forcing a failure.
name failslab, interval 1, probability 0, space 0, times 1
[  168.567403] CPU: 1 PID: 6425 Comm: syz Kdump: loaded Not tainted 4.19.90-vhulk2201.1.0.h1035.kasan.eulerosv2r10.aarch64 #1
[  168.567406] Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
[  168.567408] Call trace:
[  168.567414]  dump_backtrace+0x0/0x310
[  168.567418]  show_stack+0x28/0x38
[  168.567423]  dump_stack+0xec/0x15c
[  168.567427]  should_fail+0x3ac/0x3d0
[  168.567437]  __should_failslab+0xb8/0x120
[  168.567441]  should_failslab+0x28/0xc0
[  168.567445]  kmem_cache_alloc_trace+0x50/0x640
[  168.567454]  drm_mode_create+0x40/0x90
[  168.567458]  drm_cvt_mode+0x48/0xc78
[  168.567477]  virtio_gpu_conn_get_modes+0xa8/0x140 [virtio_gpu]
[  168.567485]  drm_helper_probe_single_connector_modes+0x3a4/0xd80
[  168.567492]  drm_mode_getconnector+0x2e0/0xa70
[  168.567496]  drm_ioctl_kernel+0x11c/0x1d8
[  168.567514]  drm_ioctl+0x558/0x6d0
[  168.567522]  do_vfs_ioctl+0x160/0xf30
[  168.567525]  ksys_ioctl+0x98/0xd8
[  168.567530]  __arm64_sys_ioctl+0x50/0xc8
[  168.567536]  el0_svc_common+0xc8/0x320
[  168.567540]  el0_svc_handler+0xf8/0x160
[  168.567544]  el0_svc+0x10/0x218

KASAN stacktrace:
[  168.567561] BUG: KASAN: null-ptr-deref in virtio_gpu_conn_get_modes+0xb4/0x140 [virtio_gpu]
[  168.567565] Read of size 4 at addr 0000000000000054 by task syz/6425
[  168.567566]
[  168.567571] CPU: 1 PID: 6425 Comm: syz Kdump: loaded Not tainted 4.19.90-vhulk2201.1.0.h1035.kasan.eulerosv2r10.aarch64 #1
[  168.567573] Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
[  168.567575] Call trace:
[  168.567578]  dump_backtrace+0x0/0x310
[  168.567582]  show_stack+0x28/0x38
[  168.567586]  dump_stack+0xec/0x15c
[  168.567591]  kasan_report+0x244/0x2f0
[  168.567594]  __asan_load4+0x58/0xb0
[  168.567607]  virtio_gpu_conn_get_modes+0xb4/0x140 [virtio_gpu]
[  168.567612]  drm_helper_probe_single_connector_modes+0x3a4/0xd80
[  168.567617]  drm_mode_getconnector+0x2e0/0xa70
[  168.567621]  drm_ioctl_kernel+0x11c/0x1d8
[  168.567624]  drm_ioctl+0x558/0x6d0
[  168.567628]  do_vfs_ioctl+0x160/0xf30
[  168.567632]  ksys_ioctl+0x98/0xd8
[  168.567636]  __arm64_sys_ioctl+0x50/0xc8
[  168.567641]  el0_svc_common+0xc8/0x320
[  168.567645]  el0_svc_handler+0xf8/0x160
[  168.567649]  el0_svc+0x10/0x218

Signed-off-by: Liu Zixian <liuzixian4@huawei.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20220322091730.1653-1-liuzixian4@huawei.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/virtio/virtgpu_display.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
index e622485ae826..7e34307eb075 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -174,6 +174,8 @@ static int virtio_gpu_conn_get_modes(struct drm_connector *connector)
 		DRM_DEBUG("add mode: %dx%d\n", width, height);
 		mode = drm_cvt_mode(connector->dev, width, height, 60,
 				    false, false, false);
+		if (!mode)
+			return count;
 		mode->type |= DRM_MODE_TYPE_PREFERRED;
 		drm_mode_probed_add(connector, mode);
 		count++;
-- 
2.35.1

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 89+ messages in thread

end of thread, other threads:[~2022-06-05 14:02 UTC | newest]

Thread overview: 89+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-30 13:46 [PATCH AUTOSEL 5.4 01/55] drm/virtio: fix NULL pointer dereference in virtio_gpu_conn_get_modes Sasha Levin
2022-05-30 13:46 ` Sasha Levin
2022-05-30 13:46 ` Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 02/55] mwifiex: add mutex lock for call in mwifiex_dfs_chan_sw_work_queue Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 03/55] b43legacy: Fix assigning negative value to unsigned variable Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 04/55] b43: " Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 05/55] ipw2x00: Fix potential NULL dereference in libipw_xmit() Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 06/55] ipv6: fix locking issues with loops over idev->addr_list Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 07/55] fbcon: Consistently protect deferred_takeover with console_lock() Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 08/55] ACPICA: Avoid cache flush inside virtual machines Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 09/55] drm/komeda: return early if drm_universal_plane_init() fails Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 10/55] ALSA: jack: Access input_dev under mutex Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 11/55] spi: spi-rspi: Remove setting {src,dst}_{addr,addr_width} based on DMA direction Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 12/55] tools/power turbostat: fix ICX DRAM power numbers Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 13/55] drm/amd/pm: fix double free in si_parse_power_table() Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 14/55] ath9k: fix QCA9561 PA bias level Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 15/55] media: venus: hfi: avoid null dereference in deinit Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 16/55] media: pci: cx23885: Fix the error handling in cx23885_initdev() Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 17/55] media: cx25821: Fix the warning when removing the module Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 18/55] md/bitmap: don't set sb values if can't pass sanity check Sasha Levin
2022-06-01 21:36   ` John Stoffel
2022-06-05 13:27     ` Sasha Levin
2022-06-05 14:01       ` John Stoffel
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 19/55] mmc: jz4740: Apply DMA engine limits to maximum segment size Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 20/55] drm/sun4i: Add support for D1 TCONs Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 21/55] scsi: megaraid: Fix error check return value of register_chrdev() Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 22/55] arm64/sme: Add ID_AA64SMFR0_EL1 to __read_sysreg_by_encoding() Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 23/55] drm/plane: Move range check for format_count earlier Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 24/55] drm/amd/pm: fix the compile warning Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 25/55] arm64: compat: Do not treat syscall number as ESR_ELx for a bad syscall Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 26/55] drm: msm: fix error check return value of irq_of_parse_and_map() Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 27/55] ipv6: Don't send rs packets to the interface of ARPHRD_TUNNEL Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 28/55] net/mlx5: fs, delete the FTE when there are no rules attached to it Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 29/55] ASoC: dapm: Don't fold register value changes into notifications Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 30/55] mlxsw: spectrum_dcb: Do not warn about priority changes Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 31/55] drm/amdgpu/ucode: Remove firmware load type check in amdgpu_ucode_free_bo Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 32/55] HID: bigben: fix slab-out-of-bounds Write in bigben_probe Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 33/55] ASoC: tscs454: Add endianness flag in snd_soc_component_driver Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 34/55] net: remove two BUG() from skb_checksum_help() Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 35/55] s390/preempt: disable __preempt_count_add() optimization for PROFILE_ALL_BRANCHES Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 36/55] spi: stm32-qspi: Fix wait_cmd timeout in APM mode Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 37/55] dma-debug: change allocation mode from GFP_NOWAIT to GFP_ATIOMIC Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 38/55] ACPI: PM: Block ASUS B1400CEAE from suspend to idle by default Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 39/55] ipmi:ssif: Check for NULL msg when handling events and messages Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 40/55] ipmi: Fix pr_fmt to avoid compilation issues Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 41/55] rtlwifi: Use pr_warn instead of WARN_ONCE Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 42/55] media: coda: limit frame interval enumeration to supported encoder frame sizes Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 43/55] media: cec-adap.c: fix is_configuring state Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 44/55] openrisc: start CPU timer early in boot Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 45/55] nvme-pci: fix a NULL pointer dereference in nvme_alloc_admin_tags Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 46/55] ASoC: rt5645: Fix errorenous cleanup order Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 47/55] nbd: Fix hung on disconnect request if socket is closed before Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 48/55] net: phy: micrel: Allow probing without .driver_data Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 49/55] media: exynos4-is: Fix compile warning Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 50/55] ASoC: max98357a: remove dependency on GPIOLIB Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 51/55] ARM: 9201/1: spectre-bhb: rely on linker to emit cross-section literal loads Sasha Levin
2022-05-30 13:46   ` Sasha Levin
2022-05-30 13:52   ` Ard Biesheuvel
2022-05-30 13:52     ` Ard Biesheuvel
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 52/55] hwmon: Make chip parameter for with_info API mandatory Sasha Levin
2022-05-30 14:29   ` Guenter Roeck
2022-05-30 13:46 ` [PATCH AUTOSEL 5.4 53/55] rxrpc: Return an error to sendmsg if call failed Sasha Levin
2022-05-30 13:47 ` [PATCH AUTOSEL 5.4 54/55] eth: tg3: silence the GCC 12 array-bounds warning Sasha Levin
2022-05-30 13:47 ` [PATCH AUTOSEL 5.4 55/55] selftests/bpf: fix btf_dump/btf_dump due to recent clang change Sasha Levin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.