ANDROID: ashmem: Shrink directly through shmem_fallocate
authorTobias Lindskog <tobias.lindskog@sonymobile.com>
Mon, 9 Feb 2015 07:10:39 +0000 (08:10 +0100)
committerAmit Pundir <amit.pundir@linaro.org>
Mon, 18 Dec 2017 15:41:22 +0000 (21:11 +0530)
commitdaf3169cce9ab1434ec3345043f8483b56c69408
treef868e642009508893d30c106e5e1608855c8d4cf
parentebfc8d6476a66dc91a1b30cbfc18e67d4401af09
ANDROID: ashmem: Shrink directly through shmem_fallocate

When ashmem_shrink is called from direct reclaim on a user thread, a
call to do_fallocate will check for permissions against the security
policy of that user thread.  It can thus fail by chance if called on a
thread that isn't permitted to modify the relevant ashmem areas.

Because we know that we have a shmem file underneath, call the shmem
implementation of fallocate directly instead of going through the
user-space interface for fallocate.

FIX=DMS06243560
Area: Kernel/Linux Kernel

Bug: 21951515
Change-Id: Ie98fff18a2bdeb535cd24d4fbdd13677e12681a7
Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
drivers/staging/android/ashmem.c