linux-sctp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sctp: Initialize daddr on peeled off socket
@ 2022-03-07 19:59 Petr Malat
  2022-03-07 21:33 ` Jakub Kicinski
  0 siblings, 1 reply; 9+ messages in thread
From: Petr Malat @ 2022-03-07 19:59 UTC (permalink / raw)
  To: linux-sctp
  Cc: Vlad Yasevich, Neil Horman, Marcelo Ricardo Leitner,
	David S. Miller, Jakub Kicinski, Petr Malat

Function sctp_do_peeloff() wrongly initializes daddr of the original
socket instead of the peeled off one, which makes getpeername() return
zeroes instead of the primary address. Initialize the new socket
instead.

Signed-off-by: Petr Malat <oss@malat.biz>
---
 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.30.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-04-12  3:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-07 19:59 [PATCH] sctp: Initialize daddr on peeled off socket Petr Malat
2022-03-07 21:33 ` Jakub Kicinski
2022-03-07 22:02   ` [PATCH v2] " Petr Malat
2022-04-08 17:34     ` Marcelo Ricardo Leitner
2022-04-09  6:36       ` [PATCH] " Petr Malat
2022-04-12  3:40         ` patchwork-bot+netdevbpf
2022-04-08 12:35   ` Petr Malat
2022-04-08 16:33     ` Jakub Kicinski
2022-04-08 17:18       ` Marcelo Ricardo Leitner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).