From e5e5f587d915f68aab7b339b373c70efc830bd38 Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Fri, 8 Oct 2021 12:13:42 -0700 Subject: [PATCH] ANDROID: Restore a line removed accidentally during a revert When reverting commit 9ad8ff902e39f37baf15904c6627ca03e8f60c27 in android-mainline (commit 31c9ccb1389d10c7d5b0d6c74b953b301e7e23ec), a call to __mutex_remove_waiter() was accidentally removed. That results in a mutex waiter being left in the wait_list of the mutex in the error handling path of __mutex_lock_common(). The issue was reproduced by running controllers.memcg ltp tests and results in a kernel crash that looks like this: [ 306.207016] list_del corruption. next->prev should be ffffa5f983a479d0, but was ffffa5f983a6f9e8 [ 306.207271] ------------[ cut here ]------------ [ 306.207328] kernel BUG at lib/list_debug.c:56! Fix this by restoring the removed line. Fixes: 31c9ccb1389d ("Revert "ANDROID: vendor_hooks: add waiting information for blocked tasks"") Bug: 199506772 Signed-off-by: Suren Baghdasaryan Change-Id: I49ac82b20405fda0ea7d10fae68402279ad751fa --- kernel/locking/mutex.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c index 1eb993c6271e..d456579d0952 100644 --- a/kernel/locking/mutex.c +++ b/kernel/locking/mutex.c @@ -713,6 +713,7 @@ skip_wait: err: __set_current_state(TASK_RUNNING); + __mutex_remove_waiter(lock, &waiter); err_early_kill: raw_spin_unlock(&lock->wait_lock); debug_mutex_free_waiter(&waiter);