diff options
| author | Tobias Lindskog <tobias.lindskog@sonymobile.com> | 2015-02-09 08:10:39 +0100 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2018-12-21 14:03:29 +0100 |
| commit | 483078293392a2c21f3b88b6e2fb8e751cbb152c (patch) | |
| tree | 25a0273a45966e03740afdb459a4ccb4c50fc6e6 | |
| parent | 7deb45a05a209702825be94503f0a71ff66ac104 (diff) | |
Shrink ashmem 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>
| -rw-r--r-- | drivers/staging/android/ashmem.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index c9080e8ba..ce39a6578 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -376,7 +376,7 @@ static int ashmem_shrink(struct shrinker *s, struct shrink_control *sc) loff_t start = range->pgstart * PAGE_SIZE; loff_t end = (range->pgend + 1) * PAGE_SIZE; - do_fallocate(range->asma->file, + range->asma->file->f_op->fallocate(range->asma->file, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, start, end - start); range->purged = ASHMEM_WAS_PURGED; |
