8b2b4b2c7fe13d44ff14b091909107b52c72516d
[openwrt/staging/linusw.git] /
1 From 1e53604087930e7cf42eee3d42572d0d6f54c86a Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Tue, 7 May 2024 11:44:49 +0100
4 Subject: [PATCH 1084/1085] drm/vc4: Fix potential null pointer read when
5 disabling vblank
6
7 vc4_disable_vblank assumed that vc4_encoder was always assigned,
8 which isn't guaranteed.
9
10 If it isn't assigned then disable the interrupt anyway as it's
11 not connected.
12
13 https://github.com/raspberrypi/linux/issues/6146
14
15 Fixes: 63c0bcc4b747 ("drm/vc4: Add option to call from crtc to encoder on vblank")
16 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
17 ---
18 drivers/gpu/drm/vc4/vc4_crtc.c | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
20
21 --- a/drivers/gpu/drm/vc4/vc4_crtc.c
22 +++ b/drivers/gpu/drm/vc4/vc4_crtc.c
23 @@ -834,7 +834,7 @@ static void vc4_disable_vblank(struct dr
24 if (!drm_dev_enter(dev, &idx))
25 return;
26
27 - if (vc4_encoder->type != VC4_ENCODER_TYPE_DSI0)
28 + if (!vc4_encoder || vc4_encoder->type != VC4_ENCODER_TYPE_DSI0)
29 CRTC_WRITE(PV_INTEN, 0);
30
31 drm_dev_exit(idx);