Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp719229lqs; Fri, 14 Jun 2024 03:55:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUpbzRZzinSt7noiMSELt58/A3/Zlc8bcVEIZ4GxUYkPKi9asc8t1qx0OVHW1SykKnVIyspARJduKi3FYPOwiMPQzHKQmn2S9EdWI9k1w== X-Google-Smtp-Source: AGHT+IHJLpDp10Fh/h05Bt9O/IpoetsAOE9mySfCHPYe/Zkfpx5V7sKVzpqFxfG/vwDP18ZUE5L0 X-Received: by 2002:a17:906:6886:b0:a6f:4ae3:5324 with SMTP id a640c23a62f3a-a6f60d3fd58mr150558066b.40.1718362518084; Fri, 14 Jun 2024 03:55:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718362518; cv=pass; d=google.com; s=arc-20160816; b=tci1Q2Mre/jlOpL9zRz+jETk26ZOSImhK4qzb2XEhskbGia+FQAdgaser3igdAXeHN sVBwKhQqBhXa/ImNSnn13FVb0LdcpdutFm12YtBaWSMScf3v8jUZRXmHijraSQrLrpxx BcrMfzwG1LhOoerxxhX2NMxGLzRmcPdUG+MF4HIbjMRr4K9WMXkouG8mdon7lSamejEy sIZsL0Ny2YJcAMi/YF1ZdO8nRM7SX9ZMcvVorbzM/9DV7X3lAjx3mXtPiU3fuGdEqNqE iVm5Bv71BUIV15acWJVXJxL4+HmgS7NgSDEiLTaDvR6SFZRKvAyxqcAsGOfKDahqsG7v 61ZA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=pa5RI73Cbm3LA2mtMODXqv44qiTHqXyd2kmN0K1Ig6Y=; fh=bW69jgBcY4WbvKuEqrEVdq0shMgfwtZcchMkk4ea+Uo=; b=gk5KHcNXoz89E4/49OQZPvOCQ5q8HITIOnoVZDHUZr+9Nu6GbXLshcgXHgPsKZk0du p8SkJAywi4fz/CacP8OqWDjarEOReu4wCjwNM4E34L713amyJR/ByVDhReILX04ldkmw b0A7qaV0NTBwoNeteAWTSOTxPwMUOnm//Pg1L5wIhXELeflzbCb2x7JdCGgdWZF8yDc/ FCIZ70U/6loh+FctIjvgPtMWSSkpHI4LUBIqecbuAGrg1NQeQNzch4x5abqyYOUVcxqA X79ahuhMU1pMKzhacBOlMndOs9omeJQKEjkB0Nu+QRT/5UbNgN00U4sVDhDQxI6533YI rUEA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=strlen.de); spf=pass (google.com: domain of linux-kernel+bounces-214821-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214821-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 a640c23a62f3a-a6f56dd67desi163463266b.390.2024.06.14.03.55.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 03:55:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214821-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; arc=pass (i=1 spf=pass spfdomain=strlen.de); spf=pass (google.com: domain of linux-kernel+bounces-214821-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214821-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 C0CAF1F2220F for ; Fri, 14 Jun 2024 10:55:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BD6B719580E; Fri, 14 Jun 2024 10:55:06 +0000 (UTC) Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [91.216.245.30]) (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 2EB4419539C; Fri, 14 Jun 2024 10:55:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.216.245.30 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718362506; cv=none; b=aKAxNQY5honxgdQmgH7mS4CKSZlKTJxfBZsw/gAoUyTZ+lwAbnv5sFQFQ6aksghxB3nVwzAbW+hjg8+flLzWP+2f0W4rC5rvqy5w9Crq870MbXjmY7LlZEr2qYHC5BWqEc3DnVWXV+bOMydvlD61hBTFZakCPYa0a8Cls80koG4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718362506; c=relaxed/simple; bh=AC6asnkFXpU0r0Pl9EyslQA5xfu3UdgVgxcdXZ6lmFc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sNcOhsqSWi62TN9f8vG8uWFHfinbpJglin4eXcTmxKWeMQ6TZxSdJgFp+WXHfknbcqDmt+k3Zx1ixvo8B51+WqCsWQp0IWn2rM9gTZEPA3EzgCgSmPVBhZ1WmHbhtzQcnYSkKN3ed5NareZEiWei+skFeRKm1GQt4pJLzLbjx1E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strlen.de; spf=pass smtp.mailfrom=strlen.de; arc=none smtp.client-ip=91.216.245.30 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strlen.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=strlen.de Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1sI4Zt-0006X8-Cb; Fri, 14 Jun 2024 12:54:41 +0200 Date: Fri, 14 Jun 2024 12:54:41 +0200 From: Florian Westphal To: luoxuanqiang Cc: edumazet@google.com, davem@davemloft.net, dsahern@kernel.org, fw@strlen.de, kuba@kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, kuniyu@amazon.com, dccp@vger.kernel.org Subject: Re: [PATCH net v2] Fix race for duplicate reqsk on identical SYN Message-ID: <20240614105441.GA24596@breakpoint.cc> References: <20240614102628.446642-1-luoxuanqiang@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240614102628.446642-1-luoxuanqiang@kylinos.cn> User-Agent: Mutt/1.10.1 (2018-07-13) luoxuanqiang wrote: > include/net/inet_connection_sock.h | 2 +- > net/dccp/ipv4.c | 2 +- > net/dccp/ipv6.c | 2 +- > net/ipv4/inet_connection_sock.c | 15 +++++++++++---- > net/ipv4/tcp_input.c | 11 ++++++++++- > 5 files changed, 24 insertions(+), 8 deletions(-) > > diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h > index 7d6b1254c92d..8773d161d184 100644 > --- a/include/net/inet_connection_sock.h > +++ b/include/net/inet_connection_sock.h > @@ -264,7 +264,7 @@ struct sock *inet_csk_reqsk_queue_add(struct sock *sk, > struct request_sock *req, > struct sock *child); > void inet_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req, > - unsigned long timeout); > + unsigned long timeout, bool *found_dup_sk); Nit: I think it would be preferrable to change retval to bool rather than bool *found_dup_sk extra arg, so one can do bool inet_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req, unsigned long timeout) { if (!reqsk_queue_hash_req(req, timeout)) return false; i.e. let retval indicate wheter reqsk was inserted or not. Patch looks good to me otherwise.