From: Xuewen Yan <xuewen.yan@unisoc.com>
To: <peterz@infradead.org>, <mingo@redhat.com>, <will@kernel.org>
Cc: <longman@redhat.com>, <boqun.feng@gmail.com>,
<ke.wang@unisoc.com>, <zhiguo.niu@unisoc.com>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH] lock/lockdep: Add missing graph_unlock in validate_chain
Date: Thu, 4 Jan 2024 13:40:30 +0800 [thread overview]
Message-ID: <20240104054030.14733-1-xuewen.yan@unisoc.com> (raw)
The lookup_chain_cache_add will get graph_lock, but the
validate_chain do not unlock before return 0.
So add graph_unlock before return 0.
Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
---
kernel/locking/lockdep.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 151bd3de5936..24995e1ebc62 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -3855,8 +3855,11 @@ static int validate_chain(struct task_struct *curr,
*/
int ret = check_deadlock(curr, hlock);
- if (!ret)
+ if (!ret) {
+ graph_unlock();
return 0;
+ }
+
/*
* Add dependency only if this lock is not the head
* of the chain, and if the new lock introduces no more
@@ -3865,9 +3868,9 @@ static int validate_chain(struct task_struct *curr,
* serializes nesting locks), see the comments for
* check_deadlock().
*/
- if (!chain_head && ret != 2) {
- if (!check_prevs_add(curr, hlock))
- return 0;
+ if (!chain_head && ret != 2 && !check_prevs_add(curr, hlock)) {
+ graph_unlock();
+ return 0;
}
graph_unlock();
--
2.25.1
next reply other threads:[~2024-01-04 5:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-04 5:40 Xuewen Yan [this message]
2024-01-04 19:41 ` Boqun Feng
2024-01-05 4:46 ` Xuewen Yan
2024-01-08 16:28 ` Boqun Feng
2024-01-09 2:55 ` Xuewen Yan
2024-01-09 5:35 ` Boqun Feng
2024-01-09 6:11 ` Xuewen Yan
2024-01-08 13:53 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240104054030.14733-1-xuewen.yan@unisoc.com \
--to=xuewen.yan@unisoc.com \
--cc=boqun.feng@gmail.com \
--cc=ke.wang@unisoc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=will@kernel.org \
--cc=zhiguo.niu@unisoc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®