From patchwork Mon May 6 03:09:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 13654859 X-Patchwork-Delegate: kuba@kernel.org Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (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 9024F3C489; Mon, 6 May 2024 03:04:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714964693; cv=none; b=m3papft5/ofgiQel3hG7srb8k1RcpzxKx4NYnrhJy8FxH4rgEEEr5wkqRWYe+FYtpLaXo/NnifKSc3HdR80lh8/YcupmRDuS5IWylxJeijxp3EdM1AtlVcBN11VOPZUUbia3wz0mnxpb8wr0x1/fBd0TnzvdWHjlDEaAI3YzRZU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714964693; c=relaxed/simple; bh=TVSPYkE9sRVNHV1H0Zb6I+09HIY37nj9vghSCf1iIlY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dKQ34n830OJLV451t5He+187wLpLCVqpQtNlGrDE5+ubrVheutMQJZkOobzwsyLg5ZeatsG1cPbmNcA7x8BQDCYnXxJdIKATHnNpVver3KvowAKKxj3RT21gM7Yij6ibgnNICHXl9wFn2Cx+H6MaplfwV/GCIKMt9LE+sNutz8Y= 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.191 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.162.112]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4VXmSL51J2z1HBjm; Mon, 6 May 2024 11:03:14 +0800 (CST) Received: from dggpeml500026.china.huawei.com (unknown [7.185.36.106]) by mail.maildlp.com (Postfix) with ESMTPS id D84E61402D0; Mon, 6 May 2024 11:04:28 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 6 May 2024 11:04:28 +0800 From: Zhengchao Shao To: CC: , , , , , , , , , , Subject: [PATCH stable,5.10 2/2] Revert "tcp: Clean up kernel listener's reqsk in inet_twsk_purge()" Date: Mon, 6 May 2024 11:09:27 +0800 Message-ID: <20240506030927.3168586-3-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240506030927.3168586-1-shaozhengchao@huawei.com> References: <20240506030927.3168586-1-shaozhengchao@huawei.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500026.china.huawei.com (7.185.36.106) X-Patchwork-Delegate: kuba@kernel.org This reverts commit 74e5e5601df4c4a4f1b7bd1da5761acf4aa8b084. There's no "pernet" variable in the struct hashinfo. The "pernet" variable is introduced from v6.1-rc1. Revert this patch. Signed-off-by: Zhengchao Shao --- net/ipv4/inet_timewait_sock.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c index 04726bbd72dc..c411c87ae865 100644 --- a/net/ipv4/inet_timewait_sock.c +++ b/net/ipv4/inet_timewait_sock.c @@ -268,21 +268,8 @@ void inet_twsk_purge(struct inet_hashinfo *hashinfo, int family) rcu_read_lock(); restart: sk_nulls_for_each_rcu(sk, node, &head->chain) { - if (sk->sk_state != TCP_TIME_WAIT) { - /* A kernel listener socket might not hold refcnt for net, - * so reqsk_timer_handler() could be fired after net is - * freed. Userspace listener and reqsk never exist here. - */ - if (unlikely(sk->sk_state == TCP_NEW_SYN_RECV && - hashinfo->pernet)) { - struct request_sock *req = inet_reqsk(sk); - - inet_csk_reqsk_queue_drop_and_put(req->rsk_listener, req); - } - + if (sk->sk_state != TCP_TIME_WAIT) continue; - } - tw = inet_twsk(sk); if ((tw->tw_family != family) || refcount_read(&twsk_net(tw)->count))