diff options
Diffstat (limited to 'net')
69 files changed, 408 insertions, 275 deletions
diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c index daad0064e2c2..08b54b593d56 100644 --- a/net/8021q/vlanproc.c +++ b/net/8021q/vlanproc.c | |||
@@ -176,12 +176,11 @@ int vlan_proc_add_dev(struct net_device *vlandev) | |||
176 | struct vlan_dev_info *dev_info = vlan_dev_info(vlandev); | 176 | struct vlan_dev_info *dev_info = vlan_dev_info(vlandev); |
177 | struct vlan_net *vn = net_generic(dev_net(vlandev), vlan_net_id); | 177 | struct vlan_net *vn = net_generic(dev_net(vlandev), vlan_net_id); |
178 | 178 | ||
179 | dev_info->dent = proc_create(vlandev->name, S_IFREG|S_IRUSR|S_IWUSR, | 179 | dev_info->dent = |
180 | vn->proc_vlan_dir, &vlandev_fops); | 180 | proc_create_data(vlandev->name, S_IFREG|S_IRUSR|S_IWUSR, |
181 | vn->proc_vlan_dir, &vlandev_fops, vlandev); | ||
181 | if (!dev_info->dent) | 182 | if (!dev_info->dent) |
182 | return -ENOBUFS; | 183 | return -ENOBUFS; |
183 | |||
184 | dev_info->dent->data = vlandev; | ||
185 | return 0; | 184 | return 0; |
186 | } | 185 | } |
187 | 186 | ||
diff --git a/net/atm/proc.c b/net/atm/proc.c index 5c9f3d148135..49487b313f22 100644 --- a/net/atm/proc.c +++ b/net/atm/proc.c | |||
@@ -417,12 +417,10 @@ int atm_proc_dev_register(struct atm_dev *dev) | |||
417 | goto err_out; | 417 | goto err_out; |
418 | sprintf(dev->proc_name,"%s:%d",dev->type, dev->number); | 418 | sprintf(dev->proc_name,"%s:%d",dev->type, dev->number); |
419 | 419 | ||
420 | dev->proc_entry = proc_create(dev->proc_name, 0, atm_proc_root, | 420 | dev->proc_entry = proc_create_data(dev->proc_name, 0, atm_proc_root, |
421 | &proc_atm_dev_ops); | 421 | &proc_atm_dev_ops, dev); |
422 | if (!dev->proc_entry) | 422 | if (!dev->proc_entry) |
423 | goto err_free_name; | 423 | goto err_free_name; |
424 | dev->proc_entry->data = dev; | ||
425 | dev->proc_entry->owner = THIS_MODULE; | ||
426 | return 0; | 424 | return 0; |
427 | err_free_name: | 425 | err_free_name: |
428 | kfree(dev->proc_name); | 426 | kfree(dev->proc_name); |
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c index 347e935faaf0..f85d94643aaf 100644 --- a/net/bluetooth/bnep/core.c +++ b/net/bluetooth/bnep/core.c | |||
@@ -135,7 +135,7 @@ static int bnep_ctrl_set_netfilter(struct bnep_session *s, __be16 *data, int len | |||
135 | if (len < 2) | 135 | if (len < 2) |
136 | return -EILSEQ; | 136 | return -EILSEQ; |
137 | 137 | ||
138 | n = ntohs(get_unaligned(data)); | 138 | n = get_unaligned_be16(data); |
139 | data++; len -= 2; | 139 | data++; len -= 2; |
140 | 140 | ||
141 | if (len < n) | 141 | if (len < n) |
@@ -150,8 +150,8 @@ static int bnep_ctrl_set_netfilter(struct bnep_session *s, __be16 *data, int len | |||
150 | int i; | 150 | int i; |
151 | 151 | ||
152 | for (i = 0; i < n; i++) { | 152 | for (i = 0; i < n; i++) { |
153 | f[i].start = ntohs(get_unaligned(data++)); | 153 | f[i].start = get_unaligned_be16(data++); |
154 | f[i].end = ntohs(get_unaligned(data++)); | 154 | f[i].end = get_unaligned_be16(data++); |
155 | 155 | ||
156 | BT_DBG("proto filter start %d end %d", | 156 | BT_DBG("proto filter start %d end %d", |
157 | f[i].start, f[i].end); | 157 | f[i].start, f[i].end); |
@@ -180,7 +180,7 @@ static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len) | |||
180 | if (len < 2) | 180 | if (len < 2) |
181 | return -EILSEQ; | 181 | return -EILSEQ; |
182 | 182 | ||
183 | n = ntohs(get_unaligned((__be16 *) data)); | 183 | n = get_unaligned_be16(data); |
184 | data += 2; len -= 2; | 184 | data += 2; len -= 2; |
185 | 185 | ||
186 | if (len < n) | 186 | if (len < n) |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 46df2e403df8..6aef8f24e581 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -129,8 +129,7 @@ static void hci_cc_write_link_policy(struct hci_dev *hdev, struct sk_buff *skb) | |||
129 | 129 | ||
130 | conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); | 130 | conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); |
131 | if (conn) { | 131 | if (conn) { |
132 | __le16 policy = get_unaligned((__le16 *) (sent + 2)); | 132 | conn->link_policy = get_unaligned_le16(sent + 2); |
133 | conn->link_policy = __le16_to_cpu(policy); | ||
134 | } | 133 | } |
135 | 134 | ||
136 | hci_dev_unlock(hdev); | 135 | hci_dev_unlock(hdev); |
@@ -313,7 +312,7 @@ static void hci_cc_write_voice_setting(struct hci_dev *hdev, struct sk_buff *skb | |||
313 | return; | 312 | return; |
314 | 313 | ||
315 | if (!status) { | 314 | if (!status) { |
316 | __u16 setting = __le16_to_cpu(get_unaligned((__le16 *) sent)); | 315 | __u16 setting = get_unaligned_le16(sent); |
317 | 316 | ||
318 | if (hdev->voice_setting != setting) { | 317 | if (hdev->voice_setting != setting) { |
319 | hdev->voice_setting = setting; | 318 | hdev->voice_setting = setting; |
@@ -1152,8 +1151,8 @@ static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *s | |||
1152 | struct hci_conn *conn; | 1151 | struct hci_conn *conn; |
1153 | __u16 handle, count; | 1152 | __u16 handle, count; |
1154 | 1153 | ||
1155 | handle = __le16_to_cpu(get_unaligned(ptr++)); | 1154 | handle = get_unaligned_le16(ptr++); |
1156 | count = __le16_to_cpu(get_unaligned(ptr++)); | 1155 | count = get_unaligned_le16(ptr++); |
1157 | 1156 | ||
1158 | conn = hci_conn_hash_lookup_handle(hdev, handle); | 1157 | conn = hci_conn_hash_lookup_handle(hdev, handle); |
1159 | if (conn) { | 1158 | if (conn) { |
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 1d36c093523b..747fabd735d2 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -440,7 +440,7 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
440 | skb->dev = (void *) hdev; | 440 | skb->dev = (void *) hdev; |
441 | 441 | ||
442 | if (bt_cb(skb)->pkt_type == HCI_COMMAND_PKT) { | 442 | if (bt_cb(skb)->pkt_type == HCI_COMMAND_PKT) { |
443 | u16 opcode = __le16_to_cpu(get_unaligned((__le16 *) skb->data)); | 443 | u16 opcode = get_unaligned_le16(skb->data); |
444 | u16 ogf = hci_opcode_ogf(opcode); | 444 | u16 ogf = hci_opcode_ogf(opcode); |
445 | u16 ocf = hci_opcode_ocf(opcode); | 445 | u16 ocf = hci_opcode_ocf(opcode); |
446 | 446 | ||
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index a4849f2c1d81..6e180d255505 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -1827,7 +1827,7 @@ static inline int l2cap_information_rsp(struct l2cap_conn *conn, struct l2cap_cm | |||
1827 | del_timer(&conn->info_timer); | 1827 | del_timer(&conn->info_timer); |
1828 | 1828 | ||
1829 | if (type == L2CAP_IT_FEAT_MASK) | 1829 | if (type == L2CAP_IT_FEAT_MASK) |
1830 | conn->feat_mask = __le32_to_cpu(get_unaligned((__le32 *) rsp->data)); | 1830 | conn->feat_mask = get_unaligned_le32(rsp->data); |
1831 | 1831 | ||
1832 | l2cap_conn_start(conn); | 1832 | l2cap_conn_start(conn); |
1833 | 1833 | ||
diff --git a/net/bridge/br.c b/net/bridge/br.c index a90182873120..8f3c58e5f7a5 100644 --- a/net/bridge/br.c +++ b/net/bridge/br.c | |||
@@ -76,7 +76,6 @@ static void __exit br_deinit(void) | |||
76 | rcu_assign_pointer(br_stp_sap->rcv_func, NULL); | 76 | rcu_assign_pointer(br_stp_sap->rcv_func, NULL); |
77 | 77 | ||
78 | br_netlink_fini(); | 78 | br_netlink_fini(); |
79 | br_netfilter_fini(); | ||
80 | unregister_netdevice_notifier(&br_device_notifier); | 79 | unregister_netdevice_notifier(&br_device_notifier); |
81 | brioctl_set(NULL); | 80 | brioctl_set(NULL); |
82 | 81 | ||
@@ -84,6 +83,7 @@ static void __exit br_deinit(void) | |||
84 | 83 | ||
85 | synchronize_net(); | 84 | synchronize_net(); |
86 | 85 | ||
86 | br_netfilter_fini(); | ||
87 | llc_sap_put(br_stp_sap); | 87 | llc_sap_put(br_stp_sap); |
88 | br_fdb_get_hook = NULL; | 88 | br_fdb_get_hook = NULL; |
89 | br_fdb_put_hook = NULL; | 89 | br_fdb_put_hook = NULL; |
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index 9326c377822e..72c5976a5ce3 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c | |||
@@ -285,7 +285,11 @@ int br_fdb_fillbuf(struct net_bridge *br, void *buf, | |||
285 | 285 | ||
286 | /* convert from internal format to API */ | 286 | /* convert from internal format to API */ |
287 | memcpy(fe->mac_addr, f->addr.addr, ETH_ALEN); | 287 | memcpy(fe->mac_addr, f->addr.addr, ETH_ALEN); |
288 | |||
289 | /* due to ABI compat need to split into hi/lo */ | ||
288 | fe->port_no = f->dst->port_no; | 290 | fe->port_no = f->dst->port_no; |
291 | fe->port_hi = f->dst->port_no >> 8; | ||
292 | |||
289 | fe->is_local = f->is_local; | 293 | fe->is_local = f->is_local; |
290 | if (!f->is_static) | 294 | if (!f->is_static) |
291 | fe->ageing_timer_value = jiffies_to_clock_t(jiffies - f->ageing_timer); | 295 | fe->ageing_timer_value = jiffies_to_clock_t(jiffies - f->ageing_timer); |
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 298e0f463c56..77a981a1ee52 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c | |||
@@ -411,9 +411,12 @@ err2: | |||
411 | br_fdb_delete_by_port(br, p, 1); | 411 | br_fdb_delete_by_port(br, p, 1); |
412 | err1: | 412 | err1: |
413 | kobject_del(&p->kobj); | 413 | kobject_del(&p->kobj); |
414 | return err; | 414 | goto put_back; |
415 | err0: | 415 | err0: |
416 | kobject_put(&p->kobj); | 416 | kobject_put(&p->kobj); |
417 | |||
418 | put_back: | ||
419 | dev_put(dev); | ||
417 | return err; | 420 | return err; |
418 | } | 421 | } |
419 | 422 | ||
diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c index 8deab645ef75..ddeb6e5d45d6 100644 --- a/net/bridge/br_stp_bpdu.c +++ b/net/bridge/br_stp_bpdu.c | |||
@@ -58,12 +58,12 @@ static inline void br_set_ticks(unsigned char *dest, int j) | |||
58 | { | 58 | { |
59 | unsigned long ticks = (STP_HZ * j)/ HZ; | 59 | unsigned long ticks = (STP_HZ * j)/ HZ; |
60 | 60 | ||
61 | put_unaligned(htons(ticks), (__be16 *)dest); | 61 | put_unaligned_be16(ticks, dest); |
62 | } | 62 | } |
63 | 63 | ||
64 | static inline int br_get_ticks(const unsigned char *src) | 64 | static inline int br_get_ticks(const unsigned char *src) |
65 | { | 65 | { |
66 | unsigned long ticks = ntohs(get_unaligned((__be16 *)src)); | 66 | unsigned long ticks = get_unaligned_be16(src); |
67 | 67 | ||
68 | return DIV_ROUND_UP(ticks * HZ, STP_HZ); | 68 | return DIV_ROUND_UP(ticks * HZ, STP_HZ); |
69 | } | 69 | } |
diff --git a/net/can/bcm.c b/net/can/bcm.c index 74fd2d33aff4..d9a3a9d13bed 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c | |||
@@ -412,12 +412,6 @@ static void bcm_rx_changed(struct bcm_op *op, struct can_frame *data) | |||
412 | bcm_send_to_user(op, &head, data, 1); | 412 | bcm_send_to_user(op, &head, data, 1); |
413 | } | 413 | } |
414 | 414 | ||
415 | /* TODO: move to linux/hrtimer.h */ | ||
416 | static inline int hrtimer_callback_running(struct hrtimer *timer) | ||
417 | { | ||
418 | return timer->state & HRTIMER_STATE_CALLBACK; | ||
419 | } | ||
420 | |||
421 | /* | 415 | /* |
422 | * bcm_rx_update_and_send - process a detected relevant receive content change | 416 | * bcm_rx_update_and_send - process a detected relevant receive content change |
423 | * 1. update the last received data | 417 | * 1. update the last received data |
diff --git a/net/compat.c b/net/compat.c index 01bf95d0832e..c823f6f290cb 100644 --- a/net/compat.c +++ b/net/compat.c | |||
@@ -548,6 +548,9 @@ struct compat_group_filter { | |||
548 | __attribute__ ((aligned(4))); | 548 | __attribute__ ((aligned(4))); |
549 | } __attribute__ ((packed)); | 549 | } __attribute__ ((packed)); |
550 | 550 | ||
551 | #define __COMPAT_GF0_SIZE (sizeof(struct compat_group_filter) - \ | ||
552 | sizeof(struct __kernel_sockaddr_storage)) | ||
553 | |||
551 | 554 | ||
552 | int compat_mc_setsockopt(struct sock *sock, int level, int optname, | 555 | int compat_mc_setsockopt(struct sock *sock, int level, int optname, |
553 | char __user *optval, int optlen, | 556 | char __user *optval, int optlen, |
@@ -582,7 +585,7 @@ int compat_mc_setsockopt(struct sock *sock, int level, int optname, | |||
582 | case MCAST_UNBLOCK_SOURCE: | 585 | case MCAST_UNBLOCK_SOURCE: |
583 | { | 586 | { |
584 | struct compat_group_source_req __user *gsr32 = (void *)optval; | 587 | struct compat_group_source_req __user *gsr32 = (void *)optval; |
585 | struct group_source_req *kgsr = compat_alloc_user_space( | 588 | struct group_source_req __user *kgsr = compat_alloc_user_space( |
586 | sizeof(struct group_source_req)); | 589 | sizeof(struct group_source_req)); |
587 | u32 interface; | 590 | u32 interface; |
588 | 591 | ||
@@ -603,10 +606,10 @@ int compat_mc_setsockopt(struct sock *sock, int level, int optname, | |||
603 | case MCAST_MSFILTER: | 606 | case MCAST_MSFILTER: |
604 | { | 607 | { |
605 | struct compat_group_filter __user *gf32 = (void *)optval; | 608 | struct compat_group_filter __user *gf32 = (void *)optval; |
606 | struct group_filter *kgf; | 609 | struct group_filter __user *kgf; |
607 | u32 interface, fmode, numsrc; | 610 | u32 interface, fmode, numsrc; |
608 | 611 | ||
609 | if (!access_ok(VERIFY_READ, gf32, sizeof(*gf32)) || | 612 | if (!access_ok(VERIFY_READ, gf32, __COMPAT_GF0_SIZE) || |
610 | __get_user(interface, &gf32->gf_interface) || | 613 | __get_user(interface, &gf32->gf_interface) || |
611 | __get_user(fmode, &gf32->gf_fmode) || | 614 | __get_user(fmode, &gf32->gf_fmode) || |
612 | __get_user(numsrc, &gf32->gf_numsrc)) | 615 | __get_user(numsrc, &gf32->gf_numsrc)) |
@@ -622,7 +625,7 @@ int compat_mc_setsockopt(struct sock *sock, int level, int optname, | |||
622 | __put_user(numsrc, &kgf->gf_numsrc) || | 625 | __put_user(numsrc, &kgf->gf_numsrc) || |
623 | copy_in_user(&kgf->gf_group, &gf32->gf_group, | 626 | copy_in_user(&kgf->gf_group, &gf32->gf_group, |
624 | sizeof(kgf->gf_group)) || | 627 | sizeof(kgf->gf_group)) || |
625 | (numsrc && copy_in_user(&kgf->gf_slist, &gf32->gf_slist, | 628 | (numsrc && copy_in_user(kgf->gf_slist, gf32->gf_slist, |
626 | numsrc * sizeof(kgf->gf_slist[0])))) | 629 | numsrc * sizeof(kgf->gf_slist[0])))) |
627 | return -EFAULT; | 630 | return -EFAULT; |
628 | koptval = (char __user *)kgf; | 631 | koptval = (char __user *)kgf; |
@@ -637,6 +640,85 @@ int compat_mc_setsockopt(struct sock *sock, int level, int optname, | |||
637 | 640 | ||
638 | EXPORT_SYMBOL(compat_mc_setsockopt); | 641 | EXPORT_SYMBOL(compat_mc_setsockopt); |
639 | 642 | ||
643 | int compat_mc_getsockopt(struct sock *sock, int level, int optname, | ||
644 | char __user *optval, int __user *optlen, | ||
645 | int (*getsockopt)(struct sock *,int,int,char __user *,int __user *)) | ||
646 | { | ||
647 | struct compat_group_filter __user *gf32 = (void *)optval; | ||
648 | struct group_filter __user *kgf; | ||
649 | int __user *koptlen; | ||
650 | u32 interface, fmode, numsrc; | ||
651 | int klen, ulen, err; | ||
652 | |||
653 | if (optname != MCAST_MSFILTER) | ||
654 | return getsockopt(sock, level, optname, optval, optlen); | ||
655 | |||
656 | koptlen = compat_alloc_user_space(sizeof(*koptlen)); | ||
657 | if (!access_ok(VERIFY_READ, optlen, sizeof(*optlen)) || | ||
658 | __get_user(ulen, optlen)) | ||
659 | return -EFAULT; | ||
660 | |||
661 | /* adjust len for pad */ | ||
662 | klen = ulen + sizeof(*kgf) - sizeof(*gf32); | ||
663 | |||
664 | if (klen < GROUP_FILTER_SIZE(0)) | ||
665 | return -EINVAL; | ||
666 | |||
667 | if (!access_ok(VERIFY_WRITE, koptlen, sizeof(*koptlen)) || | ||
668 | __put_user(klen, koptlen)) | ||
669 | return -EFAULT; | ||
670 | |||
671 | /* have to allow space for previous compat_alloc_user_space, too */ | ||
672 | kgf = compat_alloc_user_space(klen+sizeof(*optlen)); | ||
673 | |||
674 | if (!access_ok(VERIFY_READ, gf32, __COMPAT_GF0_SIZE) || | ||
675 | __get_user(interface, &gf32->gf_interface) || | ||
676 | __get_user(fmode, &gf32->gf_fmode) || | ||
677 | __get_user(numsrc, &gf32->gf_numsrc) || | ||
678 | __put_user(interface, &kgf->gf_interface) || | ||
679 | __put_user(fmode, &kgf->gf_fmode) || | ||
680 | __put_user(numsrc, &kgf->gf_numsrc) || | ||
681 | copy_in_user(&kgf->gf_group,&gf32->gf_group,sizeof(kgf->gf_group))) | ||
682 | return -EFAULT; | ||
683 | |||
684 | err = getsockopt(sock, level, optname, (char __user *)kgf, koptlen); | ||
685 | if (err) | ||
686 | return err; | ||
687 | |||
688 | if (!access_ok(VERIFY_READ, koptlen, sizeof(*koptlen)) || | ||
689 | __get_user(klen, koptlen)) | ||
690 | return -EFAULT; | ||
691 | |||
692 | ulen = klen - (sizeof(*kgf)-sizeof(*gf32)); | ||
693 | |||
694 | if (!access_ok(VERIFY_WRITE, optlen, sizeof(*optlen)) || | ||
695 | __put_user(ulen, optlen)) | ||
696 | return -EFAULT; | ||
697 | |||
698 | if (!access_ok(VERIFY_READ, kgf, klen) || | ||
699 | !access_ok(VERIFY_WRITE, gf32, ulen) || | ||
700 | __get_user(interface, &kgf->gf_interface) || | ||
701 | __get_user(fmode, &kgf->gf_fmode) || | ||
702 | __get_user(numsrc, &kgf->gf_numsrc) || | ||
703 | __put_user(interface, &gf32->gf_interface) || | ||
704 | __put_user(fmode, &gf32->gf_fmode) || | ||
705 | __put_user(numsrc, &gf32->gf_numsrc)) | ||
706 | return -EFAULT; | ||
707 | if (numsrc) { | ||
708 | int copylen; | ||
709 | |||
710 | klen -= GROUP_FILTER_SIZE(0); | ||
711 | copylen = numsrc * sizeof(gf32->gf_slist[0]); | ||
712 | if (copylen > klen) | ||
713 | copylen = klen; | ||
714 | if (copy_in_user(gf32->gf_slist, kgf->gf_slist, copylen)) | ||
715 | return -EFAULT; | ||
716 | } | ||
717 | return err; | ||
718 | } | ||
719 | |||
720 | EXPORT_SYMBOL(compat_mc_getsockopt); | ||
721 | |||
640 | 722 | ||
641 | /* Argument list sizes for compat_sys_socketcall */ | 723 | /* Argument list sizes for compat_sys_socketcall */ |
642 | #define AL(x) ((x) * sizeof(u32)) | 724 | #define AL(x) ((x) * sizeof(u32)) |
diff --git a/net/core/dev.c b/net/core/dev.c index ed49da592051..d334446a8eaf 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -162,7 +162,7 @@ struct net_dma { | |||
162 | struct dma_client client; | 162 | struct dma_client client; |
163 | spinlock_t lock; | 163 | spinlock_t lock; |
164 | cpumask_t channel_mask; | 164 | cpumask_t channel_mask; |
165 | struct dma_chan *channels[NR_CPUS]; | 165 | struct dma_chan **channels; |
166 | }; | 166 | }; |
167 | 167 | ||
168 | static enum dma_state_client | 168 | static enum dma_state_client |
@@ -2444,7 +2444,7 @@ static struct netif_rx_stats *softnet_get_online(loff_t *pos) | |||
2444 | { | 2444 | { |
2445 | struct netif_rx_stats *rc = NULL; | 2445 | struct netif_rx_stats *rc = NULL; |
2446 | 2446 | ||
2447 | while (*pos < NR_CPUS) | 2447 | while (*pos < nr_cpu_ids) |
2448 | if (cpu_online(*pos)) { | 2448 | if (cpu_online(*pos)) { |
2449 | rc = &per_cpu(netdev_rx_stat, *pos); | 2449 | rc = &per_cpu(netdev_rx_stat, *pos); |
2450 | break; | 2450 | break; |
@@ -3776,6 +3776,7 @@ int register_netdevice(struct net_device *dev) | |||
3776 | } | 3776 | } |
3777 | } | 3777 | } |
3778 | 3778 | ||
3779 | netdev_initialize_kobject(dev); | ||
3779 | ret = netdev_register_kobject(dev); | 3780 | ret = netdev_register_kobject(dev); |
3780 | if (ret) | 3781 | if (ret) |
3781 | goto err_uninit; | 3782 | goto err_uninit; |
@@ -4208,7 +4209,8 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char | |||
4208 | } | 4209 | } |
4209 | 4210 | ||
4210 | /* Fixup kobjects */ | 4211 | /* Fixup kobjects */ |
4211 | err = device_rename(&dev->dev, dev->name); | 4212 | netdev_unregister_kobject(dev); |
4213 | err = netdev_register_kobject(dev); | ||
4212 | WARN_ON(err); | 4214 | WARN_ON(err); |
4213 | 4215 | ||
4214 | /* Add the device back in the hashes */ | 4216 | /* Add the device back in the hashes */ |
@@ -4324,7 +4326,7 @@ netdev_dma_event(struct dma_client *client, struct dma_chan *chan, | |||
4324 | spin_lock(&net_dma->lock); | 4326 | spin_lock(&net_dma->lock); |
4325 | switch (state) { | 4327 | switch (state) { |
4326 | case DMA_RESOURCE_AVAILABLE: | 4328 | case DMA_RESOURCE_AVAILABLE: |
4327 | for (i = 0; i < NR_CPUS; i++) | 4329 | for (i = 0; i < nr_cpu_ids; i++) |
4328 | if (net_dma->channels[i] == chan) { | 4330 | if (net_dma->channels[i] == chan) { |
4329 | found = 1; | 4331 | found = 1; |
4330 | break; | 4332 | break; |
@@ -4339,7 +4341,7 @@ netdev_dma_event(struct dma_client *client, struct dma_chan *chan, | |||
4339 | } | 4341 | } |
4340 | break; | 4342 | break; |
4341 | case DMA_RESOURCE_REMOVED: | 4343 | case DMA_RESOURCE_REMOVED: |
4342 | for (i = 0; i < NR_CPUS; i++) | 4344 | for (i = 0; i < nr_cpu_ids; i++) |
4343 | if (net_dma->channels[i] == chan) { | 4345 | if (net_dma->channels[i] == chan) { |
4344 | found = 1; | 4346 | found = 1; |
4345 | pos = i; | 4347 | pos = i; |
@@ -4366,6 +4368,13 @@ netdev_dma_event(struct dma_client *client, struct dma_chan *chan, | |||
4366 | */ | 4368 | */ |
4367 | static int __init netdev_dma_register(void) | 4369 | static int __init netdev_dma_register(void) |
4368 | { | 4370 | { |
4371 | net_dma.channels = kzalloc(nr_cpu_ids * sizeof(struct net_dma), | ||
4372 | GFP_KERNEL); | ||
4373 | if (unlikely(!net_dma.channels)) { | ||
4374 | printk(KERN_NOTICE | ||
4375 | "netdev_dma: no memory for net_dma.channels\n"); | ||
4376 | return -ENOMEM; | ||
4377 | } | ||
4369 | spin_lock_init(&net_dma.lock); | 4378 | spin_lock_init(&net_dma.lock); |
4370 | dma_cap_set(DMA_MEMCPY, net_dma.client.cap_mask); | 4379 | dma_cap_set(DMA_MEMCPY, net_dma.client.cap_mask); |
4371 | dma_async_client_register(&net_dma.client); | 4380 | dma_async_client_register(&net_dma.client); |
diff --git a/net/core/filter.c b/net/core/filter.c index f5f3cf603064..4f8369729a4e 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -213,7 +213,7 @@ unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int | |||
213 | load_w: | 213 | load_w: |
214 | ptr = load_pointer(skb, k, 4, &tmp); | 214 | ptr = load_pointer(skb, k, 4, &tmp); |
215 | if (ptr != NULL) { | 215 | if (ptr != NULL) { |
216 | A = ntohl(get_unaligned((__be32 *)ptr)); | 216 | A = get_unaligned_be32(ptr); |
217 | continue; | 217 | continue; |
218 | } | 218 | } |
219 | break; | 219 | break; |
@@ -222,7 +222,7 @@ load_w: | |||
222 | load_h: | 222 | load_h: |
223 | ptr = load_pointer(skb, k, 2, &tmp); | 223 | ptr = load_pointer(skb, k, 2, &tmp); |
224 | if (ptr != NULL) { | 224 | if (ptr != NULL) { |
225 | A = ntohs(get_unaligned((__be16 *)ptr)); | 225 | A = get_unaligned_be16(ptr); |
226 | continue; | 226 | continue; |
227 | } | 227 | } |
228 | break; | 228 | break; |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 75075c303c44..5d9d7130bd6e 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -1430,11 +1430,10 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl) | |||
1430 | panic("cannot create neighbour cache statistics"); | 1430 | panic("cannot create neighbour cache statistics"); |
1431 | 1431 | ||
1432 | #ifdef CONFIG_PROC_FS | 1432 | #ifdef CONFIG_PROC_FS |
1433 | tbl->pde = proc_create(tbl->id, 0, init_net.proc_net_stat, | 1433 | tbl->pde = proc_create_data(tbl->id, 0, init_net.proc_net_stat, |
1434 | &neigh_stat_seq_fops); | 1434 | &neigh_stat_seq_fops, tbl); |
1435 | if (!tbl->pde) | 1435 | if (!tbl->pde) |
1436 | panic("cannot create neighbour proc dir entry"); | 1436 | panic("cannot create neighbour proc dir entry"); |
1437 | tbl->pde->data = tbl; | ||
1438 | #endif | 1437 | #endif |
1439 | 1438 | ||
1440 | tbl->hash_mask = 1; | 1439 | tbl->hash_mask = 1; |
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 4e7b847347f7..90e2177af081 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
@@ -449,7 +449,6 @@ int netdev_register_kobject(struct net_device *net) | |||
449 | struct device *dev = &(net->dev); | 449 | struct device *dev = &(net->dev); |
450 | struct attribute_group **groups = net->sysfs_groups; | 450 | struct attribute_group **groups = net->sysfs_groups; |
451 | 451 | ||
452 | device_initialize(dev); | ||
453 | dev->class = &net_class; | 452 | dev->class = &net_class; |
454 | dev->platform_data = net; | 453 | dev->platform_data = net; |
455 | dev->groups = groups; | 454 | dev->groups = groups; |
@@ -470,6 +469,12 @@ int netdev_register_kobject(struct net_device *net) | |||
470 | return device_add(dev); | 469 | return device_add(dev); |
471 | } | 470 | } |
472 | 471 | ||
472 | void netdev_initialize_kobject(struct net_device *net) | ||
473 | { | ||
474 | struct device *device = &(net->dev); | ||
475 | device_initialize(device); | ||
476 | } | ||
477 | |||
473 | int netdev_kobject_init(void) | 478 | int netdev_kobject_init(void) |
474 | { | 479 | { |
475 | return class_register(&net_class); | 480 | return class_register(&net_class); |
diff --git a/net/core/net-sysfs.h b/net/core/net-sysfs.h index f5f108db3924..14e7524260b3 100644 --- a/net/core/net-sysfs.h +++ b/net/core/net-sysfs.h | |||
@@ -4,5 +4,5 @@ | |||
4 | int netdev_kobject_init(void); | 4 | int netdev_kobject_init(void); |
5 | int netdev_register_kobject(struct net_device *); | 5 | int netdev_register_kobject(struct net_device *); |
6 | void netdev_unregister_kobject(struct net_device *); | 6 | void netdev_unregister_kobject(struct net_device *); |
7 | 7 | void netdev_initialize_kobject(struct net_device *); | |
8 | #endif | 8 | #endif |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index a803b442234c..8dca21110493 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -3570,15 +3570,14 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname) | |||
3570 | if (err) | 3570 | if (err) |
3571 | goto out1; | 3571 | goto out1; |
3572 | 3572 | ||
3573 | pkt_dev->entry = proc_create(ifname, 0600, | 3573 | pkt_dev->entry = proc_create_data(ifname, 0600, pg_proc_dir, |
3574 | pg_proc_dir, &pktgen_if_fops); | 3574 | &pktgen_if_fops, pkt_dev); |
3575 | if (!pkt_dev->entry) { | 3575 | if (!pkt_dev->entry) { |
3576 | printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n", | 3576 | printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n", |
3577 | PG_PROC_DIR, ifname); | 3577 | PG_PROC_DIR, ifname); |
3578 | err = -EINVAL; | 3578 | err = -EINVAL; |
3579 | goto out2; | 3579 | goto out2; |
3580 | } | 3580 | } |
3581 | pkt_dev->entry->data = pkt_dev; | ||
3582 | #ifdef CONFIG_XFRM | 3581 | #ifdef CONFIG_XFRM |
3583 | pkt_dev->ipsmode = XFRM_MODE_TRANSPORT; | 3582 | pkt_dev->ipsmode = XFRM_MODE_TRANSPORT; |
3584 | pkt_dev->ipsproto = IPPROTO_ESP; | 3583 | pkt_dev->ipsproto = IPPROTO_ESP; |
@@ -3628,7 +3627,8 @@ static int __init pktgen_create_thread(int cpu) | |||
3628 | kthread_bind(p, cpu); | 3627 | kthread_bind(p, cpu); |
3629 | t->tsk = p; | 3628 | t->tsk = p; |
3630 | 3629 | ||
3631 | pe = proc_create(t->tsk->comm, 0600, pg_proc_dir, &pktgen_thread_fops); | 3630 | pe = proc_create_data(t->tsk->comm, 0600, pg_proc_dir, |
3631 | &pktgen_thread_fops, t); | ||
3632 | if (!pe) { | 3632 | if (!pe) { |
3633 | printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n", | 3633 | printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n", |
3634 | PG_PROC_DIR, t->tsk->comm); | 3634 | PG_PROC_DIR, t->tsk->comm); |
@@ -3638,8 +3638,6 @@ static int __init pktgen_create_thread(int cpu) | |||
3638 | return -EINVAL; | 3638 | return -EINVAL; |
3639 | } | 3639 | } |
3640 | 3640 | ||
3641 | pe->data = t; | ||
3642 | |||
3643 | wake_up_process(p); | 3641 | wake_up_process(p); |
3644 | 3642 | ||
3645 | return 0; | 3643 | return 0; |
@@ -3716,8 +3714,6 @@ static int __init pg_init(void) | |||
3716 | return -EINVAL; | 3714 | return -EINVAL; |
3717 | } | 3715 | } |
3718 | 3716 | ||
3719 | pe->data = NULL; | ||
3720 | |||
3721 | /* Register us to receive netdevice events */ | 3717 | /* Register us to receive netdevice events */ |
3722 | register_netdevice_notifier(&pktgen_notifier_block); | 3718 | register_netdevice_notifier(&pktgen_notifier_block); |
3723 | 3719 | ||
diff --git a/net/core/sock.c b/net/core/sock.c index 5dbb81bc9673..fa76f04fa9c6 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -228,11 +228,12 @@ static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen) | |||
228 | static int warned __read_mostly; | 228 | static int warned __read_mostly; |
229 | 229 | ||
230 | *timeo_p = 0; | 230 | *timeo_p = 0; |
231 | if (warned < 10 && net_ratelimit()) | 231 | if (warned < 10 && net_ratelimit()) { |
232 | warned++; | 232 | warned++; |
233 | printk(KERN_INFO "sock_set_timeout: `%s' (pid %d) " | 233 | printk(KERN_INFO "sock_set_timeout: `%s' (pid %d) " |
234 | "tries to set negative timeout\n", | 234 | "tries to set negative timeout\n", |
235 | current->comm, task_pid_nr(current)); | 235 | current->comm, task_pid_nr(current)); |
236 | } | ||
236 | return 0; | 237 | return 0; |
237 | } | 238 | } |
238 | *timeo_p = MAX_SCHEDULE_TIMEOUT; | 239 | *timeo_p = MAX_SCHEDULE_TIMEOUT; |
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c index b5b52ebb2693..8e9580874216 100644 --- a/net/dccp/ccids/ccid2.c +++ b/net/dccp/ccids/ccid2.c | |||
@@ -716,7 +716,7 @@ static int ccid2_hc_tx_init(struct ccid *ccid, struct sock *sk) | |||
716 | * packets for new connections, following the rules from [RFC3390]". | 716 | * packets for new connections, following the rules from [RFC3390]". |
717 | * We need to convert the bytes of RFC3390 into the packets of RFC 4341. | 717 | * We need to convert the bytes of RFC3390 into the packets of RFC 4341. |
718 | */ | 718 | */ |
719 | hctx->ccid2hctx_cwnd = min(4U, max(2U, 4380U / dp->dccps_mss_cache)); | 719 | hctx->ccid2hctx_cwnd = clamp(4380U / dp->dccps_mss_cache, 2U, 4U); |
720 | 720 | ||
721 | /* Make sure that Ack Ratio is enabled and within bounds. */ | 721 | /* Make sure that Ack Ratio is enabled and within bounds. */ |
722 | max_ratio = DIV_ROUND_UP(hctx->ccid2hctx_cwnd, 2); | 722 | max_ratio = DIV_ROUND_UP(hctx->ccid2hctx_cwnd, 2); |
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index e76f460af0ea..cd61dea2eea1 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
@@ -88,8 +88,8 @@ static void ccid3_hc_tx_set_state(struct sock *sk, | |||
88 | static inline u64 rfc3390_initial_rate(struct sock *sk) | 88 | static inline u64 rfc3390_initial_rate(struct sock *sk) |
89 | { | 89 | { |
90 | const struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); | 90 | const struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); |
91 | const __u32 w_init = min_t(__u32, 4 * hctx->ccid3hctx_s, | 91 | const __u32 w_init = clamp_t(__u32, 4380U, |
92 | max_t(__u32, 2 * hctx->ccid3hctx_s, 4380)); | 92 | 2 * hctx->ccid3hctx_s, 4 * hctx->ccid3hctx_s); |
93 | 93 | ||
94 | return scaled_div(w_init << 6, hctx->ccid3hctx_rtt); | 94 | return scaled_div(w_init << 6, hctx->ccid3hctx_rtt); |
95 | } | 95 | } |
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c index 4637ded3dba8..05afb576d935 100644 --- a/net/ipv4/cipso_ipv4.c +++ b/net/ipv4/cipso_ipv4.c | |||
@@ -983,7 +983,7 @@ static int cipso_v4_map_cat_enum_valid(const struct cipso_v4_doi *doi_def, | |||
983 | return -EFAULT; | 983 | return -EFAULT; |
984 | 984 | ||
985 | for (iter = 0; iter < enumcat_len; iter += 2) { | 985 | for (iter = 0; iter < enumcat_len; iter += 2) { |
986 | cat = ntohs(get_unaligned((__be16 *)&enumcat[iter])); | 986 | cat = get_unaligned_be16(&enumcat[iter]); |
987 | if (cat <= cat_prev) | 987 | if (cat <= cat_prev) |
988 | return -EFAULT; | 988 | return -EFAULT; |
989 | cat_prev = cat; | 989 | cat_prev = cat; |
@@ -1052,7 +1052,7 @@ static int cipso_v4_map_cat_enum_ntoh(const struct cipso_v4_doi *doi_def, | |||
1052 | 1052 | ||
1053 | for (iter = 0; iter < net_cat_len; iter += 2) { | 1053 | for (iter = 0; iter < net_cat_len; iter += 2) { |
1054 | ret_val = netlbl_secattr_catmap_setbit(secattr->attr.mls.cat, | 1054 | ret_val = netlbl_secattr_catmap_setbit(secattr->attr.mls.cat, |
1055 | ntohs(get_unaligned((__be16 *)&net_cat[iter])), | 1055 | get_unaligned_be16(&net_cat[iter]), |
1056 | GFP_ATOMIC); | 1056 | GFP_ATOMIC); |
1057 | if (ret_val != 0) | 1057 | if (ret_val != 0) |
1058 | return ret_val; | 1058 | return ret_val; |
@@ -1086,10 +1086,9 @@ static int cipso_v4_map_cat_rng_valid(const struct cipso_v4_doi *doi_def, | |||
1086 | return -EFAULT; | 1086 | return -EFAULT; |
1087 | 1087 | ||
1088 | for (iter = 0; iter < rngcat_len; iter += 4) { | 1088 | for (iter = 0; iter < rngcat_len; iter += 4) { |
1089 | cat_high = ntohs(get_unaligned((__be16 *)&rngcat[iter])); | 1089 | cat_high = get_unaligned_be16(&rngcat[iter]); |
1090 | if ((iter + 4) <= rngcat_len) | 1090 | if ((iter + 4) <= rngcat_len) |
1091 | cat_low = ntohs( | 1091 | cat_low = get_unaligned_be16(&rngcat[iter + 2]); |
1092 | get_unaligned((__be16 *)&rngcat[iter + 2])); | ||
1093 | else | 1092 | else |
1094 | cat_low = 0; | 1093 | cat_low = 0; |
1095 | 1094 | ||
@@ -1188,10 +1187,9 @@ static int cipso_v4_map_cat_rng_ntoh(const struct cipso_v4_doi *doi_def, | |||
1188 | u16 cat_high; | 1187 | u16 cat_high; |
1189 | 1188 | ||
1190 | for (net_iter = 0; net_iter < net_cat_len; net_iter += 4) { | 1189 | for (net_iter = 0; net_iter < net_cat_len; net_iter += 4) { |
1191 | cat_high = ntohs(get_unaligned((__be16 *)&net_cat[net_iter])); | 1190 | cat_high = get_unaligned_be16(&net_cat[net_iter]); |
1192 | if ((net_iter + 4) <= net_cat_len) | 1191 | if ((net_iter + 4) <= net_cat_len) |
1193 | cat_low = ntohs( | 1192 | cat_low = get_unaligned_be16(&net_cat[net_iter + 2]); |
1194 | get_unaligned((__be16 *)&net_cat[net_iter + 2])); | ||
1195 | else | 1193 | else |
1196 | cat_low = 0; | 1194 | cat_low = 0; |
1197 | 1195 | ||
@@ -1562,7 +1560,7 @@ int cipso_v4_validate(unsigned char **option) | |||
1562 | } | 1560 | } |
1563 | 1561 | ||
1564 | rcu_read_lock(); | 1562 | rcu_read_lock(); |
1565 | doi_def = cipso_v4_doi_search(ntohl(get_unaligned((__be32 *)&opt[2]))); | 1563 | doi_def = cipso_v4_doi_search(get_unaligned_be32(&opt[2])); |
1566 | if (doi_def == NULL) { | 1564 | if (doi_def == NULL) { |
1567 | err_offset = 2; | 1565 | err_offset = 2; |
1568 | goto validate_return_locked; | 1566 | goto validate_return_locked; |
@@ -1843,7 +1841,7 @@ static int cipso_v4_getattr(const unsigned char *cipso, | |||
1843 | if (cipso_v4_cache_check(cipso, cipso[1], secattr) == 0) | 1841 | if (cipso_v4_cache_check(cipso, cipso[1], secattr) == 0) |
1844 | return 0; | 1842 | return 0; |
1845 | 1843 | ||
1846 | doi = ntohl(get_unaligned((__be32 *)&cipso[2])); | 1844 | doi = get_unaligned_be32(&cipso[2]); |
1847 | rcu_read_lock(); | 1845 | rcu_read_lock(); |
1848 | doi_def = cipso_v4_doi_search(doi); | 1846 | doi_def = cipso_v4_doi_search(doi); |
1849 | if (doi_def == NULL) | 1847 | if (doi_def == NULL) |
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index c67d00e8c600..87397351ddac 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
@@ -691,7 +691,8 @@ static void icmp_unreach(struct sk_buff *skb) | |||
691 | NIPQUAD(iph->daddr)); | 691 | NIPQUAD(iph->daddr)); |
692 | } else { | 692 | } else { |
693 | info = ip_rt_frag_needed(net, iph, | 693 | info = ip_rt_frag_needed(net, iph, |
694 | ntohs(icmph->un.frag.mtu)); | 694 | ntohs(icmph->un.frag.mtu), |
695 | skb->dev); | ||
695 | if (!info) | 696 | if (!info) |
696 | goto out; | 697 | goto out; |
697 | } | 698 | } |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 08349267ceb4..e527628f56cf 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -753,23 +753,15 @@ static inline int ip_ufo_append_data(struct sock *sk, | |||
753 | skb->ip_summed = CHECKSUM_PARTIAL; | 753 | skb->ip_summed = CHECKSUM_PARTIAL; |
754 | skb->csum = 0; | 754 | skb->csum = 0; |
755 | sk->sk_sndmsg_off = 0; | 755 | sk->sk_sndmsg_off = 0; |
756 | } | ||
757 | 756 | ||
758 | err = skb_append_datato_frags(sk,skb, getfrag, from, | 757 | /* specify the length of each IP datagram fragment */ |
759 | (length - transhdrlen)); | ||
760 | if (!err) { | ||
761 | /* specify the length of each IP datagram fragment*/ | ||
762 | skb_shinfo(skb)->gso_size = mtu - fragheaderlen; | 758 | skb_shinfo(skb)->gso_size = mtu - fragheaderlen; |
763 | skb_shinfo(skb)->gso_type = SKB_GSO_UDP; | 759 | skb_shinfo(skb)->gso_type = SKB_GSO_UDP; |
764 | __skb_queue_tail(&sk->sk_write_queue, skb); | 760 | __skb_queue_tail(&sk->sk_write_queue, skb); |
765 | |||
766 | return 0; | ||
767 | } | 761 | } |
768 | /* There is not enough support do UFO , | 762 | |
769 | * so follow normal path | 763 | return skb_append_datato_frags(sk, skb, getfrag, from, |
770 | */ | 764 | (length - transhdrlen)); |
771 | kfree_skb(skb); | ||
772 | return err; | ||
773 | } | 765 | } |
774 | 766 | ||
775 | /* | 767 | /* |
@@ -863,9 +855,9 @@ int ip_append_data(struct sock *sk, | |||
863 | csummode = CHECKSUM_PARTIAL; | 855 | csummode = CHECKSUM_PARTIAL; |
864 | 856 | ||
865 | inet->cork.length += length; | 857 | inet->cork.length += length; |
866 | if (((length > mtu) && (sk->sk_protocol == IPPROTO_UDP)) && | 858 | if (((length> mtu) || !skb_queue_empty(&sk->sk_write_queue)) && |
867 | (rt->u.dst.dev->features & NETIF_F_UFO)) { | 859 | (sk->sk_protocol == IPPROTO_UDP) && |
868 | 860 | (rt->u.dst.dev->features & NETIF_F_UFO)) { | |
869 | err = ip_ufo_append_data(sk, getfrag, from, length, hh_len, | 861 | err = ip_ufo_append_data(sk, getfrag, from, length, hh_len, |
870 | fragheaderlen, transhdrlen, mtu, | 862 | fragheaderlen, transhdrlen, mtu, |
871 | flags); | 863 | flags); |
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 4d8d95404f45..e0514e82308e 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -1186,7 +1186,14 @@ int ip_getsockopt(struct sock *sk, int level, | |||
1186 | int compat_ip_getsockopt(struct sock *sk, int level, int optname, | 1186 | int compat_ip_getsockopt(struct sock *sk, int level, int optname, |
1187 | char __user *optval, int __user *optlen) | 1187 | char __user *optval, int __user *optlen) |
1188 | { | 1188 | { |
1189 | int err = do_ip_getsockopt(sk, level, optname, optval, optlen); | 1189 | int err; |
1190 | |||
1191 | if (optname == MCAST_MSFILTER) | ||
1192 | return compat_mc_getsockopt(sk, level, optname, optval, optlen, | ||
1193 | ip_getsockopt); | ||
1194 | |||
1195 | err = do_ip_getsockopt(sk, level, optname, optval, optlen); | ||
1196 | |||
1190 | #ifdef CONFIG_NETFILTER | 1197 | #ifdef CONFIG_NETFILTER |
1191 | /* we need to exclude all possible ENOPROTOOPTs except default case */ | 1198 | /* we need to exclude all possible ENOPROTOOPTs except default case */ |
1192 | if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS && | 1199 | if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS && |
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index 0f42d1c1f690..89dee4346f60 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c | |||
@@ -412,12 +412,12 @@ static struct packet_type rarp_packet_type __initdata = { | |||
412 | .func = ic_rarp_recv, | 412 | .func = ic_rarp_recv, |
413 | }; | 413 | }; |
414 | 414 | ||
415 | static inline void ic_rarp_init(void) | 415 | static inline void __init ic_rarp_init(void) |
416 | { | 416 | { |
417 | dev_add_pack(&rarp_packet_type); | 417 | dev_add_pack(&rarp_packet_type); |
418 | } | 418 | } |
419 | 419 | ||
420 | static inline void ic_rarp_cleanup(void) | 420 | static inline void __init ic_rarp_cleanup(void) |
421 | { | 421 | { |
422 | dev_remove_pack(&rarp_packet_type); | 422 | dev_remove_pack(&rarp_packet_type); |
423 | } | 423 | } |
@@ -682,7 +682,7 @@ static void __init ic_bootp_init_ext(u8 *e) | |||
682 | /* | 682 | /* |
683 | * Initialize the DHCP/BOOTP mechanism. | 683 | * Initialize the DHCP/BOOTP mechanism. |
684 | */ | 684 | */ |
685 | static inline void ic_bootp_init(void) | 685 | static inline void __init ic_bootp_init(void) |
686 | { | 686 | { |
687 | int i; | 687 | int i; |
688 | 688 | ||
@@ -696,7 +696,7 @@ static inline void ic_bootp_init(void) | |||
696 | /* | 696 | /* |
697 | * DHCP/BOOTP cleanup. | 697 | * DHCP/BOOTP cleanup. |
698 | */ | 698 | */ |
699 | static inline void ic_bootp_cleanup(void) | 699 | static inline void __init ic_bootp_cleanup(void) |
700 | { | 700 | { |
701 | dev_remove_pack(&bootp_packet_type); | 701 | dev_remove_pack(&bootp_packet_type); |
702 | } | 702 | } |
diff --git a/net/ipv4/ipvs/ip_vs_proto.c b/net/ipv4/ipvs/ip_vs_proto.c index dde28a250d92..4b1c16cbb16b 100644 --- a/net/ipv4/ipvs/ip_vs_proto.c +++ b/net/ipv4/ipvs/ip_vs_proto.c | |||
@@ -148,7 +148,7 @@ const char * ip_vs_state_name(__u16 proto, int state) | |||
148 | struct ip_vs_protocol *pp = ip_vs_proto_get(proto); | 148 | struct ip_vs_protocol *pp = ip_vs_proto_get(proto); |
149 | 149 | ||
150 | if (pp == NULL || pp->state_name == NULL) | 150 | if (pp == NULL || pp->state_name == NULL) |
151 | return "ERR!"; | 151 | return (IPPROTO_IP == proto) ? "NONE" : "ERR!"; |
152 | return pp->state_name(state); | 152 | return pp->state_name(state); |
153 | } | 153 | } |
154 | 154 | ||
diff --git a/net/ipv4/ipvs/ip_vs_proto_ah.c b/net/ipv4/ipvs/ip_vs_proto_ah.c index a842676e1c69..4bf835e1d86d 100644 --- a/net/ipv4/ipvs/ip_vs_proto_ah.c +++ b/net/ipv4/ipvs/ip_vs_proto_ah.c | |||
@@ -160,6 +160,7 @@ static void ah_exit(struct ip_vs_protocol *pp) | |||
160 | struct ip_vs_protocol ip_vs_protocol_ah = { | 160 | struct ip_vs_protocol ip_vs_protocol_ah = { |
161 | .name = "AH", | 161 | .name = "AH", |
162 | .protocol = IPPROTO_AH, | 162 | .protocol = IPPROTO_AH, |
163 | .num_states = 1, | ||
163 | .dont_defrag = 1, | 164 | .dont_defrag = 1, |
164 | .init = ah_init, | 165 | .init = ah_init, |
165 | .exit = ah_exit, | 166 | .exit = ah_exit, |
diff --git a/net/ipv4/ipvs/ip_vs_proto_esp.c b/net/ipv4/ipvs/ip_vs_proto_esp.c index aef0d3ee8e44..db6a6b7b1a0b 100644 --- a/net/ipv4/ipvs/ip_vs_proto_esp.c +++ b/net/ipv4/ipvs/ip_vs_proto_esp.c | |||
@@ -159,6 +159,7 @@ static void esp_exit(struct ip_vs_protocol *pp) | |||
159 | struct ip_vs_protocol ip_vs_protocol_esp = { | 159 | struct ip_vs_protocol ip_vs_protocol_esp = { |
160 | .name = "ESP", | 160 | .name = "ESP", |
161 | .protocol = IPPROTO_ESP, | 161 | .protocol = IPPROTO_ESP, |
162 | .num_states = 1, | ||
162 | .dont_defrag = 1, | 163 | .dont_defrag = 1, |
163 | .init = esp_init, | 164 | .init = esp_init, |
164 | .exit = esp_exit, | 165 | .exit = esp_exit, |
diff --git a/net/ipv4/ipvs/ip_vs_proto_tcp.c b/net/ipv4/ipvs/ip_vs_proto_tcp.c index 620e40ff79a9..b83dc14b0a4d 100644 --- a/net/ipv4/ipvs/ip_vs_proto_tcp.c +++ b/net/ipv4/ipvs/ip_vs_proto_tcp.c | |||
@@ -594,6 +594,7 @@ static void ip_vs_tcp_exit(struct ip_vs_protocol *pp) | |||
594 | struct ip_vs_protocol ip_vs_protocol_tcp = { | 594 | struct ip_vs_protocol ip_vs_protocol_tcp = { |
595 | .name = "TCP", | 595 | .name = "TCP", |
596 | .protocol = IPPROTO_TCP, | 596 | .protocol = IPPROTO_TCP, |
597 | .num_states = IP_VS_TCP_S_LAST, | ||
597 | .dont_defrag = 0, | 598 | .dont_defrag = 0, |
598 | .appcnt = ATOMIC_INIT(0), | 599 | .appcnt = ATOMIC_INIT(0), |
599 | .init = ip_vs_tcp_init, | 600 | .init = ip_vs_tcp_init, |
diff --git a/net/ipv4/ipvs/ip_vs_proto_udp.c b/net/ipv4/ipvs/ip_vs_proto_udp.c index 1caa2908373f..75771cb3cd6f 100644 --- a/net/ipv4/ipvs/ip_vs_proto_udp.c +++ b/net/ipv4/ipvs/ip_vs_proto_udp.c | |||
@@ -409,6 +409,7 @@ static void udp_exit(struct ip_vs_protocol *pp) | |||
409 | struct ip_vs_protocol ip_vs_protocol_udp = { | 409 | struct ip_vs_protocol ip_vs_protocol_udp = { |
410 | .name = "UDP", | 410 | .name = "UDP", |
411 | .protocol = IPPROTO_UDP, | 411 | .protocol = IPPROTO_UDP, |
412 | .num_states = IP_VS_UDP_S_LAST, | ||
412 | .dont_defrag = 0, | 413 | .dont_defrag = 0, |
413 | .init = udp_init, | 414 | .init = udp_init, |
414 | .exit = udp_exit, | 415 | .exit = udp_exit, |
diff --git a/net/ipv4/ipvs/ip_vs_sync.c b/net/ipv4/ipvs/ip_vs_sync.c index 69c56663cc9a..eff54efe0351 100644 --- a/net/ipv4/ipvs/ip_vs_sync.c +++ b/net/ipv4/ipvs/ip_vs_sync.c | |||
@@ -288,11 +288,16 @@ static void ip_vs_process_message(const char *buffer, const size_t buflen) | |||
288 | char *p; | 288 | char *p; |
289 | int i; | 289 | int i; |
290 | 290 | ||
291 | if (buflen < sizeof(struct ip_vs_sync_mesg)) { | ||
292 | IP_VS_ERR_RL("sync message header too short\n"); | ||
293 | return; | ||
294 | } | ||
295 | |||
291 | /* Convert size back to host byte order */ | 296 | /* Convert size back to host byte order */ |
292 | m->size = ntohs(m->size); | 297 | m->size = ntohs(m->size); |
293 | 298 | ||
294 | if (buflen != m->size) { | 299 | if (buflen != m->size) { |
295 | IP_VS_ERR("bogus message\n"); | 300 | IP_VS_ERR_RL("bogus sync message size\n"); |
296 | return; | 301 | return; |
297 | } | 302 | } |
298 | 303 | ||
@@ -307,9 +312,48 @@ static void ip_vs_process_message(const char *buffer, const size_t buflen) | |||
307 | for (i=0; i<m->nr_conns; i++) { | 312 | for (i=0; i<m->nr_conns; i++) { |
308 | unsigned flags, state; | 313 | unsigned flags, state; |
309 | 314 | ||
310 | s = (struct ip_vs_sync_conn *)p; | 315 | if (p + SIMPLE_CONN_SIZE > buffer+buflen) { |
316 | IP_VS_ERR_RL("bogus conn in sync message\n"); | ||
317 | return; | ||
318 | } | ||
319 | s = (struct ip_vs_sync_conn *) p; | ||
311 | flags = ntohs(s->flags) | IP_VS_CONN_F_SYNC; | 320 | flags = ntohs(s->flags) | IP_VS_CONN_F_SYNC; |
321 | flags &= ~IP_VS_CONN_F_HASHED; | ||
322 | if (flags & IP_VS_CONN_F_SEQ_MASK) { | ||
323 | opt = (struct ip_vs_sync_conn_options *)&s[1]; | ||
324 | p += FULL_CONN_SIZE; | ||
325 | if (p > buffer+buflen) { | ||
326 | IP_VS_ERR_RL("bogus conn options in sync message\n"); | ||
327 | return; | ||
328 | } | ||
329 | } else { | ||
330 | opt = NULL; | ||
331 | p += SIMPLE_CONN_SIZE; | ||
332 | } | ||
333 | |||
312 | state = ntohs(s->state); | 334 | state = ntohs(s->state); |
335 | if (!(flags & IP_VS_CONN_F_TEMPLATE)) { | ||
336 | pp = ip_vs_proto_get(s->protocol); | ||
337 | if (!pp) { | ||
338 | IP_VS_ERR_RL("Unsupported protocol %u in sync msg\n", | ||
339 | s->protocol); | ||
340 | continue; | ||
341 | } | ||
342 | if (state >= pp->num_states) { | ||
343 | IP_VS_DBG(2, "Invalid %s state %u in sync msg\n", | ||
344 | pp->name, state); | ||
345 | continue; | ||
346 | } | ||
347 | } else { | ||
348 | /* protocol in templates is not used for state/timeout */ | ||
349 | pp = NULL; | ||
350 | if (state > 0) { | ||
351 | IP_VS_DBG(2, "Invalid template state %u in sync msg\n", | ||
352 | state); | ||
353 | state = 0; | ||
354 | } | ||
355 | } | ||
356 | |||
313 | if (!(flags & IP_VS_CONN_F_TEMPLATE)) | 357 | if (!(flags & IP_VS_CONN_F_TEMPLATE)) |
314 | cp = ip_vs_conn_in_get(s->protocol, | 358 | cp = ip_vs_conn_in_get(s->protocol, |
315 | s->caddr, s->cport, | 359 | s->caddr, s->cport, |
@@ -345,14 +389,9 @@ static void ip_vs_process_message(const char *buffer, const size_t buflen) | |||
345 | IP_VS_ERR("ip_vs_conn_new failed\n"); | 389 | IP_VS_ERR("ip_vs_conn_new failed\n"); |
346 | return; | 390 | return; |
347 | } | 391 | } |
348 | cp->state = state; | ||
349 | } else if (!cp->dest) { | 392 | } else if (!cp->dest) { |
350 | dest = ip_vs_try_bind_dest(cp); | 393 | dest = ip_vs_try_bind_dest(cp); |
351 | if (!dest) { | 394 | if (dest) |
352 | /* it is an unbound entry created by | ||
353 | * synchronization */ | ||
354 | cp->flags = flags | IP_VS_CONN_F_HASHED; | ||
355 | } else | ||
356 | atomic_dec(&dest->refcnt); | 395 | atomic_dec(&dest->refcnt); |
357 | } else if ((cp->dest) && (cp->protocol == IPPROTO_TCP) && | 396 | } else if ((cp->dest) && (cp->protocol == IPPROTO_TCP) && |
358 | (cp->state != state)) { | 397 | (cp->state != state)) { |
@@ -371,23 +410,22 @@ static void ip_vs_process_message(const char *buffer, const size_t buflen) | |||
371 | } | 410 | } |
372 | } | 411 | } |
373 | 412 | ||
374 | if (flags & IP_VS_CONN_F_SEQ_MASK) { | 413 | if (opt) |
375 | opt = (struct ip_vs_sync_conn_options *)&s[1]; | ||
376 | memcpy(&cp->in_seq, opt, sizeof(*opt)); | 414 | memcpy(&cp->in_seq, opt, sizeof(*opt)); |
377 | p += FULL_CONN_SIZE; | ||
378 | } else | ||
379 | p += SIMPLE_CONN_SIZE; | ||
380 | |||
381 | atomic_set(&cp->in_pkts, sysctl_ip_vs_sync_threshold[0]); | 415 | atomic_set(&cp->in_pkts, sysctl_ip_vs_sync_threshold[0]); |
382 | cp->state = state; | 416 | cp->state = state; |
383 | pp = ip_vs_proto_get(s->protocol); | 417 | cp->old_state = cp->state; |
384 | cp->timeout = pp->timeout_table[cp->state]; | 418 | /* |
419 | * We can not recover the right timeout for templates | ||
420 | * in all cases, we can not find the right fwmark | ||
421 | * virtual service. If needed, we can do it for | ||
422 | * non-fwmark persistent services. | ||
423 | */ | ||
424 | if (!(flags & IP_VS_CONN_F_TEMPLATE) && pp->timeout_table) | ||
425 | cp->timeout = pp->timeout_table[state]; | ||
426 | else | ||
427 | cp->timeout = (3*60*HZ); | ||
385 | ip_vs_conn_put(cp); | 428 | ip_vs_conn_put(cp); |
386 | |||
387 | if (p > buffer+buflen) { | ||
388 | IP_VS_ERR("bogus message\n"); | ||
389 | return; | ||
390 | } | ||
391 | } | 429 | } |
392 | } | 430 | } |
393 | 431 | ||
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c index 719be29f7506..26a37cedcf2e 100644 --- a/net/ipv4/netfilter/ip_queue.c +++ b/net/ipv4/netfilter/ip_queue.c | |||
@@ -296,9 +296,8 @@ ipq_mangle_ipv4(ipq_verdict_msg_t *v, struct nf_queue_entry *e) | |||
296 | if (v->data_len > 0xFFFF) | 296 | if (v->data_len > 0xFFFF) |
297 | return -EINVAL; | 297 | return -EINVAL; |
298 | if (diff > skb_tailroom(e->skb)) { | 298 | if (diff > skb_tailroom(e->skb)) { |
299 | nskb = skb_copy_expand(e->skb, 0, | 299 | nskb = skb_copy_expand(e->skb, skb_headroom(e->skb), |
300 | diff - skb_tailroom(e->skb), | 300 | diff, GFP_ATOMIC); |
301 | GFP_ATOMIC); | ||
302 | if (!nskb) { | 301 | if (!nskb) { |
303 | printk(KERN_WARNING "ip_queue: error " | 302 | printk(KERN_WARNING "ip_queue: error " |
304 | "in mangle, dropping packet\n"); | 303 | "in mangle, dropping packet\n"); |
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c index 22d8e7cd9197..1819ad7ab910 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c | |||
@@ -169,14 +169,14 @@ clusterip_config_init(const struct ipt_clusterip_tgt_info *i, __be32 ip, | |||
169 | 169 | ||
170 | /* create proc dir entry */ | 170 | /* create proc dir entry */ |
171 | sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(ip)); | 171 | sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(ip)); |
172 | c->pde = proc_create(buffer, S_IWUSR|S_IRUSR, | 172 | c->pde = proc_create_data(buffer, S_IWUSR|S_IRUSR, |
173 | clusterip_procdir, &clusterip_proc_fops); | 173 | clusterip_procdir, |
174 | &clusterip_proc_fops, c); | ||
174 | if (!c->pde) { | 175 | if (!c->pde) { |
175 | kfree(c); | 176 | kfree(c); |
176 | return NULL; | 177 | return NULL; |
177 | } | 178 | } |
178 | } | 179 | } |
179 | c->pde->data = c; | ||
180 | #endif | 180 | #endif |
181 | 181 | ||
182 | write_lock_bh(&clusterip_lock); | 182 | write_lock_bh(&clusterip_lock); |
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c index cacb9cb27dab..5a955c440364 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | |||
@@ -303,7 +303,7 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len) | |||
303 | const struct nf_conntrack_tuple_hash *h; | 303 | const struct nf_conntrack_tuple_hash *h; |
304 | struct nf_conntrack_tuple tuple; | 304 | struct nf_conntrack_tuple tuple; |
305 | 305 | ||
306 | NF_CT_TUPLE_U_BLANK(&tuple); | 306 | memset(&tuple, 0, sizeof(tuple)); |
307 | tuple.src.u3.ip = inet->rcv_saddr; | 307 | tuple.src.u3.ip = inet->rcv_saddr; |
308 | tuple.src.u.tcp.port = inet->sport; | 308 | tuple.src.u.tcp.port = inet->sport; |
309 | tuple.dst.u3.ip = inet->daddr; | 309 | tuple.dst.u3.ip = inet->daddr; |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index ce25a13f3430..5e3685c5c407 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1430,11 +1430,13 @@ static inline unsigned short guess_mtu(unsigned short old_mtu) | |||
1430 | } | 1430 | } |
1431 | 1431 | ||
1432 | unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, | 1432 | unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, |
1433 | unsigned short new_mtu) | 1433 | unsigned short new_mtu, |
1434 | struct net_device *dev) | ||
1434 | { | 1435 | { |
1435 | int i; | 1436 | int i, k; |
1436 | unsigned short old_mtu = ntohs(iph->tot_len); | 1437 | unsigned short old_mtu = ntohs(iph->tot_len); |
1437 | struct rtable *rth; | 1438 | struct rtable *rth; |
1439 | int ikeys[2] = { dev->ifindex, 0 }; | ||
1438 | __be32 skeys[2] = { iph->saddr, 0, }; | 1440 | __be32 skeys[2] = { iph->saddr, 0, }; |
1439 | __be32 daddr = iph->daddr; | 1441 | __be32 daddr = iph->daddr; |
1440 | unsigned short est_mtu = 0; | 1442 | unsigned short est_mtu = 0; |
@@ -1442,22 +1444,26 @@ unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, | |||
1442 | if (ipv4_config.no_pmtu_disc) | 1444 | if (ipv4_config.no_pmtu_disc) |
1443 | return 0; | 1445 | return 0; |
1444 | 1446 | ||
1445 | for (i = 0; i < 2; i++) { | 1447 | for (k = 0; k < 2; k++) { |
1446 | unsigned hash = rt_hash(daddr, skeys[i], 0); | 1448 | for (i = 0; i < 2; i++) { |
1449 | unsigned hash = rt_hash(daddr, skeys[i], ikeys[k]); | ||
1447 | 1450 | ||
1448 | rcu_read_lock(); | 1451 | rcu_read_lock(); |
1449 | for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; | 1452 | for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; |
1450 | rth = rcu_dereference(rth->u.dst.rt_next)) { | 1453 | rth = rcu_dereference(rth->u.dst.rt_next)) { |
1451 | if (rth->fl.fl4_dst == daddr && | ||
1452 | rth->fl.fl4_src == skeys[i] && | ||
1453 | rth->rt_dst == daddr && | ||
1454 | rth->rt_src == iph->saddr && | ||
1455 | rth->fl.iif == 0 && | ||
1456 | !(dst_metric_locked(&rth->u.dst, RTAX_MTU)) && | ||
1457 | net_eq(dev_net(rth->u.dst.dev), net) && | ||
1458 | rth->rt_genid == atomic_read(&rt_genid)) { | ||
1459 | unsigned short mtu = new_mtu; | 1454 | unsigned short mtu = new_mtu; |
1460 | 1455 | ||
1456 | if (rth->fl.fl4_dst != daddr || | ||
1457 | rth->fl.fl4_src != skeys[i] || | ||
1458 | rth->rt_dst != daddr || | ||
1459 | rth->rt_src != iph->saddr || | ||
1460 | rth->fl.oif != ikeys[k] || | ||
1461 | rth->fl.iif != 0 || | ||
1462 | dst_metric_locked(&rth->u.dst, RTAX_MTU) || | ||
1463 | !net_eq(dev_net(rth->u.dst.dev), net) || | ||
1464 | rth->rt_genid != atomic_read(&rt_genid)) | ||
1465 | continue; | ||
1466 | |||
1461 | if (new_mtu < 68 || new_mtu >= old_mtu) { | 1467 | if (new_mtu < 68 || new_mtu >= old_mtu) { |
1462 | 1468 | ||
1463 | /* BSD 4.2 compatibility hack :-( */ | 1469 | /* BSD 4.2 compatibility hack :-( */ |
@@ -1483,8 +1489,8 @@ unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, | |||
1483 | est_mtu = mtu; | 1489 | est_mtu = mtu; |
1484 | } | 1490 | } |
1485 | } | 1491 | } |
1492 | rcu_read_unlock(); | ||
1486 | } | 1493 | } |
1487 | rcu_read_unlock(); | ||
1488 | } | 1494 | } |
1489 | return est_mtu ? : new_mtu; | 1495 | return est_mtu ? : new_mtu; |
1490 | } | 1496 | } |
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c index 3a6be23d222f..6a250828b767 100644 --- a/net/ipv4/tcp_cong.c +++ b/net/ipv4/tcp_cong.c | |||
@@ -285,14 +285,12 @@ int tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight) | |||
285 | if (in_flight >= tp->snd_cwnd) | 285 | if (in_flight >= tp->snd_cwnd) |
286 | return 1; | 286 | return 1; |
287 | 287 | ||
288 | if (!sk_can_gso(sk)) | ||
289 | return 0; | ||
290 | |||
291 | left = tp->snd_cwnd - in_flight; | 288 | left = tp->snd_cwnd - in_flight; |
292 | if (sysctl_tcp_tso_win_divisor) | 289 | if (sk_can_gso(sk) && |
293 | return left * sysctl_tcp_tso_win_divisor < tp->snd_cwnd; | 290 | left * sysctl_tcp_tso_win_divisor < tp->snd_cwnd && |
294 | else | 291 | left * tp->mss_cache < sk->sk_gso_max_size) |
295 | return left <= tcp_max_burst(tp); | 292 | return 1; |
293 | return left <= tcp_max_burst(tp); | ||
296 | } | 294 | } |
297 | EXPORT_SYMBOL_GPL(tcp_is_cwnd_limited); | 295 | EXPORT_SYMBOL_GPL(tcp_is_cwnd_limited); |
298 | 296 | ||
diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c index eb5b9854c8c7..4a1221e5e8ee 100644 --- a/net/ipv4/tcp_cubic.c +++ b/net/ipv4/tcp_cubic.c | |||
@@ -15,8 +15,8 @@ | |||
15 | 15 | ||
16 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/math64.h> | ||
18 | #include <net/tcp.h> | 19 | #include <net/tcp.h> |
19 | #include <asm/div64.h> | ||
20 | 20 | ||
21 | #define BICTCP_BETA_SCALE 1024 /* Scale factor beta calculation | 21 | #define BICTCP_BETA_SCALE 1024 /* Scale factor beta calculation |
22 | * max_cwnd = snd_cwnd * beta | 22 | * max_cwnd = snd_cwnd * beta |
@@ -128,7 +128,7 @@ static u32 cubic_root(u64 a) | |||
128 | * x = ( 2 * x + a / x ) / 3 | 128 | * x = ( 2 * x + a / x ) / 3 |
129 | * k+1 k k | 129 | * k+1 k k |
130 | */ | 130 | */ |
131 | x = (2 * x + (u32)div64_64(a, (u64)x * (u64)(x - 1))); | 131 | x = (2 * x + (u32)div64_u64(a, (u64)x * (u64)(x - 1))); |
132 | x = ((x * 341) >> 10); | 132 | x = ((x * 341) >> 10); |
133 | return x; | 133 | return x; |
134 | } | 134 | } |
diff --git a/net/ipv4/tcp_hybla.c b/net/ipv4/tcp_hybla.c index 44618b675916..bfcbd148a89d 100644 --- a/net/ipv4/tcp_hybla.c +++ b/net/ipv4/tcp_hybla.c | |||
@@ -101,8 +101,10 @@ static void hybla_cong_avoid(struct sock *sk, u32 ack, u32 in_flight) | |||
101 | if (!tcp_is_cwnd_limited(sk, in_flight)) | 101 | if (!tcp_is_cwnd_limited(sk, in_flight)) |
102 | return; | 102 | return; |
103 | 103 | ||
104 | if (!ca->hybla_en) | 104 | if (!ca->hybla_en) { |
105 | return tcp_reno_cong_avoid(sk, ack, in_flight); | 105 | tcp_reno_cong_avoid(sk, ack, in_flight); |
106 | return; | ||
107 | } | ||
106 | 108 | ||
107 | if (ca->rho == 0) | 109 | if (ca->rho == 0) |
108 | hybla_recalc_param(sk); | 110 | hybla_recalc_param(sk); |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 0298f80681f2..eda4f4a233f3 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -1172,8 +1172,8 @@ static int tcp_check_dsack(struct tcp_sock *tp, struct sk_buff *ack_skb, | |||
1172 | struct tcp_sack_block_wire *sp, int num_sacks, | 1172 | struct tcp_sack_block_wire *sp, int num_sacks, |
1173 | u32 prior_snd_una) | 1173 | u32 prior_snd_una) |
1174 | { | 1174 | { |
1175 | u32 start_seq_0 = ntohl(get_unaligned(&sp[0].start_seq)); | 1175 | u32 start_seq_0 = get_unaligned_be32(&sp[0].start_seq); |
1176 | u32 end_seq_0 = ntohl(get_unaligned(&sp[0].end_seq)); | 1176 | u32 end_seq_0 = get_unaligned_be32(&sp[0].end_seq); |
1177 | int dup_sack = 0; | 1177 | int dup_sack = 0; |
1178 | 1178 | ||
1179 | if (before(start_seq_0, TCP_SKB_CB(ack_skb)->ack_seq)) { | 1179 | if (before(start_seq_0, TCP_SKB_CB(ack_skb)->ack_seq)) { |
@@ -1181,8 +1181,8 @@ static int tcp_check_dsack(struct tcp_sock *tp, struct sk_buff *ack_skb, | |||
1181 | tcp_dsack_seen(tp); | 1181 | tcp_dsack_seen(tp); |
1182 | NET_INC_STATS_BH(LINUX_MIB_TCPDSACKRECV); | 1182 | NET_INC_STATS_BH(LINUX_MIB_TCPDSACKRECV); |
1183 | } else if (num_sacks > 1) { | 1183 | } else if (num_sacks > 1) { |
1184 | u32 end_seq_1 = ntohl(get_unaligned(&sp[1].end_seq)); | 1184 | u32 end_seq_1 = get_unaligned_be32(&sp[1].end_seq); |
1185 | u32 start_seq_1 = ntohl(get_unaligned(&sp[1].start_seq)); | 1185 | u32 start_seq_1 = get_unaligned_be32(&sp[1].start_seq); |
1186 | 1186 | ||
1187 | if (!after(end_seq_0, end_seq_1) && | 1187 | if (!after(end_seq_0, end_seq_1) && |
1188 | !before(start_seq_0, start_seq_1)) { | 1188 | !before(start_seq_0, start_seq_1)) { |
@@ -1453,8 +1453,8 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, | |||
1453 | for (i = 0; i < num_sacks; i++) { | 1453 | for (i = 0; i < num_sacks; i++) { |
1454 | int dup_sack = !i && found_dup_sack; | 1454 | int dup_sack = !i && found_dup_sack; |
1455 | 1455 | ||
1456 | sp[used_sacks].start_seq = ntohl(get_unaligned(&sp_wire[i].start_seq)); | 1456 | sp[used_sacks].start_seq = get_unaligned_be32(&sp_wire[i].start_seq); |
1457 | sp[used_sacks].end_seq = ntohl(get_unaligned(&sp_wire[i].end_seq)); | 1457 | sp[used_sacks].end_seq = get_unaligned_be32(&sp_wire[i].end_seq); |
1458 | 1458 | ||
1459 | if (!tcp_is_sackblock_valid(tp, dup_sack, | 1459 | if (!tcp_is_sackblock_valid(tp, dup_sack, |
1460 | sp[used_sacks].start_seq, | 1460 | sp[used_sacks].start_seq, |
@@ -3340,7 +3340,7 @@ void tcp_parse_options(struct sk_buff *skb, struct tcp_options_received *opt_rx, | |||
3340 | switch (opcode) { | 3340 | switch (opcode) { |
3341 | case TCPOPT_MSS: | 3341 | case TCPOPT_MSS: |
3342 | if (opsize == TCPOLEN_MSS && th->syn && !estab) { | 3342 | if (opsize == TCPOLEN_MSS && th->syn && !estab) { |
3343 | u16 in_mss = ntohs(get_unaligned((__be16 *)ptr)); | 3343 | u16 in_mss = get_unaligned_be16(ptr); |
3344 | if (in_mss) { | 3344 | if (in_mss) { |
3345 | if (opt_rx->user_mss && | 3345 | if (opt_rx->user_mss && |
3346 | opt_rx->user_mss < in_mss) | 3346 | opt_rx->user_mss < in_mss) |
@@ -3369,8 +3369,8 @@ void tcp_parse_options(struct sk_buff *skb, struct tcp_options_received *opt_rx, | |||
3369 | ((estab && opt_rx->tstamp_ok) || | 3369 | ((estab && opt_rx->tstamp_ok) || |
3370 | (!estab && sysctl_tcp_timestamps))) { | 3370 | (!estab && sysctl_tcp_timestamps))) { |
3371 | opt_rx->saw_tstamp = 1; | 3371 | opt_rx->saw_tstamp = 1; |
3372 | opt_rx->rcv_tsval = ntohl(get_unaligned((__be32 *)ptr)); | 3372 | opt_rx->rcv_tsval = get_unaligned_be32(ptr); |
3373 | opt_rx->rcv_tsecr = ntohl(get_unaligned((__be32 *)(ptr+4))); | 3373 | opt_rx->rcv_tsecr = get_unaligned_be32(ptr + 4); |
3374 | } | 3374 | } |
3375 | break; | 3375 | break; |
3376 | case TCPOPT_SACK_PERM: | 3376 | case TCPOPT_SACK_PERM: |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 0e9bc120707d..cd601a866c2f 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -2214,9 +2214,6 @@ static int tcp_seq_open(struct inode *inode, struct file *file) | |||
2214 | struct tcp_iter_state *s; | 2214 | struct tcp_iter_state *s; |
2215 | int err; | 2215 | int err; |
2216 | 2216 | ||
2217 | if (unlikely(afinfo == NULL)) | ||
2218 | return -EINVAL; | ||
2219 | |||
2220 | err = seq_open_net(inode, file, &afinfo->seq_ops, | 2217 | err = seq_open_net(inode, file, &afinfo->seq_ops, |
2221 | sizeof(struct tcp_iter_state)); | 2218 | sizeof(struct tcp_iter_state)); |
2222 | if (err < 0) | 2219 | if (err < 0) |
@@ -2241,10 +2238,9 @@ int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo) | |||
2241 | afinfo->seq_ops.next = tcp_seq_next; | 2238 | afinfo->seq_ops.next = tcp_seq_next; |
2242 | afinfo->seq_ops.stop = tcp_seq_stop; | 2239 | afinfo->seq_ops.stop = tcp_seq_stop; |
2243 | 2240 | ||
2244 | p = proc_net_fops_create(net, afinfo->name, S_IRUGO, &afinfo->seq_fops); | 2241 | p = proc_create_data(afinfo->name, S_IRUGO, net->proc_net, |
2245 | if (p) | 2242 | &afinfo->seq_fops, afinfo); |
2246 | p->data = afinfo; | 2243 | if (!p) |
2247 | else | ||
2248 | rc = -ENOMEM; | 2244 | rc = -ENOMEM; |
2249 | return rc; | 2245 | return rc; |
2250 | } | 2246 | } |
diff --git a/net/ipv4/tcp_vegas.c b/net/ipv4/tcp_vegas.c index be24d6ee34bd..14504dada116 100644 --- a/net/ipv4/tcp_vegas.c +++ b/net/ipv4/tcp_vegas.c | |||
@@ -167,8 +167,10 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, u32 in_flight) | |||
167 | struct tcp_sock *tp = tcp_sk(sk); | 167 | struct tcp_sock *tp = tcp_sk(sk); |
168 | struct vegas *vegas = inet_csk_ca(sk); | 168 | struct vegas *vegas = inet_csk_ca(sk); |
169 | 169 | ||
170 | if (!vegas->doing_vegas_now) | 170 | if (!vegas->doing_vegas_now) { |
171 | return tcp_reno_cong_avoid(sk, ack, in_flight); | 171 | tcp_reno_cong_avoid(sk, ack, in_flight); |
172 | return; | ||
173 | } | ||
172 | 174 | ||
173 | /* The key players are v_beg_snd_una and v_beg_snd_nxt. | 175 | /* The key players are v_beg_snd_una and v_beg_snd_nxt. |
174 | * | 176 | * |
@@ -229,7 +231,8 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, u32 in_flight) | |||
229 | */ | 231 | */ |
230 | tcp_reno_cong_avoid(sk, ack, in_flight); | 232 | tcp_reno_cong_avoid(sk, ack, in_flight); |
231 | } else { | 233 | } else { |
232 | u32 rtt, target_cwnd, diff; | 234 | u32 rtt, diff; |
235 | u64 target_cwnd; | ||
233 | 236 | ||
234 | /* We have enough RTT samples, so, using the Vegas | 237 | /* We have enough RTT samples, so, using the Vegas |
235 | * algorithm, we determine if we should increase or | 238 | * algorithm, we determine if we should increase or |
@@ -252,8 +255,9 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, u32 in_flight) | |||
252 | * We keep it as a fixed point number with | 255 | * We keep it as a fixed point number with |
253 | * V_PARAM_SHIFT bits to the right of the binary point. | 256 | * V_PARAM_SHIFT bits to the right of the binary point. |
254 | */ | 257 | */ |
255 | target_cwnd = ((old_wnd * vegas->baseRTT) | 258 | target_cwnd = ((u64)old_wnd * vegas->baseRTT); |
256 | << V_PARAM_SHIFT) / rtt; | 259 | target_cwnd <<= V_PARAM_SHIFT; |
260 | do_div(target_cwnd, rtt); | ||
257 | 261 | ||
258 | /* Calculate the difference between the window we had, | 262 | /* Calculate the difference between the window we had, |
259 | * and the window we would like to have. This quantity | 263 | * and the window we would like to have. This quantity |
@@ -279,7 +283,7 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, u32 in_flight) | |||
279 | * utilization. | 283 | * utilization. |
280 | */ | 284 | */ |
281 | tp->snd_cwnd = min(tp->snd_cwnd, | 285 | tp->snd_cwnd = min(tp->snd_cwnd, |
282 | (target_cwnd >> | 286 | ((u32)target_cwnd >> |
283 | V_PARAM_SHIFT)+1); | 287 | V_PARAM_SHIFT)+1); |
284 | 288 | ||
285 | } else if (tp->snd_cwnd <= tp->snd_ssthresh) { | 289 | } else if (tp->snd_cwnd <= tp->snd_ssthresh) { |
diff --git a/net/ipv4/tcp_veno.c b/net/ipv4/tcp_veno.c index d16689e98516..d08b2e855c22 100644 --- a/net/ipv4/tcp_veno.c +++ b/net/ipv4/tcp_veno.c | |||
@@ -119,8 +119,10 @@ static void tcp_veno_cong_avoid(struct sock *sk, u32 ack, u32 in_flight) | |||
119 | struct tcp_sock *tp = tcp_sk(sk); | 119 | struct tcp_sock *tp = tcp_sk(sk); |
120 | struct veno *veno = inet_csk_ca(sk); | 120 | struct veno *veno = inet_csk_ca(sk); |
121 | 121 | ||
122 | if (!veno->doing_veno_now) | 122 | if (!veno->doing_veno_now) { |
123 | return tcp_reno_cong_avoid(sk, ack, in_flight); | 123 | tcp_reno_cong_avoid(sk, ack, in_flight); |
124 | return; | ||
125 | } | ||
124 | 126 | ||
125 | /* limited by applications */ | 127 | /* limited by applications */ |
126 | if (!tcp_is_cwnd_limited(sk, in_flight)) | 128 | if (!tcp_is_cwnd_limited(sk, in_flight)) |
@@ -133,7 +135,8 @@ static void tcp_veno_cong_avoid(struct sock *sk, u32 ack, u32 in_flight) | |||
133 | */ | 135 | */ |
134 | tcp_reno_cong_avoid(sk, ack, in_flight); | 136 | tcp_reno_cong_avoid(sk, ack, in_flight); |
135 | } else { | 137 | } else { |
136 | u32 rtt, target_cwnd; | 138 | u64 target_cwnd; |
139 | u32 rtt; | ||
137 | 140 | ||
138 | /* We have enough rtt samples, so, using the Veno | 141 | /* We have enough rtt samples, so, using the Veno |
139 | * algorithm, we determine the state of the network. | 142 | * algorithm, we determine the state of the network. |
@@ -141,8 +144,9 @@ static void tcp_veno_cong_avoid(struct sock *sk, u32 ack, u32 in_flight) | |||
141 | 144 | ||
142 | rtt = veno->minrtt; | 145 | rtt = veno->minrtt; |
143 | 146 | ||
144 | target_cwnd = ((tp->snd_cwnd * veno->basertt) | 147 | target_cwnd = (tp->snd_cwnd * veno->basertt); |
145 | << V_PARAM_SHIFT) / rtt; | 148 | target_cwnd <<= V_PARAM_SHIFT; |
149 | do_div(target_cwnd, rtt); | ||
146 | 150 | ||
147 | veno->diff = (tp->snd_cwnd << V_PARAM_SHIFT) - target_cwnd; | 151 | veno->diff = (tp->snd_cwnd << V_PARAM_SHIFT) - target_cwnd; |
148 | 152 | ||
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 1f535e315188..db1cb7c96d63 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -1605,10 +1605,9 @@ int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo) | |||
1605 | afinfo->seq_ops.next = udp_seq_next; | 1605 | afinfo->seq_ops.next = udp_seq_next; |
1606 | afinfo->seq_ops.stop = udp_seq_stop; | 1606 | afinfo->seq_ops.stop = udp_seq_stop; |
1607 | 1607 | ||
1608 | p = proc_net_fops_create(net, afinfo->name, S_IRUGO, &afinfo->seq_fops); | 1608 | p = proc_create_data(afinfo->name, S_IRUGO, net->proc_net, |
1609 | if (p) | 1609 | &afinfo->seq_fops, afinfo); |
1610 | p->data = afinfo; | 1610 | if (!p) |
1611 | else | ||
1612 | rc = -ENOMEM; | 1611 | rc = -ENOMEM; |
1613 | return rc; | 1612 | return rc; |
1614 | } | 1613 | } |
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index db6fdc1498aa..56d55fecf8ec 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
@@ -1127,6 +1127,10 @@ int compat_ipv6_getsockopt(struct sock *sk, int level, int optname, | |||
1127 | if (level != SOL_IPV6) | 1127 | if (level != SOL_IPV6) |
1128 | return -ENOPROTOOPT; | 1128 | return -ENOPROTOOPT; |
1129 | 1129 | ||
1130 | if (optname == MCAST_MSFILTER) | ||
1131 | return compat_mc_getsockopt(sk, level, optname, optval, optlen, | ||
1132 | ipv6_getsockopt); | ||
1133 | |||
1130 | err = do_ipv6_getsockopt(sk, level, optname, optval, optlen); | 1134 | err = do_ipv6_getsockopt(sk, level, optname, optval, optlen); |
1131 | #ifdef CONFIG_NETFILTER | 1135 | #ifdef CONFIG_NETFILTER |
1132 | /* we need to exclude all possible ENOPROTOOPTs except default case */ | 1136 | /* we need to exclude all possible ENOPROTOOPTs except default case */ |
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c index 92a36c9e5402..2eff3ae8977d 100644 --- a/net/ipv6/netfilter/ip6_queue.c +++ b/net/ipv6/netfilter/ip6_queue.c | |||
@@ -298,9 +298,8 @@ ipq_mangle_ipv6(ipq_verdict_msg_t *v, struct nf_queue_entry *e) | |||
298 | if (v->data_len > 0xFFFF) | 298 | if (v->data_len > 0xFFFF) |
299 | return -EINVAL; | 299 | return -EINVAL; |
300 | if (diff > skb_tailroom(e->skb)) { | 300 | if (diff > skb_tailroom(e->skb)) { |
301 | nskb = skb_copy_expand(e->skb, 0, | 301 | nskb = skb_copy_expand(e->skb, skb_headroom(e->skb), |
302 | diff - skb_tailroom(e->skb), | 302 | diff, GFP_ATOMIC); |
303 | GFP_ATOMIC); | ||
304 | if (!nskb) { | 303 | if (!nskb) { |
305 | printk(KERN_WARNING "ip6_queue: OOM " | 304 | printk(KERN_WARNING "ip6_queue: OOM " |
306 | "in mangle, dropping packet\n"); | 305 | "in mangle, dropping packet\n"); |
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c index ca8b82f96fe5..df0736a4cafa 100644 --- a/net/ipv6/proc.c +++ b/net/ipv6/proc.c | |||
@@ -247,13 +247,11 @@ int snmp6_register_dev(struct inet6_dev *idev) | |||
247 | if (!proc_net_devsnmp6) | 247 | if (!proc_net_devsnmp6) |
248 | return -ENOENT; | 248 | return -ENOENT; |
249 | 249 | ||
250 | p = proc_create(idev->dev->name, S_IRUGO, | 250 | p = proc_create_data(idev->dev->name, S_IRUGO, |
251 | proc_net_devsnmp6, &snmp6_seq_fops); | 251 | proc_net_devsnmp6, &snmp6_seq_fops, idev); |
252 | if (!p) | 252 | if (!p) |
253 | return -ENOMEM; | 253 | return -ENOMEM; |
254 | 254 | ||
255 | p->data = idev; | ||
256 | |||
257 | idev->stats.proc_dir_entry = p; | 255 | idev->stats.proc_dir_entry = p; |
258 | return 0; | 256 | return 0; |
259 | } | 257 | } |
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c index 7b247e3a16fe..798cabc7535b 100644 --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c | |||
@@ -197,6 +197,7 @@ static void ip6_frag_expire(unsigned long data) | |||
197 | { | 197 | { |
198 | struct frag_queue *fq; | 198 | struct frag_queue *fq; |
199 | struct net_device *dev = NULL; | 199 | struct net_device *dev = NULL; |
200 | struct net *net; | ||
200 | 201 | ||
201 | fq = container_of((struct inet_frag_queue *)data, struct frag_queue, q); | 202 | fq = container_of((struct inet_frag_queue *)data, struct frag_queue, q); |
202 | 203 | ||
@@ -207,7 +208,8 @@ static void ip6_frag_expire(unsigned long data) | |||
207 | 208 | ||
208 | fq_kill(fq); | 209 | fq_kill(fq); |
209 | 210 | ||
210 | dev = dev_get_by_index(&init_net, fq->iif); | 211 | net = container_of(fq->q.net, struct net, ipv6.frags); |
212 | dev = dev_get_by_index(net, fq->iif); | ||
211 | if (!dev) | 213 | if (!dev) |
212 | goto out; | 214 | goto out; |
213 | 215 | ||
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c index d2620410cb0a..76c3057d0179 100644 --- a/net/irda/ircomm/ircomm_tty.c +++ b/net/irda/ircomm/ircomm_tty.c | |||
@@ -555,10 +555,8 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp) | |||
555 | 555 | ||
556 | ircomm_tty_shutdown(self); | 556 | ircomm_tty_shutdown(self); |
557 | 557 | ||
558 | if (tty->driver->flush_buffer) | 558 | tty_driver_flush_buffer(tty); |
559 | tty->driver->flush_buffer(tty); | 559 | tty_ldisc_flush(tty); |
560 | if (tty->ldisc.flush_buffer) | ||
561 | tty->ldisc.flush_buffer(tty); | ||
562 | 560 | ||
563 | tty->closing = 0; | 561 | tty->closing = 0; |
564 | self->tty = NULL; | 562 | self->tty = NULL; |
diff --git a/net/irda/iriap.c b/net/irda/iriap.c index 9e15c82960fe..4a105dc32dcd 100644 --- a/net/irda/iriap.c +++ b/net/irda/iriap.c | |||
@@ -451,12 +451,14 @@ static void iriap_getvaluebyclass_confirm(struct iriap_cb *self, | |||
451 | n = 2; | 451 | n = 2; |
452 | 452 | ||
453 | /* Get length, MSB first */ | 453 | /* Get length, MSB first */ |
454 | len = be16_to_cpu(get_unaligned((__be16 *)(fp+n))); n += 2; | 454 | len = get_unaligned_be16(fp + n); |
455 | n += 2; | ||
455 | 456 | ||
456 | IRDA_DEBUG(4, "%s(), len=%d\n", __func__, len); | 457 | IRDA_DEBUG(4, "%s(), len=%d\n", __func__, len); |
457 | 458 | ||
458 | /* Get object ID, MSB first */ | 459 | /* Get object ID, MSB first */ |
459 | obj_id = be16_to_cpu(get_unaligned((__be16 *)(fp+n))); n += 2; | 460 | obj_id = get_unaligned_be16(fp + n); |
461 | n += 2; | ||
460 | 462 | ||
461 | type = fp[n++]; | 463 | type = fp[n++]; |
462 | IRDA_DEBUG(4, "%s(), Value type = %d\n", __func__, type); | 464 | IRDA_DEBUG(4, "%s(), Value type = %d\n", __func__, type); |
@@ -506,7 +508,7 @@ static void iriap_getvaluebyclass_confirm(struct iriap_cb *self, | |||
506 | value = irias_new_string_value(fp+n); | 508 | value = irias_new_string_value(fp+n); |
507 | break; | 509 | break; |
508 | case IAS_OCT_SEQ: | 510 | case IAS_OCT_SEQ: |
509 | value_len = be16_to_cpu(get_unaligned((__be16 *)(fp+n))); | 511 | value_len = get_unaligned_be16(fp + n); |
510 | n += 2; | 512 | n += 2; |
511 | 513 | ||
512 | /* Will truncate to IAS_MAX_OCTET_STRING bytes */ | 514 | /* Will truncate to IAS_MAX_OCTET_STRING bytes */ |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 8e53ce7ed444..c7314bf4bec2 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -354,7 +354,7 @@ struct ieee80211_if_sta { | |||
354 | int preq_queue_len; | 354 | int preq_queue_len; |
355 | struct mesh_stats mshstats; | 355 | struct mesh_stats mshstats; |
356 | struct mesh_config mshcfg; | 356 | struct mesh_config mshcfg; |
357 | u8 mesh_seqnum[3]; | 357 | u32 mesh_seqnum; |
358 | bool accepting_plinks; | 358 | bool accepting_plinks; |
359 | #endif | 359 | #endif |
360 | u16 aid; | 360 | u16 aid; |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index e9a978979d38..9ad4e3631b6b 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -255,22 +255,8 @@ static int ieee80211_open(struct net_device *dev) | |||
255 | 255 | ||
256 | switch (sdata->vif.type) { | 256 | switch (sdata->vif.type) { |
257 | case IEEE80211_IF_TYPE_WDS: | 257 | case IEEE80211_IF_TYPE_WDS: |
258 | if (is_zero_ether_addr(sdata->u.wds.remote_addr)) | 258 | if (!is_valid_ether_addr(sdata->u.wds.remote_addr)) |
259 | return -ENOLINK; | 259 | return -ENOLINK; |
260 | |||
261 | /* Create STA entry for the WDS peer */ | ||
262 | sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr, | ||
263 | GFP_KERNEL); | ||
264 | if (!sta) | ||
265 | return -ENOMEM; | ||
266 | |||
267 | sta->flags |= WLAN_STA_AUTHORIZED; | ||
268 | |||
269 | res = sta_info_insert(sta); | ||
270 | if (res) { | ||
271 | /* STA has been freed */ | ||
272 | return res; | ||
273 | } | ||
274 | break; | 260 | break; |
275 | case IEEE80211_IF_TYPE_VLAN: | 261 | case IEEE80211_IF_TYPE_VLAN: |
276 | if (!sdata->u.vlan.ap) | 262 | if (!sdata->u.vlan.ap) |
@@ -337,10 +323,8 @@ static int ieee80211_open(struct net_device *dev) | |||
337 | conf.type = sdata->vif.type; | 323 | conf.type = sdata->vif.type; |
338 | conf.mac_addr = dev->dev_addr; | 324 | conf.mac_addr = dev->dev_addr; |
339 | res = local->ops->add_interface(local_to_hw(local), &conf); | 325 | res = local->ops->add_interface(local_to_hw(local), &conf); |
340 | if (res && !local->open_count && local->ops->stop) | ||
341 | local->ops->stop(local_to_hw(local)); | ||
342 | if (res) | 326 | if (res) |
343 | return res; | 327 | goto err_stop; |
344 | 328 | ||
345 | ieee80211_if_config(dev); | 329 | ieee80211_if_config(dev); |
346 | ieee80211_reset_erp_info(dev); | 330 | ieee80211_reset_erp_info(dev); |
@@ -353,9 +337,29 @@ static int ieee80211_open(struct net_device *dev) | |||
353 | netif_carrier_on(dev); | 337 | netif_carrier_on(dev); |
354 | } | 338 | } |
355 | 339 | ||
340 | if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) { | ||
341 | /* Create STA entry for the WDS peer */ | ||
342 | sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr, | ||
343 | GFP_KERNEL); | ||
344 | if (!sta) { | ||
345 | res = -ENOMEM; | ||
346 | goto err_del_interface; | ||
347 | } | ||
348 | |||
349 | sta->flags |= WLAN_STA_AUTHORIZED; | ||
350 | |||
351 | res = sta_info_insert(sta); | ||
352 | if (res) { | ||
353 | /* STA has been freed */ | ||
354 | goto err_del_interface; | ||
355 | } | ||
356 | } | ||
357 | |||
356 | if (local->open_count == 0) { | 358 | if (local->open_count == 0) { |
357 | res = dev_open(local->mdev); | 359 | res = dev_open(local->mdev); |
358 | WARN_ON(res); | 360 | WARN_ON(res); |
361 | if (res) | ||
362 | goto err_del_interface; | ||
359 | tasklet_enable(&local->tx_pending_tasklet); | 363 | tasklet_enable(&local->tx_pending_tasklet); |
360 | tasklet_enable(&local->tasklet); | 364 | tasklet_enable(&local->tasklet); |
361 | } | 365 | } |
@@ -390,6 +394,12 @@ static int ieee80211_open(struct net_device *dev) | |||
390 | netif_start_queue(dev); | 394 | netif_start_queue(dev); |
391 | 395 | ||
392 | return 0; | 396 | return 0; |
397 | err_del_interface: | ||
398 | local->ops->remove_interface(local_to_hw(local), &conf); | ||
399 | err_stop: | ||
400 | if (!local->open_count && local->ops->stop) | ||
401 | local->ops->stop(local_to_hw(local)); | ||
402 | return res; | ||
393 | } | 403 | } |
394 | 404 | ||
395 | static int ieee80211_stop(struct net_device *dev) | 405 | static int ieee80211_stop(struct net_device *dev) |
@@ -975,6 +985,7 @@ static int __ieee80211_if_config(struct net_device *dev, | |||
975 | conf.ssid_len = sdata->u.sta.ssid_len; | 985 | conf.ssid_len = sdata->u.sta.ssid_len; |
976 | } else if (ieee80211_vif_is_mesh(&sdata->vif)) { | 986 | } else if (ieee80211_vif_is_mesh(&sdata->vif)) { |
977 | conf.beacon = beacon; | 987 | conf.beacon = beacon; |
988 | conf.beacon_control = control; | ||
978 | ieee80211_start_mesh(dev); | 989 | ieee80211_start_mesh(dev); |
979 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_AP) { | 990 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_AP) { |
980 | conf.ssid = sdata->u.ap.ssid; | 991 | conf.ssid = sdata->u.ap.ssid; |
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 594a3356a508..f76bc26ae4d2 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -8,6 +8,7 @@ | |||
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <asm/unaligned.h> | ||
11 | #include "ieee80211_i.h" | 12 | #include "ieee80211_i.h" |
12 | #include "mesh.h" | 13 | #include "mesh.h" |
13 | 14 | ||
@@ -167,8 +168,8 @@ int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr, | |||
167 | struct rmc_entry *p, *n; | 168 | struct rmc_entry *p, *n; |
168 | 169 | ||
169 | /* Don't care about endianness since only match matters */ | 170 | /* Don't care about endianness since only match matters */ |
170 | memcpy(&seqnum, mesh_hdr->seqnum, sizeof(mesh_hdr->seqnum)); | 171 | memcpy(&seqnum, &mesh_hdr->seqnum, sizeof(mesh_hdr->seqnum)); |
171 | idx = mesh_hdr->seqnum[0] & rmc->idx_mask; | 172 | idx = le32_to_cpu(mesh_hdr->seqnum) & rmc->idx_mask; |
172 | list_for_each_entry_safe(p, n, &rmc->bucket[idx].list, list) { | 173 | list_for_each_entry_safe(p, n, &rmc->bucket[idx].list, list) { |
173 | ++entries; | 174 | ++entries; |
174 | if (time_after(jiffies, p->exp_time) || | 175 | if (time_after(jiffies, p->exp_time) || |
@@ -393,16 +394,8 @@ int ieee80211_new_mesh_header(struct ieee80211s_hdr *meshhdr, | |||
393 | { | 394 | { |
394 | meshhdr->flags = 0; | 395 | meshhdr->flags = 0; |
395 | meshhdr->ttl = sdata->u.sta.mshcfg.dot11MeshTTL; | 396 | meshhdr->ttl = sdata->u.sta.mshcfg.dot11MeshTTL; |
396 | 397 | put_unaligned(cpu_to_le32(sdata->u.sta.mesh_seqnum), &meshhdr->seqnum); | |
397 | meshhdr->seqnum[0] = sdata->u.sta.mesh_seqnum[0]++; | 398 | sdata->u.sta.mesh_seqnum++; |
398 | meshhdr->seqnum[1] = sdata->u.sta.mesh_seqnum[1]; | ||
399 | meshhdr->seqnum[2] = sdata->u.sta.mesh_seqnum[2]; | ||
400 | |||
401 | if (sdata->u.sta.mesh_seqnum[0] == 0) { | ||
402 | sdata->u.sta.mesh_seqnum[1]++; | ||
403 | if (sdata->u.sta.mesh_seqnum[1] == 0) | ||
404 | sdata->u.sta.mesh_seqnum[2]++; | ||
405 | } | ||
406 | 399 | ||
407 | return 5; | 400 | return 5; |
408 | } | 401 | } |
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h index 9ee3affab346..2e161f6d8288 100644 --- a/net/mac80211/mesh.h +++ b/net/mac80211/mesh.h | |||
@@ -140,7 +140,7 @@ struct rmc_entry { | |||
140 | 140 | ||
141 | struct mesh_rmc { | 141 | struct mesh_rmc { |
142 | struct rmc_entry bucket[RMC_BUCKETS]; | 142 | struct rmc_entry bucket[RMC_BUCKETS]; |
143 | u8 idx_mask; | 143 | u32 idx_mask; |
144 | }; | 144 | }; |
145 | 145 | ||
146 | 146 | ||
diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c index dddbfd60f351..09093da24af6 100644 --- a/net/mac80211/tkip.c +++ b/net/mac80211/tkip.c | |||
@@ -230,10 +230,8 @@ void ieee80211_get_tkip_key(struct ieee80211_key_conf *keyconf, | |||
230 | 230 | ||
231 | iv16 = data[hdr_len] << 8; | 231 | iv16 = data[hdr_len] << 8; |
232 | iv16 += data[hdr_len + 2]; | 232 | iv16 += data[hdr_len + 2]; |
233 | iv32 = data[hdr_len + 4] + | 233 | iv32 = data[hdr_len + 4] | (data[hdr_len + 5] << 8) | |
234 | (data[hdr_len + 5] >> 8) + | 234 | (data[hdr_len + 6] << 16) | (data[hdr_len + 7] << 24); |
235 | (data[hdr_len + 6] >> 16) + | ||
236 | (data[hdr_len + 7] >> 24); | ||
237 | 235 | ||
238 | #ifdef CONFIG_TKIP_DEBUG | 236 | #ifdef CONFIG_TKIP_DEBUG |
239 | printk(KERN_DEBUG "TKIP encrypt: iv16 = 0x%04x, iv32 = 0x%08x\n", | 237 | printk(KERN_DEBUG "TKIP encrypt: iv16 = 0x%04x, iv32 = 0x%08x\n", |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 4eac65c74ed0..c4b1799da5d7 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -104,7 +104,7 @@ nf_ct_get_tuple(const struct sk_buff *skb, | |||
104 | const struct nf_conntrack_l3proto *l3proto, | 104 | const struct nf_conntrack_l3proto *l3proto, |
105 | const struct nf_conntrack_l4proto *l4proto) | 105 | const struct nf_conntrack_l4proto *l4proto) |
106 | { | 106 | { |
107 | NF_CT_TUPLE_U_BLANK(tuple); | 107 | memset(tuple, 0, sizeof(*tuple)); |
108 | 108 | ||
109 | tuple->src.l3num = l3num; | 109 | tuple->src.l3num = l3num; |
110 | if (l3proto->pkt_to_tuple(skb, nhoff, tuple) == 0) | 110 | if (l3proto->pkt_to_tuple(skb, nhoff, tuple) == 0) |
@@ -151,7 +151,7 @@ nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse, | |||
151 | const struct nf_conntrack_l3proto *l3proto, | 151 | const struct nf_conntrack_l3proto *l3proto, |
152 | const struct nf_conntrack_l4proto *l4proto) | 152 | const struct nf_conntrack_l4proto *l4proto) |
153 | { | 153 | { |
154 | NF_CT_TUPLE_U_BLANK(inverse); | 154 | memset(inverse, 0, sizeof(*inverse)); |
155 | 155 | ||
156 | inverse->src.l3num = orig->src.l3num; | 156 | inverse->src.l3num = orig->src.l3num; |
157 | if (l3proto->invert_tuple(inverse, orig) == 0) | 157 | if (l3proto->invert_tuple(inverse, orig) == 0) |
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c index b59871f6bdda..46ea542d0df9 100644 --- a/net/netfilter/nf_conntrack_standalone.c +++ b/net/netfilter/nf_conntrack_standalone.c | |||
@@ -296,11 +296,11 @@ static int nf_conntrack_standalone_init_proc(void) | |||
296 | pde = proc_net_fops_create(&init_net, "nf_conntrack", 0440, &ct_file_ops); | 296 | pde = proc_net_fops_create(&init_net, "nf_conntrack", 0440, &ct_file_ops); |
297 | if (!pde) | 297 | if (!pde) |
298 | goto out_nf_conntrack; | 298 | goto out_nf_conntrack; |
299 | pde = create_proc_entry("nf_conntrack", S_IRUGO, init_net.proc_net_stat); | 299 | |
300 | pde = proc_create("nf_conntrack", S_IRUGO, init_net.proc_net_stat, | ||
301 | &ct_cpu_seq_fops); | ||
300 | if (!pde) | 302 | if (!pde) |
301 | goto out_stat_nf_conntrack; | 303 | goto out_stat_nf_conntrack; |
302 | pde->proc_fops = &ct_cpu_seq_fops; | ||
303 | pde->owner = THIS_MODULE; | ||
304 | return 0; | 304 | return 0; |
305 | 305 | ||
306 | out_stat_nf_conntrack: | 306 | out_stat_nf_conntrack: |
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c index 2c9fe5c12894..3447025ce068 100644 --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c | |||
@@ -454,9 +454,8 @@ nfqnl_mangle(void *data, int data_len, struct nf_queue_entry *e) | |||
454 | if (data_len > 0xFFFF) | 454 | if (data_len > 0xFFFF) |
455 | return -EINVAL; | 455 | return -EINVAL; |
456 | if (diff > skb_tailroom(e->skb)) { | 456 | if (diff > skb_tailroom(e->skb)) { |
457 | nskb = skb_copy_expand(e->skb, 0, | 457 | nskb = skb_copy_expand(e->skb, skb_headroom(e->skb), |
458 | diff - skb_tailroom(e->skb), | 458 | diff, GFP_ATOMIC); |
459 | GFP_ATOMIC); | ||
460 | if (!nskb) { | 459 | if (!nskb) { |
461 | printk(KERN_WARNING "nf_queue: OOM " | 460 | printk(KERN_WARNING "nf_queue: OOM " |
462 | "in mangle, dropping packet\n"); | 461 | "in mangle, dropping packet\n"); |
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index f52f7f810ac4..5d75cd86ebb3 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c | |||
@@ -787,7 +787,7 @@ static const struct file_operations xt_table_ops = { | |||
787 | .open = xt_table_open, | 787 | .open = xt_table_open, |
788 | .read = seq_read, | 788 | .read = seq_read, |
789 | .llseek = seq_lseek, | 789 | .llseek = seq_lseek, |
790 | .release = seq_release, | 790 | .release = seq_release_net, |
791 | }; | 791 | }; |
792 | 792 | ||
793 | static void *xt_match_seq_start(struct seq_file *seq, loff_t *pos) | 793 | static void *xt_match_seq_start(struct seq_file *seq, loff_t *pos) |
@@ -936,25 +936,24 @@ int xt_proto_init(struct net *net, int af) | |||
936 | #ifdef CONFIG_PROC_FS | 936 | #ifdef CONFIG_PROC_FS |
937 | strlcpy(buf, xt_prefix[af], sizeof(buf)); | 937 | strlcpy(buf, xt_prefix[af], sizeof(buf)); |
938 | strlcat(buf, FORMAT_TABLES, sizeof(buf)); | 938 | strlcat(buf, FORMAT_TABLES, sizeof(buf)); |
939 | proc = proc_net_fops_create(net, buf, 0440, &xt_table_ops); | 939 | proc = proc_create_data(buf, 0440, net->proc_net, &xt_table_ops, |
940 | (void *)(unsigned long)af); | ||
940 | if (!proc) | 941 | if (!proc) |
941 | goto out; | 942 | goto out; |
942 | proc->data = (void *)(unsigned long)af; | ||
943 | |||
944 | 943 | ||
945 | strlcpy(buf, xt_prefix[af], sizeof(buf)); | 944 | strlcpy(buf, xt_prefix[af], sizeof(buf)); |
946 | strlcat(buf, FORMAT_MATCHES, sizeof(buf)); | 945 | strlcat(buf, FORMAT_MATCHES, sizeof(buf)); |
947 | proc = proc_net_fops_create(net, buf, 0440, &xt_match_ops); | 946 | proc = proc_create_data(buf, 0440, net->proc_net, &xt_match_ops, |
947 | (void *)(unsigned long)af); | ||
948 | if (!proc) | 948 | if (!proc) |
949 | goto out_remove_tables; | 949 | goto out_remove_tables; |
950 | proc->data = (void *)(unsigned long)af; | ||
951 | 950 | ||
952 | strlcpy(buf, xt_prefix[af], sizeof(buf)); | 951 | strlcpy(buf, xt_prefix[af], sizeof(buf)); |
953 | strlcat(buf, FORMAT_TARGETS, sizeof(buf)); | 952 | strlcat(buf, FORMAT_TARGETS, sizeof(buf)); |
954 | proc = proc_net_fops_create(net, buf, 0440, &xt_target_ops); | 953 | proc = proc_create_data(buf, 0440, net->proc_net, &xt_target_ops, |
954 | (void *)(unsigned long)af); | ||
955 | if (!proc) | 955 | if (!proc) |
956 | goto out_remove_matches; | 956 | goto out_remove_matches; |
957 | proc->data = (void *)(unsigned long)af; | ||
958 | #endif | 957 | #endif |
959 | 958 | ||
960 | return 0; | 959 | return 0; |
diff --git a/net/netfilter/xt_TCPOPTSTRIP.c b/net/netfilter/xt_TCPOPTSTRIP.c index 3b2aa56833b9..9685b6fcbc81 100644 --- a/net/netfilter/xt_TCPOPTSTRIP.c +++ b/net/netfilter/xt_TCPOPTSTRIP.c | |||
@@ -90,7 +90,7 @@ tcpoptstrip_tg6(struct sk_buff *skb, const struct net_device *in, | |||
90 | const struct xt_target *target, const void *targinfo) | 90 | const struct xt_target *target, const void *targinfo) |
91 | { | 91 | { |
92 | struct ipv6hdr *ipv6h = ipv6_hdr(skb); | 92 | struct ipv6hdr *ipv6h = ipv6_hdr(skb); |
93 | unsigned int tcphoff; | 93 | int tcphoff; |
94 | u_int8_t nexthdr; | 94 | u_int8_t nexthdr; |
95 | 95 | ||
96 | nexthdr = ipv6h->nexthdr; | 96 | nexthdr = ipv6h->nexthdr; |
diff --git a/net/netfilter/xt_connbytes.c b/net/netfilter/xt_connbytes.c index b15e7e2fa143..d7e8983cd37f 100644 --- a/net/netfilter/xt_connbytes.c +++ b/net/netfilter/xt_connbytes.c | |||
@@ -4,12 +4,11 @@ | |||
4 | #include <linux/module.h> | 4 | #include <linux/module.h> |
5 | #include <linux/bitops.h> | 5 | #include <linux/bitops.h> |
6 | #include <linux/skbuff.h> | 6 | #include <linux/skbuff.h> |
7 | #include <linux/math64.h> | ||
7 | #include <linux/netfilter/x_tables.h> | 8 | #include <linux/netfilter/x_tables.h> |
8 | #include <linux/netfilter/xt_connbytes.h> | 9 | #include <linux/netfilter/xt_connbytes.h> |
9 | #include <net/netfilter/nf_conntrack.h> | 10 | #include <net/netfilter/nf_conntrack.h> |
10 | 11 | ||
11 | #include <asm/div64.h> | ||
12 | |||
13 | MODULE_LICENSE("GPL"); | 12 | MODULE_LICENSE("GPL"); |
14 | MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); | 13 | MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); |
15 | MODULE_DESCRIPTION("Xtables: Number of packets/bytes per connection matching"); | 14 | MODULE_DESCRIPTION("Xtables: Number of packets/bytes per connection matching"); |
@@ -82,7 +81,7 @@ connbytes_mt(const struct sk_buff *skb, const struct net_device *in, | |||
82 | break; | 81 | break; |
83 | } | 82 | } |
84 | if (pkts != 0) | 83 | if (pkts != 0) |
85 | what = div64_64(bytes, pkts); | 84 | what = div64_u64(bytes, pkts); |
86 | break; | 85 | break; |
87 | } | 86 | } |
88 | 87 | ||
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c index 40d344b21453..6809af542a2c 100644 --- a/net/netfilter/xt_hashlimit.c +++ b/net/netfilter/xt_hashlimit.c | |||
@@ -237,15 +237,15 @@ static int htable_create_v0(struct xt_hashlimit_info *minfo, int family) | |||
237 | hinfo->family = family; | 237 | hinfo->family = family; |
238 | hinfo->rnd_initialized = 0; | 238 | hinfo->rnd_initialized = 0; |
239 | spin_lock_init(&hinfo->lock); | 239 | spin_lock_init(&hinfo->lock); |
240 | hinfo->pde = proc_create(minfo->name, 0, | 240 | hinfo->pde = |
241 | proc_create_data(minfo->name, 0, | ||
241 | family == AF_INET ? hashlimit_procdir4 : | 242 | family == AF_INET ? hashlimit_procdir4 : |
242 | hashlimit_procdir6, | 243 | hashlimit_procdir6, |
243 | &dl_file_ops); | 244 | &dl_file_ops, hinfo); |
244 | if (!hinfo->pde) { | 245 | if (!hinfo->pde) { |
245 | vfree(hinfo); | 246 | vfree(hinfo); |
246 | return -1; | 247 | return -1; |
247 | } | 248 | } |
248 | hinfo->pde->data = hinfo; | ||
249 | 249 | ||
250 | setup_timer(&hinfo->timer, htable_gc, (unsigned long )hinfo); | 250 | setup_timer(&hinfo->timer, htable_gc, (unsigned long )hinfo); |
251 | hinfo->timer.expires = jiffies + msecs_to_jiffies(hinfo->cfg.gc_interval); | 251 | hinfo->timer.expires = jiffies + msecs_to_jiffies(hinfo->cfg.gc_interval); |
@@ -301,15 +301,15 @@ static int htable_create(struct xt_hashlimit_mtinfo1 *minfo, | |||
301 | hinfo->rnd_initialized = 0; | 301 | hinfo->rnd_initialized = 0; |
302 | spin_lock_init(&hinfo->lock); | 302 | spin_lock_init(&hinfo->lock); |
303 | 303 | ||
304 | hinfo->pde = proc_create(minfo->name, 0, | 304 | hinfo->pde = |
305 | proc_create_data(minfo->name, 0, | ||
305 | family == AF_INET ? hashlimit_procdir4 : | 306 | family == AF_INET ? hashlimit_procdir4 : |
306 | hashlimit_procdir6, | 307 | hashlimit_procdir6, |
307 | &dl_file_ops); | 308 | &dl_file_ops, hinfo); |
308 | if (hinfo->pde == NULL) { | 309 | if (hinfo->pde == NULL) { |
309 | vfree(hinfo); | 310 | vfree(hinfo); |
310 | return -1; | 311 | return -1; |
311 | } | 312 | } |
312 | hinfo->pde->data = hinfo; | ||
313 | 313 | ||
314 | setup_timer(&hinfo->timer, htable_gc, (unsigned long)hinfo); | 314 | setup_timer(&hinfo->timer, htable_gc, (unsigned long)hinfo); |
315 | hinfo->timer.expires = jiffies + msecs_to_jiffies(hinfo->cfg.gc_interval); | 315 | hinfo->timer.expires = jiffies + msecs_to_jiffies(hinfo->cfg.gc_interval); |
diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c index 5053a53ba24f..bd593871c81e 100644 --- a/net/rose/rose_route.c +++ b/net/rose/rose_route.c | |||
@@ -1066,12 +1066,12 @@ out: | |||
1066 | #ifdef CONFIG_PROC_FS | 1066 | #ifdef CONFIG_PROC_FS |
1067 | 1067 | ||
1068 | static void *rose_node_start(struct seq_file *seq, loff_t *pos) | 1068 | static void *rose_node_start(struct seq_file *seq, loff_t *pos) |
1069 | __acquires(rose_neigh_list_lock) | 1069 | __acquires(rose_node_list_lock) |
1070 | { | 1070 | { |
1071 | struct rose_node *rose_node; | 1071 | struct rose_node *rose_node; |
1072 | int i = 1; | 1072 | int i = 1; |
1073 | 1073 | ||
1074 | spin_lock_bh(&rose_neigh_list_lock); | 1074 | spin_lock_bh(&rose_node_list_lock); |
1075 | if (*pos == 0) | 1075 | if (*pos == 0) |
1076 | return SEQ_START_TOKEN; | 1076 | return SEQ_START_TOKEN; |
1077 | 1077 | ||
@@ -1090,9 +1090,9 @@ static void *rose_node_next(struct seq_file *seq, void *v, loff_t *pos) | |||
1090 | } | 1090 | } |
1091 | 1091 | ||
1092 | static void rose_node_stop(struct seq_file *seq, void *v) | 1092 | static void rose_node_stop(struct seq_file *seq, void *v) |
1093 | __releases(rose_neigh_list_lock) | 1093 | __releases(rose_node_list_lock) |
1094 | { | 1094 | { |
1095 | spin_unlock_bh(&rose_neigh_list_lock); | 1095 | spin_unlock_bh(&rose_node_list_lock); |
1096 | } | 1096 | } |
1097 | 1097 | ||
1098 | static int rose_node_show(struct seq_file *seq, void *v) | 1098 | static int rose_node_show(struct seq_file *seq, void *v) |
diff --git a/net/rxrpc/ar-transport.c b/net/rxrpc/ar-transport.c index bb282a6a19f0..64069c8769a5 100644 --- a/net/rxrpc/ar-transport.c +++ b/net/rxrpc/ar-transport.c | |||
@@ -184,12 +184,13 @@ void rxrpc_put_transport(struct rxrpc_transport *trans) | |||
184 | ASSERTCMP(atomic_read(&trans->usage), >, 0); | 184 | ASSERTCMP(atomic_read(&trans->usage), >, 0); |
185 | 185 | ||
186 | trans->put_time = get_seconds(); | 186 | trans->put_time = get_seconds(); |
187 | if (unlikely(atomic_dec_and_test(&trans->usage))) | 187 | if (unlikely(atomic_dec_and_test(&trans->usage))) { |
188 | _debug("zombie"); | 188 | _debug("zombie"); |
189 | /* let the reaper determine the timeout to avoid a race with | 189 | /* let the reaper determine the timeout to avoid a race with |
190 | * overextending the timeout if the reaper is running at the | 190 | * overextending the timeout if the reaper is running at the |
191 | * same time */ | 191 | * same time */ |
192 | rxrpc_queue_delayed_work(&rxrpc_transport_reap, 0); | 192 | rxrpc_queue_delayed_work(&rxrpc_transport_reap, 0); |
193 | } | ||
193 | _leave(""); | 194 | _leave(""); |
194 | } | 195 | } |
195 | 196 | ||
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index b741618e4d54..d355e5e47fe3 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
@@ -219,6 +219,7 @@ static void dev_watchdog(unsigned long arg) | |||
219 | printk(KERN_INFO "NETDEV WATCHDOG: %s: transmit timed out\n", | 219 | printk(KERN_INFO "NETDEV WATCHDOG: %s: transmit timed out\n", |
220 | dev->name); | 220 | dev->name); |
221 | dev->tx_timeout(dev); | 221 | dev->tx_timeout(dev); |
222 | WARN_ON_ONCE(1); | ||
222 | } | 223 | } |
223 | if (!mod_timer(&dev->watchdog_timer, round_jiffies(jiffies + dev->watchdog_timeo))) | 224 | if (!mod_timer(&dev->watchdog_timer, round_jiffies(jiffies + dev->watchdog_timeo))) |
224 | dev_hold(dev); | 225 | dev_hold(dev); |
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c index a20e2ef7704b..f0463d757a98 100644 --- a/net/sched/sch_sfq.c +++ b/net/sched/sch_sfq.c | |||
@@ -521,7 +521,8 @@ static void sfq_destroy(struct Qdisc *sch) | |||
521 | struct sfq_sched_data *q = qdisc_priv(sch); | 521 | struct sfq_sched_data *q = qdisc_priv(sch); |
522 | 522 | ||
523 | tcf_destroy_chain(q->filter_list); | 523 | tcf_destroy_chain(q->filter_list); |
524 | del_timer(&q->perturb_timer); | 524 | q->perturb_period = 0; |
525 | del_timer_sync(&q->perturb_timer); | ||
525 | } | 526 | } |
526 | 527 | ||
527 | static int sfq_dump(struct Qdisc *sch, struct sk_buff *skb) | 528 | static int sfq_dump(struct Qdisc *sch, struct sk_buff *skb) |
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index d75530ff2a6d..c9966713282a 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
@@ -316,31 +316,28 @@ static int create_cache_proc_entries(struct cache_detail *cd) | |||
316 | cd->proc_ent->owner = cd->owner; | 316 | cd->proc_ent->owner = cd->owner; |
317 | cd->channel_ent = cd->content_ent = NULL; | 317 | cd->channel_ent = cd->content_ent = NULL; |
318 | 318 | ||
319 | p = proc_create("flush", S_IFREG|S_IRUSR|S_IWUSR, | 319 | p = proc_create_data("flush", S_IFREG|S_IRUSR|S_IWUSR, |
320 | cd->proc_ent, &cache_flush_operations); | 320 | cd->proc_ent, &cache_flush_operations, cd); |
321 | cd->flush_ent = p; | 321 | cd->flush_ent = p; |
322 | if (p == NULL) | 322 | if (p == NULL) |
323 | goto out_nomem; | 323 | goto out_nomem; |
324 | p->owner = cd->owner; | 324 | p->owner = cd->owner; |
325 | p->data = cd; | ||
326 | 325 | ||
327 | if (cd->cache_request || cd->cache_parse) { | 326 | if (cd->cache_request || cd->cache_parse) { |
328 | p = proc_create("channel", S_IFREG|S_IRUSR|S_IWUSR, | 327 | p = proc_create_data("channel", S_IFREG|S_IRUSR|S_IWUSR, |
329 | cd->proc_ent, &cache_file_operations); | 328 | cd->proc_ent, &cache_file_operations, cd); |
330 | cd->channel_ent = p; | 329 | cd->channel_ent = p; |
331 | if (p == NULL) | 330 | if (p == NULL) |
332 | goto out_nomem; | 331 | goto out_nomem; |
333 | p->owner = cd->owner; | 332 | p->owner = cd->owner; |
334 | p->data = cd; | ||
335 | } | 333 | } |
336 | if (cd->cache_show) { | 334 | if (cd->cache_show) { |
337 | p = proc_create("content", S_IFREG|S_IRUSR|S_IWUSR, | 335 | p = proc_create_data("content", S_IFREG|S_IRUSR|S_IWUSR, |
338 | cd->proc_ent, &content_file_operations); | 336 | cd->proc_ent, &content_file_operations, cd); |
339 | cd->content_ent = p; | 337 | cd->content_ent = p; |
340 | if (p == NULL) | 338 | if (p == NULL) |
341 | goto out_nomem; | 339 | goto out_nomem; |
342 | p->owner = cd->owner; | 340 | p->owner = cd->owner; |
343 | p->data = cd; | ||
344 | } | 341 | } |
345 | return 0; | 342 | return 0; |
346 | out_nomem: | 343 | out_nomem: |
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c index c6061a4346c8..50b049c6598a 100644 --- a/net/sunrpc/stats.c +++ b/net/sunrpc/stats.c | |||
@@ -224,16 +224,10 @@ EXPORT_SYMBOL_GPL(rpc_print_iostats); | |||
224 | static inline struct proc_dir_entry * | 224 | static inline struct proc_dir_entry * |
225 | do_register(const char *name, void *data, const struct file_operations *fops) | 225 | do_register(const char *name, void *data, const struct file_operations *fops) |
226 | { | 226 | { |
227 | struct proc_dir_entry *ent; | ||
228 | |||
229 | rpc_proc_init(); | 227 | rpc_proc_init(); |
230 | dprintk("RPC: registering /proc/net/rpc/%s\n", name); | 228 | dprintk("RPC: registering /proc/net/rpc/%s\n", name); |
231 | 229 | ||
232 | ent = proc_create(name, 0, proc_net_rpc, fops); | 230 | return proc_create_data(name, 0, proc_net_rpc, fops, data); |
233 | if (ent) { | ||
234 | ent->data = data; | ||
235 | } | ||
236 | return ent; | ||
237 | } | 231 | } |
238 | 232 | ||
239 | struct proc_dir_entry * | 233 | struct proc_dir_entry * |
diff --git a/net/sysctl_net.c b/net/sysctl_net.c index 665e856675a4..b4f0525f91af 100644 --- a/net/sysctl_net.c +++ b/net/sysctl_net.c | |||
@@ -82,6 +82,6 @@ EXPORT_SYMBOL_GPL(register_net_sysctl_table); | |||
82 | 82 | ||
83 | void unregister_net_sysctl_table(struct ctl_table_header *header) | 83 | void unregister_net_sysctl_table(struct ctl_table_header *header) |
84 | { | 84 | { |
85 | return unregister_sysctl_table(header); | 85 | unregister_sysctl_table(header); |
86 | } | 86 | } |
87 | EXPORT_SYMBOL_GPL(unregister_net_sysctl_table); | 87 | EXPORT_SYMBOL_GPL(unregister_net_sysctl_table); |