summaryrefslogtreecommitdiffstats
path: root/drivers/staging/android/ashmem.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2018-03-19 20:37:35 +0100
committerIngo Molnar <mingo@kernel.org>2018-03-19 20:37:35 +0100
commit134933e55789ece9bca973d3502c7b8f7a9dae86 (patch)
treeb1694310855e43acb5fceb8b2d55ec8cd713ccad /drivers/staging/android/ashmem.c
parent24868367cdcac447232ebcb2aa06e1bf91291586 (diff)
parentc698ca5278934c0ae32297a8725ced2e27585d7f (diff)
downloadlinux-134933e55789ece9bca973d3502c7b8f7a9dae86.tar.gz
linux-134933e55789ece9bca973d3502c7b8f7a9dae86.tar.bz2
linux-134933e55789ece9bca973d3502c7b8f7a9dae86.zip
Merge tag 'v4.16-rc6' into perf/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/staging/android/ashmem.c')
-rw-r--r--drivers/staging/android/ashmem.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
index 6dbba5aff191..86580b6df33d 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -326,24 +326,23 @@ static loff_t ashmem_llseek(struct file *file, loff_t offset, int origin)
mutex_lock(&ashmem_mutex);
if (asma->size == 0) {
- ret = -EINVAL;
- goto out;
+ mutex_unlock(&ashmem_mutex);
+ return -EINVAL;
}
if (!asma->file) {
- ret = -EBADF;
- goto out;
+ mutex_unlock(&ashmem_mutex);
+ return -EBADF;
}
+ mutex_unlock(&ashmem_mutex);
+
ret = vfs_llseek(asma->file, offset, origin);
if (ret < 0)
- goto out;
+ return ret;
/** Copy f_pos from backing file, since f_ops->llseek() sets it */
file->f_pos = asma->file->f_pos;
-
-out:
- mutex_unlock(&ashmem_mutex);
return ret;
}
@@ -702,16 +701,14 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd,
size_t pgstart, pgend;
int ret = -EINVAL;
+ if (unlikely(copy_from_user(&pin, p, sizeof(pin))))
+ return -EFAULT;
+
mutex_lock(&ashmem_mutex);
if (unlikely(!asma->file))
goto out_unlock;
- if (unlikely(copy_from_user(&pin, p, sizeof(pin)))) {
- ret = -EFAULT;
- goto out_unlock;
- }
-
/* per custom, you can pass zero for len to mean "everything onward" */
if (!pin.len)
pin.len = PAGE_ALIGN(asma->size) - pin.offset;