Patch "drm/i915/dp: prevent potential div-by-zero" has been added to the 5.10-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/i915/dp: prevent potential div-by-zero

to the 5.10-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-i915-dp-prevent-potential-div-by-zero.patch
and it can be found in the queue-5.10 subdirectory.

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



commit acebfb2fb5eeb4815500da062930aac46dad4bd4
Author: Nikita Zhandarovich <n.zhandarovich@xxxxxxxxxx>
Date:   Tue Apr 18 07:04:30 2023 -0700

    drm/i915/dp: prevent potential div-by-zero
    
    [ Upstream commit 0ff80028e2702c7c3d78b69705dc47c1ccba8c39 ]
    
    drm_dp_dsc_sink_max_slice_count() may return 0 if something goes
    wrong on the part of the DSC sink and its DPCD register. This null
    value may be later used as a divisor in intel_dsc_compute_params(),
    which will lead to an error.
    In the unlikely event that this issue occurs, fix it by testing the
    return value of drm_dp_dsc_sink_max_slice_count() against zero.
    
    Found by Linux Verification Center (linuxtesting.org) with static
    analysis tool SVACE.
    
    Fixes: a4a157777c80 ("drm/i915/dp: Compute DSC pipe config in atomic check")
    Signed-off-by: Nikita Zhandarovich <n.zhandarovich@xxxxxxxxxx>
    Reviewed-by: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230418140430.69902-1-n.zhandarovich@xxxxxxxxxx
    (cherry picked from commit 51f7008239de011370c5067bbba07f0207f06b72)
    Signed-off-by: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 1c1931f5c958b..7f633f8b3239a 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -2281,6 +2281,11 @@ static int intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
 		pipe_config->dsc.slice_count =
 			drm_dp_dsc_sink_max_slice_count(intel_dp->dsc_dpcd,
 							true);
+		if (!pipe_config->dsc.slice_count) {
+			drm_dbg_kms(&dev_priv->drm, "Unsupported Slice Count %d\n",
+				    pipe_config->dsc.slice_count);
+			return -EINVAL;
+		}
 	} else {
 		u16 dsc_max_output_bpp;
 		u8 dsc_dp_slice_count;



[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