Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp1590225lqb; Sun, 26 May 2024 07:58:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUFl31kZ66+WAZXVK3snRXQu6BZGXLOQqMdrJy9PzYc6p8E5nmkBve6LkVcH1RL0yLnCrNQzkwSuu0xuuHqjM1M8EGagGvwyFbFzCuv7Q== X-Google-Smtp-Source: AGHT+IGfaPcNGIAMes0JycoTQEoHCdgxI/psvOELafoMIneNlqcKWF64zAN1m/Ij+tX+oJ9rRiQS X-Received: by 2002:a05:6512:4810:b0:523:9226:41db with SMTP id 2adb3069b0e04-529644ebf50mr4252039e87.6.1716735492646; Sun, 26 May 2024 07:58:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716735492; cv=pass; d=google.com; s=arc-20160816; b=HTYNeRy1ehGPJluTJFAPpbGPgseVQ+DUOXnfrQXSBxsLsuLF82JKB/p3tRA4mwZHRY 8sm+Mimhs9HyidcBCyqh+RVCYXChFa6oMPERd4RhNme0bRH2emojNS6Lvml6Zcnnb8cy MlvRXqQHRHALwlly38xRZ84FrrWBJ44l2WaltqbC7U2Y+Nxlc5FeBBYom18x3cOn7BBO jTOap/ff7Z5kkMOyzWVUZoDpnda9PpzLNFSBtFUApXmvxdSUYW4qWmWjp3VEN95A7iOp w3qUymnxSlHxttg68ulSWaswqVwc43EdlmDPApIt1Ue6v/z++CPEL9qPCLwXQzTjLg9H KP8g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=feedback-id:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=XnvCmt3oH2ZD5gfCXyPTjy/JpSyt+EJJAaNUNSZ5TMg=; fh=7gDKjcn37NJSytuZtQlEeku1ePPZ2uKMRksW5a3LnhE=; b=a8EEv9NPFpnRDosgyTKDHsT0nrXfAghy/Yea+ieOWg1wYJUb/IB3J3JceN3nOWmQ8j qMeWtxrbr6NlYaq8CMYpd/LfgEBXnyX+b2EiCo/sz8A4ktK0Bizwy54cYx8mTJS/8lho FDOc2rNpPQwAz0UdaaKYd17PtuRUFhAk8/bEW+s/Yq8yxwy/gTpP1hu/pn2NmfnJuP8j EQAIOhjhuQnaHVICKhrUDFl6RhZ5vfQVFQaEKhsgv3gYveTqk2hn5xgVwwOrbMfCCsL7 QWTF6RUOvUF1WsVZ0IVM+ddIm13wpqOPPnbEjUIRepTEujo4zPbFSVdoB2WbwBexfs/q Qgpw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=uniontech.com); spf=pass (google.com: domain of linux-kernel+bounces-189766-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189766-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5785245feb1si3021602a12.291.2024.05.26.07.58.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 May 2024 07:58:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-189766-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=uniontech.com); spf=pass (google.com: domain of linux-kernel+bounces-189766-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189766-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 5C62F1F213AD for ; Sun, 26 May 2024 14:58:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4977D18B05; Sun, 26 May 2024 14:57:53 +0000 (UTC) Received: from bg1.exmail.qq.com (bg1.exmail.qq.com [114.132.67.179]) (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 AD2751863E; Sun, 26 May 2024 14:57:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.132.67.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716735472; cv=none; b=mEAr0NZSJrdspEiay4mzqIYqBiQOPUAAfDF3MrXqzBQQ+bzFw9DsEZX8Lx6Po+e5ujjFPbc/B6QAjUq70WvmKnRtFTMzOoqsD0ydhn87CAxalsYwS19bRGvT3pAMRFUpK5C3vGL+X1++lDpD11kaZDpj9V0sTuxyGOSQCgSsylM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716735472; c=relaxed/simple; bh=nrD4hFFvapXYZd2L53EHBsQezPh8Yz2h9r35lDCw8rA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dEuRAL9pB1XqFTjkD9JxJldczDoQw/Fd9GU4xlogCqeLAlpRsZLJ4wbGslEnE9AY0mhV+OAVe9NVZeO5wMdMZe7Gfa4+VA43yCEEzMxW0godki7Xv+FJTlLXw5hxgXrRgQkgc2Fef/mFFn88Cqcb4Uvr0pKDpHf4GvPlMoMf8iY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=uniontech.com; spf=pass smtp.mailfrom=uniontech.com; arc=none smtp.client-ip=114.132.67.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=uniontech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uniontech.com X-QQ-mid: bizesmtp90t1716735448tjvg0qfg X-QQ-Originating-IP: K72cxvKEX3Aw3XDhR4O/4VT8Xy+EieP4tjIR8Zz/AfM= Received: from localhost.localdomain ( [125.76.217.162]) by bizesmtp.qq.com (ESMTP) with id ; Sun, 26 May 2024 22:57:26 +0800 (CST) X-QQ-SSF: 01400000000000I0J000000A0000000 X-QQ-FEAT: D6RqbDSxuq6QJkXJx+RtBYhcIlGiq6QAi8sR0DhEb4B9PY63Zcngyo2cg4aJi TryaNq8M8wR/IPplEXxsI7zOmjJ8Ski90vfc7lST+mXwxPYllM+XB5ucAXTF70fndovfCqt 8JegV229Yz6Tb/kC/CRBoomQjWj6nqWhxhlvWSRWFgWYYlfFsFJy5sHwBQxOPAXDoyTyD6q RAx8r2HbltBUj86hy09lRg29WN9JqjpDIMY/h2k6MIudZF+NB3EnQvT6KkWW/+b7htK1FFF YfXuKVl4kbZE/N/OE9rYnInDHhtzCRH7T1tk5GvhN2s+X3C8lNR7bRXzA7cN1zqnq21ylRX CsQPmzKgActsdmT8xlHvWqs2aWhDGsCRAc9HaH0Q5uoFkQ9P0ZsvjqAgFQxsuUOxCjfGutg GnqYmbqcfxg7Ry/dgFmXQ5/j25Oa0Y4g X-QQ-GoodBg: 1 X-BIZMAIL-ID: 1830244723863975844 From: Gou Hao To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, kuniyu@amazon.com, wuyun.abel@bytedance.com, leitao@debian.org, alexander@mihalicyn.com, dhowells@redhat.com, netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, zhanjun@uniontech.com, gouhaojake@163.com Subject: [PATCH 2/2] net/core: move the lockdep-init of sk_callback_lock to sk_init_common() Date: Sun, 26 May 2024 22:57:18 +0800 Message-Id: <20240526145718.9542-2-gouhao@uniontech.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20240526145718.9542-1-gouhao@uniontech.com> References: <20240526145718.9542-1-gouhao@uniontech.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybglogicsvrsz:qybglogicsvrsz4a-2 In commit cdfbabfb2f0c ("net: Work around lockdep limitation in sockets that use sockets"), it introduces 'af_kern_callback_keys' to lockdep-init of sk_callback_lock according to 'sk_kern_sock', it modifies sock_init_data() only, and sk_clone_lock() calls sk_init_common() to initialize sk_callback_lock too, so the lockdep-init of sk_callback_lock should be moved to sk_init_common(). Signed-off-by: Gou Hao --- net/core/sock.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/net/core/sock.c b/net/core/sock.c index 67b10954e0cf..521e6373d4f7 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -2262,7 +2262,12 @@ static void sk_init_common(struct sock *sk) lockdep_set_class_and_name(&sk->sk_error_queue.lock, af_elock_keys + sk->sk_family, af_family_elock_key_strings[sk->sk_family]); - lockdep_set_class_and_name(&sk->sk_callback_lock, + if (sk->sk_kern_sock) + lockdep_set_class_and_name(&sk->sk_callback_lock, + af_kern_callback_keys + sk->sk_family, + af_family_kern_clock_key_strings[sk->sk_family]); + else + lockdep_set_class_and_name(&sk->sk_callback_lock, af_callback_keys + sk->sk_family, af_family_clock_key_strings[sk->sk_family]); } @@ -3460,17 +3465,6 @@ void sock_init_data_uid(struct socket *sock, struct sock *sk, kuid_t uid) } sk->sk_uid = uid; - if (sk->sk_kern_sock) - lockdep_set_class_and_name( - &sk->sk_callback_lock, - af_kern_callback_keys + sk->sk_family, - af_family_kern_clock_key_strings[sk->sk_family]); - else - lockdep_set_class_and_name( - &sk->sk_callback_lock, - af_callback_keys + sk->sk_family, - af_family_clock_key_strings[sk->sk_family]); - sk->sk_state_change = sock_def_wakeup; sk->sk_data_ready = sock_def_readable; sk->sk_write_space = sock_def_write_space; -- 2.20.1