diff options
Diffstat (limited to 'net')
39 files changed, 278 insertions, 120 deletions
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c index 8e1d89d2b1c1..183f97a86bb2 100644 --- a/net/batman-adv/distributed-arp-table.c +++ b/net/batman-adv/distributed-arp-table.c | |||
@@ -738,6 +738,7 @@ static uint16_t batadv_arp_get_type(struct batadv_priv *bat_priv, | |||
738 | struct arphdr *arphdr; | 738 | struct arphdr *arphdr; |
739 | struct ethhdr *ethhdr; | 739 | struct ethhdr *ethhdr; |
740 | __be32 ip_src, ip_dst; | 740 | __be32 ip_src, ip_dst; |
741 | uint8_t *hw_src, *hw_dst; | ||
741 | uint16_t type = 0; | 742 | uint16_t type = 0; |
742 | 743 | ||
743 | /* pull the ethernet header */ | 744 | /* pull the ethernet header */ |
@@ -777,9 +778,23 @@ static uint16_t batadv_arp_get_type(struct batadv_priv *bat_priv, | |||
777 | ip_src = batadv_arp_ip_src(skb, hdr_size); | 778 | ip_src = batadv_arp_ip_src(skb, hdr_size); |
778 | ip_dst = batadv_arp_ip_dst(skb, hdr_size); | 779 | ip_dst = batadv_arp_ip_dst(skb, hdr_size); |
779 | if (ipv4_is_loopback(ip_src) || ipv4_is_multicast(ip_src) || | 780 | if (ipv4_is_loopback(ip_src) || ipv4_is_multicast(ip_src) || |
780 | ipv4_is_loopback(ip_dst) || ipv4_is_multicast(ip_dst)) | 781 | ipv4_is_loopback(ip_dst) || ipv4_is_multicast(ip_dst) || |
782 | ipv4_is_zeronet(ip_src) || ipv4_is_lbcast(ip_src) || | ||
783 | ipv4_is_zeronet(ip_dst) || ipv4_is_lbcast(ip_dst)) | ||
781 | goto out; | 784 | goto out; |
782 | 785 | ||
786 | hw_src = batadv_arp_hw_src(skb, hdr_size); | ||
787 | if (is_zero_ether_addr(hw_src) || is_multicast_ether_addr(hw_src)) | ||
788 | goto out; | ||
789 | |||
790 | /* we don't care about the destination MAC address in ARP requests */ | ||
791 | if (arphdr->ar_op != htons(ARPOP_REQUEST)) { | ||
792 | hw_dst = batadv_arp_hw_dst(skb, hdr_size); | ||
793 | if (is_zero_ether_addr(hw_dst) || | ||
794 | is_multicast_ether_addr(hw_dst)) | ||
795 | goto out; | ||
796 | } | ||
797 | |||
783 | type = ntohs(arphdr->ar_op); | 798 | type = ntohs(arphdr->ar_op); |
784 | out: | 799 | out: |
785 | return type; | 800 | return type; |
@@ -1012,6 +1027,8 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv, | |||
1012 | */ | 1027 | */ |
1013 | ret = !batadv_is_my_client(bat_priv, hw_dst); | 1028 | ret = !batadv_is_my_client(bat_priv, hw_dst); |
1014 | out: | 1029 | out: |
1030 | if (ret) | ||
1031 | kfree_skb(skb); | ||
1015 | /* if ret == false -> packet has to be delivered to the interface */ | 1032 | /* if ret == false -> packet has to be delivered to the interface */ |
1016 | return ret; | 1033 | return ret; |
1017 | } | 1034 | } |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 596660d37c5e..0f78e34220c9 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -2810,14 +2810,6 @@ static void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb) | |||
2810 | if (conn) { | 2810 | if (conn) { |
2811 | hci_conn_enter_active_mode(conn, BT_POWER_FORCE_ACTIVE_OFF); | 2811 | hci_conn_enter_active_mode(conn, BT_POWER_FORCE_ACTIVE_OFF); |
2812 | 2812 | ||
2813 | hci_dev_lock(hdev); | ||
2814 | if (test_bit(HCI_MGMT, &hdev->dev_flags) && | ||
2815 | !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) | ||
2816 | mgmt_device_connected(hdev, &conn->dst, conn->type, | ||
2817 | conn->dst_type, 0, NULL, 0, | ||
2818 | conn->dev_class); | ||
2819 | hci_dev_unlock(hdev); | ||
2820 | |||
2821 | /* Send to upper protocol */ | 2813 | /* Send to upper protocol */ |
2822 | l2cap_recv_acldata(conn, skb, flags); | 2814 | l2cap_recv_acldata(conn, skb, flags); |
2823 | return; | 2815 | return; |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 705078a0cc39..81b44481d0d9 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -2688,7 +2688,7 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
2688 | if (ev->opcode != HCI_OP_NOP) | 2688 | if (ev->opcode != HCI_OP_NOP) |
2689 | del_timer(&hdev->cmd_timer); | 2689 | del_timer(&hdev->cmd_timer); |
2690 | 2690 | ||
2691 | if (ev->ncmd) { | 2691 | if (ev->ncmd && !test_bit(HCI_RESET, &hdev->flags)) { |
2692 | atomic_set(&hdev->cmd_cnt, 1); | 2692 | atomic_set(&hdev->cmd_cnt, 1); |
2693 | if (!skb_queue_empty(&hdev->cmd_q)) | 2693 | if (!skb_queue_empty(&hdev->cmd_q)) |
2694 | queue_work(hdev->workqueue, &hdev->cmd_work); | 2694 | queue_work(hdev->workqueue, &hdev->cmd_work); |
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index b2bcbe2dc328..a7352ff3fd1e 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c | |||
@@ -931,7 +931,7 @@ static int hidp_setup_hid(struct hidp_session *session, | |||
931 | hid->version = req->version; | 931 | hid->version = req->version; |
932 | hid->country = req->country; | 932 | hid->country = req->country; |
933 | 933 | ||
934 | strncpy(hid->name, req->name, 128); | 934 | strncpy(hid->name, req->name, sizeof(req->name) - 1); |
935 | 935 | ||
936 | snprintf(hid->phys, sizeof(hid->phys), "%pMR", | 936 | snprintf(hid->phys, sizeof(hid->phys), "%pMR", |
937 | &bt_sk(session->ctrl_sock->sk)->src); | 937 | &bt_sk(session->ctrl_sock->sk)->src); |
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 2c78208d793e..22e658322845 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -3727,6 +3727,17 @@ sendresp: | |||
3727 | static int l2cap_connect_req(struct l2cap_conn *conn, | 3727 | static int l2cap_connect_req(struct l2cap_conn *conn, |
3728 | struct l2cap_cmd_hdr *cmd, u8 *data) | 3728 | struct l2cap_cmd_hdr *cmd, u8 *data) |
3729 | { | 3729 | { |
3730 | struct hci_dev *hdev = conn->hcon->hdev; | ||
3731 | struct hci_conn *hcon = conn->hcon; | ||
3732 | |||
3733 | hci_dev_lock(hdev); | ||
3734 | if (test_bit(HCI_MGMT, &hdev->dev_flags) && | ||
3735 | !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &hcon->flags)) | ||
3736 | mgmt_device_connected(hdev, &hcon->dst, hcon->type, | ||
3737 | hcon->dst_type, 0, NULL, 0, | ||
3738 | hcon->dev_class); | ||
3739 | hci_dev_unlock(hdev); | ||
3740 | |||
3730 | l2cap_connect(conn, cmd, data, L2CAP_CONN_RSP, 0); | 3741 | l2cap_connect(conn, cmd, data, L2CAP_CONN_RSP, 0); |
3731 | return 0; | 3742 | return 0; |
3732 | } | 3743 | } |
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 531a93d613d4..57f250c20e39 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
@@ -352,7 +352,7 @@ static void __sco_sock_close(struct sock *sk) | |||
352 | 352 | ||
353 | case BT_CONNECTED: | 353 | case BT_CONNECTED: |
354 | case BT_CONFIG: | 354 | case BT_CONFIG: |
355 | if (sco_pi(sk)->conn) { | 355 | if (sco_pi(sk)->conn->hcon) { |
356 | sk->sk_state = BT_DISCONN; | 356 | sk->sk_state = BT_DISCONN; |
357 | sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT); | 357 | sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT); |
358 | hci_conn_put(sco_pi(sk)->conn->hcon); | 358 | hci_conn_put(sco_pi(sk)->conn->hcon); |
diff --git a/net/core/request_sock.c b/net/core/request_sock.c index c31d9e8668c3..4425148d2b51 100644 --- a/net/core/request_sock.c +++ b/net/core/request_sock.c | |||
@@ -186,8 +186,6 @@ void reqsk_fastopen_remove(struct sock *sk, struct request_sock *req, | |||
186 | struct fastopen_queue *fastopenq = | 186 | struct fastopen_queue *fastopenq = |
187 | inet_csk(lsk)->icsk_accept_queue.fastopenq; | 187 | inet_csk(lsk)->icsk_accept_queue.fastopenq; |
188 | 188 | ||
189 | BUG_ON(!spin_is_locked(&sk->sk_lock.slock) && !sock_owned_by_user(sk)); | ||
190 | |||
191 | tcp_sk(sk)->fastopen_rsk = NULL; | 189 | tcp_sk(sk)->fastopen_rsk = NULL; |
192 | spin_lock_bh(&fastopenq->lock); | 190 | spin_lock_bh(&fastopenq->lock); |
193 | fastopenq->qlen--; | 191 | fastopenq->qlen--; |
diff --git a/net/core/scm.c b/net/core/scm.c index 57fb1ee6649f..905dcc6ad1e3 100644 --- a/net/core/scm.c +++ b/net/core/scm.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <net/sock.h> | 35 | #include <net/sock.h> |
36 | #include <net/compat.h> | 36 | #include <net/compat.h> |
37 | #include <net/scm.h> | 37 | #include <net/scm.h> |
38 | #include <net/cls_cgroup.h> | ||
38 | 39 | ||
39 | 40 | ||
40 | /* | 41 | /* |
@@ -302,8 +303,10 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm) | |||
302 | } | 303 | } |
303 | /* Bump the usage count and install the file. */ | 304 | /* Bump the usage count and install the file. */ |
304 | sock = sock_from_file(fp[i], &err); | 305 | sock = sock_from_file(fp[i], &err); |
305 | if (sock) | 306 | if (sock) { |
306 | sock_update_netprioidx(sock->sk, current); | 307 | sock_update_netprioidx(sock->sk, current); |
308 | sock_update_classid(sock->sk, current); | ||
309 | } | ||
307 | fd_install(new_fd, get_file(fp[i])); | 310 | fd_install(new_fd, get_file(fp[i])); |
308 | } | 311 | } |
309 | 312 | ||
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 3ab989b0de42..a9a2ae3e2213 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -1649,7 +1649,7 @@ static void sock_spd_release(struct splice_pipe_desc *spd, unsigned int i) | |||
1649 | 1649 | ||
1650 | static struct page *linear_to_page(struct page *page, unsigned int *len, | 1650 | static struct page *linear_to_page(struct page *page, unsigned int *len, |
1651 | unsigned int *offset, | 1651 | unsigned int *offset, |
1652 | struct sk_buff *skb, struct sock *sk) | 1652 | struct sock *sk) |
1653 | { | 1653 | { |
1654 | struct page_frag *pfrag = sk_page_frag(sk); | 1654 | struct page_frag *pfrag = sk_page_frag(sk); |
1655 | 1655 | ||
@@ -1682,14 +1682,14 @@ static bool spd_can_coalesce(const struct splice_pipe_desc *spd, | |||
1682 | static bool spd_fill_page(struct splice_pipe_desc *spd, | 1682 | static bool spd_fill_page(struct splice_pipe_desc *spd, |
1683 | struct pipe_inode_info *pipe, struct page *page, | 1683 | struct pipe_inode_info *pipe, struct page *page, |
1684 | unsigned int *len, unsigned int offset, | 1684 | unsigned int *len, unsigned int offset, |
1685 | struct sk_buff *skb, bool linear, | 1685 | bool linear, |
1686 | struct sock *sk) | 1686 | struct sock *sk) |
1687 | { | 1687 | { |
1688 | if (unlikely(spd->nr_pages == MAX_SKB_FRAGS)) | 1688 | if (unlikely(spd->nr_pages == MAX_SKB_FRAGS)) |
1689 | return true; | 1689 | return true; |
1690 | 1690 | ||
1691 | if (linear) { | 1691 | if (linear) { |
1692 | page = linear_to_page(page, len, &offset, skb, sk); | 1692 | page = linear_to_page(page, len, &offset, sk); |
1693 | if (!page) | 1693 | if (!page) |
1694 | return true; | 1694 | return true; |
1695 | } | 1695 | } |
@@ -1706,23 +1706,9 @@ static bool spd_fill_page(struct splice_pipe_desc *spd, | |||
1706 | return false; | 1706 | return false; |
1707 | } | 1707 | } |
1708 | 1708 | ||
1709 | static inline void __segment_seek(struct page **page, unsigned int *poff, | ||
1710 | unsigned int *plen, unsigned int off) | ||
1711 | { | ||
1712 | unsigned long n; | ||
1713 | |||
1714 | *poff += off; | ||
1715 | n = *poff / PAGE_SIZE; | ||
1716 | if (n) | ||
1717 | *page = nth_page(*page, n); | ||
1718 | |||
1719 | *poff = *poff % PAGE_SIZE; | ||
1720 | *plen -= off; | ||
1721 | } | ||
1722 | |||
1723 | static bool __splice_segment(struct page *page, unsigned int poff, | 1709 | static bool __splice_segment(struct page *page, unsigned int poff, |
1724 | unsigned int plen, unsigned int *off, | 1710 | unsigned int plen, unsigned int *off, |
1725 | unsigned int *len, struct sk_buff *skb, | 1711 | unsigned int *len, |
1726 | struct splice_pipe_desc *spd, bool linear, | 1712 | struct splice_pipe_desc *spd, bool linear, |
1727 | struct sock *sk, | 1713 | struct sock *sk, |
1728 | struct pipe_inode_info *pipe) | 1714 | struct pipe_inode_info *pipe) |
@@ -1737,23 +1723,19 @@ static bool __splice_segment(struct page *page, unsigned int poff, | |||
1737 | } | 1723 | } |
1738 | 1724 | ||
1739 | /* ignore any bits we already processed */ | 1725 | /* ignore any bits we already processed */ |
1740 | if (*off) { | 1726 | poff += *off; |
1741 | __segment_seek(&page, &poff, &plen, *off); | 1727 | plen -= *off; |
1742 | *off = 0; | 1728 | *off = 0; |
1743 | } | ||
1744 | 1729 | ||
1745 | do { | 1730 | do { |
1746 | unsigned int flen = min(*len, plen); | 1731 | unsigned int flen = min(*len, plen); |
1747 | 1732 | ||
1748 | /* the linear region may spread across several pages */ | 1733 | if (spd_fill_page(spd, pipe, page, &flen, poff, |
1749 | flen = min_t(unsigned int, flen, PAGE_SIZE - poff); | 1734 | linear, sk)) |
1750 | |||
1751 | if (spd_fill_page(spd, pipe, page, &flen, poff, skb, linear, sk)) | ||
1752 | return true; | 1735 | return true; |
1753 | 1736 | poff += flen; | |
1754 | __segment_seek(&page, &poff, &plen, flen); | 1737 | plen -= flen; |
1755 | *len -= flen; | 1738 | *len -= flen; |
1756 | |||
1757 | } while (*len && plen); | 1739 | } while (*len && plen); |
1758 | 1740 | ||
1759 | return false; | 1741 | return false; |
@@ -1777,7 +1759,7 @@ static bool __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe, | |||
1777 | if (__splice_segment(virt_to_page(skb->data), | 1759 | if (__splice_segment(virt_to_page(skb->data), |
1778 | (unsigned long) skb->data & (PAGE_SIZE - 1), | 1760 | (unsigned long) skb->data & (PAGE_SIZE - 1), |
1779 | skb_headlen(skb), | 1761 | skb_headlen(skb), |
1780 | offset, len, skb, spd, | 1762 | offset, len, spd, |
1781 | skb_head_is_locked(skb), | 1763 | skb_head_is_locked(skb), |
1782 | sk, pipe)) | 1764 | sk, pipe)) |
1783 | return true; | 1765 | return true; |
@@ -1790,7 +1772,7 @@ static bool __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe, | |||
1790 | 1772 | ||
1791 | if (__splice_segment(skb_frag_page(f), | 1773 | if (__splice_segment(skb_frag_page(f), |
1792 | f->page_offset, skb_frag_size(f), | 1774 | f->page_offset, skb_frag_size(f), |
1793 | offset, len, skb, spd, false, sk, pipe)) | 1775 | offset, len, spd, false, sk, pipe)) |
1794 | return true; | 1776 | return true; |
1795 | } | 1777 | } |
1796 | 1778 | ||
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c index a0d8392491c3..a69b4e4a02b5 100644 --- a/net/ipv4/ah4.c +++ b/net/ipv4/ah4.c | |||
@@ -269,7 +269,11 @@ static void ah_input_done(struct crypto_async_request *base, int err) | |||
269 | skb->network_header += ah_hlen; | 269 | skb->network_header += ah_hlen; |
270 | memcpy(skb_network_header(skb), work_iph, ihl); | 270 | memcpy(skb_network_header(skb), work_iph, ihl); |
271 | __skb_pull(skb, ah_hlen + ihl); | 271 | __skb_pull(skb, ah_hlen + ihl); |
272 | skb_set_transport_header(skb, -ihl); | 272 | |
273 | if (x->props.mode == XFRM_MODE_TUNNEL) | ||
274 | skb_reset_transport_header(skb); | ||
275 | else | ||
276 | skb_set_transport_header(skb, -ihl); | ||
273 | out: | 277 | out: |
274 | kfree(AH_SKB_CB(skb)->tmp); | 278 | kfree(AH_SKB_CB(skb)->tmp); |
275 | xfrm_input_resume(skb, err); | 279 | xfrm_input_resume(skb, err); |
@@ -381,7 +385,10 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb) | |||
381 | skb->network_header += ah_hlen; | 385 | skb->network_header += ah_hlen; |
382 | memcpy(skb_network_header(skb), work_iph, ihl); | 386 | memcpy(skb_network_header(skb), work_iph, ihl); |
383 | __skb_pull(skb, ah_hlen + ihl); | 387 | __skb_pull(skb, ah_hlen + ihl); |
384 | skb_set_transport_header(skb, -ihl); | 388 | if (x->props.mode == XFRM_MODE_TUNNEL) |
389 | skb_reset_transport_header(skb); | ||
390 | else | ||
391 | skb_set_transport_header(skb, -ihl); | ||
385 | 392 | ||
386 | err = nexthdr; | 393 | err = nexthdr; |
387 | 394 | ||
@@ -413,9 +420,12 @@ static void ah4_err(struct sk_buff *skb, u32 info) | |||
413 | if (!x) | 420 | if (!x) |
414 | return; | 421 | return; |
415 | 422 | ||
416 | if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) | 423 | if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) { |
424 | atomic_inc(&flow_cache_genid); | ||
425 | rt_genid_bump(net); | ||
426 | |||
417 | ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_AH, 0); | 427 | ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_AH, 0); |
418 | else | 428 | } else |
419 | ipv4_redirect(skb, net, 0, 0, IPPROTO_AH, 0); | 429 | ipv4_redirect(skb, net, 0, 0, IPPROTO_AH, 0); |
420 | xfrm_state_put(x); | 430 | xfrm_state_put(x); |
421 | } | 431 | } |
diff --git a/net/ipv4/datagram.c b/net/ipv4/datagram.c index 424fafbc8cb0..b28e863fe0a7 100644 --- a/net/ipv4/datagram.c +++ b/net/ipv4/datagram.c | |||
@@ -85,3 +85,28 @@ out: | |||
85 | return err; | 85 | return err; |
86 | } | 86 | } |
87 | EXPORT_SYMBOL(ip4_datagram_connect); | 87 | EXPORT_SYMBOL(ip4_datagram_connect); |
88 | |||
89 | void ip4_datagram_release_cb(struct sock *sk) | ||
90 | { | ||
91 | const struct inet_sock *inet = inet_sk(sk); | ||
92 | const struct ip_options_rcu *inet_opt; | ||
93 | __be32 daddr = inet->inet_daddr; | ||
94 | struct flowi4 fl4; | ||
95 | struct rtable *rt; | ||
96 | |||
97 | if (! __sk_dst_get(sk) || __sk_dst_check(sk, 0)) | ||
98 | return; | ||
99 | |||
100 | rcu_read_lock(); | ||
101 | inet_opt = rcu_dereference(inet->inet_opt); | ||
102 | if (inet_opt && inet_opt->opt.srr) | ||
103 | daddr = inet_opt->opt.faddr; | ||
104 | rt = ip_route_output_ports(sock_net(sk), &fl4, sk, daddr, | ||
105 | inet->inet_saddr, inet->inet_dport, | ||
106 | inet->inet_sport, sk->sk_protocol, | ||
107 | RT_CONN_FLAGS(sk), sk->sk_bound_dev_if); | ||
108 | if (!IS_ERR(rt)) | ||
109 | __sk_dst_set(sk, &rt->dst); | ||
110 | rcu_read_unlock(); | ||
111 | } | ||
112 | EXPORT_SYMBOL_GPL(ip4_datagram_release_cb); | ||
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index b61e9deb7c7e..3b4f0cd2e63e 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c | |||
@@ -346,7 +346,10 @@ static int esp_input_done2(struct sk_buff *skb, int err) | |||
346 | 346 | ||
347 | pskb_trim(skb, skb->len - alen - padlen - 2); | 347 | pskb_trim(skb, skb->len - alen - padlen - 2); |
348 | __skb_pull(skb, hlen); | 348 | __skb_pull(skb, hlen); |
349 | skb_set_transport_header(skb, -ihl); | 349 | if (x->props.mode == XFRM_MODE_TUNNEL) |
350 | skb_reset_transport_header(skb); | ||
351 | else | ||
352 | skb_set_transport_header(skb, -ihl); | ||
350 | 353 | ||
351 | err = nexthdr[1]; | 354 | err = nexthdr[1]; |
352 | 355 | ||
@@ -499,9 +502,12 @@ static void esp4_err(struct sk_buff *skb, u32 info) | |||
499 | if (!x) | 502 | if (!x) |
500 | return; | 503 | return; |
501 | 504 | ||
502 | if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) | 505 | if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) { |
506 | atomic_inc(&flow_cache_genid); | ||
507 | rt_genid_bump(net); | ||
508 | |||
503 | ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_ESP, 0); | 509 | ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_ESP, 0); |
504 | else | 510 | } else |
505 | ipv4_redirect(skb, net, 0, 0, IPPROTO_ESP, 0); | 511 | ipv4_redirect(skb, net, 0, 0, IPPROTO_ESP, 0); |
506 | xfrm_state_put(x); | 512 | xfrm_state_put(x); |
507 | } | 513 | } |
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 303012adf9e6..e81b1caf2ea2 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -963,8 +963,12 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev | |||
963 | ptr--; | 963 | ptr--; |
964 | } | 964 | } |
965 | if (tunnel->parms.o_flags&GRE_CSUM) { | 965 | if (tunnel->parms.o_flags&GRE_CSUM) { |
966 | int offset = skb_transport_offset(skb); | ||
967 | |||
966 | *ptr = 0; | 968 | *ptr = 0; |
967 | *(__sum16 *)ptr = ip_compute_csum((void *)(iph+1), skb->len - sizeof(struct iphdr)); | 969 | *(__sum16 *)ptr = csum_fold(skb_checksum(skb, offset, |
970 | skb->len - offset, | ||
971 | 0)); | ||
968 | } | 972 | } |
969 | } | 973 | } |
970 | 974 | ||
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c index d3ab47e19a89..9a46daed2f3c 100644 --- a/net/ipv4/ipcomp.c +++ b/net/ipv4/ipcomp.c | |||
@@ -47,9 +47,12 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info) | |||
47 | if (!x) | 47 | if (!x) |
48 | return; | 48 | return; |
49 | 49 | ||
50 | if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) | 50 | if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) { |
51 | atomic_inc(&flow_cache_genid); | ||
52 | rt_genid_bump(net); | ||
53 | |||
51 | ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_COMP, 0); | 54 | ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_COMP, 0); |
52 | else | 55 | } else |
53 | ipv4_redirect(skb, net, 0, 0, IPPROTO_COMP, 0); | 56 | ipv4_redirect(skb, net, 0, 0, IPPROTO_COMP, 0); |
54 | xfrm_state_put(x); | 57 | xfrm_state_put(x); |
55 | } | 58 | } |
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index 8f3d05424a3e..6f9c07268cf6 100644 --- a/net/ipv4/ping.c +++ b/net/ipv4/ping.c | |||
@@ -738,6 +738,7 @@ struct proto ping_prot = { | |||
738 | .recvmsg = ping_recvmsg, | 738 | .recvmsg = ping_recvmsg, |
739 | .bind = ping_bind, | 739 | .bind = ping_bind, |
740 | .backlog_rcv = ping_queue_rcv_skb, | 740 | .backlog_rcv = ping_queue_rcv_skb, |
741 | .release_cb = ip4_datagram_release_cb, | ||
741 | .hash = ping_v4_hash, | 742 | .hash = ping_v4_hash, |
742 | .unhash = ping_v4_unhash, | 743 | .unhash = ping_v4_unhash, |
743 | .get_port = ping_v4_get_port, | 744 | .get_port = ping_v4_get_port, |
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 73d1e4df4bf6..6f08991409c3 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -894,6 +894,7 @@ struct proto raw_prot = { | |||
894 | .recvmsg = raw_recvmsg, | 894 | .recvmsg = raw_recvmsg, |
895 | .bind = raw_bind, | 895 | .bind = raw_bind, |
896 | .backlog_rcv = raw_rcv_skb, | 896 | .backlog_rcv = raw_rcv_skb, |
897 | .release_cb = ip4_datagram_release_cb, | ||
897 | .hash = raw_hash_sk, | 898 | .hash = raw_hash_sk, |
898 | .unhash = raw_unhash_sk, | 899 | .unhash = raw_unhash_sk, |
899 | .obj_size = sizeof(struct raw_sock), | 900 | .obj_size = sizeof(struct raw_sock), |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 844a9ef60dbd..a0fcc47fee73 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -912,6 +912,9 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu) | |||
912 | struct dst_entry *dst = &rt->dst; | 912 | struct dst_entry *dst = &rt->dst; |
913 | struct fib_result res; | 913 | struct fib_result res; |
914 | 914 | ||
915 | if (dst_metric_locked(dst, RTAX_MTU)) | ||
916 | return; | ||
917 | |||
915 | if (dst->dev->mtu < mtu) | 918 | if (dst->dev->mtu < mtu) |
916 | return; | 919 | return; |
917 | 920 | ||
@@ -962,7 +965,7 @@ void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu, | |||
962 | } | 965 | } |
963 | EXPORT_SYMBOL_GPL(ipv4_update_pmtu); | 966 | EXPORT_SYMBOL_GPL(ipv4_update_pmtu); |
964 | 967 | ||
965 | void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) | 968 | static void __ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) |
966 | { | 969 | { |
967 | const struct iphdr *iph = (const struct iphdr *) skb->data; | 970 | const struct iphdr *iph = (const struct iphdr *) skb->data; |
968 | struct flowi4 fl4; | 971 | struct flowi4 fl4; |
@@ -975,6 +978,53 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) | |||
975 | ip_rt_put(rt); | 978 | ip_rt_put(rt); |
976 | } | 979 | } |
977 | } | 980 | } |
981 | |||
982 | void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) | ||
983 | { | ||
984 | const struct iphdr *iph = (const struct iphdr *) skb->data; | ||
985 | struct flowi4 fl4; | ||
986 | struct rtable *rt; | ||
987 | struct dst_entry *dst; | ||
988 | bool new = false; | ||
989 | |||
990 | bh_lock_sock(sk); | ||
991 | rt = (struct rtable *) __sk_dst_get(sk); | ||
992 | |||
993 | if (sock_owned_by_user(sk) || !rt) { | ||
994 | __ipv4_sk_update_pmtu(skb, sk, mtu); | ||
995 | goto out; | ||
996 | } | ||
997 | |||
998 | __build_flow_key(&fl4, sk, iph, 0, 0, 0, 0, 0); | ||
999 | |||
1000 | if (!__sk_dst_check(sk, 0)) { | ||
1001 | rt = ip_route_output_flow(sock_net(sk), &fl4, sk); | ||
1002 | if (IS_ERR(rt)) | ||
1003 | goto out; | ||
1004 | |||
1005 | new = true; | ||
1006 | } | ||
1007 | |||
1008 | __ip_rt_update_pmtu((struct rtable *) rt->dst.path, &fl4, mtu); | ||
1009 | |||
1010 | dst = dst_check(&rt->dst, 0); | ||
1011 | if (!dst) { | ||
1012 | if (new) | ||
1013 | dst_release(&rt->dst); | ||
1014 | |||
1015 | rt = ip_route_output_flow(sock_net(sk), &fl4, sk); | ||
1016 | if (IS_ERR(rt)) | ||
1017 | goto out; | ||
1018 | |||
1019 | new = true; | ||
1020 | } | ||
1021 | |||
1022 | if (new) | ||
1023 | __sk_dst_set(sk, &rt->dst); | ||
1024 | |||
1025 | out: | ||
1026 | bh_unlock_sock(sk); | ||
1027 | } | ||
978 | EXPORT_SYMBOL_GPL(ipv4_sk_update_pmtu); | 1028 | EXPORT_SYMBOL_GPL(ipv4_sk_update_pmtu); |
979 | 1029 | ||
980 | void ipv4_redirect(struct sk_buff *skb, struct net *net, | 1030 | void ipv4_redirect(struct sk_buff *skb, struct net *net, |
@@ -1120,7 +1170,7 @@ static unsigned int ipv4_mtu(const struct dst_entry *dst) | |||
1120 | if (!mtu || time_after_eq(jiffies, rt->dst.expires)) | 1170 | if (!mtu || time_after_eq(jiffies, rt->dst.expires)) |
1121 | mtu = dst_metric_raw(dst, RTAX_MTU); | 1171 | mtu = dst_metric_raw(dst, RTAX_MTU); |
1122 | 1172 | ||
1123 | if (mtu && rt_is_output_route(rt)) | 1173 | if (mtu) |
1124 | return mtu; | 1174 | return mtu; |
1125 | 1175 | ||
1126 | mtu = dst->dev->mtu; | 1176 | mtu = dst->dev->mtu; |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 54139fa514e6..70b09ef2463b 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -369,11 +369,10 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info) | |||
369 | * We do take care of PMTU discovery (RFC1191) special case : | 369 | * We do take care of PMTU discovery (RFC1191) special case : |
370 | * we can receive locally generated ICMP messages while socket is held. | 370 | * we can receive locally generated ICMP messages while socket is held. |
371 | */ | 371 | */ |
372 | if (sock_owned_by_user(sk) && | 372 | if (sock_owned_by_user(sk)) { |
373 | type != ICMP_DEST_UNREACH && | 373 | if (!(type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED)) |
374 | code != ICMP_FRAG_NEEDED) | 374 | NET_INC_STATS_BH(net, LINUX_MIB_LOCKDROPPEDICMPS); |
375 | NET_INC_STATS_BH(net, LINUX_MIB_LOCKDROPPEDICMPS); | 375 | } |
376 | |||
377 | if (sk->sk_state == TCP_CLOSE) | 376 | if (sk->sk_state == TCP_CLOSE) |
378 | goto out; | 377 | goto out; |
379 | 378 | ||
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 79c8dbe59b54..1f4d405eafba 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -1952,6 +1952,7 @@ struct proto udp_prot = { | |||
1952 | .recvmsg = udp_recvmsg, | 1952 | .recvmsg = udp_recvmsg, |
1953 | .sendpage = udp_sendpage, | 1953 | .sendpage = udp_sendpage, |
1954 | .backlog_rcv = __udp_queue_rcv_skb, | 1954 | .backlog_rcv = __udp_queue_rcv_skb, |
1955 | .release_cb = ip4_datagram_release_cb, | ||
1955 | .hash = udp_lib_hash, | 1956 | .hash = udp_lib_hash, |
1956 | .unhash = udp_lib_unhash, | 1957 | .unhash = udp_lib_unhash, |
1957 | .rehash = udp_v4_rehash, | 1958 | .rehash = udp_v4_rehash, |
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c index ecc35b93314b..384233188ac1 100644 --- a/net/ipv6/ah6.c +++ b/net/ipv6/ah6.c | |||
@@ -472,7 +472,10 @@ static void ah6_input_done(struct crypto_async_request *base, int err) | |||
472 | skb->network_header += ah_hlen; | 472 | skb->network_header += ah_hlen; |
473 | memcpy(skb_network_header(skb), work_iph, hdr_len); | 473 | memcpy(skb_network_header(skb), work_iph, hdr_len); |
474 | __skb_pull(skb, ah_hlen + hdr_len); | 474 | __skb_pull(skb, ah_hlen + hdr_len); |
475 | skb_set_transport_header(skb, -hdr_len); | 475 | if (x->props.mode == XFRM_MODE_TUNNEL) |
476 | skb_reset_transport_header(skb); | ||
477 | else | ||
478 | skb_set_transport_header(skb, -hdr_len); | ||
476 | out: | 479 | out: |
477 | kfree(AH_SKB_CB(skb)->tmp); | 480 | kfree(AH_SKB_CB(skb)->tmp); |
478 | xfrm_input_resume(skb, err); | 481 | xfrm_input_resume(skb, err); |
@@ -593,9 +596,13 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb) | |||
593 | 596 | ||
594 | skb->network_header += ah_hlen; | 597 | skb->network_header += ah_hlen; |
595 | memcpy(skb_network_header(skb), work_iph, hdr_len); | 598 | memcpy(skb_network_header(skb), work_iph, hdr_len); |
596 | skb->transport_header = skb->network_header; | ||
597 | __skb_pull(skb, ah_hlen + hdr_len); | 599 | __skb_pull(skb, ah_hlen + hdr_len); |
598 | 600 | ||
601 | if (x->props.mode == XFRM_MODE_TUNNEL) | ||
602 | skb_reset_transport_header(skb); | ||
603 | else | ||
604 | skb_set_transport_header(skb, -hdr_len); | ||
605 | |||
599 | err = nexthdr; | 606 | err = nexthdr; |
600 | 607 | ||
601 | out_free: | 608 | out_free: |
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index 282f3723ee19..40ffd72243a4 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c | |||
@@ -300,7 +300,10 @@ static int esp_input_done2(struct sk_buff *skb, int err) | |||
300 | 300 | ||
301 | pskb_trim(skb, skb->len - alen - padlen - 2); | 301 | pskb_trim(skb, skb->len - alen - padlen - 2); |
302 | __skb_pull(skb, hlen); | 302 | __skb_pull(skb, hlen); |
303 | skb_set_transport_header(skb, -hdr_len); | 303 | if (x->props.mode == XFRM_MODE_TUNNEL) |
304 | skb_reset_transport_header(skb); | ||
305 | else | ||
306 | skb_set_transport_header(skb, -hdr_len); | ||
304 | 307 | ||
305 | err = nexthdr[1]; | 308 | err = nexthdr[1]; |
306 | 309 | ||
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index b4a9fd51dae7..fff5bdd8b680 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -81,10 +81,22 @@ static inline struct sock *icmpv6_sk(struct net *net) | |||
81 | return net->ipv6.icmp_sk[smp_processor_id()]; | 81 | return net->ipv6.icmp_sk[smp_processor_id()]; |
82 | } | 82 | } |
83 | 83 | ||
84 | static void icmpv6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | ||
85 | u8 type, u8 code, int offset, __be32 info) | ||
86 | { | ||
87 | struct net *net = dev_net(skb->dev); | ||
88 | |||
89 | if (type == ICMPV6_PKT_TOOBIG) | ||
90 | ip6_update_pmtu(skb, net, info, 0, 0); | ||
91 | else if (type == NDISC_REDIRECT) | ||
92 | ip6_redirect(skb, net, 0, 0); | ||
93 | } | ||
94 | |||
84 | static int icmpv6_rcv(struct sk_buff *skb); | 95 | static int icmpv6_rcv(struct sk_buff *skb); |
85 | 96 | ||
86 | static const struct inet6_protocol icmpv6_protocol = { | 97 | static const struct inet6_protocol icmpv6_protocol = { |
87 | .handler = icmpv6_rcv, | 98 | .handler = icmpv6_rcv, |
99 | .err_handler = icmpv6_err, | ||
88 | .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, | 100 | .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, |
89 | }; | 101 | }; |
90 | 102 | ||
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 5552d13ae92f..0c7c03d50dc0 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -1213,10 +1213,10 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, | |||
1213 | if (dst_allfrag(rt->dst.path)) | 1213 | if (dst_allfrag(rt->dst.path)) |
1214 | cork->flags |= IPCORK_ALLFRAG; | 1214 | cork->flags |= IPCORK_ALLFRAG; |
1215 | cork->length = 0; | 1215 | cork->length = 0; |
1216 | exthdrlen = (opt ? opt->opt_flen : 0) - rt->rt6i_nfheader_len; | 1216 | exthdrlen = (opt ? opt->opt_flen : 0); |
1217 | length += exthdrlen; | 1217 | length += exthdrlen; |
1218 | transhdrlen += exthdrlen; | 1218 | transhdrlen += exthdrlen; |
1219 | dst_exthdrlen = rt->dst.header_len; | 1219 | dst_exthdrlen = rt->dst.header_len - rt->rt6i_nfheader_len; |
1220 | } else { | 1220 | } else { |
1221 | rt = (struct rt6_info *)cork->dst; | 1221 | rt = (struct rt6_info *)cork->dst; |
1222 | fl6 = &inet->cork.fl.u.ip6; | 1222 | fl6 = &inet->cork.fl.u.ip6; |
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 26dcdec9e3a5..8fd154e5f079 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -1710,6 +1710,9 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, uns | |||
1710 | return -EINVAL; | 1710 | return -EINVAL; |
1711 | if (get_user(v, (u32 __user *)optval)) | 1711 | if (get_user(v, (u32 __user *)optval)) |
1712 | return -EFAULT; | 1712 | return -EFAULT; |
1713 | /* "pim6reg%u" should not exceed 16 bytes (IFNAMSIZ) */ | ||
1714 | if (v != RT_TABLE_DEFAULT && v >= 100000000) | ||
1715 | return -EINVAL; | ||
1713 | if (sk == mrt->mroute6_sk) | 1716 | if (sk == mrt->mroute6_sk) |
1714 | return -EBUSY; | 1717 | return -EBUSY; |
1715 | 1718 | ||
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 47e0aca614b7..516fbc96feff 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -164,7 +164,17 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, | |||
164 | sta = sta_info_get(sdata, mac_addr); | 164 | sta = sta_info_get(sdata, mac_addr); |
165 | else | 165 | else |
166 | sta = sta_info_get_bss(sdata, mac_addr); | 166 | sta = sta_info_get_bss(sdata, mac_addr); |
167 | if (!sta) { | 167 | /* |
168 | * The ASSOC test makes sure the driver is ready to | ||
169 | * receive the key. When wpa_supplicant has roamed | ||
170 | * using FT, it attempts to set the key before | ||
171 | * association has completed, this rejects that attempt | ||
172 | * so it will set the key again after assocation. | ||
173 | * | ||
174 | * TODO: accept the key if we have a station entry and | ||
175 | * add it to the device after the station. | ||
176 | */ | ||
177 | if (!sta || !test_sta_flag(sta, WLAN_STA_ASSOC)) { | ||
168 | ieee80211_key_free(sdata->local, key); | 178 | ieee80211_key_free(sdata->local, key); |
169 | err = -ENOENT; | 179 | err = -ENOENT; |
170 | goto out_unlock; | 180 | goto out_unlock; |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 8563b9a5cac3..2ed065c09562 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -1358,10 +1358,8 @@ int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata); | |||
1358 | void ieee80211_sched_scan_stopped_work(struct work_struct *work); | 1358 | void ieee80211_sched_scan_stopped_work(struct work_struct *work); |
1359 | 1359 | ||
1360 | /* off-channel helpers */ | 1360 | /* off-channel helpers */ |
1361 | void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local, | 1361 | void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local); |
1362 | bool offchannel_ps_enable); | 1362 | void ieee80211_offchannel_return(struct ieee80211_local *local); |
1363 | void ieee80211_offchannel_return(struct ieee80211_local *local, | ||
1364 | bool offchannel_ps_disable); | ||
1365 | void ieee80211_roc_setup(struct ieee80211_local *local); | 1363 | void ieee80211_roc_setup(struct ieee80211_local *local); |
1366 | void ieee80211_start_next_roc(struct ieee80211_local *local); | 1364 | void ieee80211_start_next_roc(struct ieee80211_local *local); |
1367 | void ieee80211_roc_purge(struct ieee80211_sub_if_data *sdata); | 1365 | void ieee80211_roc_purge(struct ieee80211_sub_if_data *sdata); |
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index 47aeee2d8db1..2659e428b80c 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c | |||
@@ -215,6 +215,7 @@ static void prepare_frame_for_deferred_tx(struct ieee80211_sub_if_data *sdata, | |||
215 | skb->priority = 7; | 215 | skb->priority = 7; |
216 | 216 | ||
217 | info->control.vif = &sdata->vif; | 217 | info->control.vif = &sdata->vif; |
218 | info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; | ||
218 | ieee80211_set_qos_hdr(sdata, skb); | 219 | ieee80211_set_qos_hdr(sdata, skb); |
219 | } | 220 | } |
220 | 221 | ||
@@ -246,11 +247,13 @@ int mesh_path_error_tx(u8 ttl, u8 *target, __le32 target_sn, | |||
246 | return -EAGAIN; | 247 | return -EAGAIN; |
247 | 248 | ||
248 | skb = dev_alloc_skb(local->tx_headroom + | 249 | skb = dev_alloc_skb(local->tx_headroom + |
250 | IEEE80211_ENCRYPT_HEADROOM + | ||
251 | IEEE80211_ENCRYPT_TAILROOM + | ||
249 | hdr_len + | 252 | hdr_len + |
250 | 2 + 15 /* PERR IE */); | 253 | 2 + 15 /* PERR IE */); |
251 | if (!skb) | 254 | if (!skb) |
252 | return -1; | 255 | return -1; |
253 | skb_reserve(skb, local->tx_headroom); | 256 | skb_reserve(skb, local->tx_headroom + IEEE80211_ENCRYPT_HEADROOM); |
254 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, hdr_len); | 257 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, hdr_len); |
255 | memset(mgmt, 0, hdr_len); | 258 | memset(mgmt, 0, hdr_len); |
256 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 259 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c index a5379aea7d09..a3ad4c3c80a3 100644 --- a/net/mac80211/offchannel.c +++ b/net/mac80211/offchannel.c | |||
@@ -102,8 +102,7 @@ static void ieee80211_offchannel_ps_disable(struct ieee80211_sub_if_data *sdata) | |||
102 | ieee80211_sta_reset_conn_monitor(sdata); | 102 | ieee80211_sta_reset_conn_monitor(sdata); |
103 | } | 103 | } |
104 | 104 | ||
105 | void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local, | 105 | void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local) |
106 | bool offchannel_ps_enable) | ||
107 | { | 106 | { |
108 | struct ieee80211_sub_if_data *sdata; | 107 | struct ieee80211_sub_if_data *sdata; |
109 | 108 | ||
@@ -134,8 +133,7 @@ void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local, | |||
134 | 133 | ||
135 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR) { | 134 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR) { |
136 | netif_tx_stop_all_queues(sdata->dev); | 135 | netif_tx_stop_all_queues(sdata->dev); |
137 | if (offchannel_ps_enable && | 136 | if (sdata->vif.type == NL80211_IFTYPE_STATION && |
138 | (sdata->vif.type == NL80211_IFTYPE_STATION) && | ||
139 | sdata->u.mgd.associated) | 137 | sdata->u.mgd.associated) |
140 | ieee80211_offchannel_ps_enable(sdata); | 138 | ieee80211_offchannel_ps_enable(sdata); |
141 | } | 139 | } |
@@ -143,8 +141,7 @@ void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local, | |||
143 | mutex_unlock(&local->iflist_mtx); | 141 | mutex_unlock(&local->iflist_mtx); |
144 | } | 142 | } |
145 | 143 | ||
146 | void ieee80211_offchannel_return(struct ieee80211_local *local, | 144 | void ieee80211_offchannel_return(struct ieee80211_local *local) |
147 | bool offchannel_ps_disable) | ||
148 | { | 145 | { |
149 | struct ieee80211_sub_if_data *sdata; | 146 | struct ieee80211_sub_if_data *sdata; |
150 | 147 | ||
@@ -163,11 +160,9 @@ void ieee80211_offchannel_return(struct ieee80211_local *local, | |||
163 | continue; | 160 | continue; |
164 | 161 | ||
165 | /* Tell AP we're back */ | 162 | /* Tell AP we're back */ |
166 | if (offchannel_ps_disable && | 163 | if (sdata->vif.type == NL80211_IFTYPE_STATION && |
167 | sdata->vif.type == NL80211_IFTYPE_STATION) { | 164 | sdata->u.mgd.associated) |
168 | if (sdata->u.mgd.associated) | 165 | ieee80211_offchannel_ps_disable(sdata); |
169 | ieee80211_offchannel_ps_disable(sdata); | ||
170 | } | ||
171 | 166 | ||
172 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR) { | 167 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR) { |
173 | /* | 168 | /* |
@@ -385,7 +380,7 @@ void ieee80211_sw_roc_work(struct work_struct *work) | |||
385 | local->tmp_channel = NULL; | 380 | local->tmp_channel = NULL; |
386 | ieee80211_hw_config(local, 0); | 381 | ieee80211_hw_config(local, 0); |
387 | 382 | ||
388 | ieee80211_offchannel_return(local, true); | 383 | ieee80211_offchannel_return(local); |
389 | } | 384 | } |
390 | 385 | ||
391 | ieee80211_recalc_idle(local); | 386 | ieee80211_recalc_idle(local); |
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index d59fc6818b1c..bf82e69d0601 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -292,7 +292,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted, | |||
292 | if (!was_hw_scan) { | 292 | if (!was_hw_scan) { |
293 | ieee80211_configure_filter(local); | 293 | ieee80211_configure_filter(local); |
294 | drv_sw_scan_complete(local); | 294 | drv_sw_scan_complete(local); |
295 | ieee80211_offchannel_return(local, true); | 295 | ieee80211_offchannel_return(local); |
296 | } | 296 | } |
297 | 297 | ||
298 | ieee80211_recalc_idle(local); | 298 | ieee80211_recalc_idle(local); |
@@ -341,7 +341,7 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local) | |||
341 | local->next_scan_state = SCAN_DECISION; | 341 | local->next_scan_state = SCAN_DECISION; |
342 | local->scan_channel_idx = 0; | 342 | local->scan_channel_idx = 0; |
343 | 343 | ||
344 | ieee80211_offchannel_stop_vifs(local, true); | 344 | ieee80211_offchannel_stop_vifs(local); |
345 | 345 | ||
346 | ieee80211_configure_filter(local); | 346 | ieee80211_configure_filter(local); |
347 | 347 | ||
@@ -678,12 +678,8 @@ static void ieee80211_scan_state_suspend(struct ieee80211_local *local, | |||
678 | local->scan_channel = NULL; | 678 | local->scan_channel = NULL; |
679 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); | 679 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); |
680 | 680 | ||
681 | /* | 681 | /* disable PS */ |
682 | * Re-enable vifs and beaconing. Leave PS | 682 | ieee80211_offchannel_return(local); |
683 | * in off-channel state..will put that back | ||
684 | * on-channel at the end of scanning. | ||
685 | */ | ||
686 | ieee80211_offchannel_return(local, false); | ||
687 | 683 | ||
688 | *next_delay = HZ / 5; | 684 | *next_delay = HZ / 5; |
689 | /* afterwards, resume scan & go to next channel */ | 685 | /* afterwards, resume scan & go to next channel */ |
@@ -693,8 +689,7 @@ static void ieee80211_scan_state_suspend(struct ieee80211_local *local, | |||
693 | static void ieee80211_scan_state_resume(struct ieee80211_local *local, | 689 | static void ieee80211_scan_state_resume(struct ieee80211_local *local, |
694 | unsigned long *next_delay) | 690 | unsigned long *next_delay) |
695 | { | 691 | { |
696 | /* PS already is in off-channel mode */ | 692 | ieee80211_offchannel_stop_vifs(local); |
697 | ieee80211_offchannel_stop_vifs(local, false); | ||
698 | 693 | ||
699 | if (local->ops->flush) { | 694 | if (local->ops->flush) { |
700 | drv_flush(local, false); | 695 | drv_flush(local, false); |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index e9eadc40c09c..467c1d1b66f2 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -1673,10 +1673,13 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, | |||
1673 | chanctx_conf = | 1673 | chanctx_conf = |
1674 | rcu_dereference(tmp_sdata->vif.chanctx_conf); | 1674 | rcu_dereference(tmp_sdata->vif.chanctx_conf); |
1675 | } | 1675 | } |
1676 | if (!chanctx_conf) | ||
1677 | goto fail_rcu; | ||
1678 | 1676 | ||
1679 | chan = chanctx_conf->def.chan; | 1677 | if (chanctx_conf) |
1678 | chan = chanctx_conf->def.chan; | ||
1679 | else if (!local->use_chanctx) | ||
1680 | chan = local->_oper_channel; | ||
1681 | else | ||
1682 | goto fail_rcu; | ||
1680 | 1683 | ||
1681 | /* | 1684 | /* |
1682 | * Frame injection is not allowed if beaconing is not allowed | 1685 | * Frame injection is not allowed if beaconing is not allowed |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 016d95ead930..e4a0c4fb3a7c 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -1376,11 +1376,12 @@ void nf_conntrack_cleanup(struct net *net) | |||
1376 | synchronize_net(); | 1376 | synchronize_net(); |
1377 | nf_conntrack_proto_fini(net); | 1377 | nf_conntrack_proto_fini(net); |
1378 | nf_conntrack_cleanup_net(net); | 1378 | nf_conntrack_cleanup_net(net); |
1379 | } | ||
1379 | 1380 | ||
1380 | if (net_eq(net, &init_net)) { | 1381 | void nf_conntrack_cleanup_end(void) |
1381 | RCU_INIT_POINTER(nf_ct_destroy, NULL); | 1382 | { |
1382 | nf_conntrack_cleanup_init_net(); | 1383 | RCU_INIT_POINTER(nf_ct_destroy, NULL); |
1383 | } | 1384 | nf_conntrack_cleanup_init_net(); |
1384 | } | 1385 | } |
1385 | 1386 | ||
1386 | void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls) | 1387 | void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls) |
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c index 363285d544a1..e7185c684816 100644 --- a/net/netfilter/nf_conntrack_standalone.c +++ b/net/netfilter/nf_conntrack_standalone.c | |||
@@ -575,6 +575,7 @@ static int __init nf_conntrack_standalone_init(void) | |||
575 | static void __exit nf_conntrack_standalone_fini(void) | 575 | static void __exit nf_conntrack_standalone_fini(void) |
576 | { | 576 | { |
577 | unregister_pernet_subsys(&nf_conntrack_net_ops); | 577 | unregister_pernet_subsys(&nf_conntrack_net_ops); |
578 | nf_conntrack_cleanup_end(); | ||
578 | } | 579 | } |
579 | 580 | ||
580 | module_init(nf_conntrack_standalone_init); | 581 | module_init(nf_conntrack_standalone_init); |
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index 8d987c3573fd..7b3a9e5999c0 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c | |||
@@ -345,19 +345,27 @@ int xt_find_revision(u8 af, const char *name, u8 revision, int target, | |||
345 | } | 345 | } |
346 | EXPORT_SYMBOL_GPL(xt_find_revision); | 346 | EXPORT_SYMBOL_GPL(xt_find_revision); |
347 | 347 | ||
348 | static char *textify_hooks(char *buf, size_t size, unsigned int mask) | 348 | static char * |
349 | textify_hooks(char *buf, size_t size, unsigned int mask, uint8_t nfproto) | ||
349 | { | 350 | { |
350 | static const char *const names[] = { | 351 | static const char *const inetbr_names[] = { |
351 | "PREROUTING", "INPUT", "FORWARD", | 352 | "PREROUTING", "INPUT", "FORWARD", |
352 | "OUTPUT", "POSTROUTING", "BROUTING", | 353 | "OUTPUT", "POSTROUTING", "BROUTING", |
353 | }; | 354 | }; |
354 | unsigned int i; | 355 | static const char *const arp_names[] = { |
356 | "INPUT", "FORWARD", "OUTPUT", | ||
357 | }; | ||
358 | const char *const *names; | ||
359 | unsigned int i, max; | ||
355 | char *p = buf; | 360 | char *p = buf; |
356 | bool np = false; | 361 | bool np = false; |
357 | int res; | 362 | int res; |
358 | 363 | ||
364 | names = (nfproto == NFPROTO_ARP) ? arp_names : inetbr_names; | ||
365 | max = (nfproto == NFPROTO_ARP) ? ARRAY_SIZE(arp_names) : | ||
366 | ARRAY_SIZE(inetbr_names); | ||
359 | *p = '\0'; | 367 | *p = '\0'; |
360 | for (i = 0; i < ARRAY_SIZE(names); ++i) { | 368 | for (i = 0; i < max; ++i) { |
361 | if (!(mask & (1 << i))) | 369 | if (!(mask & (1 << i))) |
362 | continue; | 370 | continue; |
363 | res = snprintf(p, size, "%s%s", np ? "/" : "", names[i]); | 371 | res = snprintf(p, size, "%s%s", np ? "/" : "", names[i]); |
@@ -402,8 +410,10 @@ int xt_check_match(struct xt_mtchk_param *par, | |||
402 | pr_err("%s_tables: %s match: used from hooks %s, but only " | 410 | pr_err("%s_tables: %s match: used from hooks %s, but only " |
403 | "valid from %s\n", | 411 | "valid from %s\n", |
404 | xt_prefix[par->family], par->match->name, | 412 | xt_prefix[par->family], par->match->name, |
405 | textify_hooks(used, sizeof(used), par->hook_mask), | 413 | textify_hooks(used, sizeof(used), par->hook_mask, |
406 | textify_hooks(allow, sizeof(allow), par->match->hooks)); | 414 | par->family), |
415 | textify_hooks(allow, sizeof(allow), par->match->hooks, | ||
416 | par->family)); | ||
407 | return -EINVAL; | 417 | return -EINVAL; |
408 | } | 418 | } |
409 | if (par->match->proto && (par->match->proto != proto || inv_proto)) { | 419 | if (par->match->proto && (par->match->proto != proto || inv_proto)) { |
@@ -575,8 +585,10 @@ int xt_check_target(struct xt_tgchk_param *par, | |||
575 | pr_err("%s_tables: %s target: used from hooks %s, but only " | 585 | pr_err("%s_tables: %s target: used from hooks %s, but only " |
576 | "usable from %s\n", | 586 | "usable from %s\n", |
577 | xt_prefix[par->family], par->target->name, | 587 | xt_prefix[par->family], par->target->name, |
578 | textify_hooks(used, sizeof(used), par->hook_mask), | 588 | textify_hooks(used, sizeof(used), par->hook_mask, |
579 | textify_hooks(allow, sizeof(allow), par->target->hooks)); | 589 | par->family), |
590 | textify_hooks(allow, sizeof(allow), par->target->hooks, | ||
591 | par->family)); | ||
580 | return -EINVAL; | 592 | return -EINVAL; |
581 | } | 593 | } |
582 | if (par->target->proto && (par->target->proto != proto || inv_proto)) { | 594 | if (par->target->proto && (par->target->proto != proto || inv_proto)) { |
diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c index 2a0843081840..bde009ed8d3b 100644 --- a/net/netfilter/xt_CT.c +++ b/net/netfilter/xt_CT.c | |||
@@ -109,7 +109,7 @@ static int xt_ct_tg_check_v0(const struct xt_tgchk_param *par) | |||
109 | struct xt_ct_target_info *info = par->targinfo; | 109 | struct xt_ct_target_info *info = par->targinfo; |
110 | struct nf_conntrack_tuple t; | 110 | struct nf_conntrack_tuple t; |
111 | struct nf_conn *ct; | 111 | struct nf_conn *ct; |
112 | int ret; | 112 | int ret = -EOPNOTSUPP; |
113 | 113 | ||
114 | if (info->flags & ~XT_CT_NOTRACK) | 114 | if (info->flags & ~XT_CT_NOTRACK) |
115 | return -EINVAL; | 115 | return -EINVAL; |
@@ -247,7 +247,7 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par) | |||
247 | struct xt_ct_target_info_v1 *info = par->targinfo; | 247 | struct xt_ct_target_info_v1 *info = par->targinfo; |
248 | struct nf_conntrack_tuple t; | 248 | struct nf_conntrack_tuple t; |
249 | struct nf_conn *ct; | 249 | struct nf_conn *ct; |
250 | int ret; | 250 | int ret = -EOPNOTSUPP; |
251 | 251 | ||
252 | if (info->flags & ~XT_CT_NOTRACK) | 252 | if (info->flags & ~XT_CT_NOTRACK) |
253 | return -EINVAL; | 253 | return -EINVAL; |
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c index 379c81dee9d1..9bcdbd02d777 100644 --- a/net/sctp/outqueue.c +++ b/net/sctp/outqueue.c | |||
@@ -224,7 +224,7 @@ void sctp_outq_init(struct sctp_association *asoc, struct sctp_outq *q) | |||
224 | 224 | ||
225 | /* Free the outqueue structure and any related pending chunks. | 225 | /* Free the outqueue structure and any related pending chunks. |
226 | */ | 226 | */ |
227 | void sctp_outq_teardown(struct sctp_outq *q) | 227 | static void __sctp_outq_teardown(struct sctp_outq *q) |
228 | { | 228 | { |
229 | struct sctp_transport *transport; | 229 | struct sctp_transport *transport; |
230 | struct list_head *lchunk, *temp; | 230 | struct list_head *lchunk, *temp; |
@@ -277,8 +277,6 @@ void sctp_outq_teardown(struct sctp_outq *q) | |||
277 | sctp_chunk_free(chunk); | 277 | sctp_chunk_free(chunk); |
278 | } | 278 | } |
279 | 279 | ||
280 | q->error = 0; | ||
281 | |||
282 | /* Throw away any leftover control chunks. */ | 280 | /* Throw away any leftover control chunks. */ |
283 | list_for_each_entry_safe(chunk, tmp, &q->control_chunk_list, list) { | 281 | list_for_each_entry_safe(chunk, tmp, &q->control_chunk_list, list) { |
284 | list_del_init(&chunk->list); | 282 | list_del_init(&chunk->list); |
@@ -286,11 +284,17 @@ void sctp_outq_teardown(struct sctp_outq *q) | |||
286 | } | 284 | } |
287 | } | 285 | } |
288 | 286 | ||
287 | void sctp_outq_teardown(struct sctp_outq *q) | ||
288 | { | ||
289 | __sctp_outq_teardown(q); | ||
290 | sctp_outq_init(q->asoc, q); | ||
291 | } | ||
292 | |||
289 | /* Free the outqueue structure and any related pending chunks. */ | 293 | /* Free the outqueue structure and any related pending chunks. */ |
290 | void sctp_outq_free(struct sctp_outq *q) | 294 | void sctp_outq_free(struct sctp_outq *q) |
291 | { | 295 | { |
292 | /* Throw away leftover chunks. */ | 296 | /* Throw away leftover chunks. */ |
293 | sctp_outq_teardown(q); | 297 | __sctp_outq_teardown(q); |
294 | 298 | ||
295 | /* If we were kmalloc()'d, free the memory. */ | 299 | /* If we were kmalloc()'d, free the memory. */ |
296 | if (q->malloced) | 300 | if (q->malloced) |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 618ec7e216ca..5131fcfedb03 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -1779,8 +1779,10 @@ static sctp_disposition_t sctp_sf_do_dupcook_a(struct net *net, | |||
1779 | 1779 | ||
1780 | /* Update the content of current association. */ | 1780 | /* Update the content of current association. */ |
1781 | sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc)); | 1781 | sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc)); |
1782 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl)); | ||
1783 | sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(ev)); | 1782 | sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(ev)); |
1783 | sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, | ||
1784 | SCTP_STATE(SCTP_STATE_ESTABLISHED)); | ||
1785 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl)); | ||
1784 | return SCTP_DISPOSITION_CONSUME; | 1786 | return SCTP_DISPOSITION_CONSUME; |
1785 | 1787 | ||
1786 | nomem_ev: | 1788 | nomem_ev: |
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c index 043889ac86c0..bf3c6e8fc401 100644 --- a/net/sctp/sysctl.c +++ b/net/sctp/sysctl.c | |||
@@ -366,7 +366,11 @@ int sctp_sysctl_net_register(struct net *net) | |||
366 | 366 | ||
367 | void sctp_sysctl_net_unregister(struct net *net) | 367 | void sctp_sysctl_net_unregister(struct net *net) |
368 | { | 368 | { |
369 | struct ctl_table *table; | ||
370 | |||
371 | table = net->sctp.sysctl_header->ctl_table_arg; | ||
369 | unregister_net_sysctl_table(net->sctp.sysctl_header); | 372 | unregister_net_sysctl_table(net->sctp.sysctl_header); |
373 | kfree(table); | ||
370 | } | 374 | } |
371 | 375 | ||
372 | static struct ctl_table_header * sctp_sysctl_header; | 376 | static struct ctl_table_header * sctp_sysctl_header; |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 41eabc46f110..07c585756d2a 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -2656,7 +2656,7 @@ static void xfrm_policy_fini(struct net *net) | |||
2656 | WARN_ON(!hlist_empty(&net->xfrm.policy_inexact[dir])); | 2656 | WARN_ON(!hlist_empty(&net->xfrm.policy_inexact[dir])); |
2657 | 2657 | ||
2658 | htab = &net->xfrm.policy_bydst[dir]; | 2658 | htab = &net->xfrm.policy_bydst[dir]; |
2659 | sz = (htab->hmask + 1); | 2659 | sz = (htab->hmask + 1) * sizeof(struct hlist_head); |
2660 | WARN_ON(!hlist_empty(htab->table)); | 2660 | WARN_ON(!hlist_empty(htab->table)); |
2661 | xfrm_hash_free(htab->table, sz); | 2661 | xfrm_hash_free(htab->table, sz); |
2662 | } | 2662 | } |
diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c index 765f6fe951eb..35754cc8a9e5 100644 --- a/net/xfrm/xfrm_replay.c +++ b/net/xfrm/xfrm_replay.c | |||
@@ -242,11 +242,13 @@ static void xfrm_replay_advance_bmp(struct xfrm_state *x, __be32 net_seq) | |||
242 | u32 diff; | 242 | u32 diff; |
243 | struct xfrm_replay_state_esn *replay_esn = x->replay_esn; | 243 | struct xfrm_replay_state_esn *replay_esn = x->replay_esn; |
244 | u32 seq = ntohl(net_seq); | 244 | u32 seq = ntohl(net_seq); |
245 | u32 pos = (replay_esn->seq - 1) % replay_esn->replay_window; | 245 | u32 pos; |
246 | 246 | ||
247 | if (!replay_esn->replay_window) | 247 | if (!replay_esn->replay_window) |
248 | return; | 248 | return; |
249 | 249 | ||
250 | pos = (replay_esn->seq - 1) % replay_esn->replay_window; | ||
251 | |||
250 | if (seq > replay_esn->seq) { | 252 | if (seq > replay_esn->seq) { |
251 | diff = seq - replay_esn->seq; | 253 | diff = seq - replay_esn->seq; |
252 | 254 | ||