From nobody Mon May 11 00:10:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 758A7C433F5 for ; Thu, 21 Apr 2022 00:50:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383524AbiDUAxS (ORCPT ); Wed, 20 Apr 2022 20:53:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347647AbiDUAxP (ORCPT ); Wed, 20 Apr 2022 20:53:15 -0400 Received: from mail-vs1-xe64.google.com (mail-vs1-xe64.google.com [IPv6:2607:f8b0:4864:20::e64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6994815A3B for ; Wed, 20 Apr 2022 17:50:28 -0700 (PDT) Received: by mail-vs1-xe64.google.com with SMTP id r1so3128972vsi.12 for ; Wed, 20 Apr 2022 17:50:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:dkim-signature:date:to:subject:user-agent :content-transfer-encoding:message-id:from; bh=LWwI/BH/zs2PRw3S4cSl2rzpqJDY2RDYVUt6dkvsFts=; b=wnaqr9pwZuNaePcRDhyA2lZ8VclUb0EBODoG0TmvqZyzK2Ut6DKO9XEaiyFKIefKos AgAfkGrD9zDvbmDto58Bu1xquLx78iiOD4fDSE6CXr56zvs9Q9BSdWpicNKl9BeVltqS pk9hLqyNFrNOhwzNjbQ8/0rq/Ho++cFpo0veazysVDIajAOYkyPns+XhHCz6XNWL4zDd eWUMvme4bKsA2ozzWh85qYG2CkOzAe3TwdxPhcJCw2GgCjegyh4/RDBLCvRSVX/2IL8w A9ZP1U+ilQ3I+GihPjw6PvGo8IVXfLj1bcJr1PIIOv+zr0Mj73k89ieZt5r1mJ+Y6qKE pxqw== X-Gm-Message-State: AOAM530kJF/9P/dlJLwUlpCxFuoZ4fTYqqm/Vyda/cZgEfcIBcyHj6rG /Q1P23akl9YTJenp2ZnbtxtB5YRIlGp+gwyss6OylJQYcoKb X-Google-Smtp-Source: ABdhPJyx6JAyhWnwk8dFTXuMp9aOxl0jWB4NUgPircADTj8bfDwnEJh0lEtqyaEjDlkH/FqSpr9mgZ+oqwCp X-Received: by 2002:a67:c894:0:b0:324:c5da:a9b5 with SMTP id v20-20020a67c894000000b00324c5daa9b5mr7816833vsk.33.1650502227526; Wed, 20 Apr 2022 17:50:27 -0700 (PDT) Received: from smtp.aristanetworks.com (mx.aristanetworks.com. [162.210.129.12]) by smtp-relay.gmail.com with ESMTPS id x15-20020ab036ef000000b0035d3d7f148asm404575uau.12.2022.04.20.17.50.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Apr 2022 17:50:27 -0700 (PDT) X-Relaying-Domain: arista.com Received: from us226.sjc.aristanetworks.com (us226.sjc.aristanetworks.com [10.243.208.9]) by smtp.aristanetworks.com (Postfix) with ESMTP id 8A460509630; Wed, 20 Apr 2022 17:50:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=Arista-A; t=1650502226; bh=LWwI/BH/zs2PRw3S4cSl2rzpqJDY2RDYVUt6dkvsFts=; h=Date:To:Subject:From:From; b=dlEfqT+bunv39xlhI4BWZj3ZFE2fBZRwOljFenOnq0kVMO5dgZUvvoqpPNUpt3j27 3MwqQJdRXQ+5uBrapZF3vwa7f88Y0gKgk1dTbRHIZ2EC4vWdgKr+ohlqCb2XdAHr8M feM/14h0lZe8PpqWOlaYO0MZOuGiTaekvbO6aNG2AXrDO6DQqyiEvJphKtp9CH9Te/ aBEFQNSAYCPKNMnoOMDF3hK5uRwi3b/9P6p7vt71AWwUwG+a5ljbq05Oj3xGpZrWad HMVEaR/BglSTorvNgSoe+fItLi9YiiNx/hYOsvPQWl3+sDOMaAZ3/H0DLxAvfd0EA3 qgrh5v1ko5hWg== Received: by us226.sjc.aristanetworks.com (Postfix, from userid 10189) id 686A45EC01F2; Wed, 20 Apr 2022 17:50:26 -0700 (PDT) Date: Wed, 20 Apr 2022 17:50:26 -0700 To: pabeni@redhat.com, kuba@kernel.org, dsahern@kernel.org, yoshfuji@linux-ipv6.org, davem@davemloft.net, edumazet@google.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, fruggeri@arista.com Subject: [PATCH v2 net] tcp: md5: incorrect tcp_header_len for incoming connections User-Agent: Heirloom mailx 12.5 7/5/10 Content-Transfer-Encoding: quoted-printable Message-Id: <20220421005026.686A45EC01F2@us226.sjc.aristanetworks.com> From: fruggeri@arista.com (Francesco Ruggeri) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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. v2: Added "Fixes:" line. Fixes: cfb6eeb4c860 ("[TCP]: MD5 Signature Option (RFC2385) support.") Signed-off-by: Francesco Ruggeri Reviewed-by: Eric Dumazet --- 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 6366df7aaf2a..6854bb1fb32b 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 =3D treq->ts_off; #ifdef CONFIG_TCP_MD5SIG newtp->md5sig_info =3D 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 +=3D TCPOLEN_MD5SIG_ALIGNED; #endif if (skb->len >=3D TCP_MSS_DEFAULT + newtp->tcp_header_len) --=20 2.28.0