DivestOS/Patches/Linux_CVEs/CVE-2017-8263/ANY/0.patch
2017-10-29 22:14:37 -04:00

95 lines
2.5 KiB
Diff

diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
index 7fbdf65..79ec3da 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -32,7 +32,6 @@
#include <linux/mutex.h>
#include <linux/shmem_fs.h>
#include <linux/ashmem.h>
-#include <asm/cacheflush.h>
#define ASHMEM_NAME_PREFIX "dev/ashmem/"
#define ASHMEM_NAME_PREFIX_LEN (sizeof(ASHMEM_NAME_PREFIX) - 1)
@@ -704,51 +703,6 @@
}
#endif
-static int ashmem_cache_op(struct ashmem_area *asma,
- void (*cache_func)(unsigned long vstart, unsigned long length,
- unsigned long pstart))
-{
- int ret = 0;
- struct vm_area_struct *vma;
-#ifdef CONFIG_OUTER_CACHE
- unsigned long vaddr;
-#endif
- if (!asma->vm_start)
- return -EINVAL;
-
- down_read(&current->mm->mmap_sem);
- vma = find_vma(current->mm, asma->vm_start);
- if (!vma) {
- ret = -EINVAL;
- goto done;
- }
- if (vma->vm_file != asma->file) {
- ret = -EINVAL;
- goto done;
- }
- if ((asma->vm_start + asma->size) > vma->vm_end) {
- ret = -EINVAL;
- goto done;
- }
-#ifndef CONFIG_OUTER_CACHE
- cache_func(asma->vm_start, asma->size, 0);
-#else
- for (vaddr = asma->vm_start; vaddr < asma->vm_start + asma->size;
- vaddr += PAGE_SIZE) {
- unsigned long physaddr;
- physaddr = virtaddr_to_physaddr(vaddr);
- if (!physaddr)
- return -EINVAL;
- cache_func(vaddr, PAGE_SIZE, physaddr);
- }
-#endif
-done:
- up_read(&current->mm->mmap_sem);
- if (ret)
- asma->vm_start = 0;
- return ret;
-}
-
static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
struct ashmem_area *asma = file->private_data;
@@ -794,15 +748,6 @@
ashmem_shrink(&ashmem_shrinker, &sc);
}
break;
- case ASHMEM_CACHE_FLUSH_RANGE:
- ret = ashmem_cache_op(asma, &clean_and_invalidate_caches);
- break;
- case ASHMEM_CACHE_CLEAN_RANGE:
- ret = ashmem_cache_op(asma, &clean_caches);
- break;
- case ASHMEM_CACHE_INV_RANGE:
- ret = ashmem_cache_op(asma, &invalidate_caches);
- break;
}
return ret;
diff --git a/include/uapi/linux/ashmem.h b/include/uapi/linux/ashmem.h
index 7965b39..0a8a9aa 100644
--- a/include/uapi/linux/ashmem.h
+++ b/include/uapi/linux/ashmem.h
@@ -34,9 +34,6 @@
#define ASHMEM_UNPIN _IOW(__ASHMEMIOC, 8, struct ashmem_pin)
#define ASHMEM_GET_PIN_STATUS _IO(__ASHMEMIOC, 9)
#define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10)
-#define ASHMEM_CACHE_FLUSH_RANGE _IO(__ASHMEMIOC, 11)
-#define ASHMEM_CACHE_CLEAN_RANGE _IO(__ASHMEMIOC, 12)
-#define ASHMEM_CACHE_INV_RANGE _IO(__ASHMEMIOC, 13)
/* support of 32bit userspace on 64bit platforms */
#ifdef CONFIG_COMPAT