staging: android: ion: Return an ERR_PTR in ion_map_kernel

The expected return value from ion_map_kernel is an ERR_PTR. The error
path for a vmalloc failure currently just returns NULL, triggering
a warning in ion_buffer_kmap_get. Encode the vmalloc failure as an ERR_PTR.

Reported-by: syzbot+55b1d9f811650de944c6@syzkaller.appspotmail.com
Signed-off-by: Laura Abbott <labbott@redhat.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Laura Abbott and committed by
Greg Kroah-Hartman
0a2bc003 1376b0a2

+1 -1
+1 -1
drivers/staging/android/ion/ion_heap.c
··· 30 struct page **tmp = pages; 31 32 if (!pages) 33 - return NULL; 34 35 if (buffer->flags & ION_FLAG_CACHED) 36 pgprot = PAGE_KERNEL;
··· 30 struct page **tmp = pages; 31 32 if (!pages) 33 + return ERR_PTR(-ENOMEM); 34 35 if (buffer->flags & ION_FLAG_CACHED) 36 pgprot = PAGE_KERNEL;