Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1512241iob; Thu, 5 May 2022 03:04:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwr29JNwQajw4QCI4WZRWzZQyu62bR9k/Bwc2WOEztlu46lUS0Z2RNbpN65AEe+6wf1Vfjt X-Received: by 2002:a17:906:6a1b:b0:6f4:a9b8:e027 with SMTP id qw27-20020a1709066a1b00b006f4a9b8e027mr10218247ejc.222.1651745081103; Thu, 05 May 2022 03:04:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651745081; cv=none; d=google.com; s=arc-20160816; b=tBIbDQvO2tZUS3A0MqvCfO9Ve5bsSUVn5AEpK5D6Kj9MB3EVukI9j3k1HHUHHEg+SN ExRmQEI8mpfDZ/9iBb7Acq7+WTCJDztsEG8/UybzL/7zPBZ68T7ZKpTcREsLnOppTk75 infO6J3TUm1mtDuOXEsNv3CJvEclHxG3hybSp6TRlSX2aR3gY9h3nyoh8/FfW2rS3blz OVkY+hpM6uRkOoeAT0v9wnx6J6ACzFnvj4Bf4uTelPnuGNrBBVFH0XzJZCl3mraQJ7SP OG1rV3iMErimezOPqedEI3gIVbBTAwnwu0zm0SqT7nGCNh27C8j4oZw6T79FQTbN9SuN DSCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vJj7q9wMYt6pIj3EgGpRsZAFbMp2VcmI2AeMHNJQFOg=; b=t80m+3wv5bm9qUiLkRhbpMZraZqNKFecLtWXZHpK2DYGem5u5NOo7rJDeZ7E5C++P6 SNyLhDm4TfNak8jzxkvpcA/NN1KXfOnp812EWuD8zhOz7hVM5sbgu1PPTZudnaLhhEYr 4Bu5GN/KtwNPewc6l5TSrn9gmm7tOFj5rTqGb8fidNJWRnfxioB2AChgqfcx6clLqR9m 0HGWAaYgXAExsx0TVPvwysKA1w1hWarpK5IxuC+q6hTubLJr64eDpxTAtVOuJQ6tcSQU RRIJzfDfCMi4TTMHfy+oN35qVQpobqbNriLpxXZHS8OSudT1Mldn0HauEHNsw2SEMuh5 YpCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="LWJb/H4r"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lb8-20020a170907784800b006efe546a91esi1740298ejc.140.2022.05.05.03.04.16; Thu, 05 May 2022 03:04:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="LWJb/H4r"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357900AbiEDRUL (ORCPT + 99 others); Wed, 4 May 2022 13:20:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356137AbiEDREz (ORCPT ); Wed, 4 May 2022 13:04:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5B4A50073; Wed, 4 May 2022 09:53:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E00D8B827A6; Wed, 4 May 2022 16:53:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7ACD9C385A5; Wed, 4 May 2022 16:53:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683231; bh=+zsxUrdCriv/HUEE0NzYrokSTVzd+971nHkaK5R5ooY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LWJb/H4r92G3LxN0v1lFNTqcTTQ3HsQ00PnDnN/x0Z4qg7LXixW/xitJ5dzdNs1YL 0OuVoWts9h9T8yTV8ExbGH2i2Smj4F2JiZT5myCHQ08iLDfej1GbEvx1ny5nMAddHx YHECfjfHJzk2o0Ffuv8sYKnEJ5WRJUd1Mjx7ZL90= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Francesco Ruggeri , Eric Dumazet , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 084/177] tcp: md5: incorrect tcp_header_len for incoming connections Date: Wed, 4 May 2022 18:44:37 +0200 Message-Id: <20220504153100.626141326@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153053.873100034@linuxfoundation.org> References: <20220504153053.873100034@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Francesco Ruggeri [ Upstream commit 5b0b9e4c2c895227c8852488b3f09839233bba54 ] In tcp_create_openreq_child we adjust tcp_header_len for md5 using the remote address in newsk. But that address is still 0 in newsk at this point, and it is only set later by the callers (tcp_v[46]_syn_recv_sock). Use the address from the request socket instead. Fixes: cfb6eeb4c860 ("[TCP]: MD5 Signature Option (RFC2385) support.") Signed-off-by: Francesco Ruggeri Reviewed-by: Eric Dumazet Link: https://lore.kernel.org/r/20220421005026.686A45EC01F2@us226.sjc.aristanetworks.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv4/tcp_minisocks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index 0a4f3f16140a..13783fc58e03 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c @@ -538,7 +538,7 @@ struct sock *tcp_create_openreq_child(const struct sock *sk, newtp->tsoffset = treq->ts_off; #ifdef CONFIG_TCP_MD5SIG newtp->md5sig_info = NULL; /*XXX*/ - if (newtp->af_specific->md5_lookup(sk, newsk)) + if (treq->af_specific->req_md5_lookup(sk, req_to_sk(req))) newtp->tcp_header_len += TCPOLEN_MD5SIG_ALIGNED; #endif if (skb->len >= TCP_MSS_DEFAULT + newtp->tcp_header_len) -- 2.35.1