Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3698206iob; Sat, 7 May 2022 12:18:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcEjcJuxryOMsZDH5hK3AId/fSDyajWrCkBoQjyrZyJi5xfsp7c45V6McQs9P3adxCeNLg X-Received: by 2002:a17:90b:245:b0:1dc:1597:20e with SMTP id fz5-20020a17090b024500b001dc1597020emr10489520pjb.151.1651951128729; Sat, 07 May 2022 12:18:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651951128; cv=none; d=google.com; s=arc-20160816; b=QxXJPkp+MLYdqp0KHOOnL75AUhbTF3mbz2s5/+Bn4O8Z4A+kGhSmu6zI0CU2ZqZkvS b8pvmqDtisx2wqUknFkrfpj+Eupp4VmzmtYVGMrzP32YkYbjxJs8iY2v21lrhQylk3Ow LypSUItPpBHMj8KBIEb9D0Do8FALNCRBQuOSGyGUqmTF9KZpq50uCE4nIcW3c2iXRjW8 Q0WpL9oSfHAumC6zy4xnYgcoUWzXoB/13ZOhXXJEWhXRmxXVj0/1rIi9VkkIyZMYUvGG yoQAcix1xWdmQW5D8HDQDZBx3I+fjHBD2s6mIoaGyNTmkVzo0a001VObrH72vLeLCMTe RThA== 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=28/ANjgPxhSF07gmAtgSxPtZRFmln0bHo/1t+Tc9gNI=; b=cb/8VjT7nnrxOMNFKKpruD7sBdZNQH0DSQ1fUv9CC3fLtvK1XG5AM5fI+OmxUZkp8C XLF2daPz8WgIjyTEPMJRdXpuqqRjG9yOqXKP4BdbCMVByQIFyQH4jq1AZRZkFz641m1+ JvB2pHDiHkATorIzv+s5sjZPeDrv5mU6ygO8PV/p25+xrmwVZecoNw+PcK1Xbv0B1lWM teNCrWugtW3/u+y1svMkJkA+QN+KclITCCGrDnH1WfdLWS2FXmPkz8Xb4Dcdu7KMwqLs a85mbA5lk7Rer7lJFaRhv7RhqatQKImMit9tdckTqrVCmxLt/nma56/SmhccUMCa3x+A w4GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="tg/t1P2a"; 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 s3-20020a170902ea0300b00156aa838400si7108149plg.621.2022.05.07.12.18.31; Sat, 07 May 2022 12:18:48 -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="tg/t1P2a"; 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 S1356245AbiEDRLz (ORCPT + 99 others); Wed, 4 May 2022 13:11:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355026AbiEDQ7h (ORCPT ); Wed, 4 May 2022 12:59:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 681184924F; Wed, 4 May 2022 09:51:13 -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 C2FF2B827A3; Wed, 4 May 2022 16:51:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58678C385AA; Wed, 4 May 2022 16:51:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683071; bh=OM7cXWUgQsh7S2dSER4HhmICHOFNPlw7hzYj/A2eg9M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tg/t1P2acfW2pV1SyOGKFv4JPAq85AbBJdP1yBCltK4N2lECxRI4hmPdioIawxpTH bjQDYZBlhj+1d25V1d54MvWnn/mx4MpP7O3e+8McWRSCmBvdB8oUD7ow7q/OoZoV/j rj7ibC+6JKfyWNgBBU1tgez+UuGvnu04nCJTnF28= 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.10 067/129] tcp: md5: incorrect tcp_header_len for incoming connections Date: Wed, 4 May 2022 18:44:19 +0200 Message-Id: <20220504153026.578788965@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153021.299025455@linuxfoundation.org> References: <20220504153021.299025455@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 f0f67b25c97a..62f5ef9e6f93 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