diff options
Diffstat (limited to 'net/core/netpoll.c')
-rw-r--r-- | net/core/netpoll.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index adf84dd8c7b5..cf64c1ffa4cd 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/rcupdate.h> | 23 | #include <linux/rcupdate.h> |
24 | #include <linux/workqueue.h> | 24 | #include <linux/workqueue.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/export.h> | ||
26 | #include <net/tcp.h> | 27 | #include <net/tcp.h> |
27 | #include <net/udp.h> | 28 | #include <net/udp.h> |
28 | #include <asm/unaligned.h> | 29 | #include <asm/unaligned.h> |
@@ -558,13 +559,14 @@ int __netpoll_rx(struct sk_buff *skb) | |||
558 | if (skb_shared(skb)) | 559 | if (skb_shared(skb)) |
559 | goto out; | 560 | goto out; |
560 | 561 | ||
561 | iph = (struct iphdr *)skb->data; | ||
562 | if (!pskb_may_pull(skb, sizeof(struct iphdr))) | 562 | if (!pskb_may_pull(skb, sizeof(struct iphdr))) |
563 | goto out; | 563 | goto out; |
564 | iph = (struct iphdr *)skb->data; | ||
564 | if (iph->ihl < 5 || iph->version != 4) | 565 | if (iph->ihl < 5 || iph->version != 4) |
565 | goto out; | 566 | goto out; |
566 | if (!pskb_may_pull(skb, iph->ihl*4)) | 567 | if (!pskb_may_pull(skb, iph->ihl*4)) |
567 | goto out; | 568 | goto out; |
569 | iph = (struct iphdr *)skb->data; | ||
568 | if (ip_fast_csum((u8 *)iph, iph->ihl) != 0) | 570 | if (ip_fast_csum((u8 *)iph, iph->ihl) != 0) |
569 | goto out; | 571 | goto out; |
570 | 572 | ||
@@ -579,6 +581,7 @@ int __netpoll_rx(struct sk_buff *skb) | |||
579 | if (pskb_trim_rcsum(skb, len)) | 581 | if (pskb_trim_rcsum(skb, len)) |
580 | goto out; | 582 | goto out; |
581 | 583 | ||
584 | iph = (struct iphdr *)skb->data; | ||
582 | if (iph->protocol != IPPROTO_UDP) | 585 | if (iph->protocol != IPPROTO_UDP) |
583 | goto out; | 586 | goto out; |
584 | 587 | ||
@@ -760,7 +763,7 @@ int __netpoll_setup(struct netpoll *np) | |||
760 | } | 763 | } |
761 | 764 | ||
762 | /* last thing to do is link it to the net device structure */ | 765 | /* last thing to do is link it to the net device structure */ |
763 | rcu_assign_pointer(ndev->npinfo, npinfo); | 766 | RCU_INIT_POINTER(ndev->npinfo, npinfo); |
764 | 767 | ||
765 | return 0; | 768 | return 0; |
766 | 769 | ||
@@ -901,7 +904,7 @@ void __netpoll_cleanup(struct netpoll *np) | |||
901 | if (ops->ndo_netpoll_cleanup) | 904 | if (ops->ndo_netpoll_cleanup) |
902 | ops->ndo_netpoll_cleanup(np->dev); | 905 | ops->ndo_netpoll_cleanup(np->dev); |
903 | 906 | ||
904 | rcu_assign_pointer(np->dev->npinfo, NULL); | 907 | RCU_INIT_POINTER(np->dev->npinfo, NULL); |
905 | 908 | ||
906 | /* avoid racing with NAPI reading npinfo */ | 909 | /* avoid racing with NAPI reading npinfo */ |
907 | synchronize_rcu_bh(); | 910 | synchronize_rcu_bh(); |