Skip to content

Commit cdc3074

Browse files
author
Paolo Abeni
committed
Merge branch 'sctp-fix-two-issues-in-sctp_clone_sock'
Kuniyuki Iwashima says: ==================== sctp: Fix two issues in sctp_clone_sock(). syzbot reported two issues in sctp_clone_sock(). This series fixes the issues. v1: https://lore.kernel.org/netdev/20251208133728.157648-1-kuniyu@google.com/ ==================== Link: https://patch.msgid.link/20251210081206.1141086-1-kuniyu@google.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2 parents 15564bd + d7ff61e commit cdc3074

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

net/sctp/ipv6.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,8 @@ static void sctp_v6_copy_ip_options(struct sock *sk, struct sock *newsk)
492492
struct ipv6_pinfo *newnp, *np = inet6_sk(sk);
493493
struct ipv6_txoptions *opt;
494494

495+
inet_sk(newsk)->inet_opt = NULL;
496+
495497
newnp = inet6_sk(newsk);
496498

497499
rcu_read_lock();

net/sctp/socket.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4863,8 +4863,6 @@ static struct sock *sctp_clone_sock(struct sock *sk,
48634863

48644864
newsp->pf->to_sk_daddr(&asoc->peer.primary_addr, newsk);
48654865
newinet->inet_dport = htons(asoc->peer.port);
4866-
4867-
newsp->pf->copy_ip_options(sk, newsk);
48684866
atomic_set(&newinet->inet_id, get_random_u16());
48694867

48704868
inet_set_bit(MC_LOOP, newsk);
@@ -4874,17 +4872,20 @@ static struct sock *sctp_clone_sock(struct sock *sk,
48744872

48754873
#if IS_ENABLED(CONFIG_IPV6)
48764874
if (sk->sk_family == AF_INET6) {
4877-
struct ipv6_pinfo *newnp = inet6_sk(newsk);
4875+
struct ipv6_pinfo *newnp;
48784876

48794877
newinet->pinet6 = &((struct sctp6_sock *)newsk)->inet6;
48804878
newinet->ipv6_fl_list = NULL;
48814879

4880+
newnp = inet6_sk(newsk);
48824881
memcpy(newnp, inet6_sk(sk), sizeof(struct ipv6_pinfo));
48834882
newnp->ipv6_mc_list = NULL;
48844883
newnp->ipv6_ac_list = NULL;
48854884
}
48864885
#endif
48874886

4887+
newsp->pf->copy_ip_options(sk, newsk);
4888+
48884889
newsp->do_auto_asconf = 0;
48894890
skb_queue_head_init(&newsp->pd_lobby);
48904891

0 commit comments

Comments
 (0)