Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2018-10-11 10:24:13 +0200
committerThomas Zimmermann <tzimmermann@suse.de>2018-10-11 14:32:50 +0200
commit273a6bd4c1c06081cb85030b301a5ff6988e73cb (patch)
tree27ea04d41cf46f61970285ee22e68a7ac6ecc9e7
parentaf8dddae5da93d27f16ae38038d7980eebac672d (diff)
drm/amdgpu: fix error handling in amdgpu_cs_user_fence_chunk (bsc#1106110)
-rw-r--r--patches.fixes/0001-drm-amdgpu-fix-error-handling-in-amdgpu_cs_user_fenc.patch70
-rw-r--r--series.conf1
2 files changed, 71 insertions, 0 deletions
diff --git a/patches.fixes/0001-drm-amdgpu-fix-error-handling-in-amdgpu_cs_user_fenc.patch b/patches.fixes/0001-drm-amdgpu-fix-error-handling-in-amdgpu_cs_user_fenc.patch
new file mode 100644
index 0000000000..b45e34f997
--- /dev/null
+++ b/patches.fixes/0001-drm-amdgpu-fix-error-handling-in-amdgpu_cs_user_fenc.patch
@@ -0,0 +1,70 @@
+From 0165de983272d1fae0809ed9db47c46a412279bc Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com>
+Date: Mon, 10 Sep 2018 15:52:55 +0200
+Subject: drm/amdgpu: fix error handling in amdgpu_cs_user_fence_chunk
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+Git-commit: 0165de983272d1fae0809ed9db47c46a412279bc
+Patch-mainline: v4.19-rc2
+References: bsc#1106110
+
+Slowly leaking memory one page at a time :)
+
+Backporting notes:
+
+ * updated for context changes in amdgpu_cs_user_fence_chunk()
+
+Signed-off-by: Christian K├Ânig <christian.koenig@amd.com>
+Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 23 +++++++++++++++--------
+ 1 file changed, 15 insertions(+), 8 deletions(-)
+
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+@@ -108,6 +108,7 @@ static int amdgpu_cs_user_fence_chunk(st
+ {
+ struct drm_gem_object *gobj;
+ unsigned long size;
++ int r;
+
+ gobj = drm_gem_object_lookup(p->filp, data->handle);
+ if (gobj == NULL)
+@@ -119,20 +120,26 @@ static int amdgpu_cs_user_fence_chunk(st
+ p->uf_entry.tv.shared = true;
+ p->uf_entry.user_pages = NULL;
+
+- size = amdgpu_bo_size(p->uf_entry.robj);
+- if (size != PAGE_SIZE || (data->offset + 8) > size)
+- return -EINVAL;
+-
+- *offset = data->offset;
+-
+ drm_gem_object_unreference_unlocked(gobj);
+
++ size = amdgpu_bo_size(p->uf_entry.robj);
++ if (size != PAGE_SIZE || (data->offset + 8) > size) {
++ r = -EINVAL;
++ goto error_unref;
++ }
++
+ if (amdgpu_ttm_tt_get_usermm(p->uf_entry.robj->tbo.ttm)) {
+- amdgpu_bo_unref(&p->uf_entry.robj);
+- return -EINVAL;
++ r = -EINVAL;
++ goto error_unref;
+ }
+
++ *offset = data->offset;
++
+ return 0;
++
++error_unref:
++ amdgpu_bo_unref(&p->uf_entry.robj);
++ return r;
+ }
+
+ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)
diff --git a/series.conf b/series.conf
index 8148a1d0cd..b3cdd95508 100644
--- a/series.conf
+++ b/series.conf
@@ -17725,6 +17725,7 @@
patches.drivers/pstore-Fix-incorrect-persistent-ram-buffer-mapping.patch
patches.drivers/drm-i915-gvt-Fix-the-incorrect-length-of-child_devic.patch
patches.drivers/drm-i915-overlay-Allocate-physical-registers-from-st.patch
+ patches.fixes/0001-drm-amdgpu-fix-error-handling-in-amdgpu_cs_user_fenc.patch
patches.drivers/mei-ignore-not-found-client-in-the-enumeration.patch
patches.drivers/USB-add-quirk-for-WORLDE-Controller-KS49-or-Prodipe-.patch
patches.drivers/xhci-Fix-use-after-free-for-URB-cancellation-on-a-re.patch