possible deadlock in shmem_file_llseek

From: syzbot
Date: Wed Jan 24 2018 - 13:42:53 EST


Hello,

syzbot tried to test the proposed patch but build/boot failed:

patch is already applied


Tested on https://github.com/joelagnel/linux.git/test-ashmem commit
32f813bb0d06c1e189ac336f8c3c7377f85c71f0 (Wed Jan 24 01:45:04 2018 +0000)
ashmem: Fix lockdep issue during llseek

compiler: gcc (GCC) 7.1.1 20170620
Patch is attached.



--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -343,7 +343,9 @@ static loff_t ashmem_llseek(struct file *file, loff_t offset, int origin)
goto out;
}

+ mutex_unlock(&ashmem_mutex);
ret = vfs_llseek(asma->file, offset, origin);
+ mutex_lock(&ashmem_mutex);
if (ret < 0)
goto out;