mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] lockdep: Add missing graph_unlock in check_prev_add
@ 2024-01-05  6:04 Xuewen Yan
  2024-01-09  3:49 ` Waiman Long
  0 siblings, 1 reply; 4+ messages in thread
From: Xuewen Yan @ 2024-01-05  6:04 UTC (permalink / raw)
  To: peterz, mingo, will, boqun.feng
  Cc: longman, zhiguo.niu, ke.wang, linux-kernel

The check_prev_add() is held graph_lock, and it should unlock
the graph_lock before return 0.
But there is one condition where it will return 0 without unlock,
that is:

/* <prev> is not found in <next>::locks_before */
	return 0;

So add graph_unlock before return 0.

Fixes: 3454a36d6a39 ("lockdep: Introduce lock_list::dep")
Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
---
Change in V2:
-move the graph_unlock to check_prev_add from validate_chain(Boqun)
-Add fix tag
---
---
 kernel/locking/lockdep.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 151bd3de5936..c8602a251bec 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -3178,6 +3178,7 @@ check_prev_add(struct task_struct *curr, struct held_lock *prev,
 			}
 
 			/* <prev> is not found in <next>::locks_before */
+			graph_unlock();
 			return 0;
 		}
 	}
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-09 15:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-05  6:04 [PATCH v2] lockdep: Add missing graph_unlock in check_prev_add Xuewen Yan
2024-01-09  3:49 ` Waiman Long
2024-01-09  5:11   ` Xuewen Yan
2024-01-09 15:40     ` Waiman Long

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®