Skip to content

Commit 1758fd4

Browse files
tracywwnjdavem330
authored andcommitted
ipv6: remove unnecessary dst_hold() in ip6_fragment()
In ipv6 tx path, rcu_read_lock() is taken so that dst won't get freed during the execution of ip6_fragment(). Hence, no need to hold dst in it. Signed-off-by: Wei Wang <weiwan@google.com> Acked-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 273889e commit 1758fd4

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

net/ipv6/ip6_output.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -698,8 +698,6 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
698698
ipv6_hdr(skb)->payload_len = htons(first_len -
699699
sizeof(struct ipv6hdr));
700700

701-
dst_hold(&rt->dst);
702-
703701
for (;;) {
704702
/* Prepare header of the next frame,
705703
* before previous one went down. */
@@ -742,15 +740,13 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
742740
if (err == 0) {
743741
IP6_INC_STATS(net, ip6_dst_idev(&rt->dst),
744742
IPSTATS_MIB_FRAGOKS);
745-
ip6_rt_put(rt);
746743
return 0;
747744
}
748745

749746
kfree_skb_list(frag);
750747

751748
IP6_INC_STATS(net, ip6_dst_idev(&rt->dst),
752749
IPSTATS_MIB_FRAGFAILS);
753-
ip6_rt_put(rt);
754750
return err;
755751

756752
slow_path_clean:

0 commit comments

Comments
 (0)