From 8b41af93300c80555f0795a7f605237dc1dbee3d Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Thu, 9 Jun 2022 11:42:25 -0700 Subject: [PATCH] sync/lockdep: use RangeRepeatable instead of Range It is lockless and so it guarantes to avoid nested locks (deadlocks). Reported-by: syzbot+7f2b94fef2e1109bcd40@syzkaller.appspotmail.com --- pkg/sync/locking/lockdep.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/sync/locking/lockdep.go b/pkg/sync/locking/lockdep.go index d58c2c825..b38d2fd0b 100644 --- a/pkg/sync/locking/lockdep.go +++ b/pkg/sync/locking/lockdep.go @@ -70,7 +70,7 @@ func checkLock(class *MutexClass, prevClass *MutexClass, chain []*MutexClass) { } panic(b.String()) } - prevClass.ancestors.Range(func(parentClass *MutexClass, stacks *string) bool { + prevClass.ancestors.RangeRepeatable(func(parentClass *MutexClass, stacks *string) bool { // The recursion is fine here. If it fails, you need to reduce // a number of nested locks. checkLock(class, parentClass, chain)