Patch "drm/vc4: kms: Fix IS_ERR() vs NULL check for vc4_kms" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/vc4: kms: Fix IS_ERR() vs NULL check for vc4_kms

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-vc4-kms-fix-is_err-vs-null-check-for-vc4_kms.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 930a62b272875416df12cd9f9261380fffa9362e
Author: Gaosheng Cui <cuigaosheng1@xxxxxxxxxx>
Date:   Thu Nov 10 17:44:45 2022 +0800

    drm/vc4: kms: Fix IS_ERR() vs NULL check for vc4_kms
    
    [ Upstream commit dba9e3467425800f9d3a14e8b6a0f85c731c1650 ]
    
    The drm_atomic_get_new_private_obj_state() function returns NULL
    on error path, drm_atomic_get_old_private_obj_state() function
    returns NULL on error path, too, they does not return error pointers.
    
    By the way, vc4_hvs_get_new/old_global_state() should return
    ERR_PTR(-EINVAL), otherwise there will be null-ptr-defer issue,
    such as follows:
    
    In function vc4_atomic_commit_tail():
      |-- old_hvs_state = vc4_hvs_get_old_global_state(state); <-- return NULL
      |-- if (WARN_ON(IS_ERR(old_hvs_state))) <-- no return
      |-- unsigned long state_rate = max(old_hvs_state->core_clock_rate,
            new_hvs_state->core_clock_rate); <-- null-ptr-defer
    
    Fixes: 9ec03d7f1ed3 ("drm/vc4: kms: Wait on previous FIFO users before a commit")
    Signed-off-by: Gaosheng Cui <cuigaosheng1@xxxxxxxxxx>
    Signed-off-by: Maxime Ripard <maxime@xxxxxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20221110094445.2930509-6-cuigaosheng1@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
index 6030d4a82155..1bb8bcc45d71 100644
--- a/drivers/gpu/drm/vc4/vc4_kms.c
+++ b/drivers/gpu/drm/vc4/vc4_kms.c
@@ -193,8 +193,8 @@ vc4_hvs_get_new_global_state(struct drm_atomic_state *state)
 	struct drm_private_state *priv_state;
 
 	priv_state = drm_atomic_get_new_private_obj_state(state, &vc4->hvs_channels);
-	if (IS_ERR(priv_state))
-		return ERR_CAST(priv_state);
+	if (!priv_state)
+		return ERR_PTR(-EINVAL);
 
 	return to_vc4_hvs_state(priv_state);
 }
@@ -206,8 +206,8 @@ vc4_hvs_get_old_global_state(struct drm_atomic_state *state)
 	struct drm_private_state *priv_state;
 
 	priv_state = drm_atomic_get_old_private_obj_state(state, &vc4->hvs_channels);
-	if (IS_ERR(priv_state))
-		return ERR_CAST(priv_state);
+	if (!priv_state)
+		return ERR_PTR(-EINVAL);
 
 	return to_vc4_hvs_state(priv_state);
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux