Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp260440rdb; Mon, 22 Jan 2024 03:27:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IHmbdKHtyTwApGG6ow/2OFcIhQGgTK96LSTZx/hwT0vLDCZQH737kfG0/3LGgUhAQYf7hDg X-Received: by 2002:a50:9519:0:b0:558:72d1:b8ed with SMTP id u25-20020a509519000000b0055872d1b8edmr1416848eda.45.1705922832203; Mon, 22 Jan 2024 03:27:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705922832; cv=pass; d=google.com; s=arc-20160816; b=mZp+S27U2uViRCX0IMZXbRniWoFTP8RB0CXGAznOJWq//+ZIV9hWZmpSrh70r7bMug ExesRLod+vnCIltp1dQlDIgw+3N6XGJz4VEoqRLFllvo7lKGOVG2YOYhgMqFcDl5m3iU oJuCWVK+4zoyAkFrxFr/tniko4Rluz/h2Brhmqnhn9NMJJyGPh1+9y/vPXHp83IUqbVe jGtqcuivB8Ym00xZOEd17i26OnDCfTxUrLcmddFLkrBFYodsOO81YNo+zC6xmDSGVn+q 2PmvfsQ2/tDgWSHtreQdxX6Eb1/hHgPMnVFWJroSqcWxzTfexrLNqHR/Iq9jbZ3w6tZZ TGDg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id; bh=QQGJfPJiuv1ZhLY5UcBKuwojTW9Ob10v/Kfs6l7ApVA=; fh=KNTlPrGF6XZXcL2/66Ly9D/+zjV+ii+j9stCs41ShJw=; b=WL7ECADrIWrIHewrTpKR6Pjxlluw6E/k+Hq+aoLvTCHy9KYdem3xhUTYFLlAyPHalQ DDXDeuwuidEewcMKsgWJQNr574br63Vh/d0H39MGWesNvDzP7HxH2xnlorVmqowv7MkT 4dev+CdI4nLtZB8Vt2DPCmCV4hJTWRaDSyFpQfxOyrYq4djRnF/ZtxEASPT2+34nwPlq GaN68GbwA13+5UB4fqgXe1+NR8Q1yzUghs86JJr43CGssFvXCVAWB9jlxjwaSkhGQZId reaN8JnpniE6jaN3TgENwRjHWCb3WgcFXfRBT7xmSSwOYkRm18BjRm0/tBiKpBqGx3gV zPIQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-32885-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32885-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id er10-20020a056402448a00b0055a49a21d7bsi3846398edb.388.2024.01.22.03.27.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 03:27:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32885-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=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-32885-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32885-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com 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 8361B1F27F8B for ; Mon, 22 Jan 2024 11:26:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8FF7E3FB2A; Mon, 22 Jan 2024 11:12:51 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (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 A0E343FB1E; Mon, 22 Jan 2024 11:12:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705921971; cv=none; b=I7ywl4t8xATgSaEEGKu09f/+EWrsFv7SDAqvf/GZzm3mYoevzcVij+cx3M37WQlGUwx0ORmdFOFW5E0NTvB8L8QQf0oiD51+PA2fJ8lOz7gpIYDaE6snjKfLQtuJHtqUMw/176bQ2iSBRY0DE+rX6zvhFuUdN1EbZS45sMh1ilc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705921971; c=relaxed/simple; bh=rOtL9M7EFa+Ovl0KWx795b/5zMGGND+rDCTV90EM8Kk=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=qpmNT123Ck3EsqmhHbWAcJ40njyl+omtuvsYsz6x2x+JNE4sPILrI2pHPJU5RXvWSOyMWShAvi4qqvgDZeu6fOcswQ0SKXWgWDy/zlo+Qvp51/fu4HQY7gNiqX9RhUa5po8qMs3czsM6Se9RuvQQH2h8o3zRysaAb6Nj5zFWxwY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4TJSGS3H4zzsWKc; Mon, 22 Jan 2024 19:11:44 +0800 (CST) Received: from dggpeml500026.china.huawei.com (unknown [7.185.36.106]) by mail.maildlp.com (Postfix) with ESMTPS id B65991400E5; Mon, 22 Jan 2024 19:12:44 +0800 (CST) Received: from [10.174.178.66] (10.174.178.66) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 22 Jan 2024 19:12:44 +0800 Message-ID: <7f963ac6-28ef-376c-e20d-bdfaedefba36@huawei.com> Date: Mon, 22 Jan 2024 19:12:43 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.0.2 Subject: Re: [PATCH netdev] ipv6: Make sure tcp accept_queue's spinlocks are initialized To: Chen-Yu Tsai , "David S. Miller" , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , References: <20240122102322.1131826-1-wenst@chromium.org> From: shaozhengchao In-Reply-To: <20240122102322.1131826-1-wenst@chromium.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500026.china.huawei.com (7.185.36.106) Hi Chen-Yu Tsai: I have send the fixed patch. https://lore.kernel.org/all/20240122102001.2851701-1-shaozhengchao@huawei.com/ Thank you Zhengchao Shao On 2024/1/22 18:23, Chen-Yu Tsai wrote: > Commit 198bc90e0e73 ("tcp: make sure init the accept_queue's spinlocks > once") moved the TCP accept_queue spinlock initialization from a common > core function to two places for two cases: the common accept callback, > and the socket create callback. > > For the second case, only AF_INET (IPv4) was considered. This results > in a lockdep error when accepting an incoming IPv6 TCP connection. > > INFO: trying to register non-static key. > The code is fine but needs lockdep annotation, or maybe > you didn't initialize this object before use? > turning off the locking correctness validator. > Call trace: > ... ... > register_lock_class (kernel/locking/lockdep.c:977 kernel/locking/lockdep.c:1289) > __lock_acquire (kernel/locking/lockdep.c:5014) > lock_acquire (./arch/arm64/include/asm/percpu.h:40 kernel/locking/lockdep.c:467 kernel/locking/lockdep.c:5756 kernel/locking/lockdep.c:5719) > _raw_spin_lock (./include/linux/spinlock_api_smp.h:134 kernel/locking/spinlock.c:154) > inet_csk_complete_hashdance (net/ipv4/inet_connection_sock.c:1303 net/ipv4/inet_connection_sock.c:1355) > tcp_check_req (net/ipv4/tcp_minisocks.c:653) > tcp_v6_rcv (net/ipv6/tcp_ipv6.c:1837) > ip6_protocol_deliver_rcu (net/ipv6/ip6_input.c:438) > ip6_input_finish (./include/linux/rcupdate.h:779 net/ipv6/ip6_input.c:484) > ip6_input (./include/linux/netfilter.h:314 ./include/linux/netfilter.h:308 net/ipv6/ip6_input.c:492) > ip6_sublist_rcv_finish (net/ipv6/ip6_input.c:86 (discriminator 3)) > ip6_sublist_rcv (net/ipv6/ip6_input.c:317) > ipv6_list_rcv (net/ipv6/ip6_input.c:326) > __netif_receive_skb_list_core (net/core/dev.c:5577 net/core/dev.c:5625) > netif_receive_skb_list_internal (net/core/dev.c:5679 net/core/dev.c:5768) > napi_complete_done (./include/linux/list.h:37 (discriminator 2) ./include/net/gro.h:440 (discriminator 2) ./include/net/gro.h:435 (discriminator 2) net/core/dev.c:6108 (discriminator 2)) > ... ... > > Fix this by adding the appropriate code to AF_INET6 (IPv6) socket create > callback, mirroring what was added for AF_INET. > > Fixes: 198bc90e0e73 ("tcp: make sure init the accept_queue's spinlocks once") > Signed-off-by: Chen-Yu Tsai > --- > net/ipv6/af_inet6.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c > index 13a1833a4df5..959bfd9f6344 100644 > --- a/net/ipv6/af_inet6.c > +++ b/net/ipv6/af_inet6.c > @@ -199,6 +199,9 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol, > if (INET_PROTOSW_REUSE & answer_flags) > sk->sk_reuse = SK_CAN_REUSE; > > + if (INET_PROTOSW_ICSK & answer_flags) > + inet_init_csk_locks(sk); > + > inet = inet_sk(sk); > inet_assign_bit(IS_ICSK, sk, INET_PROTOSW_ICSK & answer_flags); >