diff options
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/addrconf.c | 12 | ||||
-rw-r--r-- | net/ipv6/ah6.c | 7 | ||||
-rw-r--r-- | net/ipv6/esp6.c | 3 | ||||
-rw-r--r-- | net/ipv6/icmp.c | 3 | ||||
-rw-r--r-- | net/ipv6/ip6_flowlabel.c | 6 | ||||
-rw-r--r-- | net/ipv6/ip6_input.c | 3 | ||||
-rw-r--r-- | net/ipv6/ip6_output.c | 12 | ||||
-rw-r--r-- | net/ipv6/ip6_tunnel.c | 15 | ||||
-rw-r--r-- | net/ipv6/ip6_vti.c | 4 | ||||
-rw-r--r-- | net/ipv6/ndisc.c | 7 | ||||
-rw-r--r-- | net/ipv6/reassembly.c | 3 | ||||
-rw-r--r-- | net/ipv6/sit.c | 7 | ||||
-rw-r--r-- | net/ipv6/udp.c | 6 |
13 files changed, 55 insertions, 33 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 251fcb48b216..9eac3a7fefa3 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -2543,7 +2543,8 @@ static int inet6_addr_del(struct net *net, int ifindex, u32 ifa_flags, | |||
2543 | if (!dev) | 2543 | if (!dev) |
2544 | return -ENODEV; | 2544 | return -ENODEV; |
2545 | 2545 | ||
2546 | if ((idev = __in6_dev_get(dev)) == NULL) | 2546 | idev = __in6_dev_get(dev); |
2547 | if (idev == NULL) | ||
2547 | return -ENXIO; | 2548 | return -ENXIO; |
2548 | 2549 | ||
2549 | read_lock_bh(&idev->lock); | 2550 | read_lock_bh(&idev->lock); |
@@ -2690,7 +2691,8 @@ static void init_loopback(struct net_device *dev) | |||
2690 | 2691 | ||
2691 | ASSERT_RTNL(); | 2692 | ASSERT_RTNL(); |
2692 | 2693 | ||
2693 | if ((idev = ipv6_find_idev(dev)) == NULL) { | 2694 | idev = ipv6_find_idev(dev); |
2695 | if (idev == NULL) { | ||
2694 | pr_debug("%s: add_dev failed\n", __func__); | 2696 | pr_debug("%s: add_dev failed\n", __func__); |
2695 | return; | 2697 | return; |
2696 | } | 2698 | } |
@@ -2813,7 +2815,8 @@ static void addrconf_sit_config(struct net_device *dev) | |||
2813 | * our v4 addrs in the tunnel | 2815 | * our v4 addrs in the tunnel |
2814 | */ | 2816 | */ |
2815 | 2817 | ||
2816 | if ((idev = ipv6_find_idev(dev)) == NULL) { | 2818 | idev = ipv6_find_idev(dev); |
2819 | if (idev == NULL) { | ||
2817 | pr_debug("%s: add_dev failed\n", __func__); | 2820 | pr_debug("%s: add_dev failed\n", __func__); |
2818 | return; | 2821 | return; |
2819 | } | 2822 | } |
@@ -2837,7 +2840,8 @@ static void addrconf_gre_config(struct net_device *dev) | |||
2837 | 2840 | ||
2838 | ASSERT_RTNL(); | 2841 | ASSERT_RTNL(); |
2839 | 2842 | ||
2840 | if ((idev = ipv6_find_idev(dev)) == NULL) { | 2843 | idev = ipv6_find_idev(dev); |
2844 | if (idev == NULL) { | ||
2841 | pr_debug("%s: add_dev failed\n", __func__); | 2845 | pr_debug("%s: add_dev failed\n", __func__); |
2842 | return; | 2846 | return; |
2843 | } | 2847 | } |
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c index 8ab1989198f6..a6727add2624 100644 --- a/net/ipv6/ah6.c +++ b/net/ipv6/ah6.c | |||
@@ -353,7 +353,8 @@ static int ah6_output(struct xfrm_state *x, struct sk_buff *skb) | |||
353 | ahp = x->data; | 353 | ahp = x->data; |
354 | ahash = ahp->ahash; | 354 | ahash = ahp->ahash; |
355 | 355 | ||
356 | if ((err = skb_cow_data(skb, 0, &trailer)) < 0) | 356 | err = skb_cow_data(skb, 0, &trailer); |
357 | if (err < 0) | ||
357 | goto out; | 358 | goto out; |
358 | nfrags = err; | 359 | nfrags = err; |
359 | 360 | ||
@@ -559,8 +560,8 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb) | |||
559 | if (!pskb_may_pull(skb, ah_hlen)) | 560 | if (!pskb_may_pull(skb, ah_hlen)) |
560 | goto out; | 561 | goto out; |
561 | 562 | ||
562 | 563 | err = skb_cow_data(skb, 0, &trailer); | |
563 | if ((err = skb_cow_data(skb, 0, &trailer)) < 0) | 564 | if (err < 0) |
564 | goto out; | 565 | goto out; |
565 | nfrags = err; | 566 | nfrags = err; |
566 | 567 | ||
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index d2c2d749b6db..e48f2c7c5c59 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c | |||
@@ -345,7 +345,8 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb) | |||
345 | goto out; | 345 | goto out; |
346 | } | 346 | } |
347 | 347 | ||
348 | if ((nfrags = skb_cow_data(skb, 0, &trailer)) < 0) { | 348 | nfrags = skb_cow_data(skb, 0, &trailer); |
349 | if (nfrags < 0) { | ||
349 | ret = -EINVAL; | 350 | ret = -EINVAL; |
350 | goto out; | 351 | goto out; |
351 | } | 352 | } |
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index 39b3ff97a504..d674152b6ede 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -243,7 +243,8 @@ int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6, | |||
243 | struct icmp6hdr *icmp6h; | 243 | struct icmp6hdr *icmp6h; |
244 | int err = 0; | 244 | int err = 0; |
245 | 245 | ||
246 | if ((skb = skb_peek(&sk->sk_write_queue)) == NULL) | 246 | skb = skb_peek(&sk->sk_write_queue); |
247 | if (skb == NULL) | ||
247 | goto out; | 248 | goto out; |
248 | 249 | ||
249 | icmp6h = icmp6_hdr(skb); | 250 | icmp6h = icmp6_hdr(skb); |
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index 7221021b2d97..2f780cba6e12 100644 --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c | |||
@@ -654,7 +654,11 @@ release: | |||
654 | goto done; | 654 | goto done; |
655 | 655 | ||
656 | err = -ENOMEM; | 656 | err = -ENOMEM; |
657 | if (sfl1 == NULL || (err = mem_check(sk)) != 0) | 657 | if (sfl1 == NULL) |
658 | goto done; | ||
659 | |||
660 | err = mem_check(sk); | ||
661 | if (err != 0) | ||
658 | goto done; | 662 | goto done; |
659 | 663 | ||
660 | fl1 = fl_intern(net, fl, freq.flr_label); | 664 | fl1 = fl_intern(net, fl, freq.flr_label); |
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c index a3084ab5df6c..aacdcb4dc762 100644 --- a/net/ipv6/ip6_input.c +++ b/net/ipv6/ip6_input.c | |||
@@ -220,7 +220,8 @@ resubmit: | |||
220 | nexthdr = skb_network_header(skb)[nhoff]; | 220 | nexthdr = skb_network_header(skb)[nhoff]; |
221 | 221 | ||
222 | raw = raw6_local_deliver(skb, nexthdr); | 222 | raw = raw6_local_deliver(skb, nexthdr); |
223 | if ((ipprot = rcu_dereference(inet6_protos[nexthdr])) != NULL) { | 223 | ipprot = rcu_dereference(inet6_protos[nexthdr]); |
224 | if (ipprot != NULL) { | ||
224 | int ret; | 225 | int ret; |
225 | 226 | ||
226 | if (ipprot->flags & INET6_PROTO_FINAL) { | 227 | if (ipprot->flags & INET6_PROTO_FINAL) { |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 916d2a166a9b..ce69a12ae48c 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -898,7 +898,8 @@ static int ip6_dst_lookup_tail(struct sock *sk, | |||
898 | if (*dst == NULL) | 898 | if (*dst == NULL) |
899 | *dst = ip6_route_output(net, sk, fl6); | 899 | *dst = ip6_route_output(net, sk, fl6); |
900 | 900 | ||
901 | if ((err = (*dst)->error)) | 901 | err = (*dst)->error; |
902 | if (err) | ||
902 | goto out_err_release; | 903 | goto out_err_release; |
903 | 904 | ||
904 | if (ipv6_addr_any(&fl6->saddr)) { | 905 | if (ipv6_addr_any(&fl6->saddr)) { |
@@ -946,7 +947,8 @@ static int ip6_dst_lookup_tail(struct sock *sk, | |||
946 | memcpy(&fl_gw6, fl6, sizeof(struct flowi6)); | 947 | memcpy(&fl_gw6, fl6, sizeof(struct flowi6)); |
947 | memset(&fl_gw6.daddr, 0, sizeof(struct in6_addr)); | 948 | memset(&fl_gw6.daddr, 0, sizeof(struct in6_addr)); |
948 | *dst = ip6_route_output(net, sk, &fl_gw6); | 949 | *dst = ip6_route_output(net, sk, &fl_gw6); |
949 | if ((err = (*dst)->error)) | 950 | err = (*dst)->error; |
951 | if (err) | ||
950 | goto out_err_release; | 952 | goto out_err_release; |
951 | } | 953 | } |
952 | } | 954 | } |
@@ -1054,7 +1056,8 @@ static inline int ip6_ufo_append_data(struct sock *sk, | |||
1054 | * device, so create one single skb packet containing complete | 1056 | * device, so create one single skb packet containing complete |
1055 | * udp datagram | 1057 | * udp datagram |
1056 | */ | 1058 | */ |
1057 | if ((skb = skb_peek_tail(&sk->sk_write_queue)) == NULL) { | 1059 | skb = skb_peek_tail(&sk->sk_write_queue); |
1060 | if (skb == NULL) { | ||
1058 | skb = sock_alloc_send_skb(sk, | 1061 | skb = sock_alloc_send_skb(sk, |
1059 | hh_len + fragheaderlen + transhdrlen + 20, | 1062 | hh_len + fragheaderlen + transhdrlen + 20, |
1060 | (flags & MSG_DONTWAIT), &err); | 1063 | (flags & MSG_DONTWAIT), &err); |
@@ -1534,7 +1537,8 @@ int ip6_push_pending_frames(struct sock *sk) | |||
1534 | unsigned char proto = fl6->flowi6_proto; | 1537 | unsigned char proto = fl6->flowi6_proto; |
1535 | int err = 0; | 1538 | int err = 0; |
1536 | 1539 | ||
1537 | if ((skb = __skb_dequeue(&sk->sk_write_queue)) == NULL) | 1540 | skb = __skb_dequeue(&sk->sk_write_queue); |
1541 | if (skb == NULL) | ||
1538 | goto out; | 1542 | goto out; |
1539 | tail_skb = &(skb_shinfo(skb)->frag_list); | 1543 | tail_skb = &(skb_shinfo(skb)->frag_list); |
1540 | 1544 | ||
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index e2b6cfba873c..92b3da571980 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -501,8 +501,8 @@ ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt, | |||
501 | processing of the error. */ | 501 | processing of the error. */ |
502 | 502 | ||
503 | rcu_read_lock(); | 503 | rcu_read_lock(); |
504 | if ((t = ip6_tnl_lookup(dev_net(skb->dev), &ipv6h->daddr, | 504 | t = ip6_tnl_lookup(dev_net(skb->dev), &ipv6h->daddr, &ipv6h->saddr); |
505 | &ipv6h->saddr)) == NULL) | 505 | if (t == NULL) |
506 | goto out; | 506 | goto out; |
507 | 507 | ||
508 | tproto = ACCESS_ONCE(t->parms.proto); | 508 | tproto = ACCESS_ONCE(t->parms.proto); |
@@ -550,7 +550,8 @@ ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt, | |||
550 | mtu = IPV6_MIN_MTU; | 550 | mtu = IPV6_MIN_MTU; |
551 | t->dev->mtu = mtu; | 551 | t->dev->mtu = mtu; |
552 | 552 | ||
553 | if ((len = sizeof(*ipv6h) + ntohs(ipv6h->payload_len)) > mtu) { | 553 | len = sizeof(*ipv6h) + ntohs(ipv6h->payload_len); |
554 | if (len > mtu) { | ||
554 | rel_type = ICMPV6_PKT_TOOBIG; | 555 | rel_type = ICMPV6_PKT_TOOBIG; |
555 | rel_code = 0; | 556 | rel_code = 0; |
556 | rel_info = mtu; | 557 | rel_info = mtu; |
@@ -811,9 +812,8 @@ static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol, | |||
811 | int err; | 812 | int err; |
812 | 813 | ||
813 | rcu_read_lock(); | 814 | rcu_read_lock(); |
814 | 815 | t = ip6_tnl_lookup(dev_net(skb->dev), &ipv6h->saddr, &ipv6h->daddr); | |
815 | if ((t = ip6_tnl_lookup(dev_net(skb->dev), &ipv6h->saddr, | 816 | if (t != NULL) { |
816 | &ipv6h->daddr)) != NULL) { | ||
817 | struct pcpu_sw_netstats *tstats; | 817 | struct pcpu_sw_netstats *tstats; |
818 | 818 | ||
819 | tproto = ACCESS_ONCE(t->parms.proto); | 819 | tproto = ACCESS_ONCE(t->parms.proto); |
@@ -1069,7 +1069,8 @@ static int ip6_tnl_xmit2(struct sk_buff *skb, | |||
1069 | (skb_cloned(skb) && !skb_clone_writable(skb, 0))) { | 1069 | (skb_cloned(skb) && !skb_clone_writable(skb, 0))) { |
1070 | struct sk_buff *new_skb; | 1070 | struct sk_buff *new_skb; |
1071 | 1071 | ||
1072 | if (!(new_skb = skb_realloc_headroom(skb, max_headroom))) | 1072 | new_skb = skb_realloc_headroom(skb, max_headroom); |
1073 | if (!new_skb) | ||
1073 | goto tx_err_dst_release; | 1074 | goto tx_err_dst_release; |
1074 | 1075 | ||
1075 | if (skb->sk) | 1076 | if (skb->sk) |
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c index ec84d03491c7..83082168b056 100644 --- a/net/ipv6/ip6_vti.c +++ b/net/ipv6/ip6_vti.c | |||
@@ -287,8 +287,8 @@ static int vti6_rcv(struct sk_buff *skb) | |||
287 | const struct ipv6hdr *ipv6h = ipv6_hdr(skb); | 287 | const struct ipv6hdr *ipv6h = ipv6_hdr(skb); |
288 | 288 | ||
289 | rcu_read_lock(); | 289 | rcu_read_lock(); |
290 | if ((t = vti6_tnl_lookup(dev_net(skb->dev), &ipv6h->saddr, | 290 | t = vti6_tnl_lookup(dev_net(skb->dev), &ipv6h->saddr, &ipv6h->daddr); |
291 | &ipv6h->daddr)) != NULL) { | 291 | if (t != NULL) { |
292 | if (t->parms.proto != IPPROTO_IPV6 && t->parms.proto != 0) { | 292 | if (t->parms.proto != IPPROTO_IPV6 && t->parms.proto != 0) { |
293 | rcu_read_unlock(); | 293 | rcu_read_unlock(); |
294 | goto discard; | 294 | goto discard; |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 2c9f6bf57325..682866777d53 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -162,7 +162,8 @@ static void ndisc_fill_addr_option(struct sk_buff *skb, int type, void *data) | |||
162 | memcpy(opt+2, data, data_len); | 162 | memcpy(opt+2, data, data_len); |
163 | data_len += 2; | 163 | data_len += 2; |
164 | opt += data_len; | 164 | opt += data_len; |
165 | if ((space -= data_len) > 0) | 165 | space -= data_len; |
166 | if (space > 0) | ||
166 | memset(opt, 0, space); | 167 | memset(opt, 0, space); |
167 | } | 168 | } |
168 | 169 | ||
@@ -656,8 +657,8 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb) | |||
656 | 657 | ||
657 | if (skb && ipv6_chk_addr(dev_net(dev), &ipv6_hdr(skb)->saddr, dev, 1)) | 658 | if (skb && ipv6_chk_addr(dev_net(dev), &ipv6_hdr(skb)->saddr, dev, 1)) |
658 | saddr = &ipv6_hdr(skb)->saddr; | 659 | saddr = &ipv6_hdr(skb)->saddr; |
659 | 660 | probes -= NEIGH_VAR(neigh->parms, UCAST_PROBES); | |
660 | if ((probes -= NEIGH_VAR(neigh->parms, UCAST_PROBES)) < 0) { | 661 | if (probes < 0) { |
661 | if (!(neigh->nud_state & NUD_VALID)) { | 662 | if (!(neigh->nud_state & NUD_VALID)) { |
662 | ND_PRINTK(1, dbg, | 663 | ND_PRINTK(1, dbg, |
663 | "%s: trying to ucast probe in NUD_INVALID: %pI6\n", | 664 | "%s: trying to ucast probe in NUD_INVALID: %pI6\n", |
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c index 51ab096ae574..d7d70e69973b 100644 --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c | |||
@@ -429,7 +429,8 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev, | |||
429 | struct sk_buff *clone; | 429 | struct sk_buff *clone; |
430 | int i, plen = 0; | 430 | int i, plen = 0; |
431 | 431 | ||
432 | if ((clone = alloc_skb(0, GFP_ATOMIC)) == NULL) | 432 | clone = alloc_skb(0, GFP_ATOMIC); |
433 | if (clone == NULL) | ||
433 | goto out_oom; | 434 | goto out_oom; |
434 | clone->next = head->next; | 435 | clone->next = head->next; |
435 | head->next = clone; | 436 | head->next = clone; |
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 660496de6125..213546bd6d5d 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
@@ -1241,7 +1241,8 @@ ipip6_tunnel_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1241 | if (copy_from_user(&p, ifr->ifr_ifru.ifru_data, sizeof(p))) | 1241 | if (copy_from_user(&p, ifr->ifr_ifru.ifru_data, sizeof(p))) |
1242 | goto done; | 1242 | goto done; |
1243 | err = -ENOENT; | 1243 | err = -ENOENT; |
1244 | if ((t = ipip6_tunnel_locate(net, &p, 0)) == NULL) | 1244 | t = ipip6_tunnel_locate(net, &p, 0); |
1245 | if (t == NULL) | ||
1245 | goto done; | 1246 | goto done; |
1246 | err = -EPERM; | 1247 | err = -EPERM; |
1247 | if (t == netdev_priv(sitn->fb_tunnel_dev)) | 1248 | if (t == netdev_priv(sitn->fb_tunnel_dev)) |
@@ -1836,8 +1837,8 @@ static int __net_init sit_init_net(struct net *net) | |||
1836 | goto err_dev_free; | 1837 | goto err_dev_free; |
1837 | 1838 | ||
1838 | ipip6_tunnel_clone_6rd(sitn->fb_tunnel_dev, sitn); | 1839 | ipip6_tunnel_clone_6rd(sitn->fb_tunnel_dev, sitn); |
1839 | 1840 | err = register_netdev(sitn->fb_tunnel_dev); | |
1840 | if ((err = register_netdev(sitn->fb_tunnel_dev))) | 1841 | if (err) |
1841 | goto err_reg_dev; | 1842 | goto err_reg_dev; |
1842 | 1843 | ||
1843 | t = netdev_priv(sitn->fb_tunnel_dev); | 1844 | t = netdev_priv(sitn->fb_tunnel_dev); |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 0ba3de4f2368..dbc0b042bdd6 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -357,7 +357,8 @@ static struct sock *__udp6_lib_lookup_skb(struct sk_buff *skb, | |||
357 | struct sock *sk; | 357 | struct sock *sk; |
358 | const struct ipv6hdr *iph = ipv6_hdr(skb); | 358 | const struct ipv6hdr *iph = ipv6_hdr(skb); |
359 | 359 | ||
360 | if (unlikely(sk = skb_steal_sock(skb))) | 360 | sk = skb_steal_sock(skb); |
361 | if (unlikely(sk)) | ||
361 | return sk; | 362 | return sk; |
362 | return __udp6_lib_lookup(dev_net(skb_dst(skb)->dev), &iph->saddr, sport, | 363 | return __udp6_lib_lookup(dev_net(skb_dst(skb)->dev), &iph->saddr, sport, |
363 | &iph->daddr, dport, inet6_iif(skb), | 364 | &iph->daddr, dport, inet6_iif(skb), |
@@ -1026,7 +1027,8 @@ static int udp_v6_push_pending_frames(struct sock *sk) | |||
1026 | fl6 = &inet->cork.fl.u.ip6; | 1027 | fl6 = &inet->cork.fl.u.ip6; |
1027 | 1028 | ||
1028 | /* Grab the skbuff where UDP header space exists. */ | 1029 | /* Grab the skbuff where UDP header space exists. */ |
1029 | if ((skb = skb_peek(&sk->sk_write_queue)) == NULL) | 1030 | skb = skb_peek(&sk->sk_write_queue); |
1031 | if (skb == NULL) | ||
1030 | goto out; | 1032 | goto out; |
1031 | 1033 | ||
1032 | /* | 1034 | /* |