Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1478524iob; Thu, 5 May 2022 02:08:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoMiMwO5oBztM+Jl28eGK5C4voXU7W81jkkk+h3Cy9iQHKKhRIbmu296LaDXa6lDtEY11t X-Received: by 2002:a50:d79a:0:b0:425:e577:c71a with SMTP id w26-20020a50d79a000000b00425e577c71amr28419271edi.188.1651741698386; Thu, 05 May 2022 02:08:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651741698; cv=none; d=google.com; s=arc-20160816; b=JE2gMqUxinDjykLm1KXK4Ch/UujUouZRdueJtDxgnJugVUuxa5MUxnhnzUssscL9Gc x+gbcZ4xeurI3eqtPPVq0EBiUGgr1qEOXmTxBhSjPLUyW5GVbe+yrduUT4rx5Or8n1D3 19yUiXMuSiMGzivbLx2yiMViBO4511+80av6MAoP2nqBwUHwR6wzdHkeYy66QGk+r/SX F1MR683u82J55KKLetTLfnWIUCc8rAK07sX1N1ZdTh0Vv3iRTv58Zt9qbqzxWxsQI+gU Mho5gHYkLVb2aGhe1dcMYJdr+C9z+L2ZuUlNohIMpF+LEobw2o7N300MkBwpkppIMdX8 hA2Q== 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=9QBtNDTYVpdtAy32oRy+9OxY9J8K8DSHj4uj/XrbIUQ=; b=JU3ePyK0gNFmYNjV+R9bJWHvawKvXxUyEgeyqhZXdsEpN0puiVb9wMiXjXSrokw1V+ /sLuKbPhGj/ITNqBeUV7uQPXb/0nkq9xiftCiqsx6dxVsHZunq/GMlHo60rso7zD1spj 0sPRXOCsGJfrW/4G6M1+Fo1Hl5mRXrsL8H6kbEVRh0rm7Jf3CDjf0EjtrC2nu7ZZ11K2 7cpjhJPO3tIt8glaKQ8RNVwXENfufsTq6wvo9kKfyotv3sURsFJlS+aVw+zn3dpT+lN/ Pdk5dFBpd2sV8HrcqtT97+QlmcpX6ul8WJIGPcoyOpk1/i1KxCCj0EQitmDwOk8AwzGC 8rbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="yFzO/+Vr"; 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 g8-20020a056402424800b00425d8c497cfsi1506176edb.149.2022.05.05.02.07.51; Thu, 05 May 2022 02:08:18 -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="yFzO/+Vr"; 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 S1358292AbiEDRd7 (ORCPT + 99 others); Wed, 4 May 2022 13:33:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357090AbiEDRJ6 (ORCPT ); Wed, 4 May 2022 13:09:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D34448E76; Wed, 4 May 2022 09:57:05 -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 221C7B827A3; Wed, 4 May 2022 16:57:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADFECC385A4; Wed, 4 May 2022 16:57:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683421; bh=8jV2h+eNgYTlk2g9f/ePE55tVvCnKBAeJ8Q1/2X9DBs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yFzO/+Vr3KGYhD/izHbCtSZqcbSq4IrfwBZ8kowAmxqYudpc7FiAON41wKygpztl3 PxCK106Mnxr+YxYISMndcxUNyvhs+TShS1aNeSEkTXKjiCPFffBa7Tu00VTGOEAkTJ ClUWYqzpwkc8F7L3LufDythPXIJgPbmp++dFRA8k= 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.17 105/225] tcp: md5: incorrect tcp_header_len for incoming connections Date: Wed, 4 May 2022 18:45:43 +0200 Message-Id: <20220504153120.037017876@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153110.096069935@linuxfoundation.org> References: <20220504153110.096069935@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 7c2d3ac2363a..492737d2b7d3 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c @@ -531,7 +531,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