From patchwork Fri Jan 5 06:04:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xuewen Yan X-Patchwork-Id: 185229 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp6046999dyb; Thu, 4 Jan 2024 22:06:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IFRqInped6vEbm3QRbTbCgeZhACEAsH0Yr4Dho+Qll2oUG97/mX3d8UML+QpFZuIxw/cmFk X-Received: by 2002:a17:906:ef0a:b0:a28:67a9:eec8 with SMTP id f10-20020a170906ef0a00b00a2867a9eec8mr976746ejs.93.1704434802786; Thu, 04 Jan 2024 22:06:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704434802; cv=none; d=google.com; s=arc-20160816; b=J0FzrwtXICfHYW296RLrZOgHwT9A3w2BEtrSzLMwrI/Cp9i8h53exlK+bdTwZFGGQg 5Ko8s6x29seCu6VMQFZmEd5KA9PRg6YW+/IsbBkaGY3wCKipVA2nq943iitDcIYTAa8D PmTSmftlX2ZAG2GQyUAK0ryQB2rRRiJ9xmt1E5PsmkNPcd/PC1jEK3X873JpdOGDUA9M Ft+obHJKOVXwtC/g1AO9SwOyovb2GoxoJSkZHVSqC+HRa4F7Uj0J632TmnclmORtNO6Y XFOF844l9Bc3DzMGZ8F7iTEGGbMGb9Oz+vMYgrnGcx8UVtXN4aq3WYMpo7uJPFc1xwuS A2Xw== 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=WdkFKCRbyK0g3vjxPFtUnW8TRCKNxZu/fajrS3Vsaq8=; fh=6TEuBn3xHBmm9CO09z8Oulz2ZYn5AJtkDIzfzYoQFK0=; b=MeLWyLlZciSmJIFH/6JyaWbzyN4yQy4iiwSbb6NcodrFSbaBleUEw7uL13BJlEK2rX LcmD30miENrfrPqFs5EVZq/afWxYblE+S2sFoTczQ0YYHahJ2kkidHwkNuqKj0ML4UWR pjMR/rvmzRwi2ne3GQ09ihxr400gj8FIpJyO0xEq3AUm9DJLfcjKEvj0W+vTClH8CJXS 8WVQ+f80hcqRODX5TfuRtoVR3g4uRnn3pRq+KOUo0Fm58Nsti3NJKbZUqe+WvdCow8rh B4bojfg/9YOJOoobtd5EsqRiN1WKViXXBo9HALDWXy0AENx75M+GmGbg6ihJ2p9VkDUI LW2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-17498-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17498-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id gh38-20020a1709073c2600b00a2934eecdcesi247157ejc.425.2024.01.04.22.06.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 22:06:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17498-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-17498-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17498-ouuuleilei=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 675B71F22E32 for ; Fri, 5 Jan 2024 06:06:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F198FC8C6; Fri, 5 Jan 2024 06:06:23 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org 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 X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL: SHSQR01.spreadtrum.com 40565A0p056912 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787229427891399327 X-GMAIL-MSGID: 1787229427891399327 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, } /* is not found in ::locks_before */ + graph_unlock(); return 0; } }