From nobody Fri Dec 26 13:26:50 2025 Received: from SHSQR01.spreadtrum.com (mx1.unisoc.com [222.66.158.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 09D775662 for ; Fri, 5 Jan 2024 06:06:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=unisoc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=unisoc.com Received: from dlp.unisoc.com ([10.29.3.86]) by SHSQR01.spreadtrum.com with ESMTP id 40565A0p056912; Fri, 5 Jan 2024 14:05:10 +0800 (+08) (envelope-from Xuewen.Yan@unisoc.com) Received: from SHDLP.spreadtrum.com (bjmbx01.spreadtrum.com [10.0.64.7]) by dlp.unisoc.com (SkyGuard) with ESMTPS id 4T5t6m0M9xz2NZjcg; Fri, 5 Jan 2024 13:58:24 +0800 (CST) Received: from BJ10918NBW01.spreadtrum.com (10.0.73.73) by BJMBX01.spreadtrum.com (10.0.64.7) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Fri, 5 Jan 2024 14:05:07 +0800 From: Xuewen Yan To: , , , CC: , , , Subject: [PATCH v2] lockdep: Add missing graph_unlock in check_prev_add Date: Fri, 5 Jan 2024 14:04:56 +0800 Message-ID: <20240105060456.15331-1-xuewen.yan@unisoc.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL: SHSQR01.spreadtrum.com 40565A0p056912 Content-Type: text/plain; charset="utf-8" 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: /* is not found in ::locks_before */ return 0; So add graph_unlock before return 0. Fixes: 3454a36d6a39 ("lockdep: Introduce lock_list::dep") Signed-off-by: Xuewen Yan Signed-off-by: Zhiguo Niu --- 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, } =20 /* is not found in ::locks_before */ + graph_unlock(); return 0; } } --=20 2.25.1