From 0af5a76743717abb1c5ecf0f9baf85085a90af40 Mon Sep 17 00:00:00 2001 From: "Sarang S. Dalal" Date: Tue, 23 Jan 2018 00:18:18 +0100 Subject: [PATCH] added kernel version check for calling kernel_read vs vfs_read added kernel version check for calling kernel_read vs vfs_read, as suggested here: https://github.com/Asmodee-Box/anbox/commit/55d56994295eae827421a5fffc7ec2370af6015e --- kernel/ashmem/ashmem.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/ashmem/ashmem.c b/kernel/ashmem/ashmem.c index 4fde1d7..dd15960 100644 --- a/kernel/ashmem/ashmem.c +++ b/kernel/ashmem/ashmem.c @@ -313,7 +313,11 @@ static ssize_t ashmem_read(struct file *file, char __user *buf, * be destroyed until all references to the file are dropped and * ashmem_release is called. */ - ret = kernel_read(asma->file, buf, len, pos); + #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0) + ret = __vfs_read(asma->file, buf, len, pos); + #else + ret = kernel_read(asma->file, buf, len, pos); + #endif if (ret >= 0) /** Update backing file pos, since f_ops->read() doesn't */ asma->file->f_pos = *pos;