diff options
Diffstat (limited to 'net')
33 files changed, 246 insertions, 149 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/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/ceph/Makefile b/net/ceph/Makefile index aab1cabb8035..5f19415ec9c0 100644 --- a/net/ceph/Makefile +++ b/net/ceph/Makefile | |||
| @@ -1,9 +1,6 @@ | |||
| 1 | # | 1 | # |
| 2 | # Makefile for CEPH filesystem. | 2 | # Makefile for CEPH filesystem. |
| 3 | # | 3 | # |
| 4 | |||
| 5 | ifneq ($(KERNELRELEASE),) | ||
| 6 | |||
| 7 | obj-$(CONFIG_CEPH_LIB) += libceph.o | 4 | obj-$(CONFIG_CEPH_LIB) += libceph.o |
| 8 | 5 | ||
| 9 | libceph-objs := ceph_common.o messenger.o msgpool.o buffer.o pagelist.o \ | 6 | libceph-objs := ceph_common.o messenger.o msgpool.o buffer.o pagelist.o \ |
| @@ -16,22 +13,3 @@ libceph-objs := ceph_common.o messenger.o msgpool.o buffer.o pagelist.o \ | |||
| 16 | ceph_fs.o ceph_strings.o ceph_hash.o \ | 13 | ceph_fs.o ceph_strings.o ceph_hash.o \ |
| 17 | pagevec.o | 14 | pagevec.o |
| 18 | 15 | ||
| 19 | else | ||
| 20 | #Otherwise we were called directly from the command | ||
| 21 | # line; invoke the kernel build system. | ||
| 22 | |||
| 23 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build | ||
| 24 | PWD := $(shell pwd) | ||
| 25 | |||
| 26 | default: all | ||
| 27 | |||
| 28 | all: | ||
| 29 | $(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_CEPH_LIB=m modules | ||
| 30 | |||
| 31 | modules_install: | ||
| 32 | $(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_CEPH_LIB=m modules_install | ||
| 33 | |||
| 34 | clean: | ||
| 35 | $(MAKE) -C $(KERNELDIR) M=$(PWD) clean | ||
| 36 | |||
| 37 | endif | ||
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/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/dccp/input.c b/net/dccp/input.c index 265985370fa1..e424a09e83f6 100644 --- a/net/dccp/input.c +++ b/net/dccp/input.c | |||
| @@ -239,7 +239,8 @@ static int dccp_check_seqno(struct sock *sk, struct sk_buff *skb) | |||
| 239 | dccp_update_gsr(sk, seqno); | 239 | dccp_update_gsr(sk, seqno); |
| 240 | 240 | ||
| 241 | if (dh->dccph_type != DCCP_PKT_SYNC && | 241 | if (dh->dccph_type != DCCP_PKT_SYNC && |
| 242 | (ackno != DCCP_PKT_WITHOUT_ACK_SEQ)) | 242 | ackno != DCCP_PKT_WITHOUT_ACK_SEQ && |
| 243 | after48(ackno, dp->dccps_gar)) | ||
| 243 | dp->dccps_gar = ackno; | 244 | dp->dccps_gar = ackno; |
| 244 | } else { | 245 | } else { |
| 245 | unsigned long now = jiffies; | 246 | unsigned long now = jiffies; |
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index a76b78de679f..6f97268ed85f 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c | |||
| @@ -1556,6 +1556,8 @@ static int __dn_getsockopt(struct socket *sock, int level,int optname, char __us | |||
| 1556 | if (r_len > sizeof(struct linkinfo_dn)) | 1556 | if (r_len > sizeof(struct linkinfo_dn)) |
| 1557 | r_len = sizeof(struct linkinfo_dn); | 1557 | r_len = sizeof(struct linkinfo_dn); |
| 1558 | 1558 | ||
| 1559 | memset(&link, 0, sizeof(link)); | ||
| 1560 | |||
| 1559 | switch(sock->state) { | 1561 | switch(sock->state) { |
| 1560 | case SS_CONNECTING: | 1562 | case SS_CONNECTING: |
| 1561 | link.idn_linkstate = LL_CONNECTING; | 1563 | link.idn_linkstate = LL_CONNECTING; |
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c index f8c1ae4b41f0..15dcc1a586b4 100644 --- a/net/econet/af_econet.c +++ b/net/econet/af_econet.c | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #include <linux/skbuff.h> | 31 | #include <linux/skbuff.h> |
| 32 | #include <linux/udp.h> | 32 | #include <linux/udp.h> |
| 33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
| 34 | #include <linux/vmalloc.h> | ||
| 34 | #include <net/sock.h> | 35 | #include <net/sock.h> |
| 35 | #include <net/inet_common.h> | 36 | #include <net/inet_common.h> |
| 36 | #include <linux/stat.h> | 37 | #include <linux/stat.h> |
| @@ -276,12 +277,12 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
| 276 | #endif | 277 | #endif |
| 277 | #ifdef CONFIG_ECONET_AUNUDP | 278 | #ifdef CONFIG_ECONET_AUNUDP |
| 278 | struct msghdr udpmsg; | 279 | struct msghdr udpmsg; |
| 279 | struct iovec iov[msg->msg_iovlen+1]; | 280 | struct iovec iov[2]; |
| 280 | struct aunhdr ah; | 281 | struct aunhdr ah; |
| 281 | struct sockaddr_in udpdest; | 282 | struct sockaddr_in udpdest; |
| 282 | __kernel_size_t size; | 283 | __kernel_size_t size; |
| 283 | int i; | ||
| 284 | mm_segment_t oldfs; | 284 | mm_segment_t oldfs; |
| 285 | char *userbuf; | ||
| 285 | #endif | 286 | #endif |
| 286 | 287 | ||
| 287 | /* | 288 | /* |
| @@ -297,23 +298,14 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
| 297 | 298 | ||
| 298 | mutex_lock(&econet_mutex); | 299 | mutex_lock(&econet_mutex); |
| 299 | 300 | ||
| 300 | if (saddr == NULL) { | 301 | if (saddr == NULL || msg->msg_namelen < sizeof(struct sockaddr_ec)) { |
| 301 | struct econet_sock *eo = ec_sk(sk); | 302 | mutex_unlock(&econet_mutex); |
| 302 | 303 | return -EINVAL; | |
| 303 | addr.station = eo->station; | 304 | } |
| 304 | addr.net = eo->net; | 305 | addr.station = saddr->addr.station; |
| 305 | port = eo->port; | 306 | addr.net = saddr->addr.net; |
| 306 | cb = eo->cb; | 307 | port = saddr->port; |
| 307 | } else { | 308 | cb = saddr->cb; |
| 308 | if (msg->msg_namelen < sizeof(struct sockaddr_ec)) { | ||
| 309 | mutex_unlock(&econet_mutex); | ||
| 310 | return -EINVAL; | ||
| 311 | } | ||
| 312 | addr.station = saddr->addr.station; | ||
| 313 | addr.net = saddr->addr.net; | ||
| 314 | port = saddr->port; | ||
| 315 | cb = saddr->cb; | ||
| 316 | } | ||
| 317 | 309 | ||
| 318 | /* Look for a device with the right network number. */ | 310 | /* Look for a device with the right network number. */ |
| 319 | dev = net2dev_map[addr.net]; | 311 | dev = net2dev_map[addr.net]; |
| @@ -328,17 +320,17 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
| 328 | } | 320 | } |
| 329 | } | 321 | } |
| 330 | 322 | ||
| 331 | if (len + 15 > dev->mtu) { | ||
| 332 | mutex_unlock(&econet_mutex); | ||
| 333 | return -EMSGSIZE; | ||
| 334 | } | ||
| 335 | |||
| 336 | if (dev->type == ARPHRD_ECONET) { | 323 | if (dev->type == ARPHRD_ECONET) { |
| 337 | /* Real hardware Econet. We're not worthy etc. */ | 324 | /* Real hardware Econet. We're not worthy etc. */ |
| 338 | #ifdef CONFIG_ECONET_NATIVE | 325 | #ifdef CONFIG_ECONET_NATIVE |
| 339 | unsigned short proto = 0; | 326 | unsigned short proto = 0; |
| 340 | int res; | 327 | int res; |
| 341 | 328 | ||
| 329 | if (len + 15 > dev->mtu) { | ||
| 330 | mutex_unlock(&econet_mutex); | ||
| 331 | return -EMSGSIZE; | ||
| 332 | } | ||
| 333 | |||
| 342 | dev_hold(dev); | 334 | dev_hold(dev); |
| 343 | 335 | ||
| 344 | skb = sock_alloc_send_skb(sk, len+LL_ALLOCATED_SPACE(dev), | 336 | skb = sock_alloc_send_skb(sk, len+LL_ALLOCATED_SPACE(dev), |
| @@ -351,7 +343,6 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
| 351 | 343 | ||
| 352 | eb = (struct ec_cb *)&skb->cb; | 344 | eb = (struct ec_cb *)&skb->cb; |
| 353 | 345 | ||
| 354 | /* BUG: saddr may be NULL */ | ||
| 355 | eb->cookie = saddr->cookie; | 346 | eb->cookie = saddr->cookie; |
| 356 | eb->sec = *saddr; | 347 | eb->sec = *saddr; |
| 357 | eb->sent = ec_tx_done; | 348 | eb->sent = ec_tx_done; |
| @@ -415,6 +406,11 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
| 415 | return -ENETDOWN; /* No socket - can't send */ | 406 | return -ENETDOWN; /* No socket - can't send */ |
| 416 | } | 407 | } |
| 417 | 408 | ||
| 409 | if (len > 32768) { | ||
| 410 | err = -E2BIG; | ||
| 411 | goto error; | ||
| 412 | } | ||
| 413 | |||
| 418 | /* Make up a UDP datagram and hand it off to some higher intellect. */ | 414 | /* Make up a UDP datagram and hand it off to some higher intellect. */ |
| 419 | 415 | ||
| 420 | memset(&udpdest, 0, sizeof(udpdest)); | 416 | memset(&udpdest, 0, sizeof(udpdest)); |
| @@ -446,36 +442,26 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
| 446 | 442 | ||
| 447 | /* tack our header on the front of the iovec */ | 443 | /* tack our header on the front of the iovec */ |
| 448 | size = sizeof(struct aunhdr); | 444 | size = sizeof(struct aunhdr); |
| 449 | /* | ||
| 450 | * XXX: that is b0rken. We can't mix userland and kernel pointers | ||
| 451 | * in iovec, since on a lot of platforms copy_from_user() will | ||
| 452 | * *not* work with the kernel and userland ones at the same time, | ||
| 453 | * regardless of what we do with set_fs(). And we are talking about | ||
| 454 | * econet-over-ethernet here, so "it's only ARM anyway" doesn't | ||
| 455 | * apply. Any suggestions on fixing that code? -- AV | ||
| 456 | */ | ||
| 457 | iov[0].iov_base = (void *)&ah; | 445 | iov[0].iov_base = (void *)&ah; |
| 458 | iov[0].iov_len = size; | 446 | iov[0].iov_len = size; |
| 459 | for (i = 0; i < msg->msg_iovlen; i++) { | 447 | |
| 460 | void __user *base = msg->msg_iov[i].iov_base; | 448 | userbuf = vmalloc(len); |
| 461 | size_t iov_len = msg->msg_iov[i].iov_len; | 449 | if (userbuf == NULL) { |
| 462 | /* Check it now since we switch to KERNEL_DS later. */ | 450 | err = -ENOMEM; |
| 463 | if (!access_ok(VERIFY_READ, base, iov_len)) { | 451 | goto error; |
| 464 | mutex_unlock(&econet_mutex); | ||
| 465 | return -EFAULT; | ||
| 466 | } | ||
| 467 | iov[i+1].iov_base = base; | ||
| 468 | iov[i+1].iov_len = iov_len; | ||
| 469 | size += iov_len; | ||
| 470 | } | 452 | } |
| 471 | 453 | ||
| 454 | iov[1].iov_base = userbuf; | ||
| 455 | iov[1].iov_len = len; | ||
| 456 | err = memcpy_fromiovec(userbuf, msg->msg_iov, len); | ||
| 457 | if (err) | ||
| 458 | goto error_free_buf; | ||
| 459 | |||
| 472 | /* Get a skbuff (no data, just holds our cb information) */ | 460 | /* Get a skbuff (no data, just holds our cb information) */ |
| 473 | if ((skb = sock_alloc_send_skb(sk, 0, | 461 | if ((skb = sock_alloc_send_skb(sk, 0, |
| 474 | msg->msg_flags & MSG_DONTWAIT, | 462 | msg->msg_flags & MSG_DONTWAIT, |
| 475 | &err)) == NULL) { | 463 | &err)) == NULL) |
| 476 | mutex_unlock(&econet_mutex); | 464 | goto error_free_buf; |
| 477 | return err; | ||
| 478 | } | ||
| 479 | 465 | ||
| 480 | eb = (struct ec_cb *)&skb->cb; | 466 | eb = (struct ec_cb *)&skb->cb; |
| 481 | 467 | ||
| @@ -491,7 +477,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
| 491 | udpmsg.msg_name = (void *)&udpdest; | 477 | udpmsg.msg_name = (void *)&udpdest; |
| 492 | udpmsg.msg_namelen = sizeof(udpdest); | 478 | udpmsg.msg_namelen = sizeof(udpdest); |
| 493 | udpmsg.msg_iov = &iov[0]; | 479 | udpmsg.msg_iov = &iov[0]; |
| 494 | udpmsg.msg_iovlen = msg->msg_iovlen + 1; | 480 | udpmsg.msg_iovlen = 2; |
| 495 | udpmsg.msg_control = NULL; | 481 | udpmsg.msg_control = NULL; |
| 496 | udpmsg.msg_controllen = 0; | 482 | udpmsg.msg_controllen = 0; |
| 497 | udpmsg.msg_flags=0; | 483 | udpmsg.msg_flags=0; |
| @@ -499,9 +485,13 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
| 499 | oldfs = get_fs(); set_fs(KERNEL_DS); /* More privs :-) */ | 485 | oldfs = get_fs(); set_fs(KERNEL_DS); /* More privs :-) */ |
| 500 | err = sock_sendmsg(udpsock, &udpmsg, size); | 486 | err = sock_sendmsg(udpsock, &udpmsg, size); |
| 501 | set_fs(oldfs); | 487 | set_fs(oldfs); |
| 488 | |||
| 489 | error_free_buf: | ||
| 490 | vfree(userbuf); | ||
| 502 | #else | 491 | #else |
| 503 | err = -EPROTOTYPE; | 492 | err = -EPROTOTYPE; |
| 504 | #endif | 493 | #endif |
| 494 | error: | ||
| 505 | mutex_unlock(&econet_mutex); | 495 | mutex_unlock(&econet_mutex); |
| 506 | 496 | ||
| 507 | return err; | 497 | return err; |
| @@ -671,6 +661,11 @@ static int ec_dev_ioctl(struct socket *sock, unsigned int cmd, void __user *arg) | |||
| 671 | err = 0; | 661 | err = 0; |
| 672 | switch (cmd) { | 662 | switch (cmd) { |
| 673 | case SIOCSIFADDR: | 663 | case SIOCSIFADDR: |
| 664 | if (!capable(CAP_NET_ADMIN)) { | ||
| 665 | err = -EPERM; | ||
| 666 | break; | ||
| 667 | } | ||
| 668 | |||
| 674 | edev = dev->ec_ptr; | 669 | edev = dev->ec_ptr; |
| 675 | if (edev == NULL) { | 670 | if (edev == NULL) { |
| 676 | /* Magic up a new one. */ | 671 | /* Magic up a new one. */ |
| @@ -856,9 +851,13 @@ static void aun_incoming(struct sk_buff *skb, struct aunhdr *ah, size_t len) | |||
| 856 | { | 851 | { |
| 857 | struct iphdr *ip = ip_hdr(skb); | 852 | struct iphdr *ip = ip_hdr(skb); |
| 858 | 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; | ||
| 859 | struct sock *sk = NULL; | 856 | struct sock *sk = NULL; |
| 860 | struct sk_buff *newskb; | 857 | struct sk_buff *newskb; |
| 861 | struct ec_device *edev = skb->dev->ec_ptr; | 858 | |
| 859 | if (dst) | ||
| 860 | edev = dst->dev->ec_ptr; | ||
| 862 | 861 | ||
| 863 | if (! edev) | 862 | if (! edev) |
| 864 | goto bad; | 863 | goto bad; |
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index 1b344f30b463..3c0369a3a663 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c | |||
| @@ -133,8 +133,7 @@ int __inet_inherit_port(struct sock *sk, struct sock *child) | |||
| 133 | } | 133 | } |
| 134 | } | 134 | } |
| 135 | } | 135 | } |
| 136 | sk_add_bind_node(child, &tb->owners); | 136 | inet_bind_hash(child, tb, port); |
| 137 | inet_csk(child)->icsk_bind_hash = tb; | ||
| 138 | spin_unlock(&head->lock); | 137 | spin_unlock(&head->lock); |
| 139 | 138 | ||
| 140 | return 0; | 139 | return 0; |
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/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index e91911d7aae2..1b4ec21497a4 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c | |||
| @@ -26,6 +26,8 @@ static int zero; | |||
| 26 | static int tcp_retr1_max = 255; | 26 | static int tcp_retr1_max = 255; |
| 27 | static int ip_local_port_range_min[] = { 1, 1 }; | 27 | static int ip_local_port_range_min[] = { 1, 1 }; |
| 28 | static int ip_local_port_range_max[] = { 65535, 65535 }; | 28 | static int ip_local_port_range_max[] = { 65535, 65535 }; |
| 29 | static int tcp_adv_win_scale_min = -31; | ||
| 30 | static int tcp_adv_win_scale_max = 31; | ||
| 29 | 31 | ||
| 30 | /* Update system visible IP port range */ | 32 | /* Update system visible IP port range */ |
| 31 | static void set_local_port_range(int range[2]) | 33 | static void set_local_port_range(int range[2]) |
| @@ -426,7 +428,9 @@ static struct ctl_table ipv4_table[] = { | |||
| 426 | .data = &sysctl_tcp_adv_win_scale, | 428 | .data = &sysctl_tcp_adv_win_scale, |
| 427 | .maxlen = sizeof(int), | 429 | .maxlen = sizeof(int), |
| 428 | .mode = 0644, | 430 | .mode = 0644, |
| 429 | .proc_handler = proc_dointvec | 431 | .proc_handler = proc_dointvec_minmax, |
| 432 | .extra1 = &tcp_adv_win_scale_min, | ||
| 433 | .extra2 = &tcp_adv_win_scale_max, | ||
| 430 | }, | 434 | }, |
| 431 | { | 435 | { |
| 432 | .procname = "tcp_tw_reuse", | 436 | .procname = "tcp_tw_reuse", |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 081419969485..f15c36a706ec 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
| @@ -2246,7 +2246,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level, | |||
| 2246 | /* Values greater than interface MTU won't take effect. However | 2246 | /* Values greater than interface MTU won't take effect. However |
| 2247 | * at the point when this call is done we typically don't yet | 2247 | * at the point when this call is done we typically don't yet |
| 2248 | * know which interface is going to be used */ | 2248 | * know which interface is going to be used */ |
| 2249 | if (val < 64 || val > MAX_TCP_WINDOW) { | 2249 | if (val < TCP_MIN_MSS || val > MAX_TCP_WINDOW) { |
| 2250 | err = -EINVAL; | 2250 | err = -EINVAL; |
| 2251 | break; | 2251 | break; |
| 2252 | } | 2252 | } |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 69ccbc1dde9c..e13da6de1fc7 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
| @@ -2043,7 +2043,9 @@ get_req: | |||
| 2043 | } | 2043 | } |
| 2044 | get_sk: | 2044 | get_sk: |
| 2045 | sk_nulls_for_each_from(sk, node) { | 2045 | sk_nulls_for_each_from(sk, node) { |
| 2046 | if (sk->sk_family == st->family && net_eq(sock_net(sk), net)) { | 2046 | if (!net_eq(sock_net(sk), net)) |
| 2047 | continue; | ||
| 2048 | if (sk->sk_family == st->family) { | ||
| 2047 | cur = sk; | 2049 | cur = sk; |
| 2048 | goto out; | 2050 | goto out; |
| 2049 | } | 2051 | } |
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/ipv6/addrconf.c b/net/ipv6/addrconf.c index 23cc8e1ce8d4..93b7a933a775 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
| @@ -4021,11 +4021,11 @@ void inet6_ifinfo_notify(int event, struct inet6_dev *idev) | |||
| 4021 | kfree_skb(skb); | 4021 | kfree_skb(skb); |
| 4022 | goto errout; | 4022 | goto errout; |
| 4023 | } | 4023 | } |
| 4024 | rtnl_notify(skb, net, 0, RTNLGRP_IPV6_IFADDR, NULL, GFP_ATOMIC); | 4024 | rtnl_notify(skb, net, 0, RTNLGRP_IPV6_IFINFO, NULL, GFP_ATOMIC); |
| 4025 | return; | 4025 | return; |
| 4026 | errout: | 4026 | errout: |
| 4027 | if (err < 0) | 4027 | if (err < 0) |
| 4028 | rtnl_set_sk_err(net, RTNLGRP_IPV6_IFADDR, err); | 4028 | rtnl_set_sk_err(net, RTNLGRP_IPV6_IFINFO, err); |
| 4029 | } | 4029 | } |
| 4030 | 4030 | ||
| 4031 | static inline size_t inet6_prefix_nlmsg_size(void) | 4031 | static inline size_t inet6_prefix_nlmsg_size(void) |
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/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/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/Kconfig b/net/mac80211/Kconfig index 4d6f8653ec88..8e8ea9cb7093 100644 --- a/net/mac80211/Kconfig +++ b/net/mac80211/Kconfig | |||
| @@ -92,7 +92,7 @@ config MAC80211_MESH | |||
| 92 | config MAC80211_LEDS | 92 | config MAC80211_LEDS |
| 93 | bool "Enable LED triggers" | 93 | bool "Enable LED triggers" |
| 94 | depends on MAC80211 | 94 | depends on MAC80211 |
| 95 | select NEW_LEDS | 95 | depends on LEDS_CLASS |
| 96 | select LEDS_TRIGGERS | 96 | select LEDS_TRIGGERS |
| 97 | ---help--- | 97 | ---help--- |
| 98 | This option enables a few LED triggers for different | 98 | This option enables a few LED triggers for different |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 902b03ee8f60..54fb4a0e76f0 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
| @@ -2247,6 +2247,10 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx) | |||
| 2247 | break; | 2247 | break; |
| 2248 | case cpu_to_le16(IEEE80211_STYPE_DEAUTH): | 2248 | case cpu_to_le16(IEEE80211_STYPE_DEAUTH): |
| 2249 | case cpu_to_le16(IEEE80211_STYPE_DISASSOC): | 2249 | case cpu_to_le16(IEEE80211_STYPE_DISASSOC): |
| 2250 | if (is_multicast_ether_addr(mgmt->da) && | ||
| 2251 | !is_broadcast_ether_addr(mgmt->da)) | ||
| 2252 | return RX_DROP_MONITOR; | ||
| 2253 | |||
| 2250 | /* process only for station */ | 2254 | /* process only for station */ |
| 2251 | if (sdata->vif.type != NL80211_IFTYPE_STATION) | 2255 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
| 2252 | return RX_DROP_MONITOR; | 2256 | return RX_DROP_MONITOR; |
| @@ -2741,6 +2745,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
| 2741 | 2745 | ||
| 2742 | if (ieee80211_prepare_and_rx_handle(&rx, skb, true)) | 2746 | if (ieee80211_prepare_and_rx_handle(&rx, skb, true)) |
| 2743 | return; | 2747 | return; |
| 2748 | goto out; | ||
| 2744 | } | 2749 | } |
| 2745 | } | 2750 | } |
| 2746 | 2751 | ||
| @@ -2780,6 +2785,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
| 2780 | return; | 2785 | return; |
| 2781 | } | 2786 | } |
| 2782 | 2787 | ||
| 2788 | out: | ||
| 2783 | dev_kfree_skb(skb); | 2789 | dev_kfree_skb(skb); |
| 2784 | } | 2790 | } |
| 2785 | 2791 | ||
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/sctp/socket.c b/net/sctp/socket.c index 6bd554323a34..0b9ee34ad35c 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 | ||
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/clnt.c b/net/sunrpc/clnt.c index 9dab9573be41..92ce94f5146b 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
| @@ -989,20 +989,26 @@ call_refreshresult(struct rpc_task *task) | |||
| 989 | dprint_status(task); | 989 | dprint_status(task); |
| 990 | 990 | ||
| 991 | task->tk_status = 0; | 991 | task->tk_status = 0; |
| 992 | task->tk_action = call_allocate; | 992 | task->tk_action = call_refresh; |
| 993 | if (status >= 0 && rpcauth_uptodatecred(task)) | ||
| 994 | return; | ||
| 995 | switch (status) { | 993 | switch (status) { |
| 996 | case -EACCES: | 994 | case 0: |
| 997 | rpc_exit(task, -EACCES); | 995 | if (rpcauth_uptodatecred(task)) |
| 998 | return; | 996 | task->tk_action = call_allocate; |
| 999 | case -ENOMEM: | ||
| 1000 | rpc_exit(task, -ENOMEM); | ||
| 1001 | return; | 997 | return; |
| 1002 | case -ETIMEDOUT: | 998 | case -ETIMEDOUT: |
| 1003 | rpc_delay(task, 3*HZ); | 999 | rpc_delay(task, 3*HZ); |
| 1000 | case -EAGAIN: | ||
| 1001 | status = -EACCES; | ||
| 1002 | if (!task->tk_cred_retry) | ||
| 1003 | break; | ||
| 1004 | task->tk_cred_retry--; | ||
| 1005 | dprintk("RPC: %5u %s: retry refresh creds\n", | ||
| 1006 | task->tk_pid, __func__); | ||
| 1007 | return; | ||
| 1004 | } | 1008 | } |
| 1005 | task->tk_action = call_refresh; | 1009 | dprintk("RPC: %5u %s: refresh creds failed with error %d\n", |
| 1010 | task->tk_pid, __func__, status); | ||
| 1011 | rpc_exit(task, status); | ||
| 1006 | } | 1012 | } |
| 1007 | 1013 | ||
| 1008 | /* | 1014 | /* |
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/unix/af_unix.c b/net/unix/af_unix.c index 3c95304a0817..2268e6798124 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
| @@ -1343,9 +1343,25 @@ static void unix_destruct_scm(struct sk_buff *skb) | |||
| 1343 | sock_wfree(skb); | 1343 | sock_wfree(skb); |
| 1344 | } | 1344 | } |
| 1345 | 1345 | ||
| 1346 | #define MAX_RECURSION_LEVEL 4 | ||
| 1347 | |||
| 1346 | static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) | 1348 | static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) |
| 1347 | { | 1349 | { |
| 1348 | int i; | 1350 | int i; |
| 1351 | unsigned char max_level = 0; | ||
| 1352 | int unix_sock_count = 0; | ||
| 1353 | |||
| 1354 | for (i = scm->fp->count - 1; i >= 0; i--) { | ||
| 1355 | struct sock *sk = unix_get_socket(scm->fp->fp[i]); | ||
| 1356 | |||
| 1357 | if (sk) { | ||
| 1358 | unix_sock_count++; | ||
| 1359 | max_level = max(max_level, | ||
| 1360 | unix_sk(sk)->recursion_level); | ||
| 1361 | } | ||
| 1362 | } | ||
| 1363 | if (unlikely(max_level > MAX_RECURSION_LEVEL)) | ||
| 1364 | return -ETOOMANYREFS; | ||
| 1349 | 1365 | ||
| 1350 | /* | 1366 | /* |
| 1351 | * Need to duplicate file references for the sake of garbage | 1367 | * Need to duplicate file references for the sake of garbage |
| @@ -1356,9 +1372,11 @@ static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) | |||
| 1356 | if (!UNIXCB(skb).fp) | 1372 | if (!UNIXCB(skb).fp) |
| 1357 | return -ENOMEM; | 1373 | return -ENOMEM; |
| 1358 | 1374 | ||
| 1359 | for (i = scm->fp->count-1; i >= 0; i--) | 1375 | if (unix_sock_count) { |
| 1360 | unix_inflight(scm->fp->fp[i]); | 1376 | for (i = scm->fp->count - 1; i >= 0; i--) |
| 1361 | return 0; | 1377 | unix_inflight(scm->fp->fp[i]); |
| 1378 | } | ||
| 1379 | return max_level; | ||
| 1362 | } | 1380 | } |
| 1363 | 1381 | ||
| 1364 | static int unix_scm_to_skb(struct scm_cookie *scm, struct sk_buff *skb, bool send_fds) | 1382 | static int unix_scm_to_skb(struct scm_cookie *scm, struct sk_buff *skb, bool send_fds) |
| @@ -1393,6 +1411,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
| 1393 | struct sk_buff *skb; | 1411 | struct sk_buff *skb; |
| 1394 | long timeo; | 1412 | long timeo; |
| 1395 | struct scm_cookie tmp_scm; | 1413 | struct scm_cookie tmp_scm; |
| 1414 | int max_level; | ||
| 1396 | 1415 | ||
| 1397 | if (NULL == siocb->scm) | 1416 | if (NULL == siocb->scm) |
| 1398 | siocb->scm = &tmp_scm; | 1417 | siocb->scm = &tmp_scm; |
| @@ -1431,8 +1450,9 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
| 1431 | goto out; | 1450 | goto out; |
| 1432 | 1451 | ||
| 1433 | err = unix_scm_to_skb(siocb->scm, skb, true); | 1452 | err = unix_scm_to_skb(siocb->scm, skb, true); |
| 1434 | if (err) | 1453 | if (err < 0) |
| 1435 | goto out_free; | 1454 | goto out_free; |
| 1455 | max_level = err + 1; | ||
| 1436 | unix_get_secdata(siocb->scm, skb); | 1456 | unix_get_secdata(siocb->scm, skb); |
| 1437 | 1457 | ||
| 1438 | skb_reset_transport_header(skb); | 1458 | skb_reset_transport_header(skb); |
| @@ -1514,6 +1534,8 @@ restart: | |||
| 1514 | if (sock_flag(other, SOCK_RCVTSTAMP)) | 1534 | if (sock_flag(other, SOCK_RCVTSTAMP)) |
| 1515 | __net_timestamp(skb); | 1535 | __net_timestamp(skb); |
| 1516 | skb_queue_tail(&other->sk_receive_queue, skb); | 1536 | skb_queue_tail(&other->sk_receive_queue, skb); |
| 1537 | if (max_level > unix_sk(other)->recursion_level) | ||
| 1538 | unix_sk(other)->recursion_level = max_level; | ||
| 1517 | unix_state_unlock(other); | 1539 | unix_state_unlock(other); |
| 1518 | other->sk_data_ready(other, len); | 1540 | other->sk_data_ready(other, len); |
| 1519 | sock_put(other); | 1541 | sock_put(other); |
| @@ -1544,6 +1566,7 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
| 1544 | int sent = 0; | 1566 | int sent = 0; |
| 1545 | struct scm_cookie tmp_scm; | 1567 | struct scm_cookie tmp_scm; |
| 1546 | bool fds_sent = false; | 1568 | bool fds_sent = false; |
| 1569 | int max_level; | ||
| 1547 | 1570 | ||
| 1548 | if (NULL == siocb->scm) | 1571 | if (NULL == siocb->scm) |
| 1549 | siocb->scm = &tmp_scm; | 1572 | siocb->scm = &tmp_scm; |
| @@ -1607,10 +1630,11 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
| 1607 | 1630 | ||
| 1608 | /* Only send the fds in the first buffer */ | 1631 | /* Only send the fds in the first buffer */ |
| 1609 | err = unix_scm_to_skb(siocb->scm, skb, !fds_sent); | 1632 | err = unix_scm_to_skb(siocb->scm, skb, !fds_sent); |
| 1610 | if (err) { | 1633 | if (err < 0) { |
| 1611 | kfree_skb(skb); | 1634 | kfree_skb(skb); |
| 1612 | goto out_err; | 1635 | goto out_err; |
| 1613 | } | 1636 | } |
| 1637 | max_level = err + 1; | ||
| 1614 | fds_sent = true; | 1638 | fds_sent = true; |
| 1615 | 1639 | ||
| 1616 | err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size); | 1640 | err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size); |
| @@ -1626,6 +1650,8 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
| 1626 | goto pipe_err_free; | 1650 | goto pipe_err_free; |
| 1627 | 1651 | ||
| 1628 | skb_queue_tail(&other->sk_receive_queue, skb); | 1652 | skb_queue_tail(&other->sk_receive_queue, skb); |
| 1653 | if (max_level > unix_sk(other)->recursion_level) | ||
| 1654 | unix_sk(other)->recursion_level = max_level; | ||
| 1629 | unix_state_unlock(other); | 1655 | unix_state_unlock(other); |
| 1630 | other->sk_data_ready(other, size); | 1656 | other->sk_data_ready(other, size); |
| 1631 | sent += size; | 1657 | sent += size; |
| @@ -1845,6 +1871,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
| 1845 | unix_state_lock(sk); | 1871 | unix_state_lock(sk); |
| 1846 | skb = skb_dequeue(&sk->sk_receive_queue); | 1872 | skb = skb_dequeue(&sk->sk_receive_queue); |
| 1847 | if (skb == NULL) { | 1873 | if (skb == NULL) { |
| 1874 | unix_sk(sk)->recursion_level = 0; | ||
| 1848 | if (copied >= target) | 1875 | if (copied >= target) |
| 1849 | goto unlock; | 1876 | goto unlock; |
| 1850 | 1877 | ||
diff --git a/net/unix/garbage.c b/net/unix/garbage.c index c8df6fda0b1f..f89f83bf828e 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c | |||
| @@ -96,7 +96,7 @@ static DECLARE_WAIT_QUEUE_HEAD(unix_gc_wait); | |||
| 96 | unsigned int unix_tot_inflight; | 96 | unsigned int unix_tot_inflight; |
| 97 | 97 | ||
| 98 | 98 | ||
| 99 | static struct sock *unix_get_socket(struct file *filp) | 99 | struct sock *unix_get_socket(struct file *filp) |
| 100 | { | 100 | { |
| 101 | struct sock *u_sock = NULL; | 101 | struct sock *u_sock = NULL; |
| 102 | struct inode *inode = filp->f_path.dentry->d_inode; | 102 | struct inode *inode = filp->f_path.dentry->d_inode; |
| @@ -259,9 +259,16 @@ static void inc_inflight_move_tail(struct unix_sock *u) | |||
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | static bool gc_in_progress = false; | 261 | static bool gc_in_progress = false; |
| 262 | #define UNIX_INFLIGHT_TRIGGER_GC 16000 | ||
| 262 | 263 | ||
| 263 | void wait_for_unix_gc(void) | 264 | void wait_for_unix_gc(void) |
| 264 | { | 265 | { |
| 266 | /* | ||
| 267 | * If number of inflight sockets is insane, | ||
| 268 | * force a garbage collect right now. | ||
| 269 | */ | ||
| 270 | if (unix_tot_inflight > UNIX_INFLIGHT_TRIGGER_GC && !gc_in_progress) | ||
| 271 | unix_gc(); | ||
| 265 | wait_event(unix_gc_wait, gc_in_progress == false); | 272 | wait_event(unix_gc_wait, gc_in_progress == false); |
| 266 | } | 273 | } |
| 267 | 274 | ||
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); |
