diff options
Diffstat (limited to 'net')
44 files changed, 290 insertions, 140 deletions
diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c index 799c631f0fed..f7fa67c78766 100644 --- a/net/atm/atm_sysfs.c +++ b/net/atm/atm_sysfs.c | |||
| @@ -143,12 +143,13 @@ static struct class atm_class = { | |||
| 143 | .dev_uevent = atm_uevent, | 143 | .dev_uevent = atm_uevent, |
| 144 | }; | 144 | }; |
| 145 | 145 | ||
| 146 | int atm_register_sysfs(struct atm_dev *adev) | 146 | int atm_register_sysfs(struct atm_dev *adev, struct device *parent) |
| 147 | { | 147 | { |
| 148 | struct device *cdev = &adev->class_dev; | 148 | struct device *cdev = &adev->class_dev; |
| 149 | int i, j, err; | 149 | int i, j, err; |
| 150 | 150 | ||
| 151 | cdev->class = &atm_class; | 151 | cdev->class = &atm_class; |
| 152 | cdev->parent = parent; | ||
| 152 | dev_set_drvdata(cdev, adev); | 153 | dev_set_drvdata(cdev, adev); |
| 153 | 154 | ||
| 154 | dev_set_name(cdev, "%s%d", adev->type, adev->number); | 155 | dev_set_name(cdev, "%s%d", adev->type, adev->number); |
diff --git a/net/atm/resources.c b/net/atm/resources.c index d29e58261511..23f45ce6f351 100644 --- a/net/atm/resources.c +++ b/net/atm/resources.c | |||
| @@ -74,8 +74,9 @@ struct atm_dev *atm_dev_lookup(int number) | |||
| 74 | } | 74 | } |
| 75 | EXPORT_SYMBOL(atm_dev_lookup); | 75 | EXPORT_SYMBOL(atm_dev_lookup); |
| 76 | 76 | ||
| 77 | struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops, | 77 | struct atm_dev *atm_dev_register(const char *type, struct device *parent, |
| 78 | int number, unsigned long *flags) | 78 | const struct atmdev_ops *ops, int number, |
| 79 | unsigned long *flags) | ||
| 79 | { | 80 | { |
| 80 | struct atm_dev *dev, *inuse; | 81 | struct atm_dev *dev, *inuse; |
| 81 | 82 | ||
| @@ -115,7 +116,7 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops, | |||
| 115 | goto out_fail; | 116 | goto out_fail; |
| 116 | } | 117 | } |
| 117 | 118 | ||
| 118 | if (atm_register_sysfs(dev) < 0) { | 119 | if (atm_register_sysfs(dev, parent) < 0) { |
| 119 | pr_err("atm_register_sysfs failed for dev %s\n", type); | 120 | pr_err("atm_register_sysfs failed for dev %s\n", type); |
| 120 | atm_proc_dev_deregister(dev); | 121 | atm_proc_dev_deregister(dev); |
| 121 | goto out_fail; | 122 | goto out_fail; |
diff --git a/net/atm/resources.h b/net/atm/resources.h index 126fb1840dfb..521431e30507 100644 --- a/net/atm/resources.h +++ b/net/atm/resources.h | |||
| @@ -42,6 +42,6 @@ static inline void atm_proc_dev_deregister(struct atm_dev *dev) | |||
| 42 | 42 | ||
| 43 | #endif /* CONFIG_PROC_FS */ | 43 | #endif /* CONFIG_PROC_FS */ |
| 44 | 44 | ||
| 45 | int atm_register_sysfs(struct atm_dev *adev); | 45 | int atm_register_sysfs(struct atm_dev *adev, struct device *parent); |
| 46 | void atm_unregister_sysfs(struct atm_dev *adev); | 46 | void atm_unregister_sysfs(struct atm_dev *adev); |
| 47 | #endif | 47 | #endif |
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index fa642aa652bd..432a9a633e8d 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c | |||
| @@ -311,6 +311,7 @@ static void rfcomm_dlc_clear_state(struct rfcomm_dlc *d) | |||
| 311 | d->state = BT_OPEN; | 311 | d->state = BT_OPEN; |
| 312 | d->flags = 0; | 312 | d->flags = 0; |
| 313 | d->mscex = 0; | 313 | d->mscex = 0; |
| 314 | d->sec_level = BT_SECURITY_LOW; | ||
| 314 | d->mtu = RFCOMM_DEFAULT_MTU; | 315 | d->mtu = RFCOMM_DEFAULT_MTU; |
| 315 | d->v24_sig = RFCOMM_V24_RTC | RFCOMM_V24_RTR | RFCOMM_V24_DV; | 316 | d->v24_sig = RFCOMM_V24_RTC | RFCOMM_V24_RTR | RFCOMM_V24_DV; |
| 316 | 317 | ||
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index d0927d1fdada..66b9e5c0523a 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
| @@ -882,7 +882,7 @@ static int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type) | |||
| 882 | int lm = 0; | 882 | int lm = 0; |
| 883 | 883 | ||
| 884 | if (type != SCO_LINK && type != ESCO_LINK) | 884 | if (type != SCO_LINK && type != ESCO_LINK) |
| 885 | return 0; | 885 | return -EINVAL; |
| 886 | 886 | ||
| 887 | BT_DBG("hdev %s, bdaddr %s", hdev->name, batostr(bdaddr)); | 887 | BT_DBG("hdev %s, bdaddr %s", hdev->name, batostr(bdaddr)); |
| 888 | 888 | ||
| @@ -908,7 +908,7 @@ static int sco_connect_cfm(struct hci_conn *hcon, __u8 status) | |||
| 908 | BT_DBG("hcon %p bdaddr %s status %d", hcon, batostr(&hcon->dst), status); | 908 | BT_DBG("hcon %p bdaddr %s status %d", hcon, batostr(&hcon->dst), status); |
| 909 | 909 | ||
| 910 | if (hcon->type != SCO_LINK && hcon->type != ESCO_LINK) | 910 | if (hcon->type != SCO_LINK && hcon->type != ESCO_LINK) |
| 911 | return 0; | 911 | return -EINVAL; |
| 912 | 912 | ||
| 913 | if (!status) { | 913 | if (!status) { |
| 914 | struct sco_conn *conn; | 914 | struct sco_conn *conn; |
| @@ -927,7 +927,7 @@ static int sco_disconn_cfm(struct hci_conn *hcon, __u8 reason) | |||
| 927 | BT_DBG("hcon %p reason %d", hcon, reason); | 927 | BT_DBG("hcon %p reason %d", hcon, reason); |
| 928 | 928 | ||
| 929 | if (hcon->type != SCO_LINK && hcon->type != ESCO_LINK) | 929 | if (hcon->type != SCO_LINK && hcon->type != ESCO_LINK) |
| 930 | return 0; | 930 | return -EINVAL; |
| 931 | 931 | ||
| 932 | sco_conn_del(hcon, bt_err(reason)); | 932 | sco_conn_del(hcon, bt_err(reason)); |
| 933 | 933 | ||
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index eb5b256ffc88..543b3262d002 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
| @@ -437,7 +437,7 @@ static struct sk_buff *br_ip6_multicast_alloc_query(struct net_bridge *br, | |||
| 437 | ip6h = ipv6_hdr(skb); | 437 | ip6h = ipv6_hdr(skb); |
| 438 | 438 | ||
| 439 | *(__force __be32 *)ip6h = htonl(0x60000000); | 439 | *(__force __be32 *)ip6h = htonl(0x60000000); |
| 440 | ip6h->payload_len = 8 + sizeof(*mldq); | 440 | ip6h->payload_len = htons(8 + sizeof(*mldq)); |
| 441 | ip6h->nexthdr = IPPROTO_HOPOPTS; | 441 | ip6h->nexthdr = IPPROTO_HOPOPTS; |
| 442 | ip6h->hop_limit = 1; | 442 | ip6h->hop_limit = 1; |
| 443 | ipv6_addr_set(&ip6h->saddr, 0, 0, 0, 0); | 443 | ipv6_addr_set(&ip6h->saddr, 0, 0, 0, 0); |
| @@ -1430,7 +1430,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br, | |||
| 1430 | struct net_bridge_port *port, | 1430 | struct net_bridge_port *port, |
| 1431 | struct sk_buff *skb) | 1431 | struct sk_buff *skb) |
| 1432 | { | 1432 | { |
| 1433 | struct sk_buff *skb2 = skb; | 1433 | struct sk_buff *skb2; |
| 1434 | struct ipv6hdr *ip6h; | 1434 | struct ipv6hdr *ip6h; |
| 1435 | struct icmp6hdr *icmp6h; | 1435 | struct icmp6hdr *icmp6h; |
| 1436 | u8 nexthdr; | 1436 | u8 nexthdr; |
| @@ -1469,15 +1469,15 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br, | |||
| 1469 | if (!skb2) | 1469 | if (!skb2) |
| 1470 | return -ENOMEM; | 1470 | return -ENOMEM; |
| 1471 | 1471 | ||
| 1472 | err = -EINVAL; | ||
| 1473 | if (!pskb_may_pull(skb2, offset + sizeof(struct icmp6hdr))) | ||
| 1474 | goto out; | ||
| 1475 | |||
| 1472 | len -= offset - skb_network_offset(skb2); | 1476 | len -= offset - skb_network_offset(skb2); |
| 1473 | 1477 | ||
| 1474 | __skb_pull(skb2, offset); | 1478 | __skb_pull(skb2, offset); |
| 1475 | skb_reset_transport_header(skb2); | 1479 | skb_reset_transport_header(skb2); |
| 1476 | 1480 | ||
| 1477 | err = -EINVAL; | ||
| 1478 | if (!pskb_may_pull(skb2, sizeof(*icmp6h))) | ||
| 1479 | goto out; | ||
| 1480 | |||
| 1481 | icmp6h = icmp6_hdr(skb2); | 1481 | icmp6h = icmp6_hdr(skb2); |
| 1482 | 1482 | ||
| 1483 | switch (icmp6h->icmp6_type) { | 1483 | switch (icmp6h->icmp6_type) { |
| @@ -1516,7 +1516,12 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br, | |||
| 1516 | switch (icmp6h->icmp6_type) { | 1516 | switch (icmp6h->icmp6_type) { |
| 1517 | case ICMPV6_MGM_REPORT: | 1517 | case ICMPV6_MGM_REPORT: |
| 1518 | { | 1518 | { |
| 1519 | struct mld_msg *mld = (struct mld_msg *)icmp6h; | 1519 | struct mld_msg *mld; |
| 1520 | if (!pskb_may_pull(skb2, sizeof(*mld))) { | ||
| 1521 | err = -EINVAL; | ||
| 1522 | goto out; | ||
| 1523 | } | ||
| 1524 | mld = (struct mld_msg *)skb_transport_header(skb2); | ||
| 1520 | BR_INPUT_SKB_CB(skb2)->mrouters_only = 1; | 1525 | BR_INPUT_SKB_CB(skb2)->mrouters_only = 1; |
| 1521 | err = br_ip6_multicast_add_group(br, port, &mld->mld_mca); | 1526 | err = br_ip6_multicast_add_group(br, port, &mld->mld_mca); |
| 1522 | break; | 1527 | break; |
| @@ -1529,15 +1534,18 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br, | |||
| 1529 | break; | 1534 | break; |
| 1530 | case ICMPV6_MGM_REDUCTION: | 1535 | case ICMPV6_MGM_REDUCTION: |
| 1531 | { | 1536 | { |
| 1532 | struct mld_msg *mld = (struct mld_msg *)icmp6h; | 1537 | struct mld_msg *mld; |
| 1538 | if (!pskb_may_pull(skb2, sizeof(*mld))) { | ||
| 1539 | err = -EINVAL; | ||
| 1540 | goto out; | ||
| 1541 | } | ||
| 1542 | mld = (struct mld_msg *)skb_transport_header(skb2); | ||
| 1533 | br_ip6_multicast_leave_group(br, port, &mld->mld_mca); | 1543 | br_ip6_multicast_leave_group(br, port, &mld->mld_mca); |
| 1534 | } | 1544 | } |
| 1535 | } | 1545 | } |
| 1536 | 1546 | ||
| 1537 | out: | 1547 | out: |
| 1538 | __skb_push(skb2, offset); | 1548 | kfree_skb(skb2); |
| 1539 | if (skb2 != skb) | ||
| 1540 | kfree_skb(skb2); | ||
| 1541 | return err; | 1549 | return err; |
| 1542 | } | 1550 | } |
| 1543 | #endif | 1551 | #endif |
diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c index 35cf27087b56..e3d7aefa9181 100644 --- a/net/bridge/br_stp_bpdu.c +++ b/net/bridge/br_stp_bpdu.c | |||
| @@ -50,6 +50,8 @@ static void br_send_bpdu(struct net_bridge_port *p, | |||
| 50 | 50 | ||
| 51 | llc_mac_hdr_init(skb, p->dev->dev_addr, p->br->group_addr); | 51 | llc_mac_hdr_init(skb, p->dev->dev_addr, p->br->group_addr); |
| 52 | 52 | ||
| 53 | skb_reset_mac_header(skb); | ||
| 54 | |||
| 53 | NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev, | 55 | NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev, |
| 54 | dev_queue_xmit); | 56 | dev_queue_xmit); |
| 55 | } | 57 | } |
diff --git a/net/can/bcm.c b/net/can/bcm.c index 6faa8256e10c..9d5e8accfab1 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c | |||
| @@ -125,7 +125,7 @@ struct bcm_sock { | |||
| 125 | struct list_head tx_ops; | 125 | struct list_head tx_ops; |
| 126 | unsigned long dropped_usr_msgs; | 126 | unsigned long dropped_usr_msgs; |
| 127 | struct proc_dir_entry *bcm_proc_read; | 127 | struct proc_dir_entry *bcm_proc_read; |
| 128 | char procname [20]; /* pointer printed in ASCII with \0 */ | 128 | char procname [32]; /* inode number in decimal with \0 */ |
| 129 | }; | 129 | }; |
| 130 | 130 | ||
| 131 | static inline struct bcm_sock *bcm_sk(const struct sock *sk) | 131 | static inline struct bcm_sock *bcm_sk(const struct sock *sk) |
| @@ -1521,7 +1521,7 @@ static int bcm_connect(struct socket *sock, struct sockaddr *uaddr, int len, | |||
| 1521 | 1521 | ||
| 1522 | if (proc_dir) { | 1522 | if (proc_dir) { |
| 1523 | /* unique socket address as filename */ | 1523 | /* unique socket address as filename */ |
| 1524 | sprintf(bo->procname, "%p", sock); | 1524 | sprintf(bo->procname, "%lu", sock_i_ino(sk)); |
| 1525 | bo->bcm_proc_read = proc_create_data(bo->procname, 0644, | 1525 | bo->bcm_proc_read = proc_create_data(bo->procname, 0644, |
| 1526 | proc_dir, | 1526 | proc_dir, |
| 1527 | &bcm_proc_fops, sk); | 1527 | &bcm_proc_fops, sk); |
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 1c7a2ec4f3cc..b6ff4a1519ab 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
| @@ -97,11 +97,9 @@ struct workqueue_struct *ceph_msgr_wq; | |||
| 97 | int ceph_msgr_init(void) | 97 | int ceph_msgr_init(void) |
| 98 | { | 98 | { |
| 99 | ceph_msgr_wq = create_workqueue("ceph-msgr"); | 99 | ceph_msgr_wq = create_workqueue("ceph-msgr"); |
| 100 | if (IS_ERR(ceph_msgr_wq)) { | 100 | if (!ceph_msgr_wq) { |
| 101 | int ret = PTR_ERR(ceph_msgr_wq); | 101 | pr_err("msgr_init failed to create workqueue\n"); |
| 102 | pr_err("msgr_init failed to create workqueue: %d\n", ret); | 102 | return -ENOMEM; |
| 103 | ceph_msgr_wq = NULL; | ||
| 104 | return ret; | ||
| 105 | } | 103 | } |
| 106 | return 0; | 104 | return 0; |
| 107 | } | 105 | } |
diff --git a/net/ceph/pagevec.c b/net/ceph/pagevec.c index ac34feeb2b3a..1a040e64c69f 100644 --- a/net/ceph/pagevec.c +++ b/net/ceph/pagevec.c | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | * build a vector of user pages | 13 | * build a vector of user pages |
| 14 | */ | 14 | */ |
| 15 | struct page **ceph_get_direct_page_vector(const char __user *data, | 15 | struct page **ceph_get_direct_page_vector(const char __user *data, |
| 16 | int num_pages) | 16 | int num_pages, bool write_page) |
| 17 | { | 17 | { |
| 18 | struct page **pages; | 18 | struct page **pages; |
| 19 | int rc; | 19 | int rc; |
| @@ -24,24 +24,27 @@ struct page **ceph_get_direct_page_vector(const char __user *data, | |||
| 24 | 24 | ||
| 25 | down_read(¤t->mm->mmap_sem); | 25 | down_read(¤t->mm->mmap_sem); |
| 26 | rc = get_user_pages(current, current->mm, (unsigned long)data, | 26 | rc = get_user_pages(current, current->mm, (unsigned long)data, |
| 27 | num_pages, 0, 0, pages, NULL); | 27 | num_pages, write_page, 0, pages, NULL); |
| 28 | up_read(¤t->mm->mmap_sem); | 28 | up_read(¤t->mm->mmap_sem); |
| 29 | if (rc < 0) | 29 | if (rc < num_pages) |
| 30 | goto fail; | 30 | goto fail; |
| 31 | return pages; | 31 | return pages; |
| 32 | 32 | ||
| 33 | fail: | 33 | fail: |
| 34 | kfree(pages); | 34 | ceph_put_page_vector(pages, rc > 0 ? rc : 0, false); |
| 35 | return ERR_PTR(rc); | 35 | return ERR_PTR(rc); |
| 36 | } | 36 | } |
| 37 | EXPORT_SYMBOL(ceph_get_direct_page_vector); | 37 | EXPORT_SYMBOL(ceph_get_direct_page_vector); |
| 38 | 38 | ||
| 39 | void ceph_put_page_vector(struct page **pages, int num_pages) | 39 | void ceph_put_page_vector(struct page **pages, int num_pages, bool dirty) |
| 40 | { | 40 | { |
| 41 | int i; | 41 | int i; |
| 42 | 42 | ||
| 43 | for (i = 0; i < num_pages; i++) | 43 | for (i = 0; i < num_pages; i++) { |
| 44 | if (dirty) | ||
| 45 | set_page_dirty_lock(pages[i]); | ||
| 44 | put_page(pages[i]); | 46 | put_page(pages[i]); |
| 47 | } | ||
| 45 | kfree(pages); | 48 | kfree(pages); |
| 46 | } | 49 | } |
| 47 | EXPORT_SYMBOL(ceph_put_page_vector); | 50 | EXPORT_SYMBOL(ceph_put_page_vector); |
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index 82a4369ae150..a20e5d3bbfa0 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c | |||
| @@ -181,8 +181,7 @@ static int fib_rule_match(struct fib_rule *rule, struct fib_rules_ops *ops, | |||
| 181 | { | 181 | { |
| 182 | int ret = 0; | 182 | int ret = 0; |
| 183 | 183 | ||
| 184 | if (rule->iifindex && (rule->iifindex != fl->iif) && | 184 | if (rule->iifindex && (rule->iifindex != fl->iif)) |
| 185 | !(fl->flags & FLOWI_FLAG_MATCH_ANY_IIF)) | ||
| 186 | goto out; | 185 | goto out; |
| 187 | 186 | ||
| 188 | if (rule->oifindex && (rule->oifindex != fl->oif)) | 187 | if (rule->oifindex && (rule->oifindex != fl->oif)) |
diff --git a/net/core/filter.c b/net/core/filter.c index c1ee800bc080..ae21a0d3c4a2 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
| @@ -589,23 +589,16 @@ int sk_chk_filter(struct sock_filter *filter, int flen) | |||
| 589 | EXPORT_SYMBOL(sk_chk_filter); | 589 | EXPORT_SYMBOL(sk_chk_filter); |
| 590 | 590 | ||
| 591 | /** | 591 | /** |
| 592 | * sk_filter_rcu_release - Release a socket filter by rcu_head | 592 | * sk_filter_release_rcu - Release a socket filter by rcu_head |
| 593 | * @rcu: rcu_head that contains the sk_filter to free | 593 | * @rcu: rcu_head that contains the sk_filter to free |
| 594 | */ | 594 | */ |
| 595 | static void sk_filter_rcu_release(struct rcu_head *rcu) | 595 | void sk_filter_release_rcu(struct rcu_head *rcu) |
| 596 | { | 596 | { |
| 597 | struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu); | 597 | struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu); |
| 598 | 598 | ||
| 599 | sk_filter_release(fp); | 599 | kfree(fp); |
| 600 | } | ||
| 601 | |||
| 602 | static void sk_filter_delayed_uncharge(struct sock *sk, struct sk_filter *fp) | ||
| 603 | { | ||
| 604 | unsigned int size = sk_filter_len(fp); | ||
| 605 | |||
| 606 | atomic_sub(size, &sk->sk_omem_alloc); | ||
| 607 | call_rcu_bh(&fp->rcu, sk_filter_rcu_release); | ||
| 608 | } | 600 | } |
| 601 | EXPORT_SYMBOL(sk_filter_release_rcu); | ||
| 609 | 602 | ||
| 610 | /** | 603 | /** |
| 611 | * sk_attach_filter - attach a socket filter | 604 | * sk_attach_filter - attach a socket filter |
| @@ -649,7 +642,7 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) | |||
| 649 | rcu_assign_pointer(sk->sk_filter, fp); | 642 | rcu_assign_pointer(sk->sk_filter, fp); |
| 650 | 643 | ||
| 651 | if (old_fp) | 644 | if (old_fp) |
| 652 | sk_filter_delayed_uncharge(sk, old_fp); | 645 | sk_filter_uncharge(sk, old_fp); |
| 653 | return 0; | 646 | return 0; |
| 654 | } | 647 | } |
| 655 | EXPORT_SYMBOL_GPL(sk_attach_filter); | 648 | EXPORT_SYMBOL_GPL(sk_attach_filter); |
| @@ -663,7 +656,7 @@ int sk_detach_filter(struct sock *sk) | |||
| 663 | sock_owned_by_user(sk)); | 656 | sock_owned_by_user(sk)); |
| 664 | if (filter) { | 657 | if (filter) { |
| 665 | rcu_assign_pointer(sk->sk_filter, NULL); | 658 | rcu_assign_pointer(sk->sk_filter, NULL); |
| 666 | sk_filter_delayed_uncharge(sk, filter); | 659 | sk_filter_uncharge(sk, filter); |
| 667 | ret = 0; | 660 | ret = 0; |
| 668 | } | 661 | } |
| 669 | return ret; | 662 | return ret; |
diff --git a/net/core/sock.c b/net/core/sock.c index fb6080111461..e5af8d5d5b50 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
| @@ -1009,6 +1009,36 @@ static void sock_copy(struct sock *nsk, const struct sock *osk) | |||
| 1009 | #endif | 1009 | #endif |
| 1010 | } | 1010 | } |
| 1011 | 1011 | ||
| 1012 | /* | ||
| 1013 | * caches using SLAB_DESTROY_BY_RCU should let .next pointer from nulls nodes | ||
| 1014 | * un-modified. Special care is taken when initializing object to zero. | ||
| 1015 | */ | ||
| 1016 | static inline void sk_prot_clear_nulls(struct sock *sk, int size) | ||
| 1017 | { | ||
| 1018 | if (offsetof(struct sock, sk_node.next) != 0) | ||
| 1019 | memset(sk, 0, offsetof(struct sock, sk_node.next)); | ||
| 1020 | memset(&sk->sk_node.pprev, 0, | ||
| 1021 | size - offsetof(struct sock, sk_node.pprev)); | ||
| 1022 | } | ||
| 1023 | |||
| 1024 | void sk_prot_clear_portaddr_nulls(struct sock *sk, int size) | ||
| 1025 | { | ||
| 1026 | unsigned long nulls1, nulls2; | ||
| 1027 | |||
| 1028 | nulls1 = offsetof(struct sock, __sk_common.skc_node.next); | ||
| 1029 | nulls2 = offsetof(struct sock, __sk_common.skc_portaddr_node.next); | ||
| 1030 | if (nulls1 > nulls2) | ||
| 1031 | swap(nulls1, nulls2); | ||
| 1032 | |||
| 1033 | if (nulls1 != 0) | ||
| 1034 | memset((char *)sk, 0, nulls1); | ||
| 1035 | memset((char *)sk + nulls1 + sizeof(void *), 0, | ||
| 1036 | nulls2 - nulls1 - sizeof(void *)); | ||
| 1037 | memset((char *)sk + nulls2 + sizeof(void *), 0, | ||
| 1038 | size - nulls2 - sizeof(void *)); | ||
| 1039 | } | ||
| 1040 | EXPORT_SYMBOL(sk_prot_clear_portaddr_nulls); | ||
| 1041 | |||
| 1012 | static struct sock *sk_prot_alloc(struct proto *prot, gfp_t priority, | 1042 | static struct sock *sk_prot_alloc(struct proto *prot, gfp_t priority, |
| 1013 | int family) | 1043 | int family) |
| 1014 | { | 1044 | { |
| @@ -1021,19 +1051,12 @@ static struct sock *sk_prot_alloc(struct proto *prot, gfp_t priority, | |||
| 1021 | if (!sk) | 1051 | if (!sk) |
| 1022 | return sk; | 1052 | return sk; |
| 1023 | if (priority & __GFP_ZERO) { | 1053 | if (priority & __GFP_ZERO) { |
| 1024 | /* | 1054 | if (prot->clear_sk) |
| 1025 | * caches using SLAB_DESTROY_BY_RCU should let | 1055 | prot->clear_sk(sk, prot->obj_size); |
| 1026 | * sk_node.next un-modified. Special care is taken | 1056 | else |
| 1027 | * when initializing object to zero. | 1057 | sk_prot_clear_nulls(sk, prot->obj_size); |
| 1028 | */ | ||
| 1029 | if (offsetof(struct sock, sk_node.next) != 0) | ||
| 1030 | memset(sk, 0, offsetof(struct sock, sk_node.next)); | ||
| 1031 | memset(&sk->sk_node.pprev, 0, | ||
| 1032 | prot->obj_size - offsetof(struct sock, | ||
| 1033 | sk_node.pprev)); | ||
| 1034 | } | 1058 | } |
| 1035 | } | 1059 | } else |
| 1036 | else | ||
| 1037 | sk = kmalloc(prot->obj_size, priority); | 1060 | sk = kmalloc(prot->obj_size, priority); |
| 1038 | 1061 | ||
| 1039 | if (sk != NULL) { | 1062 | if (sk != NULL) { |
diff --git a/net/core/timestamping.c b/net/core/timestamping.c index 0ae6c22da85b..c19bb4ee405e 100644 --- a/net/core/timestamping.c +++ b/net/core/timestamping.c | |||
| @@ -96,11 +96,13 @@ bool skb_defer_rx_timestamp(struct sk_buff *skb) | |||
| 96 | struct phy_device *phydev; | 96 | struct phy_device *phydev; |
| 97 | unsigned int type; | 97 | unsigned int type; |
| 98 | 98 | ||
| 99 | skb_push(skb, ETH_HLEN); | 99 | if (skb_headroom(skb) < ETH_HLEN) |
| 100 | return false; | ||
| 101 | __skb_push(skb, ETH_HLEN); | ||
| 100 | 102 | ||
| 101 | type = classify(skb); | 103 | type = classify(skb); |
| 102 | 104 | ||
| 103 | skb_pull(skb, ETH_HLEN); | 105 | __skb_pull(skb, ETH_HLEN); |
| 104 | 106 | ||
| 105 | switch (type) { | 107 | switch (type) { |
| 106 | case PTP_CLASS_V1_IPV4: | 108 | case PTP_CLASS_V1_IPV4: |
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c index 13992e1d2726..15dcc1a586b4 100644 --- a/net/econet/af_econet.c +++ b/net/econet/af_econet.c | |||
| @@ -661,8 +661,10 @@ static int ec_dev_ioctl(struct socket *sock, unsigned int cmd, void __user *arg) | |||
| 661 | err = 0; | 661 | err = 0; |
| 662 | switch (cmd) { | 662 | switch (cmd) { |
| 663 | case SIOCSIFADDR: | 663 | case SIOCSIFADDR: |
| 664 | if (!capable(CAP_NET_ADMIN)) | 664 | if (!capable(CAP_NET_ADMIN)) { |
| 665 | return -EPERM; | 665 | err = -EPERM; |
| 666 | break; | ||
| 667 | } | ||
| 666 | 668 | ||
| 667 | edev = dev->ec_ptr; | 669 | edev = dev->ec_ptr; |
| 668 | if (edev == NULL) { | 670 | if (edev == NULL) { |
| @@ -849,9 +851,13 @@ static void aun_incoming(struct sk_buff *skb, struct aunhdr *ah, size_t len) | |||
| 849 | { | 851 | { |
| 850 | struct iphdr *ip = ip_hdr(skb); | 852 | struct iphdr *ip = ip_hdr(skb); |
| 851 | unsigned char stn = ntohl(ip->saddr) & 0xff; | 853 | unsigned char stn = ntohl(ip->saddr) & 0xff; |
| 854 | struct dst_entry *dst = skb_dst(skb); | ||
| 855 | struct ec_device *edev = NULL; | ||
| 852 | struct sock *sk = NULL; | 856 | struct sock *sk = NULL; |
| 853 | struct sk_buff *newskb; | 857 | struct sk_buff *newskb; |
| 854 | struct ec_device *edev = skb->dev->ec_ptr; | 858 | |
| 859 | if (dst) | ||
| 860 | edev = dst->dev->ec_ptr; | ||
| 855 | 861 | ||
| 856 | if (! edev) | 862 | if (! edev) |
| 857 | goto bad; | 863 | goto bad; |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index eb6f69a8f27a..c19c1f739fba 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
| @@ -163,13 +163,19 @@ struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref) | |||
| 163 | .daddr = addr | 163 | .daddr = addr |
| 164 | } | 164 | } |
| 165 | }, | 165 | }, |
| 166 | .flags = FLOWI_FLAG_MATCH_ANY_IIF | ||
| 167 | }; | 166 | }; |
| 168 | struct fib_result res = { 0 }; | 167 | struct fib_result res = { 0 }; |
| 169 | struct net_device *dev = NULL; | 168 | struct net_device *dev = NULL; |
| 169 | struct fib_table *local_table; | ||
| 170 | |||
| 171 | #ifdef CONFIG_IP_MULTIPLE_TABLES | ||
| 172 | res.r = NULL; | ||
| 173 | #endif | ||
| 170 | 174 | ||
| 171 | rcu_read_lock(); | 175 | rcu_read_lock(); |
| 172 | if (fib_lookup(net, &fl, &res)) { | 176 | local_table = fib_get_table(net, RT_TABLE_LOCAL); |
| 177 | if (!local_table || | ||
| 178 | fib_table_lookup(local_table, &fl, &res, FIB_LOOKUP_NOREF)) { | ||
| 173 | rcu_read_unlock(); | 179 | rcu_read_unlock(); |
| 174 | return NULL; | 180 | return NULL; |
| 175 | } | 181 | } |
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index 1b48eb1ed453..b14ec7d03b6e 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c | |||
| @@ -253,6 +253,7 @@ static const struct snmp_mib snmp4_net_list[] = { | |||
| 253 | SNMP_MIB_ITEM("TCPMinTTLDrop", LINUX_MIB_TCPMINTTLDROP), | 253 | SNMP_MIB_ITEM("TCPMinTTLDrop", LINUX_MIB_TCPMINTTLDROP), |
| 254 | SNMP_MIB_ITEM("TCPDeferAcceptDrop", LINUX_MIB_TCPDEFERACCEPTDROP), | 254 | SNMP_MIB_ITEM("TCPDeferAcceptDrop", LINUX_MIB_TCPDEFERACCEPTDROP), |
| 255 | SNMP_MIB_ITEM("IPReversePathFilter", LINUX_MIB_IPRPFILTER), | 255 | SNMP_MIB_ITEM("IPReversePathFilter", LINUX_MIB_IPRPFILTER), |
| 256 | SNMP_MIB_ITEM("TCPTimeWaitOverflow", LINUX_MIB_TCPTIMEWAITOVERFLOW), | ||
| 256 | SNMP_MIB_SENTINEL | 257 | SNMP_MIB_SENTINEL |
| 257 | }; | 258 | }; |
| 258 | 259 | ||
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 987bf9adb318..93bfd95584f4 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
| @@ -2585,9 +2585,10 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp, | |||
| 2585 | goto out; | 2585 | goto out; |
| 2586 | 2586 | ||
| 2587 | /* RACE: Check return value of inet_select_addr instead. */ | 2587 | /* RACE: Check return value of inet_select_addr instead. */ |
| 2588 | if (rcu_dereference(dev_out->ip_ptr) == NULL) | 2588 | if (!(dev_out->flags & IFF_UP) || !__in_dev_get_rcu(dev_out)) { |
| 2589 | goto out; /* Wrong error code */ | 2589 | err = -ENETUNREACH; |
| 2590 | 2590 | goto out; | |
| 2591 | } | ||
| 2591 | if (ipv4_is_local_multicast(oldflp->fl4_dst) || | 2592 | if (ipv4_is_local_multicast(oldflp->fl4_dst) || |
| 2592 | ipv4_is_lbcast(oldflp->fl4_dst)) { | 2593 | ipv4_is_lbcast(oldflp->fl4_dst)) { |
| 2593 | if (!fl.fl4_src) | 2594 | if (!fl.fl4_src) |
| @@ -2648,8 +2649,12 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp, | |||
| 2648 | } | 2649 | } |
| 2649 | 2650 | ||
| 2650 | if (res.type == RTN_LOCAL) { | 2651 | if (res.type == RTN_LOCAL) { |
| 2651 | if (!fl.fl4_src) | 2652 | if (!fl.fl4_src) { |
| 2652 | fl.fl4_src = fl.fl4_dst; | 2653 | if (res.fi->fib_prefsrc) |
| 2654 | fl.fl4_src = res.fi->fib_prefsrc; | ||
| 2655 | else | ||
| 2656 | fl.fl4_src = fl.fl4_dst; | ||
| 2657 | } | ||
| 2653 | dev_out = net->loopback_dev; | 2658 | dev_out = net->loopback_dev; |
| 2654 | fl.oif = dev_out->ifindex; | 2659 | fl.oif = dev_out->ifindex; |
| 2655 | res.fi = NULL; | 2660 | res.fi = NULL; |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index e13da6de1fc7..d978bb2f748b 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
| @@ -2030,7 +2030,7 @@ static void *listening_get_next(struct seq_file *seq, void *cur) | |||
| 2030 | get_req: | 2030 | get_req: |
| 2031 | req = icsk->icsk_accept_queue.listen_opt->syn_table[st->sbucket]; | 2031 | req = icsk->icsk_accept_queue.listen_opt->syn_table[st->sbucket]; |
| 2032 | } | 2032 | } |
| 2033 | sk = sk_next(st->syn_wait_sk); | 2033 | sk = sk_nulls_next(st->syn_wait_sk); |
| 2034 | st->state = TCP_SEQ_STATE_LISTENING; | 2034 | st->state = TCP_SEQ_STATE_LISTENING; |
| 2035 | read_unlock_bh(&icsk->icsk_accept_queue.syn_wait_lock); | 2035 | read_unlock_bh(&icsk->icsk_accept_queue.syn_wait_lock); |
| 2036 | } else { | 2036 | } else { |
| @@ -2039,7 +2039,7 @@ get_req: | |||
| 2039 | if (reqsk_queue_len(&icsk->icsk_accept_queue)) | 2039 | if (reqsk_queue_len(&icsk->icsk_accept_queue)) |
| 2040 | goto start_req; | 2040 | goto start_req; |
| 2041 | read_unlock_bh(&icsk->icsk_accept_queue.syn_wait_lock); | 2041 | read_unlock_bh(&icsk->icsk_accept_queue.syn_wait_lock); |
| 2042 | sk = sk_next(sk); | 2042 | sk = sk_nulls_next(sk); |
| 2043 | } | 2043 | } |
| 2044 | get_sk: | 2044 | get_sk: |
| 2045 | sk_nulls_for_each_from(sk, node) { | 2045 | sk_nulls_for_each_from(sk, node) { |
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index 43cf901d7659..a66735f75963 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c | |||
| @@ -347,7 +347,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo) | |||
| 347 | * socket up. We've got bigger problems than | 347 | * socket up. We've got bigger problems than |
| 348 | * non-graceful socket closings. | 348 | * non-graceful socket closings. |
| 349 | */ | 349 | */ |
| 350 | LIMIT_NETDEBUG(KERN_INFO "TCP: time wait bucket table overflow\n"); | 350 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPTIMEWAITOVERFLOW); |
| 351 | } | 351 | } |
| 352 | 352 | ||
| 353 | tcp_update_metrics(sk); | 353 | tcp_update_metrics(sk); |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 05b1ecf36763..61c2463e2753 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
| @@ -231,11 +231,10 @@ void tcp_select_initial_window(int __space, __u32 mss, | |||
| 231 | /* when initializing use the value from init_rcv_wnd | 231 | /* when initializing use the value from init_rcv_wnd |
| 232 | * rather than the default from above | 232 | * rather than the default from above |
| 233 | */ | 233 | */ |
| 234 | if (init_rcv_wnd && | 234 | if (init_rcv_wnd) |
| 235 | (*rcv_wnd > init_rcv_wnd * mss)) | 235 | *rcv_wnd = min(*rcv_wnd, init_rcv_wnd * mss); |
| 236 | *rcv_wnd = init_rcv_wnd * mss; | 236 | else |
| 237 | else if (*rcv_wnd > init_cwnd * mss) | 237 | *rcv_wnd = min(*rcv_wnd, init_cwnd * mss); |
| 238 | *rcv_wnd = init_cwnd * mss; | ||
| 239 | } | 238 | } |
| 240 | 239 | ||
| 241 | /* Set the clamp no higher than max representable value */ | 240 | /* Set the clamp no higher than max representable value */ |
| @@ -386,27 +385,30 @@ struct tcp_out_options { | |||
| 386 | */ | 385 | */ |
| 387 | static u8 tcp_cookie_size_check(u8 desired) | 386 | static u8 tcp_cookie_size_check(u8 desired) |
| 388 | { | 387 | { |
| 389 | if (desired > 0) { | 388 | int cookie_size; |
| 389 | |||
| 390 | if (desired > 0) | ||
| 390 | /* previously specified */ | 391 | /* previously specified */ |
| 391 | return desired; | 392 | return desired; |
| 392 | } | 393 | |
| 393 | if (sysctl_tcp_cookie_size <= 0) { | 394 | cookie_size = ACCESS_ONCE(sysctl_tcp_cookie_size); |
| 395 | if (cookie_size <= 0) | ||
| 394 | /* no default specified */ | 396 | /* no default specified */ |
| 395 | return 0; | 397 | return 0; |
| 396 | } | 398 | |
| 397 | if (sysctl_tcp_cookie_size <= TCP_COOKIE_MIN) { | 399 | if (cookie_size <= TCP_COOKIE_MIN) |
| 398 | /* value too small, specify minimum */ | 400 | /* value too small, specify minimum */ |
| 399 | return TCP_COOKIE_MIN; | 401 | return TCP_COOKIE_MIN; |
| 400 | } | 402 | |
| 401 | if (sysctl_tcp_cookie_size >= TCP_COOKIE_MAX) { | 403 | if (cookie_size >= TCP_COOKIE_MAX) |
| 402 | /* value too large, specify maximum */ | 404 | /* value too large, specify maximum */ |
| 403 | return TCP_COOKIE_MAX; | 405 | return TCP_COOKIE_MAX; |
| 404 | } | 406 | |
| 405 | if (0x1 & sysctl_tcp_cookie_size) { | 407 | if (cookie_size & 1) |
| 406 | /* 8-bit multiple, illegal, fix it */ | 408 | /* 8-bit multiple, illegal, fix it */ |
| 407 | return (u8)(sysctl_tcp_cookie_size + 0x1); | 409 | cookie_size++; |
| 408 | } | 410 | |
| 409 | return (u8)sysctl_tcp_cookie_size; | 411 | return (u8)cookie_size; |
| 410 | } | 412 | } |
| 411 | 413 | ||
| 412 | /* Write previously computed TCP options to the packet. | 414 | /* Write previously computed TCP options to the packet. |
| @@ -1513,6 +1515,7 @@ static int tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb) | |||
| 1513 | struct tcp_sock *tp = tcp_sk(sk); | 1515 | struct tcp_sock *tp = tcp_sk(sk); |
| 1514 | const struct inet_connection_sock *icsk = inet_csk(sk); | 1516 | const struct inet_connection_sock *icsk = inet_csk(sk); |
| 1515 | u32 send_win, cong_win, limit, in_flight; | 1517 | u32 send_win, cong_win, limit, in_flight; |
| 1518 | int win_divisor; | ||
| 1516 | 1519 | ||
| 1517 | if (TCP_SKB_CB(skb)->flags & TCPHDR_FIN) | 1520 | if (TCP_SKB_CB(skb)->flags & TCPHDR_FIN) |
| 1518 | goto send_now; | 1521 | goto send_now; |
| @@ -1544,13 +1547,14 @@ static int tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb) | |||
| 1544 | if ((skb != tcp_write_queue_tail(sk)) && (limit >= skb->len)) | 1547 | if ((skb != tcp_write_queue_tail(sk)) && (limit >= skb->len)) |
| 1545 | goto send_now; | 1548 | goto send_now; |
| 1546 | 1549 | ||
| 1547 | if (sysctl_tcp_tso_win_divisor) { | 1550 | win_divisor = ACCESS_ONCE(sysctl_tcp_tso_win_divisor); |
| 1551 | if (win_divisor) { | ||
| 1548 | u32 chunk = min(tp->snd_wnd, tp->snd_cwnd * tp->mss_cache); | 1552 | u32 chunk = min(tp->snd_wnd, tp->snd_cwnd * tp->mss_cache); |
| 1549 | 1553 | ||
| 1550 | /* If at least some fraction of a window is available, | 1554 | /* If at least some fraction of a window is available, |
| 1551 | * just use it. | 1555 | * just use it. |
| 1552 | */ | 1556 | */ |
| 1553 | chunk /= sysctl_tcp_tso_win_divisor; | 1557 | chunk /= win_divisor; |
| 1554 | if (limit >= chunk) | 1558 | if (limit >= chunk) |
| 1555 | goto send_now; | 1559 | goto send_now; |
| 1556 | } else { | 1560 | } else { |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 5e0a3a582a59..2d3ded4d0786 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
| @@ -1899,6 +1899,7 @@ struct proto udp_prot = { | |||
| 1899 | .compat_setsockopt = compat_udp_setsockopt, | 1899 | .compat_setsockopt = compat_udp_setsockopt, |
| 1900 | .compat_getsockopt = compat_udp_getsockopt, | 1900 | .compat_getsockopt = compat_udp_getsockopt, |
| 1901 | #endif | 1901 | #endif |
| 1902 | .clear_sk = sk_prot_clear_portaddr_nulls, | ||
| 1902 | }; | 1903 | }; |
| 1903 | EXPORT_SYMBOL(udp_prot); | 1904 | EXPORT_SYMBOL(udp_prot); |
| 1904 | 1905 | ||
diff --git a/net/ipv4/udplite.c b/net/ipv4/udplite.c index ab76aa928fa9..aee9963f7f5a 100644 --- a/net/ipv4/udplite.c +++ b/net/ipv4/udplite.c | |||
| @@ -57,6 +57,7 @@ struct proto udplite_prot = { | |||
| 57 | .compat_setsockopt = compat_udp_setsockopt, | 57 | .compat_setsockopt = compat_udp_setsockopt, |
| 58 | .compat_getsockopt = compat_udp_getsockopt, | 58 | .compat_getsockopt = compat_udp_getsockopt, |
| 59 | #endif | 59 | #endif |
| 60 | .clear_sk = sk_prot_clear_portaddr_nulls, | ||
| 60 | }; | 61 | }; |
| 61 | EXPORT_SYMBOL(udplite_prot); | 62 | EXPORT_SYMBOL(udplite_prot); |
| 62 | 63 | ||
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 23cc8e1ce8d4..848b35591042 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
| @@ -2669,7 +2669,9 @@ static int addrconf_ifdown(struct net_device *dev, int how) | |||
| 2669 | 2669 | ||
| 2670 | ASSERT_RTNL(); | 2670 | ASSERT_RTNL(); |
| 2671 | 2671 | ||
| 2672 | rt6_ifdown(net, dev); | 2672 | /* Flush routes if device is being removed or it is not loopback */ |
| 2673 | if (how || !(dev->flags & IFF_LOOPBACK)) | ||
| 2674 | rt6_ifdown(net, dev); | ||
| 2673 | neigh_ifdown(&nd_tbl, dev); | 2675 | neigh_ifdown(&nd_tbl, dev); |
| 2674 | 2676 | ||
| 2675 | idev = __in6_dev_get(dev); | 2677 | idev = __in6_dev_get(dev); |
| @@ -4021,11 +4023,11 @@ void inet6_ifinfo_notify(int event, struct inet6_dev *idev) | |||
| 4021 | kfree_skb(skb); | 4023 | kfree_skb(skb); |
| 4022 | goto errout; | 4024 | goto errout; |
| 4023 | } | 4025 | } |
| 4024 | rtnl_notify(skb, net, 0, RTNLGRP_IPV6_IFADDR, NULL, GFP_ATOMIC); | 4026 | rtnl_notify(skb, net, 0, RTNLGRP_IPV6_IFINFO, NULL, GFP_ATOMIC); |
| 4025 | return; | 4027 | return; |
| 4026 | errout: | 4028 | errout: |
| 4027 | if (err < 0) | 4029 | if (err < 0) |
| 4028 | rtnl_set_sk_err(net, RTNLGRP_IPV6_IFADDR, err); | 4030 | rtnl_set_sk_err(net, RTNLGRP_IPV6_IFINFO, err); |
| 4029 | } | 4031 | } |
| 4030 | 4032 | ||
| 4031 | static inline size_t inet6_prefix_nlmsg_size(void) | 4033 | static inline size_t inet6_prefix_nlmsg_size(void) |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 99157b4cd56e..94b5bf132b2e 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
| @@ -56,7 +56,7 @@ | |||
| 56 | #include <net/checksum.h> | 56 | #include <net/checksum.h> |
| 57 | #include <linux/mroute6.h> | 57 | #include <linux/mroute6.h> |
| 58 | 58 | ||
| 59 | static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)); | 59 | int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)); |
| 60 | 60 | ||
| 61 | int __ip6_local_out(struct sk_buff *skb) | 61 | int __ip6_local_out(struct sk_buff *skb) |
| 62 | { | 62 | { |
| @@ -145,14 +145,6 @@ static int ip6_finish_output2(struct sk_buff *skb) | |||
| 145 | return -EINVAL; | 145 | return -EINVAL; |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | static inline int ip6_skb_dst_mtu(struct sk_buff *skb) | ||
| 149 | { | ||
| 150 | struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL; | ||
| 151 | |||
| 152 | return (np && np->pmtudisc == IPV6_PMTUDISC_PROBE) ? | ||
| 153 | skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb)); | ||
| 154 | } | ||
| 155 | |||
| 156 | static int ip6_finish_output(struct sk_buff *skb) | 148 | static int ip6_finish_output(struct sk_buff *skb) |
| 157 | { | 149 | { |
| 158 | if ((skb->len > ip6_skb_dst_mtu(skb) && !skb_is_gso(skb)) || | 150 | if ((skb->len > ip6_skb_dst_mtu(skb) && !skb_is_gso(skb)) || |
| @@ -601,7 +593,7 @@ int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr) | |||
| 601 | return offset; | 593 | return offset; |
| 602 | } | 594 | } |
| 603 | 595 | ||
| 604 | static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) | 596 | int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) |
| 605 | { | 597 | { |
| 606 | struct sk_buff *frag; | 598 | struct sk_buff *frag; |
| 607 | struct rt6_info *rt = (struct rt6_info*)skb_dst(skb); | 599 | struct rt6_info *rt = (struct rt6_info*)skb_dst(skb); |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 2a59610c2a58..70e891a20fb9 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
| @@ -1175,6 +1175,8 @@ static void ip6_tnl_link_config(struct ip6_tnl *t) | |||
| 1175 | sizeof (struct ipv6hdr); | 1175 | sizeof (struct ipv6hdr); |
| 1176 | 1176 | ||
| 1177 | dev->mtu = rt->rt6i_dev->mtu - sizeof (struct ipv6hdr); | 1177 | dev->mtu = rt->rt6i_dev->mtu - sizeof (struct ipv6hdr); |
| 1178 | if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) | ||
| 1179 | dev->mtu-=8; | ||
| 1178 | 1180 | ||
| 1179 | if (dev->mtu < IPV6_MIN_MTU) | 1181 | if (dev->mtu < IPV6_MIN_MTU) |
| 1180 | dev->mtu = IPV6_MIN_MTU; | 1182 | dev->mtu = IPV6_MIN_MTU; |
| @@ -1363,12 +1365,17 @@ static const struct net_device_ops ip6_tnl_netdev_ops = { | |||
| 1363 | 1365 | ||
| 1364 | static void ip6_tnl_dev_setup(struct net_device *dev) | 1366 | static void ip6_tnl_dev_setup(struct net_device *dev) |
| 1365 | { | 1367 | { |
| 1368 | struct ip6_tnl *t; | ||
| 1369 | |||
| 1366 | dev->netdev_ops = &ip6_tnl_netdev_ops; | 1370 | dev->netdev_ops = &ip6_tnl_netdev_ops; |
| 1367 | dev->destructor = ip6_dev_free; | 1371 | dev->destructor = ip6_dev_free; |
| 1368 | 1372 | ||
| 1369 | dev->type = ARPHRD_TUNNEL6; | 1373 | dev->type = ARPHRD_TUNNEL6; |
| 1370 | dev->hard_header_len = LL_MAX_HEADER + sizeof (struct ipv6hdr); | 1374 | dev->hard_header_len = LL_MAX_HEADER + sizeof (struct ipv6hdr); |
| 1371 | dev->mtu = ETH_DATA_LEN - sizeof (struct ipv6hdr); | 1375 | dev->mtu = ETH_DATA_LEN - sizeof (struct ipv6hdr); |
| 1376 | t = netdev_priv(dev); | ||
| 1377 | if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) | ||
| 1378 | dev->mtu-=8; | ||
| 1372 | dev->flags |= IFF_NOARP; | 1379 | dev->flags |= IFF_NOARP; |
| 1373 | dev->addr_len = sizeof(struct in6_addr); | 1380 | dev->addr_len = sizeof(struct in6_addr); |
| 1374 | dev->features |= NETIF_F_NETNS_LOCAL; | 1381 | dev->features |= NETIF_F_NETNS_LOCAL; |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 96455ffb76fb..7659d6f16e6b 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
| @@ -1565,11 +1565,16 @@ static void rt6_do_pmtu_disc(struct in6_addr *daddr, struct in6_addr *saddr, | |||
| 1565 | { | 1565 | { |
| 1566 | struct rt6_info *rt, *nrt; | 1566 | struct rt6_info *rt, *nrt; |
| 1567 | int allfrag = 0; | 1567 | int allfrag = 0; |
| 1568 | 1568 | again: | |
| 1569 | rt = rt6_lookup(net, daddr, saddr, ifindex, 0); | 1569 | rt = rt6_lookup(net, daddr, saddr, ifindex, 0); |
| 1570 | if (rt == NULL) | 1570 | if (rt == NULL) |
| 1571 | return; | 1571 | return; |
| 1572 | 1572 | ||
| 1573 | if (rt6_check_expired(rt)) { | ||
| 1574 | ip6_del_rt(rt); | ||
| 1575 | goto again; | ||
| 1576 | } | ||
| 1577 | |||
| 1573 | if (pmtu >= dst_mtu(&rt->dst)) | 1578 | if (pmtu >= dst_mtu(&rt->dst)) |
| 1574 | goto out; | 1579 | goto out; |
| 1575 | 1580 | ||
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index d6bfaec3bbbf..8c4d00c7cd2b 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
| @@ -606,8 +606,9 @@ static int ipip6_rcv(struct sk_buff *skb) | |||
| 606 | return 0; | 606 | return 0; |
| 607 | } | 607 | } |
| 608 | 608 | ||
| 609 | icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0); | 609 | /* no tunnel matched, let upstream know, ipsec may handle it */ |
| 610 | rcu_read_unlock(); | 610 | rcu_read_unlock(); |
| 611 | return 1; | ||
| 611 | out: | 612 | out: |
| 612 | kfree_skb(skb); | 613 | kfree_skb(skb); |
| 613 | return 0; | 614 | return 0; |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 91def93bec85..cd6cb7c3e563 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
| @@ -1477,6 +1477,7 @@ struct proto udpv6_prot = { | |||
| 1477 | .compat_setsockopt = compat_udpv6_setsockopt, | 1477 | .compat_setsockopt = compat_udpv6_setsockopt, |
| 1478 | .compat_getsockopt = compat_udpv6_getsockopt, | 1478 | .compat_getsockopt = compat_udpv6_getsockopt, |
| 1479 | #endif | 1479 | #endif |
| 1480 | .clear_sk = sk_prot_clear_portaddr_nulls, | ||
| 1480 | }; | 1481 | }; |
| 1481 | 1482 | ||
| 1482 | static struct inet_protosw udpv6_protosw = { | 1483 | static struct inet_protosw udpv6_protosw = { |
diff --git a/net/ipv6/udplite.c b/net/ipv6/udplite.c index 5f48fadc27f7..986c4de5292e 100644 --- a/net/ipv6/udplite.c +++ b/net/ipv6/udplite.c | |||
| @@ -55,6 +55,7 @@ struct proto udplitev6_prot = { | |||
| 55 | .compat_setsockopt = compat_udpv6_setsockopt, | 55 | .compat_setsockopt = compat_udpv6_setsockopt, |
| 56 | .compat_getsockopt = compat_udpv6_getsockopt, | 56 | .compat_getsockopt = compat_udpv6_getsockopt, |
| 57 | #endif | 57 | #endif |
| 58 | .clear_sk = sk_prot_clear_portaddr_nulls, | ||
| 58 | }; | 59 | }; |
| 59 | 60 | ||
| 60 | static struct inet_protosw udplite6_protosw = { | 61 | static struct inet_protosw udplite6_protosw = { |
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c index 6434bd5ce088..8e688b3de9ab 100644 --- a/net/ipv6/xfrm6_output.c +++ b/net/ipv6/xfrm6_output.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <linux/netfilter_ipv6.h> | 17 | #include <linux/netfilter_ipv6.h> |
| 18 | #include <net/dst.h> | 18 | #include <net/dst.h> |
| 19 | #include <net/ipv6.h> | 19 | #include <net/ipv6.h> |
| 20 | #include <net/ip6_route.h> | ||
| 20 | #include <net/xfrm.h> | 21 | #include <net/xfrm.h> |
| 21 | 22 | ||
| 22 | int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb, | 23 | int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb, |
| @@ -88,8 +89,21 @@ static int xfrm6_output_finish(struct sk_buff *skb) | |||
| 88 | return xfrm_output(skb); | 89 | return xfrm_output(skb); |
| 89 | } | 90 | } |
| 90 | 91 | ||
| 92 | static int __xfrm6_output(struct sk_buff *skb) | ||
| 93 | { | ||
| 94 | struct dst_entry *dst = skb_dst(skb); | ||
| 95 | struct xfrm_state *x = dst->xfrm; | ||
| 96 | |||
| 97 | if ((x && x->props.mode == XFRM_MODE_TUNNEL) && | ||
| 98 | ((skb->len > ip6_skb_dst_mtu(skb) && !skb_is_gso(skb)) || | ||
| 99 | dst_allfrag(skb_dst(skb)))) { | ||
| 100 | return ip6_fragment(skb, xfrm6_output_finish); | ||
| 101 | } | ||
| 102 | return xfrm6_output_finish(skb); | ||
| 103 | } | ||
| 104 | |||
| 91 | int xfrm6_output(struct sk_buff *skb) | 105 | int xfrm6_output(struct sk_buff *skb) |
| 92 | { | 106 | { |
| 93 | return NF_HOOK(NFPROTO_IPV6, NF_INET_POST_ROUTING, skb, NULL, | 107 | return NF_HOOK(NFPROTO_IPV6, NF_INET_POST_ROUTING, skb, NULL, |
| 94 | skb_dst(skb)->dev, xfrm6_output_finish); | 108 | skb_dst(skb)->dev, __xfrm6_output); |
| 95 | } | 109 | } |
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index a6de3059746d..c9890e25cd4c 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c | |||
| @@ -2280,6 +2280,16 @@ static int irda_getsockopt(struct socket *sock, int level, int optname, | |||
| 2280 | 2280 | ||
| 2281 | switch (optname) { | 2281 | switch (optname) { |
| 2282 | case IRLMP_ENUMDEVICES: | 2282 | case IRLMP_ENUMDEVICES: |
| 2283 | |||
| 2284 | /* Offset to first device entry */ | ||
| 2285 | offset = sizeof(struct irda_device_list) - | ||
| 2286 | sizeof(struct irda_device_info); | ||
| 2287 | |||
| 2288 | if (len < offset) { | ||
| 2289 | err = -EINVAL; | ||
| 2290 | goto out; | ||
| 2291 | } | ||
| 2292 | |||
| 2283 | /* Ask lmp for the current discovery log */ | 2293 | /* Ask lmp for the current discovery log */ |
| 2284 | discoveries = irlmp_get_discoveries(&list.len, self->mask.word, | 2294 | discoveries = irlmp_get_discoveries(&list.len, self->mask.word, |
| 2285 | self->nslots); | 2295 | self->nslots); |
| @@ -2290,15 +2300,9 @@ static int irda_getsockopt(struct socket *sock, int level, int optname, | |||
| 2290 | } | 2300 | } |
| 2291 | 2301 | ||
| 2292 | /* Write total list length back to client */ | 2302 | /* Write total list length back to client */ |
| 2293 | if (copy_to_user(optval, &list, | 2303 | if (copy_to_user(optval, &list, offset)) |
| 2294 | sizeof(struct irda_device_list) - | ||
| 2295 | sizeof(struct irda_device_info))) | ||
| 2296 | err = -EFAULT; | 2304 | err = -EFAULT; |
| 2297 | 2305 | ||
| 2298 | /* Offset to first device entry */ | ||
| 2299 | offset = sizeof(struct irda_device_list) - | ||
| 2300 | sizeof(struct irda_device_info); | ||
| 2301 | |||
| 2302 | /* Copy the list itself - watch for overflow */ | 2306 | /* Copy the list itself - watch for overflow */ |
| 2303 | if (list.len > 2048) { | 2307 | if (list.len > 2048) { |
| 2304 | err = -EINVAL; | 2308 | err = -EINVAL; |
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c index 0bf6a59545ab..522e219f3558 100644 --- a/net/l2tp/l2tp_ip.c +++ b/net/l2tp/l2tp_ip.c | |||
| @@ -674,4 +674,8 @@ MODULE_LICENSE("GPL"); | |||
| 674 | MODULE_AUTHOR("James Chapman <jchapman@katalix.com>"); | 674 | MODULE_AUTHOR("James Chapman <jchapman@katalix.com>"); |
| 675 | MODULE_DESCRIPTION("L2TP over IP"); | 675 | MODULE_DESCRIPTION("L2TP over IP"); |
| 676 | MODULE_VERSION("1.0"); | 676 | MODULE_VERSION("1.0"); |
| 677 | MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_INET, SOCK_DGRAM, IPPROTO_L2TP); | 677 | |
| 678 | /* Use the value of SOCK_DGRAM (2) directory, because __stringify does't like | ||
| 679 | * enums | ||
| 680 | */ | ||
| 681 | MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_INET, 2, IPPROTO_L2TP); | ||
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c index 582612998211..e35dbe55f520 100644 --- a/net/llc/af_llc.c +++ b/net/llc/af_llc.c | |||
| @@ -317,8 +317,9 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen) | |||
| 317 | goto out; | 317 | goto out; |
| 318 | rc = -ENODEV; | 318 | rc = -ENODEV; |
| 319 | rtnl_lock(); | 319 | rtnl_lock(); |
| 320 | rcu_read_lock(); | ||
| 320 | if (sk->sk_bound_dev_if) { | 321 | if (sk->sk_bound_dev_if) { |
| 321 | llc->dev = dev_get_by_index(&init_net, sk->sk_bound_dev_if); | 322 | llc->dev = dev_get_by_index_rcu(&init_net, sk->sk_bound_dev_if); |
| 322 | if (llc->dev) { | 323 | if (llc->dev) { |
| 323 | if (!addr->sllc_arphrd) | 324 | if (!addr->sllc_arphrd) |
| 324 | addr->sllc_arphrd = llc->dev->type; | 325 | addr->sllc_arphrd = llc->dev->type; |
| @@ -329,13 +330,13 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen) | |||
| 329 | !llc_mac_match(addr->sllc_mac, | 330 | !llc_mac_match(addr->sllc_mac, |
| 330 | llc->dev->dev_addr)) { | 331 | llc->dev->dev_addr)) { |
| 331 | rc = -EINVAL; | 332 | rc = -EINVAL; |
| 332 | dev_put(llc->dev); | ||
| 333 | llc->dev = NULL; | 333 | llc->dev = NULL; |
| 334 | } | 334 | } |
| 335 | } | 335 | } |
| 336 | } else | 336 | } else |
| 337 | llc->dev = dev_getbyhwaddr(&init_net, addr->sllc_arphrd, | 337 | llc->dev = dev_getbyhwaddr(&init_net, addr->sllc_arphrd, |
| 338 | addr->sllc_mac); | 338 | addr->sllc_mac); |
| 339 | rcu_read_unlock(); | ||
| 339 | rtnl_unlock(); | 340 | rtnl_unlock(); |
| 340 | if (!llc->dev) | 341 | if (!llc->dev) |
| 341 | goto out; | 342 | goto out; |
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 239c4836a946..077a93dd1671 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
| @@ -780,6 +780,9 @@ void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, | |||
| 780 | 780 | ||
| 781 | mutex_lock(&sdata->u.ibss.mtx); | 781 | mutex_lock(&sdata->u.ibss.mtx); |
| 782 | 782 | ||
| 783 | if (!sdata->u.ibss.ssid_len) | ||
| 784 | goto mgmt_out; /* not ready to merge yet */ | ||
| 785 | |||
| 783 | switch (fc & IEEE80211_FCTL_STYPE) { | 786 | switch (fc & IEEE80211_FCTL_STYPE) { |
| 784 | case IEEE80211_STYPE_PROBE_REQ: | 787 | case IEEE80211_STYPE_PROBE_REQ: |
| 785 | ieee80211_rx_mgmt_probe_req(sdata, mgmt, skb->len); | 788 | ieee80211_rx_mgmt_probe_req(sdata, mgmt, skb->len); |
| @@ -797,6 +800,7 @@ void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, | |||
| 797 | break; | 800 | break; |
| 798 | } | 801 | } |
| 799 | 802 | ||
| 803 | mgmt_out: | ||
| 800 | mutex_unlock(&sdata->u.ibss.mtx); | 804 | mutex_unlock(&sdata->u.ibss.mtx); |
| 801 | } | 805 | } |
| 802 | 806 | ||
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 902b03ee8f60..b01e467b76c6 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
| @@ -1788,9 +1788,11 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
| 1788 | 1788 | ||
| 1789 | fwd_skb = skb_copy(skb, GFP_ATOMIC); | 1789 | fwd_skb = skb_copy(skb, GFP_ATOMIC); |
| 1790 | 1790 | ||
| 1791 | if (!fwd_skb && net_ratelimit()) | 1791 | if (!fwd_skb && net_ratelimit()) { |
| 1792 | printk(KERN_DEBUG "%s: failed to clone mesh frame\n", | 1792 | printk(KERN_DEBUG "%s: failed to clone mesh frame\n", |
| 1793 | sdata->name); | 1793 | sdata->name); |
| 1794 | goto out; | ||
| 1795 | } | ||
| 1794 | 1796 | ||
| 1795 | fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data; | 1797 | fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data; |
| 1796 | memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN); | 1798 | memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN); |
| @@ -1828,6 +1830,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
| 1828 | } | 1830 | } |
| 1829 | } | 1831 | } |
| 1830 | 1832 | ||
| 1833 | out: | ||
| 1831 | if (is_multicast_ether_addr(hdr->addr1) || | 1834 | if (is_multicast_ether_addr(hdr->addr1) || |
| 1832 | sdata->dev->flags & IFF_PROMISC) | 1835 | sdata->dev->flags & IFF_PROMISC) |
| 1833 | return RX_CONTINUE; | 1836 | return RX_CONTINUE; |
| @@ -2247,6 +2250,10 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx) | |||
| 2247 | break; | 2250 | break; |
| 2248 | case cpu_to_le16(IEEE80211_STYPE_DEAUTH): | 2251 | case cpu_to_le16(IEEE80211_STYPE_DEAUTH): |
| 2249 | case cpu_to_le16(IEEE80211_STYPE_DISASSOC): | 2252 | case cpu_to_le16(IEEE80211_STYPE_DISASSOC): |
| 2253 | if (is_multicast_ether_addr(mgmt->da) && | ||
| 2254 | !is_broadcast_ether_addr(mgmt->da)) | ||
| 2255 | return RX_DROP_MONITOR; | ||
| 2256 | |||
| 2250 | /* process only for station */ | 2257 | /* process only for station */ |
| 2251 | if (sdata->vif.type != NL80211_IFTYPE_STATION) | 2258 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
| 2252 | return RX_DROP_MONITOR; | 2259 | return RX_DROP_MONITOR; |
| @@ -2741,6 +2748,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
| 2741 | 2748 | ||
| 2742 | if (ieee80211_prepare_and_rx_handle(&rx, skb, true)) | 2749 | if (ieee80211_prepare_and_rx_handle(&rx, skb, true)) |
| 2743 | return; | 2750 | return; |
| 2751 | goto out; | ||
| 2744 | } | 2752 | } |
| 2745 | } | 2753 | } |
| 2746 | 2754 | ||
| @@ -2780,6 +2788,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
| 2780 | return; | 2788 | return; |
| 2781 | } | 2789 | } |
| 2782 | 2790 | ||
| 2791 | out: | ||
| 2783 | dev_kfree_skb(skb); | 2792 | dev_kfree_skb(skb); |
| 2784 | } | 2793 | } |
| 2785 | 2794 | ||
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 96c594309506..7a637b80a62e 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
| @@ -1587,7 +1587,12 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, | |||
| 1587 | list) { | 1587 | list) { |
| 1588 | if (!ieee80211_sdata_running(tmp_sdata)) | 1588 | if (!ieee80211_sdata_running(tmp_sdata)) |
| 1589 | continue; | 1589 | continue; |
| 1590 | if (tmp_sdata->vif.type != NL80211_IFTYPE_AP) | 1590 | if (tmp_sdata->vif.type == |
| 1591 | NL80211_IFTYPE_MONITOR || | ||
| 1592 | tmp_sdata->vif.type == | ||
| 1593 | NL80211_IFTYPE_AP_VLAN || | ||
| 1594 | tmp_sdata->vif.type == | ||
| 1595 | NL80211_IFTYPE_WDS) | ||
| 1591 | continue; | 1596 | continue; |
| 1592 | if (compare_ether_addr(tmp_sdata->vif.addr, | 1597 | if (compare_ether_addr(tmp_sdata->vif.addr, |
| 1593 | hdr->addr2) == 0) { | 1598 | hdr->addr2) == 0) { |
| @@ -1732,15 +1737,13 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
| 1732 | int nh_pos, h_pos; | 1737 | int nh_pos, h_pos; |
| 1733 | struct sta_info *sta = NULL; | 1738 | struct sta_info *sta = NULL; |
| 1734 | u32 sta_flags = 0; | 1739 | u32 sta_flags = 0; |
| 1740 | struct sk_buff *tmp_skb; | ||
| 1735 | 1741 | ||
| 1736 | if (unlikely(skb->len < ETH_HLEN)) { | 1742 | if (unlikely(skb->len < ETH_HLEN)) { |
| 1737 | ret = NETDEV_TX_OK; | 1743 | ret = NETDEV_TX_OK; |
| 1738 | goto fail; | 1744 | goto fail; |
| 1739 | } | 1745 | } |
| 1740 | 1746 | ||
| 1741 | nh_pos = skb_network_header(skb) - skb->data; | ||
| 1742 | h_pos = skb_transport_header(skb) - skb->data; | ||
| 1743 | |||
| 1744 | /* convert Ethernet header to proper 802.11 header (based on | 1747 | /* convert Ethernet header to proper 802.11 header (based on |
| 1745 | * operation mode) */ | 1748 | * operation mode) */ |
| 1746 | ethertype = (skb->data[12] << 8) | skb->data[13]; | 1749 | ethertype = (skb->data[12] << 8) | skb->data[13]; |
| @@ -1913,6 +1916,20 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
| 1913 | goto fail; | 1916 | goto fail; |
| 1914 | } | 1917 | } |
| 1915 | 1918 | ||
| 1919 | /* | ||
| 1920 | * If the skb is shared we need to obtain our own copy. | ||
| 1921 | */ | ||
| 1922 | if (skb_shared(skb)) { | ||
| 1923 | tmp_skb = skb; | ||
| 1924 | skb = skb_copy(skb, GFP_ATOMIC); | ||
| 1925 | kfree_skb(tmp_skb); | ||
| 1926 | |||
| 1927 | if (!skb) { | ||
| 1928 | ret = NETDEV_TX_OK; | ||
| 1929 | goto fail; | ||
| 1930 | } | ||
| 1931 | } | ||
| 1932 | |||
| 1916 | hdr.frame_control = fc; | 1933 | hdr.frame_control = fc; |
| 1917 | hdr.duration_id = 0; | 1934 | hdr.duration_id = 0; |
| 1918 | hdr.seq_ctrl = 0; | 1935 | hdr.seq_ctrl = 0; |
| @@ -1931,6 +1948,9 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
| 1931 | encaps_len = 0; | 1948 | encaps_len = 0; |
| 1932 | } | 1949 | } |
| 1933 | 1950 | ||
| 1951 | nh_pos = skb_network_header(skb) - skb->data; | ||
| 1952 | h_pos = skb_transport_header(skb) - skb->data; | ||
| 1953 | |||
| 1934 | skb_pull(skb, skip_header_bytes); | 1954 | skb_pull(skb, skip_header_bytes); |
| 1935 | nh_pos -= skip_header_bytes; | 1955 | nh_pos -= skip_header_bytes; |
| 1936 | h_pos -= skip_header_bytes; | 1956 | h_pos -= skip_header_bytes; |
diff --git a/net/mac80211/work.c b/net/mac80211/work.c index ae344d1ba056..146097cb43a7 100644 --- a/net/mac80211/work.c +++ b/net/mac80211/work.c | |||
| @@ -1051,11 +1051,13 @@ void ieee80211_work_purge(struct ieee80211_sub_if_data *sdata) | |||
| 1051 | { | 1051 | { |
| 1052 | struct ieee80211_local *local = sdata->local; | 1052 | struct ieee80211_local *local = sdata->local; |
| 1053 | struct ieee80211_work *wk; | 1053 | struct ieee80211_work *wk; |
| 1054 | bool cleanup = false; | ||
| 1054 | 1055 | ||
| 1055 | mutex_lock(&local->mtx); | 1056 | mutex_lock(&local->mtx); |
| 1056 | list_for_each_entry(wk, &local->work_list, list) { | 1057 | list_for_each_entry(wk, &local->work_list, list) { |
| 1057 | if (wk->sdata != sdata) | 1058 | if (wk->sdata != sdata) |
| 1058 | continue; | 1059 | continue; |
| 1060 | cleanup = true; | ||
| 1059 | wk->type = IEEE80211_WORK_ABORT; | 1061 | wk->type = IEEE80211_WORK_ABORT; |
| 1060 | wk->started = true; | 1062 | wk->started = true; |
| 1061 | wk->timeout = jiffies; | 1063 | wk->timeout = jiffies; |
| @@ -1063,7 +1065,8 @@ void ieee80211_work_purge(struct ieee80211_sub_if_data *sdata) | |||
| 1063 | mutex_unlock(&local->mtx); | 1065 | mutex_unlock(&local->mtx); |
| 1064 | 1066 | ||
| 1065 | /* run cleanups etc. */ | 1067 | /* run cleanups etc. */ |
| 1066 | ieee80211_work_work(&local->work_work); | 1068 | if (cleanup) |
| 1069 | ieee80211_work_work(&local->work_work); | ||
| 1067 | 1070 | ||
| 1068 | mutex_lock(&local->mtx); | 1071 | mutex_lock(&local->mtx); |
| 1069 | list_for_each_entry(wk, &local->work_list, list) { | 1072 | list_for_each_entry(wk, &local->work_list, list) { |
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c index 3cf478d012dd..7150705f1d0b 100644 --- a/net/sched/sch_sfq.c +++ b/net/sched/sch_sfq.c | |||
| @@ -270,7 +270,6 @@ static unsigned int sfq_drop(struct Qdisc *sch) | |||
| 270 | /* It is difficult to believe, but ALL THE SLOTS HAVE LENGTH 1. */ | 270 | /* It is difficult to believe, but ALL THE SLOTS HAVE LENGTH 1. */ |
| 271 | d = q->next[q->tail]; | 271 | d = q->next[q->tail]; |
| 272 | q->next[q->tail] = q->next[d]; | 272 | q->next[q->tail] = q->next[d]; |
| 273 | q->allot[q->next[d]] += q->quantum; | ||
| 274 | skb = q->qs[d].prev; | 273 | skb = q->qs[d].prev; |
| 275 | len = qdisc_pkt_len(skb); | 274 | len = qdisc_pkt_len(skb); |
| 276 | __skb_unlink(skb, &q->qs[d]); | 275 | __skb_unlink(skb, &q->qs[d]); |
| @@ -321,14 +320,13 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
| 321 | sfq_inc(q, x); | 320 | sfq_inc(q, x); |
| 322 | if (q->qs[x].qlen == 1) { /* The flow is new */ | 321 | if (q->qs[x].qlen == 1) { /* The flow is new */ |
| 323 | if (q->tail == SFQ_DEPTH) { /* It is the first flow */ | 322 | if (q->tail == SFQ_DEPTH) { /* It is the first flow */ |
| 324 | q->tail = x; | ||
| 325 | q->next[x] = x; | 323 | q->next[x] = x; |
| 326 | q->allot[x] = q->quantum; | ||
| 327 | } else { | 324 | } else { |
| 328 | q->next[x] = q->next[q->tail]; | 325 | q->next[x] = q->next[q->tail]; |
| 329 | q->next[q->tail] = x; | 326 | q->next[q->tail] = x; |
| 330 | q->tail = x; | ||
| 331 | } | 327 | } |
| 328 | q->tail = x; | ||
| 329 | q->allot[x] = q->quantum; | ||
| 332 | } | 330 | } |
| 333 | if (++sch->q.qlen <= q->limit) { | 331 | if (++sch->q.qlen <= q->limit) { |
| 334 | sch->bstats.bytes += qdisc_pkt_len(skb); | 332 | sch->bstats.bytes += qdisc_pkt_len(skb); |
| @@ -359,13 +357,13 @@ sfq_dequeue(struct Qdisc *sch) | |||
| 359 | { | 357 | { |
| 360 | struct sfq_sched_data *q = qdisc_priv(sch); | 358 | struct sfq_sched_data *q = qdisc_priv(sch); |
| 361 | struct sk_buff *skb; | 359 | struct sk_buff *skb; |
| 362 | sfq_index a, old_a; | 360 | sfq_index a, next_a; |
| 363 | 361 | ||
| 364 | /* No active slots */ | 362 | /* No active slots */ |
| 365 | if (q->tail == SFQ_DEPTH) | 363 | if (q->tail == SFQ_DEPTH) |
| 366 | return NULL; | 364 | return NULL; |
| 367 | 365 | ||
| 368 | a = old_a = q->next[q->tail]; | 366 | a = q->next[q->tail]; |
| 369 | 367 | ||
| 370 | /* Grab packet */ | 368 | /* Grab packet */ |
| 371 | skb = __skb_dequeue(&q->qs[a]); | 369 | skb = __skb_dequeue(&q->qs[a]); |
| @@ -376,17 +374,15 @@ sfq_dequeue(struct Qdisc *sch) | |||
| 376 | /* Is the slot empty? */ | 374 | /* Is the slot empty? */ |
| 377 | if (q->qs[a].qlen == 0) { | 375 | if (q->qs[a].qlen == 0) { |
| 378 | q->ht[q->hash[a]] = SFQ_DEPTH; | 376 | q->ht[q->hash[a]] = SFQ_DEPTH; |
| 379 | a = q->next[a]; | 377 | next_a = q->next[a]; |
| 380 | if (a == old_a) { | 378 | if (a == next_a) { |
| 381 | q->tail = SFQ_DEPTH; | 379 | q->tail = SFQ_DEPTH; |
| 382 | return skb; | 380 | return skb; |
| 383 | } | 381 | } |
| 384 | q->next[q->tail] = a; | 382 | q->next[q->tail] = next_a; |
| 385 | q->allot[a] += q->quantum; | ||
| 386 | } else if ((q->allot[a] -= qdisc_pkt_len(skb)) <= 0) { | 383 | } else if ((q->allot[a] -= qdisc_pkt_len(skb)) <= 0) { |
| 387 | q->tail = a; | ||
| 388 | a = q->next[a]; | ||
| 389 | q->allot[a] += q->quantum; | 384 | q->allot[a] += q->quantum; |
| 385 | q->tail = a; | ||
| 390 | } | 386 | } |
| 391 | return skb; | 387 | return skb; |
| 392 | } | 388 | } |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 6bd554323a34..fff0926b1111 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
| @@ -2932,6 +2932,7 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva | |||
| 2932 | struct sctp_association *asoc = NULL; | 2932 | struct sctp_association *asoc = NULL; |
| 2933 | struct sctp_setpeerprim prim; | 2933 | struct sctp_setpeerprim prim; |
| 2934 | struct sctp_chunk *chunk; | 2934 | struct sctp_chunk *chunk; |
| 2935 | struct sctp_af *af; | ||
| 2935 | int err; | 2936 | int err; |
| 2936 | 2937 | ||
| 2937 | sp = sctp_sk(sk); | 2938 | sp = sctp_sk(sk); |
| @@ -2959,6 +2960,13 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva | |||
| 2959 | if (!sctp_state(asoc, ESTABLISHED)) | 2960 | if (!sctp_state(asoc, ESTABLISHED)) |
| 2960 | return -ENOTCONN; | 2961 | return -ENOTCONN; |
| 2961 | 2962 | ||
| 2963 | af = sctp_get_af_specific(prim.sspp_addr.ss_family); | ||
| 2964 | if (!af) | ||
| 2965 | return -EINVAL; | ||
| 2966 | |||
| 2967 | if (!af->addr_valid((union sctp_addr *)&prim.sspp_addr, sp, NULL)) | ||
| 2968 | return -EADDRNOTAVAIL; | ||
| 2969 | |||
| 2962 | if (!sctp_assoc_lookup_laddr(asoc, (union sctp_addr *)&prim.sspp_addr)) | 2970 | if (!sctp_assoc_lookup_laddr(asoc, (union sctp_addr *)&prim.sspp_addr)) |
| 2963 | return -EADDRNOTAVAIL; | 2971 | return -EADDRNOTAVAIL; |
| 2964 | 2972 | ||
| @@ -5045,7 +5053,7 @@ static int sctp_getsockopt_partial_delivery_point(struct sock *sk, int len, | |||
| 5045 | if (copy_to_user(optval, &val, len)) | 5053 | if (copy_to_user(optval, &val, len)) |
| 5046 | return -EFAULT; | 5054 | return -EFAULT; |
| 5047 | 5055 | ||
| 5048 | return -ENOTSUPP; | 5056 | return 0; |
| 5049 | } | 5057 | } |
| 5050 | 5058 | ||
| 5051 | /* | 5059 | /* |
diff --git a/net/socket.c b/net/socket.c index 3ca2fd9e3720..088fb3fd45e0 100644 --- a/net/socket.c +++ b/net/socket.c | |||
| @@ -732,6 +732,21 @@ static int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg, | |||
| 732 | return ret; | 732 | return ret; |
| 733 | } | 733 | } |
| 734 | 734 | ||
| 735 | /** | ||
| 736 | * kernel_recvmsg - Receive a message from a socket (kernel space) | ||
| 737 | * @sock: The socket to receive the message from | ||
| 738 | * @msg: Received message | ||
| 739 | * @vec: Input s/g array for message data | ||
| 740 | * @num: Size of input s/g array | ||
| 741 | * @size: Number of bytes to read | ||
| 742 | * @flags: Message flags (MSG_DONTWAIT, etc...) | ||
| 743 | * | ||
| 744 | * On return the msg structure contains the scatter/gather array passed in the | ||
| 745 | * vec argument. The array is modified so that it consists of the unfilled | ||
| 746 | * portion of the original array. | ||
| 747 | * | ||
| 748 | * The returned value is the total number of bytes received, or an error. | ||
| 749 | */ | ||
| 735 | int kernel_recvmsg(struct socket *sock, struct msghdr *msg, | 750 | int kernel_recvmsg(struct socket *sock, struct msghdr *msg, |
| 736 | struct kvec *vec, size_t num, size_t size, int flags) | 751 | struct kvec *vec, size_t num, size_t size, int flags) |
| 737 | { | 752 | { |
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index ea2ff78dcf7b..3f2c5559ca1a 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c | |||
| @@ -212,6 +212,7 @@ int svc_create_xprt(struct svc_serv *serv, const char *xprt_name, | |||
| 212 | spin_lock(&svc_xprt_class_lock); | 212 | spin_lock(&svc_xprt_class_lock); |
| 213 | list_for_each_entry(xcl, &svc_xprt_class_list, xcl_list) { | 213 | list_for_each_entry(xcl, &svc_xprt_class_list, xcl_list) { |
| 214 | struct svc_xprt *newxprt; | 214 | struct svc_xprt *newxprt; |
| 215 | unsigned short newport; | ||
| 215 | 216 | ||
| 216 | if (strcmp(xprt_name, xcl->xcl_name)) | 217 | if (strcmp(xprt_name, xcl->xcl_name)) |
| 217 | continue; | 218 | continue; |
| @@ -230,8 +231,9 @@ int svc_create_xprt(struct svc_serv *serv, const char *xprt_name, | |||
| 230 | spin_lock_bh(&serv->sv_lock); | 231 | spin_lock_bh(&serv->sv_lock); |
| 231 | list_add(&newxprt->xpt_list, &serv->sv_permsocks); | 232 | list_add(&newxprt->xpt_list, &serv->sv_permsocks); |
| 232 | spin_unlock_bh(&serv->sv_lock); | 233 | spin_unlock_bh(&serv->sv_lock); |
| 234 | newport = svc_xprt_local_port(newxprt); | ||
| 233 | clear_bit(XPT_BUSY, &newxprt->xpt_flags); | 235 | clear_bit(XPT_BUSY, &newxprt->xpt_flags); |
| 234 | return svc_xprt_local_port(newxprt); | 236 | return newport; |
| 235 | } | 237 | } |
| 236 | err: | 238 | err: |
| 237 | spin_unlock(&svc_xprt_class_lock); | 239 | spin_unlock(&svc_xprt_class_lock); |
| @@ -425,8 +427,13 @@ void svc_xprt_received(struct svc_xprt *xprt) | |||
| 425 | { | 427 | { |
| 426 | BUG_ON(!test_bit(XPT_BUSY, &xprt->xpt_flags)); | 428 | BUG_ON(!test_bit(XPT_BUSY, &xprt->xpt_flags)); |
| 427 | xprt->xpt_pool = NULL; | 429 | xprt->xpt_pool = NULL; |
| 430 | /* As soon as we clear busy, the xprt could be closed and | ||
| 431 | * 'put', so we need a reference to call svc_xprt_enqueue with: | ||
| 432 | */ | ||
| 433 | svc_xprt_get(xprt); | ||
| 428 | clear_bit(XPT_BUSY, &xprt->xpt_flags); | 434 | clear_bit(XPT_BUSY, &xprt->xpt_flags); |
| 429 | svc_xprt_enqueue(xprt); | 435 | svc_xprt_enqueue(xprt); |
| 436 | svc_xprt_put(xprt); | ||
| 430 | } | 437 | } |
| 431 | EXPORT_SYMBOL_GPL(svc_xprt_received); | 438 | EXPORT_SYMBOL_GPL(svc_xprt_received); |
| 432 | 439 | ||
diff --git a/net/x25/x25_link.c b/net/x25/x25_link.c index 73e7b954ad28..b25c6463c3e9 100644 --- a/net/x25/x25_link.c +++ b/net/x25/x25_link.c | |||
| @@ -394,6 +394,7 @@ void __exit x25_link_free(void) | |||
| 394 | list_for_each_safe(entry, tmp, &x25_neigh_list) { | 394 | list_for_each_safe(entry, tmp, &x25_neigh_list) { |
| 395 | nb = list_entry(entry, struct x25_neigh, node); | 395 | nb = list_entry(entry, struct x25_neigh, node); |
| 396 | __x25_remove_neigh(nb); | 396 | __x25_remove_neigh(nb); |
| 397 | dev_put(nb->dev); | ||
| 397 | } | 398 | } |
| 398 | write_unlock_bh(&x25_neigh_list_lock); | 399 | write_unlock_bh(&x25_neigh_list_lock); |
| 399 | } | 400 | } |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index eb96ce52f178..220ebc05c7af 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
| @@ -1268,7 +1268,7 @@ struct xfrm_state * xfrm_state_migrate(struct xfrm_state *x, | |||
| 1268 | 1268 | ||
| 1269 | return xc; | 1269 | return xc; |
| 1270 | error: | 1270 | error: |
| 1271 | kfree(xc); | 1271 | xfrm_state_put(xc); |
| 1272 | return NULL; | 1272 | return NULL; |
| 1273 | } | 1273 | } |
| 1274 | EXPORT_SYMBOL(xfrm_state_migrate); | 1274 | EXPORT_SYMBOL(xfrm_state_migrate); |
