Avoid recursing into ashmem_shrink from within ashmem itself. Signed-off-by: Robert Love ashmem.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- linux-base/drivers/staging/android/ashmem.c 2013-04-25 10:58:33.251469472 -0400 +++ linux/drivers/staging/android/ashmem.c 2013-04-25 11:02:29.420644278 -0400 @@ -361,7 +361,11 @@ if (!sc->nr_to_scan) return lru_count; - mutex_lock(&ashmem_mutex); + /* avoid recursing into this code from within ashmem itself */ + if (!mutex_trylock(&ashmem_mutex)) { + return -1; + } + list_for_each_entry_safe(range, next, &ashmem_lru_list, lru) { struct inode *inode = range->asma->file->f_dentry->d_inode; loff_t start = range->pgstart * PAGE_SIZE;