DivestOS/Patches/Linux_CVEs/CVE-2017-8262/3.10/0001.patch
2017-11-07 21:38:42 -05:00

54 lines
1.4 KiB
Diff

diff --git a/drivers/gpu/msm/kgsl.c b/drivers/gpu/msm/kgsl.c
index 640e6c1..57e3ea3 100644
--- a/drivers/gpu/msm/kgsl.c
+++ b/drivers/gpu/msm/kgsl.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2008-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -167,8 +167,11 @@
{
struct kgsl_mem_entry *entry = kzalloc(sizeof(*entry), GFP_KERNEL);
- if (entry)
+ if (entry) {
kref_init(&entry->refcount);
+ /* put this ref in the caller functions after init */
+ kref_get(&entry->refcount);
+ }
return entry;
}
@@ -3019,6 +3022,9 @@
trace_kgsl_mem_map(entry, param->fd);
kgsl_mem_entry_commit_process(private, entry);
+
+ /* put the extra refcount for kgsl_mem_entry_create() */
+ kgsl_mem_entry_put(entry);
return result;
error_attach:
@@ -3343,6 +3349,9 @@
param->flags = entry->memdesc.flags;
kgsl_mem_entry_commit_process(private, entry);
+
+ /* put the extra refcount for kgsl_mem_entry_create() */
+ kgsl_mem_entry_put(entry);
return result;
err:
kgsl_sharedmem_free(&entry->memdesc);
@@ -3382,6 +3391,9 @@
param->gpuaddr = entry->memdesc.gpuaddr;
kgsl_mem_entry_commit_process(private, entry);
+
+ /* put the extra refcount for kgsl_mem_entry_create() */
+ kgsl_mem_entry_put(entry);
return result;
err:
if (entry)