diff options
author | Petr Malat <oss@malat.biz> | 2022-04-09 08:36:11 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-04-11 20:33:10 -0700 |
commit | 8467dda0c26583547731e7f3ea73fc3856bae3bf (patch) | |
tree | d358dd9a2a89aaec91f195858684fad7f709f695 /net/sctp | |
parent | 65745da171e685b47725bfee138580ad8bf09d8f (diff) | |
download | linux-stable-8467dda0c26583547731e7f3ea73fc3856bae3bf.tar.gz linux-stable-8467dda0c26583547731e7f3ea73fc3856bae3bf.tar.bz2 linux-stable-8467dda0c26583547731e7f3ea73fc3856bae3bf.zip |
sctp: Initialize daddr on peeled off socket
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 <oss@malat.biz>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Link: https://lore.kernel.org/r/20220409063611.673193-1-oss@malat.biz
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/sctp')
-rw-r--r-- | net/sctp/socket.c | 2 |
1 files changed, 1 insertions, 1 deletions
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 |