Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3230302pxb; Mon, 18 Apr 2022 19:58:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUFZ5vJIx7648GIXYpY8WMk/+RHcslqpoGmFy7aFMp8pc+wwNupVhHF0PU/1bKJNe9no27 X-Received: by 2002:a17:907:9716:b0:6e8:9c45:64c2 with SMTP id jg22-20020a170907971600b006e89c4564c2mr11384098ejc.732.1650337099600; Mon, 18 Apr 2022 19:58:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650337099; cv=none; d=google.com; s=arc-20160816; b=KeGh2eSAsPb8udmNfK5OQGa8XXR3iBNV3CxO3MZ58vsWtSrJwghcVcmr128jNgIjJh 0UQTGaG1ngiLHHIBJDGhYt+wnLuXxY+fqWDjoRGDRr3/IluaksaTkMYqQR84JxNiJVJK 36Qajz/Tx4b7c6Qg7Y5T38rzki40UJhzP5eopOoainPpWN73PwU9aawNNcxmOkiuJzNk l8ZZpfeRQXUIrGpwHW7GgJWgSJY/1b0RwkbldAWSrCw5PG9CsCCp1e4cmEoyTJIHMPZa DMBiOzpZConaDAt+uFtqAm1egGrTgPAMVQCpibSGSXpun8eRO76B18rGgte071MFlHCa UIVw== 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=yodfF+Yn+ffQR2GOUmyFKFoNb1ZDPqba3MrEWCQQDJ4=; b=crFfR7s07erCBPIPLEezCqWUNPHlLvSUx+7cuQP/prsb7wFzGkdsFdirFoBmuO3NnJ 7mQgBUHCxCl1bdEKRY8DlSNw66t49c7Xs1k6X8joHSyAS5elaancaw+qktDsQ7C1gA4y 5MVJoE5ys3AG+qXNvvdDgxt+QZELrwu+z8gCg2yQkOZxOSNWuWE3rIMRek5RVh9u7Q4y QknUxagm1QpIzxT9uYmk2zKeMIMIvhIiyOvdw3WOYQArxZYeJrBfjTYF50EuR3mwz4iU xiGX5aXhGG6dUc3WkwrIxL7dFjkMJK7zJRPneILWzjpH5+kLMu4tKG0BriOhwgbzwJG/ 8UHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FyqttEe5; 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 ff9-20020a1709069c0900b006df76385bd5si7042236ejc.117.2022.04.18.19.57.56; Mon, 18 Apr 2022 19:58:19 -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=FyqttEe5; 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 S239223AbiDRM2A (ORCPT + 99 others); Mon, 18 Apr 2022 08:28:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238739AbiDRM0W (ORCPT ); Mon, 18 Apr 2022 08:26:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10BEF1261E; Mon, 18 Apr 2022 05:20:27 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 9E59F60F0A; Mon, 18 Apr 2022 12:20:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EDBEC385A7; Mon, 18 Apr 2022 12:20:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650284426; bh=SRfsMOKuudIG6+hJWDySYLdGJYrbURX3cFpwcDX6Gn8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FyqttEe5vL4BYBRbcozQbTdqZUChjyEbu9MX3UiafG2azJNIUBnZ5G/JGvDhW6Kig y1bcetrDtxSWfzIaAqQGwxbeFoJE9TyUZ8jntTYlNFu/sQGeKcOvksqNaKJN66R4Lz mVTpFY2Jvi0GgW5srbxLziub9beToPMaTZ7Tg00w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Petr Malat , Marcelo Ricardo Leitner , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.17 103/219] sctp: Initialize daddr on peeled off socket Date: Mon, 18 Apr 2022 14:11:12 +0200 Message-Id: <20220418121209.774257674@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121203.462784814@linuxfoundation.org> References: <20220418121203.462784814@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: Petr Malat [ Upstream commit 8467dda0c26583547731e7f3ea73fc3856bae3bf ] Function sctp_do_peeloff() wrongly initializes daddr of the original socket instead of the peeled off socket, which makes getpeername() return zeroes instead of the primary address. Initialize the new socket instead. Fixes: d570ee490fb1 ("[SCTP]: Correctly set daddr for IPv6 sockets during peeloff") Signed-off-by: Petr Malat Acked-by: Marcelo Ricardo Leitner Link: https://lore.kernel.org/r/20220409063611.673193-1-oss@malat.biz Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/sctp/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 3e1a9600be5e..7b0427658056 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -5636,7 +5636,7 @@ int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp) * Set the daddr and initialize id to something more random and also * copy over any ip options. */ - sp->pf->to_sk_daddr(&asoc->peer.primary_addr, sk); + sp->pf->to_sk_daddr(&asoc->peer.primary_addr, sock->sk); sp->pf->copy_ip_options(sk, sock->sk); /* Populate the fields of the newsk from the oldsk and migrate the -- 2.35.1