diff options
author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2017-11-29 22:29:47 +0900 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-12-18 15:59:17 +0100 |
commit | 533dfb250d1c8d2bb8c9b65252f7b296b29913d4 (patch) | |
tree | 3e18255457cf2d693e5f984dcb0ebdeb3c79892b /drivers/android/binder_alloc.c | |
parent | 22ec1a2aea73b9dfe340dff7945bd85af4cc6280 (diff) | |
download | linux-stable-533dfb250d1c8d2bb8c9b65252f7b296b29913d4.tar.gz linux-stable-533dfb250d1c8d2bb8c9b65252f7b296b29913d4.tar.bz2 linux-stable-533dfb250d1c8d2bb8c9b65252f7b296b29913d4.zip |
android: binder: Check for errors in binder_alloc_shrinker_init().
Both list_lru_init() and register_shrinker() might return an error.
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Sherry Yang <sherryy@android.com>
Cc: Michal Hocko <mhocko@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/android/binder_alloc.c')
-rw-r--r-- | drivers/android/binder_alloc.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c index 0dba2308125c..fdf9d9f12aac 100644 --- a/drivers/android/binder_alloc.c +++ b/drivers/android/binder_alloc.c @@ -1006,8 +1006,14 @@ void binder_alloc_init(struct binder_alloc *alloc) INIT_LIST_HEAD(&alloc->buffers); } -void binder_alloc_shrinker_init(void) +int binder_alloc_shrinker_init(void) { - list_lru_init(&binder_alloc_lru); - register_shrinker(&binder_shrinker); + int ret = list_lru_init(&binder_alloc_lru); + + if (ret == 0) { + ret = register_shrinker(&binder_shrinker); + if (ret) + list_lru_destroy(&binder_alloc_lru); + } + return ret; } |