Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7527296rdb; Wed, 3 Jan 2024 21:41:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IF6mvowsjHMGxtMDfs4eeIEq8/FKsW3/1h23siHnhhjbRsWlC64+qOSdq9IUvZuavSAhbK4 X-Received: by 2002:a17:906:5199:b0:a28:ea3e:7c6c with SMTP id y25-20020a170906519900b00a28ea3e7c6cmr14694ejk.17.1704346896427; Wed, 03 Jan 2024 21:41:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704346896; cv=none; d=google.com; s=arc-20160816; b=ETpXpdleQJhcZ3VkdTFFydV4dHs2Zdy3ohn0GQVZD6LmGSjuwldjHmApW4H0u+wsS/ hKNHUdzr8V3sSu9sKQNIfyQeeDe1emHyCvr4o+jv6y45jTkJFgSpWEsb7t2r0IBE/JGJ 7I7F30bZ8gXhcdBXH7nHG7fUIIJUo0ZBXalfkDS8MLVpVuCygK16kAl0UqBNpFE+B+Zd aLFUmBtgi9bhV36whaJGpFEiurDm9LE/pjASKhnYMX1CuGl2MgM/a6HlYRFt4VfdY74x tRn53GNp0acEDNctGio7iIi+coo0IgM7KiBmbbA0ltF++/RQfLp35ehbYZs31cs7rJ16 lZ3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=EsnJy+leTwKbzpG/0sU2DwnSB8aB+UajX9OfOZ++ZGA=; fh=fCbZmewdeCoNvgouhvn6BTfl32w0KLbPSiVoJrFPDA8=; b=FYcRzytLaOaZvCM1z82rP5FpQMVg5C6QaDEpAwsAGRq2MJXl2K2hK7XUygyWAhzOu6 MLRe2TUj90YVCG2f2/synlq7pSPu304HI9QkHIGpurDnWlU+/LcJ3Mm4DWnNRe0xLBAz LfAGidGeAkchNvwsXyyJZT5fmJ3PvDCLlieixkghcSRFC+RSLgVZef0k4GIIEuFB6bNO 2NEPV2mLaE9O1fBOzLuSDDSDN3CFASADyOYYXWws+CceFE8nnf1NQfcSmrKClqa2yIAX WkeR2+sqMjGc7/BGTIwmRgEUHCdjm2zusupE1lFUj4B9AR6h3q8fzNi/1IJ1RE2t8FrO IANA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-16263-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16263-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id v27-20020a17090610db00b00a282244234asi2438683ejv.439.2024.01.03.21.41.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 21:41:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16263-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-16263-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16263-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 326B51F26002 for ; Thu, 4 Jan 2024 05:41:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 908C719456; Thu, 4 Jan 2024 05:41:29 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from SHSQR01.spreadtrum.com (unknown [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 8D38F18EBF for ; Thu, 4 Jan 2024 05:41:20 +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 4045eZCU057778; Thu, 4 Jan 2024 13:40:35 +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 4T5Fct75KXz2QcMNy; Thu, 4 Jan 2024 13:33:50 +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; Thu, 4 Jan 2024 13:40:33 +0800 From: Xuewen Yan To: , , CC: , , , , Subject: [PATCH] lock/lockdep: Add missing graph_unlock in validate_chain Date: Thu, 4 Jan 2024 13:40:30 +0800 Message-ID: <20240104054030.14733-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: 8bit Content-Type: text/plain X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL:SHSQR01.spreadtrum.com 4045eZCU057778 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 Signed-off-by: Zhiguo Niu --- 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