Skip to content

Commit

Permalink
iptfs: impl: don't use after free when dont-frag set
Browse files Browse the repository at this point in the history
  • Loading branch information
choppsv1 committed Aug 29, 2023
1 parent 046b4d5 commit 036a3d1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions net/xfrm/xfrm_iptfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1641,6 +1641,9 @@ static int iptfs_output_collect(struct net *net, struct sock *sk,
/* This will be set if we do a local ping! */
// WARN_ON(sk != NULL);

if (xtfs->cfg.dont_frag)
pmtu = iptfs_get_cur_pmtu(x, xtfs, skb);

/*
* Break apart GSO skbs. If the queue is nearing full then we want the
* accounting and queuing to be based on the individual packets not on the
Expand All @@ -1664,6 +1667,7 @@ static int iptfs_output_collect(struct net *net, struct sock *sk,
return PTR_ERR(segs);
}
consume_skb(skb);
skb = NULL;
}

count = qcount = 0;
Expand All @@ -1673,9 +1677,6 @@ static int iptfs_output_collect(struct net *net, struct sock *sk,
*/
spin_lock_bh(&x->lock);

if (xtfs->cfg.dont_frag)
pmtu = iptfs_get_cur_pmtu(x, xtfs, skb);

skb_list_walk_safe (segs, segs, nskb) {
skb = segs;
skb_mark_not_on_list(segs);
Expand Down

0 comments on commit 036a3d1

Please sign in to comment.