From: Sasha Levin Date: Sun, 25 Aug 2024 23:46:21 +0000 (-0400) Subject: Fixes for 5.4 X-Git-Tag: v6.1.107~61 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4ec72e4712f2c2dcd80a9127e2f5705f61f883b2;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.4 Signed-off-by: Sasha Levin --- diff --git a/queue-5.4/drm-msm-dpu-don-t-play-tricks-with-debug-macros.patch b/queue-5.4/drm-msm-dpu-don-t-play-tricks-with-debug-macros.patch new file mode 100644 index 00000000000..46d4e25e0c2 --- /dev/null +++ b/queue-5.4/drm-msm-dpu-don-t-play-tricks-with-debug-macros.patch @@ -0,0 +1,66 @@ +From 16ae862e13b1d359227bd3d7ce40625b04af1c78 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 2 Aug 2024 22:47:34 +0300 +Subject: drm/msm/dpu: don't play tricks with debug macros + +From: Dmitry Baryshkov + +[ Upstream commit df24373435f5899a2a98b7d377479c8d4376613b ] + +DPU debugging macros need to be converted to a proper drm_debug_* +macros, however this is a going an intrusive patch, not suitable for a +fix. Wire DPU_DEBUG and DPU_DEBUG_DRIVER to always use DRM_DEBUG_DRIVER +to make sure that DPU debugging messages always end up in the drm debug +messages and are controlled via the usual drm.debug mask. + +I don't think that it is a good idea for a generic DPU_DEBUG macro to be +tied to DRM_UT_KMS. It is used to report a debug message from driver, so by +default it should go to the DRM_UT_DRIVER channel. While refactoring +debug macros later on we might end up with particular messages going to +ATOMIC or KMS, but DRIVER should be the default. + +Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support") +Signed-off-by: Dmitry Baryshkov +Reviewed-by: Abhinav Kumar +Patchwork: https://patchwork.freedesktop.org/patch/606932/ +Link: https://lore.kernel.org/r/20240802-dpu-fix-wb-v2-2-7eac9eb8e895@linaro.org +Signed-off-by: Abhinav Kumar +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 14 ++------------ + 1 file changed, 2 insertions(+), 12 deletions(-) + +diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +index d6c26426b1c6e..c1b9a0500fa22 100644 +--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h ++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +@@ -30,24 +30,14 @@ + * @fmt: Pointer to format string + */ + #define DPU_DEBUG(fmt, ...) \ +- do { \ +- if (drm_debug_enabled(DRM_UT_KMS)) \ +- DRM_DEBUG(fmt, ##__VA_ARGS__); \ +- else \ +- pr_debug(fmt, ##__VA_ARGS__); \ +- } while (0) ++ DRM_DEBUG_DRIVER(fmt, ##__VA_ARGS__) + + /** + * DPU_DEBUG_DRIVER - macro for hardware driver logging + * @fmt: Pointer to format string + */ + #define DPU_DEBUG_DRIVER(fmt, ...) \ +- do { \ +- if (drm_debug_enabled(DRM_UT_DRIVER)) \ +- DRM_ERROR(fmt, ##__VA_ARGS__); \ +- else \ +- pr_debug(fmt, ##__VA_ARGS__); \ +- } while (0) ++ DRM_DEBUG_DRIVER(fmt, ##__VA_ARGS__) + + #define DPU_ERROR(fmt, ...) pr_err("[dpu error]" fmt, ##__VA_ARGS__) + #define DPU_ERROR_RATELIMITED(fmt, ...) pr_err_ratelimited("[dpu error]" fmt, ##__VA_ARGS__) +-- +2.43.0 + diff --git a/queue-5.4/drm-msm-use-drm_debug_enabled-to-check-for-debug-cat.patch b/queue-5.4/drm-msm-use-drm_debug_enabled-to-check-for-debug-cat.patch new file mode 100644 index 00000000000..a0108de54e8 --- /dev/null +++ b/queue-5.4/drm-msm-use-drm_debug_enabled-to-check-for-debug-cat.patch @@ -0,0 +1,52 @@ +From cdd27a96c7599966993a376081edbc3d011ee125 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Sep 2019 15:59:02 +0300 +Subject: drm/msm: use drm_debug_enabled() to check for debug categories + +From: Jani Nikula + +[ Upstream commit d8db0b36d888b6a5eb392f112dc156e694de2369 ] + +Allow better abstraction of the drm_debug global variable in the +future. No functional changes. + +v2: Move unlikely() to drm_debug_enabled() + +Cc: Rob Clark +Cc: Sean Paul +Cc: linux-arm-msm@vger.kernel.org +Cc: freedreno@lists.freedesktop.org +Reviewed-by: Rob Clark +Signed-off-by: Jani Nikula +Link: https://patchwork.freedesktop.org/patch/msgid/c7142cdebb5f6fed527272b333cd6c43c0aa68ec.1569329774.git.jani.nikula@intel.com +Stable-dep-of: df24373435f5 ("drm/msm/dpu: don't play tricks with debug macros") +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +index 6a4813505c33c..d6c26426b1c6e 100644 +--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h ++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +@@ -31,7 +31,7 @@ + */ + #define DPU_DEBUG(fmt, ...) \ + do { \ +- if (unlikely(drm_debug & DRM_UT_KMS)) \ ++ if (drm_debug_enabled(DRM_UT_KMS)) \ + DRM_DEBUG(fmt, ##__VA_ARGS__); \ + else \ + pr_debug(fmt, ##__VA_ARGS__); \ +@@ -43,7 +43,7 @@ + */ + #define DPU_DEBUG_DRIVER(fmt, ...) \ + do { \ +- if (unlikely(drm_debug & DRM_UT_DRIVER)) \ ++ if (drm_debug_enabled(DRM_UT_DRIVER)) \ + DRM_ERROR(fmt, ##__VA_ARGS__); \ + else \ + pr_debug(fmt, ##__VA_ARGS__); \ +-- +2.43.0 + diff --git a/queue-5.4/mmc-mmc_test-fix-null-dereference-on-allocation-fail.patch b/queue-5.4/mmc-mmc_test-fix-null-dereference-on-allocation-fail.patch new file mode 100644 index 00000000000..d5968ea6a96 --- /dev/null +++ b/queue-5.4/mmc-mmc_test-fix-null-dereference-on-allocation-fail.patch @@ -0,0 +1,55 @@ +From 441657386edb77ecec32e0b424a1cc32a91bebb8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 20 Aug 2024 11:44:08 +0300 +Subject: mmc: mmc_test: Fix NULL dereference on allocation failure + +From: Dan Carpenter + +[ Upstream commit a1e627af32ed60713941cbfc8075d44cad07f6dd ] + +If the "test->highmem = alloc_pages()" allocation fails then calling +__free_pages(test->highmem) will result in a NULL dereference. Also +change the error code to -ENOMEM instead of returning success. + +Fixes: 2661081f5ab9 ("mmc_test: highmem tests") +Signed-off-by: Dan Carpenter +Link: https://lore.kernel.org/r/8c90be28-67b4-4b0d-a105-034dc72a0b31@stanley.mountain +Signed-off-by: Ulf Hansson +Signed-off-by: Sasha Levin +--- + drivers/mmc/core/mmc_test.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c +index cd64e0f23ae54..8fcaec5544ff4 100644 +--- a/drivers/mmc/core/mmc_test.c ++++ b/drivers/mmc/core/mmc_test.c +@@ -3097,13 +3097,13 @@ static ssize_t mtf_test_write(struct file *file, const char __user *buf, + test->buffer = kzalloc(BUFFER_SIZE, GFP_KERNEL); + #ifdef CONFIG_HIGHMEM + test->highmem = alloc_pages(GFP_KERNEL | __GFP_HIGHMEM, BUFFER_ORDER); ++ if (!test->highmem) { ++ count = -ENOMEM; ++ goto free_test_buffer; ++ } + #endif + +-#ifdef CONFIG_HIGHMEM +- if (test->buffer && test->highmem) { +-#else + if (test->buffer) { +-#endif + mutex_lock(&mmc_test_lock); + mmc_test_run(test, testcase); + mutex_unlock(&mmc_test_lock); +@@ -3111,6 +3111,7 @@ static ssize_t mtf_test_write(struct file *file, const char __user *buf, + + #ifdef CONFIG_HIGHMEM + __free_pages(test->highmem, BUFFER_ORDER); ++free_test_buffer: + #endif + kfree(test->buffer); + kfree(test); +-- +2.43.0 + diff --git a/queue-5.4/series b/queue-5.4/series index ca7baa91f1e..3cad3caeeb5 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -94,3 +94,6 @@ netem-fix-return-value-if-duplicate-enqueue-fails.patch ipv6-prevent-uaf-in-ip6_send_skb.patch net-xilinx-axienet-always-disable-promiscuous-mode.patch net-xilinx-axienet-fix-dangling-multicast-addresses.patch +drm-msm-use-drm_debug_enabled-to-check-for-debug-cat.patch +drm-msm-dpu-don-t-play-tricks-with-debug-macros.patch +mmc-mmc_test-fix-null-dereference-on-allocation-fail.patch