mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/msm/dpu: Fix error pointers in dpu_plane_virtual_atomic_check
@ 2025-03-14  1:10 Chenyuan Yang
  2025-03-14  6:11 ` Dmitry Baryshkov
  2025-04-08 18:13 ` Abhinav Kumar
  0 siblings, 2 replies; 3+ messages in thread
From: Chenyuan Yang @ 2025-03-14  1:10 UTC (permalink / raw)
  To: robdclark, quic_abhinavk, dmitry.baryshkov, sean, marijn.suijten,
	airlied, simona
  Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel, Chenyuan Yang

The function dpu_plane_virtual_atomic_check was dereferencing pointers
returned by drm_atomic_get_plane_state without checking for errors. This
could lead to undefined behavior if the function returns an error pointer.

This commit adds checks using IS_ERR to ensure that plane_state is
valid before dereferencing them.

Similar to commit da29abe71e16
("drm/amd/display: Fix error pointers in amdgpu_dm_crtc_mem_type_changed").

Fixes: 774bcfb73176 ("drm/msm/dpu: add support for virtual planes")
Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
index af3e541f60c3..b19193b02ab3 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
@@ -1059,6 +1059,9 @@ static int dpu_plane_virtual_atomic_check(struct drm_plane *plane,
 	struct drm_crtc_state *crtc_state;
 	int ret;
 
+	if (IS_ERR(plane_state))
+		return PTR_ERR(plane_state);
+
 	if (plane_state->crtc)
 		crtc_state = drm_atomic_get_new_crtc_state(state,
 							   plane_state->crtc);
-- 
2.34.1


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

* Re: [PATCH] drm/msm/dpu: Fix error pointers in dpu_plane_virtual_atomic_check
  2025-03-14  1:10 [PATCH] drm/msm/dpu: Fix error pointers in dpu_plane_virtual_atomic_check Chenyuan Yang
@ 2025-03-14  6:11 ` Dmitry Baryshkov
  2025-04-08 18:13 ` Abhinav Kumar
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Baryshkov @ 2025-03-14  6:11 UTC (permalink / raw)
  To: Chenyuan Yang
  Cc: robdclark, quic_abhinavk, dmitry.baryshkov, sean, marijn.suijten,
	airlied, simona, linux-arm-msm, dri-devel, freedreno,
	linux-kernel

On Thu, Mar 13, 2025 at 08:10:04PM -0500, Chenyuan Yang wrote:
> The function dpu_plane_virtual_atomic_check was dereferencing pointers
> returned by drm_atomic_get_plane_state without checking for errors. This
> could lead to undefined behavior if the function returns an error pointer.
> 
> This commit adds checks using IS_ERR to ensure that plane_state is
> valid before dereferencing them.
> 
> Similar to commit da29abe71e16
> ("drm/amd/display: Fix error pointers in amdgpu_dm_crtc_mem_type_changed").
> 
> Fixes: 774bcfb73176 ("drm/msm/dpu: add support for virtual planes")
> Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 3 +++
>  1 file changed, 3 insertions(+)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
-- 
With best wishes
Dmitry

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

* Re: [PATCH] drm/msm/dpu: Fix error pointers in dpu_plane_virtual_atomic_check
  2025-03-14  1:10 [PATCH] drm/msm/dpu: Fix error pointers in dpu_plane_virtual_atomic_check Chenyuan Yang
  2025-03-14  6:11 ` Dmitry Baryshkov
@ 2025-04-08 18:13 ` Abhinav Kumar
  1 sibling, 0 replies; 3+ messages in thread
From: Abhinav Kumar @ 2025-04-08 18:13 UTC (permalink / raw)
  To: Chenyuan Yang, robdclark, dmitry.baryshkov, sean, marijn.suijten,
	airlied, simona
  Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel



On 3/13/2025 6:10 PM, Chenyuan Yang wrote:
> The function dpu_plane_virtual_atomic_check was dereferencing pointers
> returned by drm_atomic_get_plane_state without checking for errors. This
> could lead to undefined behavior if the function returns an error pointer.
> 
> This commit adds checks using IS_ERR to ensure that plane_state is
> valid before dereferencing them.
> 
> Similar to commit da29abe71e16
> ("drm/amd/display: Fix error pointers in amdgpu_dm_crtc_mem_type_changed").
> 
> Fixes: 774bcfb73176 ("drm/msm/dpu: add support for virtual planes")
> Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
> ---
>   drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 3 +++
>   1 file changed, 3 insertions(+)
> 

Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>

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

end of thread, other threads:[~2025-04-08 18:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-14  1:10 [PATCH] drm/msm/dpu: Fix error pointers in dpu_plane_virtual_atomic_check Chenyuan Yang
2025-03-14  6:11 ` Dmitry Baryshkov
2025-04-08 18:13 ` Abhinav Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®