]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 7 Oct 2023 09:55:56 +0000 (11:55 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 7 Oct 2023 09:55:56 +0000 (11:55 +0200)
added patches:
drm-mediatek-fix-backport-issue-in-mtk_drm_gem_prime_vmap.patch

queue-5.10/drm-mediatek-fix-backport-issue-in-mtk_drm_gem_prime_vmap.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/drm-mediatek-fix-backport-issue-in-mtk_drm_gem_prime_vmap.patch b/queue-5.10/drm-mediatek-fix-backport-issue-in-mtk_drm_gem_prime_vmap.patch
new file mode 100644 (file)
index 0000000..56e942e
--- /dev/null
@@ -0,0 +1,43 @@
+From nathan@kernel.org  Sat Oct  7 11:52:29 2023
+From: Nathan Chancellor <nathan@kernel.org>
+Date: Fri, 22 Sep 2023 08:51:17 -0700
+Subject: drm/mediatek: Fix backport issue in mtk_drm_gem_prime_vmap()
+To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Sasha Levin <sashal@kernel.org>
+Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>, Philipp Zabel <p.zabel@pengutronix.de>, linux-mediatek@lists.infradead.org, stable@vger.kernel.org, llvm@lists.linux.dev, Nathan Chancellor <nathan@kernel.org>
+Message-ID: <20230922-5-10-fix-drm-mediatek-backport-v1-1-912d76cd4a96@kernel.org>
+
+From: Nathan Chancellor <nathan@kernel.org>
+
+When building with clang:
+
+  drivers/gpu/drm/mediatek/mtk_drm_gem.c:255:10: error: incompatible integer to pointer conversion returning 'int' from a function with result type 'void *' [-Wint-conversion]
+    255 |                 return -ENOMEM;
+        |                        ^~~~~~~
+  1 error generated.
+
+GCC reports the same issue as a warning, rather than an error.
+
+Prior to commit 7e542ff8b463 ("drm/mediatek: Use struct dma_buf_map in
+GEM vmap ops"), this function returned a pointer rather than an integer.
+This function is indirectly called in drm_gem_vmap(), which treats NULL
+as -ENOMEM through an error pointer. Return NULL in this block to
+resolve the warning but keep the same end result.
+
+Fixes: 43f561e809aa ("drm/mediatek: Fix potential memory leak if vmap() fail")
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/mediatek/mtk_drm_gem.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
++++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
+@@ -252,7 +252,7 @@ void *mtk_drm_gem_prime_vmap(struct drm_
+       if (!mtk_gem->kvaddr) {
+               kfree(sgt);
+               kfree(mtk_gem->pages);
+-              return -ENOMEM;
++              return NULL;
+       }
+ out:
+       kfree(sgt);
index 3005b95a89ef577731bb99038de9519fa08d20d0..85ca3f86effc536f1f4db60e55ff9ef2d8bc4c16 100644 (file)
@@ -169,6 +169,7 @@ nfs-rename-nfs_client_kset-to-nfs_kset.patch
 nfsv4-fix-a-state-manager-thread-deadlock-regression.patch
 ring-buffer-remove-obsolete-comment-for-free_buffer_.patch
 ring-buffer-fix-bytes-info-in-per_cpu-buffer-stats.patch
+drm-mediatek-fix-backport-issue-in-mtk_drm_gem_prime_vmap.patch
 rbd-move-rbd_dev_refresh-definition.patch
 rbd-decouple-header-read-in-from-updating-rbd_dev-he.patch
 rbd-decouple-parent-info-read-in-from-updating-rbd_d.patch