diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-11-01 05:11:07 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-11-01 05:11:07 -0500 |
commit | e87a3dd33eab30b4db539500064a9584867e4f2c (patch) | |
tree | 2f7ad16e46ae30518ff63bb5391b63f7f7cc74dd /net | |
parent | b14f5de731ae657d498d18d713c6431bfbeefb4b (diff) | |
parent | 3d00941371a765779c4e3509214c7e5793cce1fe (diff) |
Merge branch 'fix/misc' into topic/misc
Diffstat (limited to 'net')
108 files changed, 1023 insertions, 660 deletions
diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c index 343146e1bceb..a91504850195 100644 --- a/net/8021q/vlan_netlink.c +++ b/net/8021q/vlan_netlink.c | |||
@@ -169,6 +169,7 @@ static size_t vlan_get_size(const struct net_device *dev) | |||
169 | struct vlan_dev_info *vlan = vlan_dev_info(dev); | 169 | struct vlan_dev_info *vlan = vlan_dev_info(dev); |
170 | 170 | ||
171 | return nla_total_size(2) + /* IFLA_VLAN_ID */ | 171 | return nla_total_size(2) + /* IFLA_VLAN_ID */ |
172 | sizeof(struct ifla_vlan_flags) + /* IFLA_VLAN_FLAGS */ | ||
172 | vlan_qos_map_size(vlan->nr_ingress_mappings) + | 173 | vlan_qos_map_size(vlan->nr_ingress_mappings) + |
173 | vlan_qos_map_size(vlan->nr_egress_mappings); | 174 | vlan_qos_map_size(vlan->nr_egress_mappings); |
174 | } | 175 | } |
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index 9bf0b737aa51..b2e07f0dd298 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <net/9p/transport.h> | 43 | #include <net/9p/transport.h> |
44 | #include <linux/scatterlist.h> | 44 | #include <linux/scatterlist.h> |
45 | #include <linux/virtio.h> | 45 | #include <linux/virtio.h> |
46 | #include <linux/virtio_ids.h> | ||
46 | #include <linux/virtio_9p.h> | 47 | #include <linux/virtio_9p.h> |
47 | 48 | ||
48 | #define VIRTQUEUE_NUM 128 | 49 | #define VIRTQUEUE_NUM 128 |
@@ -200,7 +201,7 @@ p9_virtio_request(struct p9_client *client, struct p9_req_t *req) | |||
200 | 201 | ||
201 | req->status = REQ_STATUS_SENT; | 202 | req->status = REQ_STATUS_SENT; |
202 | 203 | ||
203 | if (chan->vq->vq_ops->add_buf(chan->vq, chan->sg, out, in, req->tc)) { | 204 | if (chan->vq->vq_ops->add_buf(chan->vq, chan->sg, out, in, req->tc) < 0) { |
204 | P9_DPRINTK(P9_DEBUG_TRANS, | 205 | P9_DPRINTK(P9_DEBUG_TRANS, |
205 | "9p debug: virtio rpc add_buf returned failure"); | 206 | "9p debug: virtio rpc add_buf returned failure"); |
206 | return -EIO; | 207 | return -EIO; |
@@ -334,8 +335,6 @@ static void p9_virtio_remove(struct virtio_device *vdev) | |||
334 | } | 335 | } |
335 | } | 336 | } |
336 | 337 | ||
337 | #define VIRTIO_ID_9P 9 | ||
338 | |||
339 | static struct virtio_device_id id_table[] = { | 338 | static struct virtio_device_id id_table[] = { |
340 | { VIRTIO_ID_9P, VIRTIO_DEV_ANY_ID }, | 339 | { VIRTIO_ID_9P, VIRTIO_DEV_ANY_ID }, |
341 | { 0 }, | 340 | { 0 }, |
diff --git a/net/atm/common.c b/net/atm/common.c index 8c4d843eb17f..950bd16d2383 100644 --- a/net/atm/common.c +++ b/net/atm/common.c | |||
@@ -679,7 +679,7 @@ static int check_qos(const struct atm_qos *qos) | |||
679 | } | 679 | } |
680 | 680 | ||
681 | int vcc_setsockopt(struct socket *sock, int level, int optname, | 681 | int vcc_setsockopt(struct socket *sock, int level, int optname, |
682 | char __user *optval, int optlen) | 682 | char __user *optval, unsigned int optlen) |
683 | { | 683 | { |
684 | struct atm_vcc *vcc; | 684 | struct atm_vcc *vcc; |
685 | unsigned long value; | 685 | unsigned long value; |
diff --git a/net/atm/common.h b/net/atm/common.h index 92e2981f479f..f48a76b6cdf4 100644 --- a/net/atm/common.h +++ b/net/atm/common.h | |||
@@ -21,7 +21,7 @@ unsigned int vcc_poll(struct file *file, struct socket *sock, poll_table *wait); | |||
21 | int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); | 21 | int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); |
22 | int vcc_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); | 22 | int vcc_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); |
23 | int vcc_setsockopt(struct socket *sock, int level, int optname, | 23 | int vcc_setsockopt(struct socket *sock, int level, int optname, |
24 | char __user *optval, int optlen); | 24 | char __user *optval, unsigned int optlen); |
25 | int vcc_getsockopt(struct socket *sock, int level, int optname, | 25 | int vcc_getsockopt(struct socket *sock, int level, int optname, |
26 | char __user *optval, int __user *optlen); | 26 | char __user *optval, int __user *optlen); |
27 | 27 | ||
diff --git a/net/atm/pvc.c b/net/atm/pvc.c index e1d22d9430dd..d4c024504f99 100644 --- a/net/atm/pvc.c +++ b/net/atm/pvc.c | |||
@@ -59,7 +59,7 @@ static int pvc_connect(struct socket *sock,struct sockaddr *sockaddr, | |||
59 | } | 59 | } |
60 | 60 | ||
61 | static int pvc_setsockopt(struct socket *sock, int level, int optname, | 61 | static int pvc_setsockopt(struct socket *sock, int level, int optname, |
62 | char __user *optval, int optlen) | 62 | char __user *optval, unsigned int optlen) |
63 | { | 63 | { |
64 | struct sock *sk = sock->sk; | 64 | struct sock *sk = sock->sk; |
65 | int error; | 65 | int error; |
diff --git a/net/atm/svc.c b/net/atm/svc.c index 7b831b526d0b..f90d143c4b25 100644 --- a/net/atm/svc.c +++ b/net/atm/svc.c | |||
@@ -446,7 +446,7 @@ int svc_change_qos(struct atm_vcc *vcc,struct atm_qos *qos) | |||
446 | 446 | ||
447 | 447 | ||
448 | static int svc_setsockopt(struct socket *sock, int level, int optname, | 448 | static int svc_setsockopt(struct socket *sock, int level, int optname, |
449 | char __user *optval, int optlen) | 449 | char __user *optval, unsigned int optlen) |
450 | { | 450 | { |
451 | struct sock *sk = sock->sk; | 451 | struct sock *sk = sock->sk; |
452 | struct atm_vcc *vcc = ATM_SD(sock); | 452 | struct atm_vcc *vcc = ATM_SD(sock); |
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index da0f64f82b57..f45460730371 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c | |||
@@ -358,6 +358,7 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg) | |||
358 | ax25_dev *ax25_dev; | 358 | ax25_dev *ax25_dev; |
359 | ax25_cb *ax25; | 359 | ax25_cb *ax25; |
360 | unsigned int k; | 360 | unsigned int k; |
361 | int ret = 0; | ||
361 | 362 | ||
362 | if (copy_from_user(&ax25_ctl, arg, sizeof(ax25_ctl))) | 363 | if (copy_from_user(&ax25_ctl, arg, sizeof(ax25_ctl))) |
363 | return -EFAULT; | 364 | return -EFAULT; |
@@ -388,57 +389,63 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg) | |||
388 | case AX25_WINDOW: | 389 | case AX25_WINDOW: |
389 | if (ax25->modulus == AX25_MODULUS) { | 390 | if (ax25->modulus == AX25_MODULUS) { |
390 | if (ax25_ctl.arg < 1 || ax25_ctl.arg > 7) | 391 | if (ax25_ctl.arg < 1 || ax25_ctl.arg > 7) |
391 | return -EINVAL; | 392 | goto einval_put; |
392 | } else { | 393 | } else { |
393 | if (ax25_ctl.arg < 1 || ax25_ctl.arg > 63) | 394 | if (ax25_ctl.arg < 1 || ax25_ctl.arg > 63) |
394 | return -EINVAL; | 395 | goto einval_put; |
395 | } | 396 | } |
396 | ax25->window = ax25_ctl.arg; | 397 | ax25->window = ax25_ctl.arg; |
397 | break; | 398 | break; |
398 | 399 | ||
399 | case AX25_T1: | 400 | case AX25_T1: |
400 | if (ax25_ctl.arg < 1) | 401 | if (ax25_ctl.arg < 1) |
401 | return -EINVAL; | 402 | goto einval_put; |
402 | ax25->rtt = (ax25_ctl.arg * HZ) / 2; | 403 | ax25->rtt = (ax25_ctl.arg * HZ) / 2; |
403 | ax25->t1 = ax25_ctl.arg * HZ; | 404 | ax25->t1 = ax25_ctl.arg * HZ; |
404 | break; | 405 | break; |
405 | 406 | ||
406 | case AX25_T2: | 407 | case AX25_T2: |
407 | if (ax25_ctl.arg < 1) | 408 | if (ax25_ctl.arg < 1) |
408 | return -EINVAL; | 409 | goto einval_put; |
409 | ax25->t2 = ax25_ctl.arg * HZ; | 410 | ax25->t2 = ax25_ctl.arg * HZ; |
410 | break; | 411 | break; |
411 | 412 | ||
412 | case AX25_N2: | 413 | case AX25_N2: |
413 | if (ax25_ctl.arg < 1 || ax25_ctl.arg > 31) | 414 | if (ax25_ctl.arg < 1 || ax25_ctl.arg > 31) |
414 | return -EINVAL; | 415 | goto einval_put; |
415 | ax25->n2count = 0; | 416 | ax25->n2count = 0; |
416 | ax25->n2 = ax25_ctl.arg; | 417 | ax25->n2 = ax25_ctl.arg; |
417 | break; | 418 | break; |
418 | 419 | ||
419 | case AX25_T3: | 420 | case AX25_T3: |
420 | if (ax25_ctl.arg < 0) | 421 | if (ax25_ctl.arg < 0) |
421 | return -EINVAL; | 422 | goto einval_put; |
422 | ax25->t3 = ax25_ctl.arg * HZ; | 423 | ax25->t3 = ax25_ctl.arg * HZ; |
423 | break; | 424 | break; |
424 | 425 | ||
425 | case AX25_IDLE: | 426 | case AX25_IDLE: |
426 | if (ax25_ctl.arg < 0) | 427 | if (ax25_ctl.arg < 0) |
427 | return -EINVAL; | 428 | goto einval_put; |
428 | ax25->idle = ax25_ctl.arg * 60 * HZ; | 429 | ax25->idle = ax25_ctl.arg * 60 * HZ; |
429 | break; | 430 | break; |
430 | 431 | ||
431 | case AX25_PACLEN: | 432 | case AX25_PACLEN: |
432 | if (ax25_ctl.arg < 16 || ax25_ctl.arg > 65535) | 433 | if (ax25_ctl.arg < 16 || ax25_ctl.arg > 65535) |
433 | return -EINVAL; | 434 | goto einval_put; |
434 | ax25->paclen = ax25_ctl.arg; | 435 | ax25->paclen = ax25_ctl.arg; |
435 | break; | 436 | break; |
436 | 437 | ||
437 | default: | 438 | default: |
438 | return -EINVAL; | 439 | goto einval_put; |
439 | } | 440 | } |
440 | 441 | ||
441 | return 0; | 442 | out_put: |
443 | ax25_cb_put(ax25); | ||
444 | return ret; | ||
445 | |||
446 | einval_put: | ||
447 | ret = -EINVAL; | ||
448 | goto out_put; | ||
442 | } | 449 | } |
443 | 450 | ||
444 | static void ax25_fillin_cb_from_dev(ax25_cb *ax25, ax25_dev *ax25_dev) | 451 | static void ax25_fillin_cb_from_dev(ax25_cb *ax25, ax25_dev *ax25_dev) |
@@ -527,7 +534,7 @@ ax25_cb *ax25_create_cb(void) | |||
527 | */ | 534 | */ |
528 | 535 | ||
529 | static int ax25_setsockopt(struct socket *sock, int level, int optname, | 536 | static int ax25_setsockopt(struct socket *sock, int level, int optname, |
530 | char __user *optval, int optlen) | 537 | char __user *optval, unsigned int optlen) |
531 | { | 538 | { |
532 | struct sock *sk = sock->sk; | 539 | struct sock *sk = sock->sk; |
533 | ax25_cb *ax25; | 540 | ax25_cb *ax25; |
@@ -634,15 +641,10 @@ static int ax25_setsockopt(struct socket *sock, int level, int optname, | |||
634 | 641 | ||
635 | case SO_BINDTODEVICE: | 642 | case SO_BINDTODEVICE: |
636 | if (optlen > IFNAMSIZ) | 643 | if (optlen > IFNAMSIZ) |
637 | optlen=IFNAMSIZ; | 644 | optlen = IFNAMSIZ; |
638 | if (copy_from_user(devname, optval, optlen)) { | ||
639 | res = -EFAULT; | ||
640 | break; | ||
641 | } | ||
642 | 645 | ||
643 | dev = dev_get_by_name(&init_net, devname); | 646 | if (copy_from_user(devname, optval, optlen)) { |
644 | if (dev == NULL) { | 647 | res = -EFAULT; |
645 | res = -ENODEV; | ||
646 | break; | 648 | break; |
647 | } | 649 | } |
648 | 650 | ||
@@ -650,12 +652,18 @@ static int ax25_setsockopt(struct socket *sock, int level, int optname, | |||
650 | (sock->state != SS_UNCONNECTED || | 652 | (sock->state != SS_UNCONNECTED || |
651 | sk->sk_state == TCP_LISTEN)) { | 653 | sk->sk_state == TCP_LISTEN)) { |
652 | res = -EADDRNOTAVAIL; | 654 | res = -EADDRNOTAVAIL; |
653 | dev_put(dev); | 655 | break; |
656 | } | ||
657 | |||
658 | dev = dev_get_by_name(&init_net, devname); | ||
659 | if (!dev) { | ||
660 | res = -ENODEV; | ||
654 | break; | 661 | break; |
655 | } | 662 | } |
656 | 663 | ||
657 | ax25->ax25_dev = ax25_dev_ax25dev(dev); | 664 | ax25->ax25_dev = ax25_dev_ax25dev(dev); |
658 | ax25_fillin_cb(ax25, ax25->ax25_dev); | 665 | ax25_fillin_cb(ax25, ax25->ax25_dev); |
666 | dev_put(dev); | ||
659 | break; | 667 | break; |
660 | 668 | ||
661 | default: | 669 | default: |
@@ -893,7 +901,6 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev) | |||
893 | 901 | ||
894 | sock_init_data(NULL, sk); | 902 | sock_init_data(NULL, sk); |
895 | 903 | ||
896 | sk->sk_destruct = ax25_free_sock; | ||
897 | sk->sk_type = osk->sk_type; | 904 | sk->sk_type = osk->sk_type; |
898 | sk->sk_priority = osk->sk_priority; | 905 | sk->sk_priority = osk->sk_priority; |
899 | sk->sk_protocol = osk->sk_protocol; | 906 | sk->sk_protocol = osk->sk_protocol; |
@@ -931,6 +938,7 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev) | |||
931 | } | 938 | } |
932 | 939 | ||
933 | sk->sk_protinfo = ax25; | 940 | sk->sk_protinfo = ax25; |
941 | sk->sk_destruct = ax25_free_sock; | ||
934 | ax25->sk = sk; | 942 | ax25->sk = sk; |
935 | 943 | ||
936 | return sk; | 944 | return sk; |
@@ -1781,8 +1789,8 @@ static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1781 | ax25_info.idletimer = ax25_display_timer(&ax25->idletimer) / (60 * HZ); | 1789 | ax25_info.idletimer = ax25_display_timer(&ax25->idletimer) / (60 * HZ); |
1782 | ax25_info.n2count = ax25->n2count; | 1790 | ax25_info.n2count = ax25->n2count; |
1783 | ax25_info.state = ax25->state; | 1791 | ax25_info.state = ax25->state; |
1784 | ax25_info.rcv_q = sk_wmem_alloc_get(sk); | 1792 | ax25_info.rcv_q = sk_rmem_alloc_get(sk); |
1785 | ax25_info.snd_q = sk_rmem_alloc_get(sk); | 1793 | ax25_info.snd_q = sk_wmem_alloc_get(sk); |
1786 | ax25_info.vs = ax25->vs; | 1794 | ax25_info.vs = ax25->vs; |
1787 | ax25_info.vr = ax25->vr; | 1795 | ax25_info.vr = ax25->vr; |
1788 | ax25_info.va = ax25->va; | 1796 | ax25_info.va = ax25->va; |
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 4f9621f759a0..75302a986067 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -466,7 +466,7 @@ drop: | |||
466 | goto done; | 466 | goto done; |
467 | } | 467 | } |
468 | 468 | ||
469 | static int hci_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int len) | 469 | static int hci_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int len) |
470 | { | 470 | { |
471 | struct hci_ufilter uf = { .opcode = 0 }; | 471 | struct hci_ufilter uf = { .opcode = 0 }; |
472 | struct sock *sk = sock->sk; | 472 | struct sock *sk = sock->sk; |
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index 09bedeb5579c..49d8495d69be 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c | |||
@@ -577,11 +577,6 @@ static int hidp_session(void *arg) | |||
577 | } | 577 | } |
578 | 578 | ||
579 | if (session->hid) { | 579 | if (session->hid) { |
580 | if (session->hid->claimed & HID_CLAIMED_INPUT) | ||
581 | hidinput_disconnect(session->hid); | ||
582 | if (session->hid->claimed & HID_CLAIMED_HIDRAW) | ||
583 | hidraw_disconnect(session->hid); | ||
584 | |||
585 | hid_destroy_device(session->hid); | 580 | hid_destroy_device(session->hid); |
586 | session->hid = NULL; | 581 | session->hid = NULL; |
587 | } | 582 | } |
@@ -747,8 +742,6 @@ static void hidp_stop(struct hid_device *hid) | |||
747 | skb_queue_purge(&session->ctrl_transmit); | 742 | skb_queue_purge(&session->ctrl_transmit); |
748 | skb_queue_purge(&session->intr_transmit); | 743 | skb_queue_purge(&session->intr_transmit); |
749 | 744 | ||
750 | if (hid->claimed & HID_CLAIMED_INPUT) | ||
751 | hidinput_disconnect(hid); | ||
752 | hid->claimed = 0; | 745 | hid->claimed = 0; |
753 | } | 746 | } |
754 | 747 | ||
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index b03012564647..555d9da1869b 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -1698,7 +1698,7 @@ static int l2cap_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct ms | |||
1698 | return bt_sock_recvmsg(iocb, sock, msg, len, flags); | 1698 | return bt_sock_recvmsg(iocb, sock, msg, len, flags); |
1699 | } | 1699 | } |
1700 | 1700 | ||
1701 | static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __user *optval, int optlen) | 1701 | static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __user *optval, unsigned int optlen) |
1702 | { | 1702 | { |
1703 | struct sock *sk = sock->sk; | 1703 | struct sock *sk = sock->sk; |
1704 | struct l2cap_options opts; | 1704 | struct l2cap_options opts; |
@@ -1755,7 +1755,7 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us | |||
1755 | return err; | 1755 | return err; |
1756 | } | 1756 | } |
1757 | 1757 | ||
1758 | static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen) | 1758 | static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen) |
1759 | { | 1759 | { |
1760 | struct sock *sk = sock->sk; | 1760 | struct sock *sk = sock->sk; |
1761 | struct bt_security sec; | 1761 | struct bt_security sec; |
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index 0b85e8116859..8a20aaf1f231 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c | |||
@@ -730,7 +730,7 @@ out: | |||
730 | return copied ? : err; | 730 | return copied ? : err; |
731 | } | 731 | } |
732 | 732 | ||
733 | static int rfcomm_sock_setsockopt_old(struct socket *sock, int optname, char __user *optval, int optlen) | 733 | static int rfcomm_sock_setsockopt_old(struct socket *sock, int optname, char __user *optval, unsigned int optlen) |
734 | { | 734 | { |
735 | struct sock *sk = sock->sk; | 735 | struct sock *sk = sock->sk; |
736 | int err = 0; | 736 | int err = 0; |
@@ -766,7 +766,7 @@ static int rfcomm_sock_setsockopt_old(struct socket *sock, int optname, char __u | |||
766 | return err; | 766 | return err; |
767 | } | 767 | } |
768 | 768 | ||
769 | static int rfcomm_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen) | 769 | static int rfcomm_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen) |
770 | { | 770 | { |
771 | struct sock *sk = sock->sk; | 771 | struct sock *sk = sock->sk; |
772 | struct bt_security sec; | 772 | struct bt_security sec; |
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 13c27f17192c..77f4153bdb5e 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
@@ -644,7 +644,7 @@ static int sco_sock_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
644 | return err; | 644 | return err; |
645 | } | 645 | } |
646 | 646 | ||
647 | static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen) | 647 | static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen) |
648 | { | 648 | { |
649 | struct sock *sk = sock->sk; | 649 | struct sock *sk = sock->sk; |
650 | int err = 0; | 650 | int err = 0; |
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 142ebac14176..b1b3b0fbf41c 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c | |||
@@ -432,6 +432,7 @@ err2: | |||
432 | br_fdb_delete_by_port(br, p, 1); | 432 | br_fdb_delete_by_port(br, p, 1); |
433 | err1: | 433 | err1: |
434 | kobject_put(&p->kobj); | 434 | kobject_put(&p->kobj); |
435 | p = NULL; /* kobject_put frees */ | ||
435 | err0: | 436 | err0: |
436 | dev_set_promiscuity(dev, -1); | 437 | dev_set_promiscuity(dev, -1); |
437 | put_back: | 438 | put_back: |
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index 907a82e9023d..a16a2342f6bf 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -965,12 +965,12 @@ static struct nf_hook_ops br_nf_ops[] __read_mostly = { | |||
965 | 965 | ||
966 | #ifdef CONFIG_SYSCTL | 966 | #ifdef CONFIG_SYSCTL |
967 | static | 967 | static |
968 | int brnf_sysctl_call_tables(ctl_table * ctl, int write, struct file *filp, | 968 | int brnf_sysctl_call_tables(ctl_table * ctl, int write, |
969 | void __user * buffer, size_t * lenp, loff_t * ppos) | 969 | void __user * buffer, size_t * lenp, loff_t * ppos) |
970 | { | 970 | { |
971 | int ret; | 971 | int ret; |
972 | 972 | ||
973 | ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); | 973 | ret = proc_dointvec(ctl, write, buffer, lenp, ppos); |
974 | 974 | ||
975 | if (write && *(int *)(ctl->data)) | 975 | if (write && *(int *)(ctl->data)) |
976 | *(int *)(ctl->data) = 1; | 976 | *(int *)(ctl->data) = 1; |
diff --git a/net/can/raw.c b/net/can/raw.c index db3152df7d2b..b5e897922d32 100644 --- a/net/can/raw.c +++ b/net/can/raw.c | |||
@@ -411,7 +411,7 @@ static int raw_getname(struct socket *sock, struct sockaddr *uaddr, | |||
411 | } | 411 | } |
412 | 412 | ||
413 | static int raw_setsockopt(struct socket *sock, int level, int optname, | 413 | static int raw_setsockopt(struct socket *sock, int level, int optname, |
414 | char __user *optval, int optlen) | 414 | char __user *optval, unsigned int optlen) |
415 | { | 415 | { |
416 | struct sock *sk = sock->sk; | 416 | struct sock *sk = sock->sk; |
417 | struct raw_sock *ro = raw_sk(sk); | 417 | struct raw_sock *ro = raw_sk(sk); |
diff --git a/net/compat.c b/net/compat.c index 12728b17a226..a407c3addbae 100644 --- a/net/compat.c +++ b/net/compat.c | |||
@@ -331,7 +331,7 @@ struct compat_sock_fprog { | |||
331 | }; | 331 | }; |
332 | 332 | ||
333 | static int do_set_attach_filter(struct socket *sock, int level, int optname, | 333 | static int do_set_attach_filter(struct socket *sock, int level, int optname, |
334 | char __user *optval, int optlen) | 334 | char __user *optval, unsigned int optlen) |
335 | { | 335 | { |
336 | struct compat_sock_fprog __user *fprog32 = (struct compat_sock_fprog __user *)optval; | 336 | struct compat_sock_fprog __user *fprog32 = (struct compat_sock_fprog __user *)optval; |
337 | struct sock_fprog __user *kfprog = compat_alloc_user_space(sizeof(struct sock_fprog)); | 337 | struct sock_fprog __user *kfprog = compat_alloc_user_space(sizeof(struct sock_fprog)); |
@@ -351,7 +351,7 @@ static int do_set_attach_filter(struct socket *sock, int level, int optname, | |||
351 | } | 351 | } |
352 | 352 | ||
353 | static int do_set_sock_timeout(struct socket *sock, int level, | 353 | static int do_set_sock_timeout(struct socket *sock, int level, |
354 | int optname, char __user *optval, int optlen) | 354 | int optname, char __user *optval, unsigned int optlen) |
355 | { | 355 | { |
356 | struct compat_timeval __user *up = (struct compat_timeval __user *) optval; | 356 | struct compat_timeval __user *up = (struct compat_timeval __user *) optval; |
357 | struct timeval ktime; | 357 | struct timeval ktime; |
@@ -373,7 +373,7 @@ static int do_set_sock_timeout(struct socket *sock, int level, | |||
373 | } | 373 | } |
374 | 374 | ||
375 | static int compat_sock_setsockopt(struct socket *sock, int level, int optname, | 375 | static int compat_sock_setsockopt(struct socket *sock, int level, int optname, |
376 | char __user *optval, int optlen) | 376 | char __user *optval, unsigned int optlen) |
377 | { | 377 | { |
378 | if (optname == SO_ATTACH_FILTER) | 378 | if (optname == SO_ATTACH_FILTER) |
379 | return do_set_attach_filter(sock, level, optname, | 379 | return do_set_attach_filter(sock, level, optname, |
@@ -385,7 +385,7 @@ static int compat_sock_setsockopt(struct socket *sock, int level, int optname, | |||
385 | } | 385 | } |
386 | 386 | ||
387 | asmlinkage long compat_sys_setsockopt(int fd, int level, int optname, | 387 | asmlinkage long compat_sys_setsockopt(int fd, int level, int optname, |
388 | char __user *optval, int optlen) | 388 | char __user *optval, unsigned int optlen) |
389 | { | 389 | { |
390 | int err; | 390 | int err; |
391 | struct socket *sock; | 391 | struct socket *sock; |
@@ -558,8 +558,8 @@ struct compat_group_filter { | |||
558 | 558 | ||
559 | 559 | ||
560 | int compat_mc_setsockopt(struct sock *sock, int level, int optname, | 560 | int compat_mc_setsockopt(struct sock *sock, int level, int optname, |
561 | char __user *optval, int optlen, | 561 | char __user *optval, unsigned int optlen, |
562 | int (*setsockopt)(struct sock *,int,int,char __user *,int)) | 562 | int (*setsockopt)(struct sock *,int,int,char __user *,unsigned int)) |
563 | { | 563 | { |
564 | char __user *koptval = optval; | 564 | char __user *koptval = optval; |
565 | int koptlen = optlen; | 565 | int koptlen = optlen; |
diff --git a/net/core/dev.c b/net/core/dev.c index 560c8c9c03ab..b8f74cfb1bfd 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2288,6 +2288,9 @@ int netif_receive_skb(struct sk_buff *skb) | |||
2288 | int ret = NET_RX_DROP; | 2288 | int ret = NET_RX_DROP; |
2289 | __be16 type; | 2289 | __be16 type; |
2290 | 2290 | ||
2291 | if (!skb->tstamp.tv64) | ||
2292 | net_timestamp(skb); | ||
2293 | |||
2291 | if (skb->vlan_tci && vlan_hwaccel_do_receive(skb)) | 2294 | if (skb->vlan_tci && vlan_hwaccel_do_receive(skb)) |
2292 | return NET_RX_SUCCESS; | 2295 | return NET_RX_SUCCESS; |
2293 | 2296 | ||
@@ -2295,9 +2298,6 @@ int netif_receive_skb(struct sk_buff *skb) | |||
2295 | if (netpoll_receive_skb(skb)) | 2298 | if (netpoll_receive_skb(skb)) |
2296 | return NET_RX_DROP; | 2299 | return NET_RX_DROP; |
2297 | 2300 | ||
2298 | if (!skb->tstamp.tv64) | ||
2299 | net_timestamp(skb); | ||
2300 | |||
2301 | if (!skb->iif) | 2301 | if (!skb->iif) |
2302 | skb->iif = skb->dev->ifindex; | 2302 | skb->iif = skb->dev->ifindex; |
2303 | 2303 | ||
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 7d4c57523b09..821d30918cfc 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
@@ -16,7 +16,7 @@ | |||
16 | #include <net/sock.h> | 16 | #include <net/sock.h> |
17 | #include <linux/rtnetlink.h> | 17 | #include <linux/rtnetlink.h> |
18 | #include <linux/wireless.h> | 18 | #include <linux/wireless.h> |
19 | #include <net/iw_handler.h> | 19 | #include <net/wext.h> |
20 | 20 | ||
21 | #include "net-sysfs.h" | 21 | #include "net-sysfs.h" |
22 | 22 | ||
@@ -363,15 +363,13 @@ static ssize_t wireless_show(struct device *d, char *buf, | |||
363 | char *)) | 363 | char *)) |
364 | { | 364 | { |
365 | struct net_device *dev = to_net_dev(d); | 365 | struct net_device *dev = to_net_dev(d); |
366 | const struct iw_statistics *iw = NULL; | 366 | const struct iw_statistics *iw; |
367 | ssize_t ret = -EINVAL; | 367 | ssize_t ret = -EINVAL; |
368 | 368 | ||
369 | read_lock(&dev_base_lock); | 369 | read_lock(&dev_base_lock); |
370 | if (dev_isalive(dev)) { | 370 | if (dev_isalive(dev)) { |
371 | if (dev->wireless_handlers && | 371 | iw = get_wireless_stats(dev); |
372 | dev->wireless_handlers->get_wireless_stats) | 372 | if (iw) |
373 | iw = dev->wireless_handlers->get_wireless_stats(dev); | ||
374 | if (iw != NULL) | ||
375 | ret = (*format)(iw, buf); | 373 | ret = (*format)(iw, buf); |
376 | } | 374 | } |
377 | read_unlock(&dev_base_lock); | 375 | read_unlock(&dev_base_lock); |
@@ -505,7 +503,7 @@ int netdev_register_kobject(struct net_device *net) | |||
505 | *groups++ = &netstat_group; | 503 | *groups++ = &netstat_group; |
506 | 504 | ||
507 | #ifdef CONFIG_WIRELESS_EXT_SYSFS | 505 | #ifdef CONFIG_WIRELESS_EXT_SYSFS |
508 | if (net->wireless_handlers && net->wireless_handlers->get_wireless_stats) | 506 | if (net->wireless_handlers || net->ieee80211_ptr) |
509 | *groups++ = &wireless_group; | 507 | *groups++ = &wireless_group; |
510 | #endif | 508 | #endif |
511 | #endif /* CONFIG_SYSFS */ | 509 | #endif /* CONFIG_SYSFS */ |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 0bcecbf06581..b69455217ed6 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -192,11 +192,10 @@ | |||
192 | #define F_QUEUE_MAP_CPU (1<<14) /* queue map mirrors smp_processor_id() */ | 192 | #define F_QUEUE_MAP_CPU (1<<14) /* queue map mirrors smp_processor_id() */ |
193 | 193 | ||
194 | /* Thread control flag bits */ | 194 | /* Thread control flag bits */ |
195 | #define T_TERMINATE (1<<0) | 195 | #define T_STOP (1<<0) /* Stop run */ |
196 | #define T_STOP (1<<1) /* Stop run */ | 196 | #define T_RUN (1<<1) /* Start run */ |
197 | #define T_RUN (1<<2) /* Start run */ | 197 | #define T_REMDEVALL (1<<2) /* Remove all devs */ |
198 | #define T_REMDEVALL (1<<3) /* Remove all devs */ | 198 | #define T_REMDEV (1<<3) /* Remove one dev */ |
199 | #define T_REMDEV (1<<4) /* Remove one dev */ | ||
200 | 199 | ||
201 | /* If lock -- can be removed after some work */ | 200 | /* If lock -- can be removed after some work */ |
202 | #define if_lock(t) spin_lock(&(t->if_lock)); | 201 | #define if_lock(t) spin_lock(&(t->if_lock)); |
@@ -2105,18 +2104,20 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev) | |||
2105 | 2104 | ||
2106 | static void spin(struct pktgen_dev *pkt_dev, ktime_t spin_until) | 2105 | static void spin(struct pktgen_dev *pkt_dev, ktime_t spin_until) |
2107 | { | 2106 | { |
2108 | ktime_t start; | 2107 | ktime_t start_time, end_time; |
2109 | s32 remaining; | 2108 | s64 remaining; |
2110 | struct hrtimer_sleeper t; | 2109 | struct hrtimer_sleeper t; |
2111 | 2110 | ||
2112 | hrtimer_init_on_stack(&t.timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); | 2111 | hrtimer_init_on_stack(&t.timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); |
2113 | hrtimer_set_expires(&t.timer, spin_until); | 2112 | hrtimer_set_expires(&t.timer, spin_until); |
2114 | 2113 | ||
2115 | remaining = ktime_to_us(hrtimer_expires_remaining(&t.timer)); | 2114 | remaining = ktime_to_us(hrtimer_expires_remaining(&t.timer)); |
2116 | if (remaining <= 0) | 2115 | if (remaining <= 0) { |
2116 | pkt_dev->next_tx = ktime_add_ns(spin_until, pkt_dev->delay); | ||
2117 | return; | 2117 | return; |
2118 | } | ||
2118 | 2119 | ||
2119 | start = ktime_now(); | 2120 | start_time = ktime_now(); |
2120 | if (remaining < 100) | 2121 | if (remaining < 100) |
2121 | udelay(remaining); /* really small just spin */ | 2122 | udelay(remaining); /* really small just spin */ |
2122 | else { | 2123 | else { |
@@ -2135,7 +2136,10 @@ static void spin(struct pktgen_dev *pkt_dev, ktime_t spin_until) | |||
2135 | } while (t.task && pkt_dev->running && !signal_pending(current)); | 2136 | } while (t.task && pkt_dev->running && !signal_pending(current)); |
2136 | __set_current_state(TASK_RUNNING); | 2137 | __set_current_state(TASK_RUNNING); |
2137 | } | 2138 | } |
2138 | pkt_dev->idle_acc += ktime_to_ns(ktime_sub(ktime_now(), start)); | 2139 | end_time = ktime_now(); |
2140 | |||
2141 | pkt_dev->idle_acc += ktime_to_ns(ktime_sub(end_time, start_time)); | ||
2142 | pkt_dev->next_tx = ktime_add_ns(end_time, pkt_dev->delay); | ||
2139 | } | 2143 | } |
2140 | 2144 | ||
2141 | static inline void set_pkt_overhead(struct pktgen_dev *pkt_dev) | 2145 | static inline void set_pkt_overhead(struct pktgen_dev *pkt_dev) |
@@ -3365,19 +3369,29 @@ static void pktgen_rem_thread(struct pktgen_thread *t) | |||
3365 | mutex_unlock(&pktgen_thread_lock); | 3369 | mutex_unlock(&pktgen_thread_lock); |
3366 | } | 3370 | } |
3367 | 3371 | ||
3368 | static void idle(struct pktgen_dev *pkt_dev) | 3372 | static void pktgen_resched(struct pktgen_dev *pkt_dev) |
3369 | { | 3373 | { |
3370 | ktime_t idle_start = ktime_now(); | 3374 | ktime_t idle_start = ktime_now(); |
3375 | schedule(); | ||
3376 | pkt_dev->idle_acc += ktime_to_ns(ktime_sub(ktime_now(), idle_start)); | ||
3377 | } | ||
3371 | 3378 | ||
3372 | if (need_resched()) | 3379 | static void pktgen_wait_for_skb(struct pktgen_dev *pkt_dev) |
3373 | schedule(); | 3380 | { |
3374 | else | 3381 | ktime_t idle_start = ktime_now(); |
3375 | cpu_relax(); | 3382 | |
3383 | while (atomic_read(&(pkt_dev->skb->users)) != 1) { | ||
3384 | if (signal_pending(current)) | ||
3385 | break; | ||
3376 | 3386 | ||
3387 | if (need_resched()) | ||
3388 | pktgen_resched(pkt_dev); | ||
3389 | else | ||
3390 | cpu_relax(); | ||
3391 | } | ||
3377 | pkt_dev->idle_acc += ktime_to_ns(ktime_sub(ktime_now(), idle_start)); | 3392 | pkt_dev->idle_acc += ktime_to_ns(ktime_sub(ktime_now(), idle_start)); |
3378 | } | 3393 | } |
3379 | 3394 | ||
3380 | |||
3381 | static void pktgen_xmit(struct pktgen_dev *pkt_dev) | 3395 | static void pktgen_xmit(struct pktgen_dev *pkt_dev) |
3382 | { | 3396 | { |
3383 | struct net_device *odev = pkt_dev->odev; | 3397 | struct net_device *odev = pkt_dev->odev; |
@@ -3387,36 +3401,21 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev) | |||
3387 | u16 queue_map; | 3401 | u16 queue_map; |
3388 | int ret; | 3402 | int ret; |
3389 | 3403 | ||
3390 | if (pkt_dev->delay) { | 3404 | /* If device is offline, then don't send */ |
3391 | spin(pkt_dev, pkt_dev->next_tx); | 3405 | if (unlikely(!netif_running(odev) || !netif_carrier_ok(odev))) { |
3392 | 3406 | pktgen_stop_device(pkt_dev); | |
3393 | /* This is max DELAY, this has special meaning of | 3407 | return; |
3394 | * "never transmit" | ||
3395 | */ | ||
3396 | if (pkt_dev->delay == ULLONG_MAX) { | ||
3397 | pkt_dev->next_tx = ktime_add_ns(ktime_now(), ULONG_MAX); | ||
3398 | return; | ||
3399 | } | ||
3400 | } | ||
3401 | |||
3402 | if (!pkt_dev->skb) { | ||
3403 | set_cur_queue_map(pkt_dev); | ||
3404 | queue_map = pkt_dev->cur_queue_map; | ||
3405 | } else { | ||
3406 | queue_map = skb_get_queue_mapping(pkt_dev->skb); | ||
3407 | } | 3408 | } |
3408 | 3409 | ||
3409 | txq = netdev_get_tx_queue(odev, queue_map); | 3410 | /* This is max DELAY, this has special meaning of |
3410 | /* Did we saturate the queue already? */ | 3411 | * "never transmit" |
3411 | if (netif_tx_queue_stopped(txq) || netif_tx_queue_frozen(txq)) { | 3412 | */ |
3412 | /* If device is down, then all queues are permnantly frozen */ | 3413 | if (unlikely(pkt_dev->delay == ULLONG_MAX)) { |
3413 | if (netif_running(odev)) | 3414 | pkt_dev->next_tx = ktime_add_ns(ktime_now(), ULONG_MAX); |
3414 | idle(pkt_dev); | ||
3415 | else | ||
3416 | pktgen_stop_device(pkt_dev); | ||
3417 | return; | 3415 | return; |
3418 | } | 3416 | } |
3419 | 3417 | ||
3418 | /* If no skb or clone count exhausted then get new one */ | ||
3420 | if (!pkt_dev->skb || (pkt_dev->last_ok && | 3419 | if (!pkt_dev->skb || (pkt_dev->last_ok && |
3421 | ++pkt_dev->clone_count >= pkt_dev->clone_skb)) { | 3420 | ++pkt_dev->clone_count >= pkt_dev->clone_skb)) { |
3422 | /* build a new pkt */ | 3421 | /* build a new pkt */ |
@@ -3435,54 +3434,45 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev) | |||
3435 | pkt_dev->clone_count = 0; /* reset counter */ | 3434 | pkt_dev->clone_count = 0; /* reset counter */ |
3436 | } | 3435 | } |
3437 | 3436 | ||
3438 | /* fill_packet() might have changed the queue */ | 3437 | if (pkt_dev->delay && pkt_dev->last_ok) |
3438 | spin(pkt_dev, pkt_dev->next_tx); | ||
3439 | |||
3439 | queue_map = skb_get_queue_mapping(pkt_dev->skb); | 3440 | queue_map = skb_get_queue_mapping(pkt_dev->skb); |
3440 | txq = netdev_get_tx_queue(odev, queue_map); | 3441 | txq = netdev_get_tx_queue(odev, queue_map); |
3441 | 3442 | ||
3442 | __netif_tx_lock_bh(txq); | 3443 | __netif_tx_lock_bh(txq); |
3443 | if (unlikely(netif_tx_queue_stopped(txq) || netif_tx_queue_frozen(txq))) | 3444 | atomic_inc(&(pkt_dev->skb->users)); |
3444 | pkt_dev->last_ok = 0; | ||
3445 | else { | ||
3446 | atomic_inc(&(pkt_dev->skb->users)); | ||
3447 | 3445 | ||
3448 | retry_now: | 3446 | if (unlikely(netif_tx_queue_stopped(txq) || netif_tx_queue_frozen(txq))) |
3447 | ret = NETDEV_TX_BUSY; | ||
3448 | else | ||
3449 | ret = (*xmit)(pkt_dev->skb, odev); | 3449 | ret = (*xmit)(pkt_dev->skb, odev); |
3450 | switch (ret) { | 3450 | |
3451 | case NETDEV_TX_OK: | 3451 | switch (ret) { |
3452 | txq_trans_update(txq); | 3452 | case NETDEV_TX_OK: |
3453 | pkt_dev->last_ok = 1; | 3453 | txq_trans_update(txq); |
3454 | pkt_dev->sofar++; | 3454 | pkt_dev->last_ok = 1; |
3455 | pkt_dev->seq_num++; | 3455 | pkt_dev->sofar++; |
3456 | pkt_dev->tx_bytes += pkt_dev->cur_pkt_size; | 3456 | pkt_dev->seq_num++; |
3457 | break; | 3457 | pkt_dev->tx_bytes += pkt_dev->cur_pkt_size; |
3458 | case NETDEV_TX_LOCKED: | 3458 | break; |
3459 | cpu_relax(); | 3459 | default: /* Drivers are not supposed to return other values! */ |
3460 | goto retry_now; | 3460 | if (net_ratelimit()) |
3461 | default: /* Drivers are not supposed to return other values! */ | 3461 | pr_info("pktgen: %s xmit error: %d\n", |
3462 | if (net_ratelimit()) | 3462 | odev->name, ret); |
3463 | pr_info("pktgen: %s xmit error: %d\n", | 3463 | pkt_dev->errors++; |
3464 | odev->name, ret); | 3464 | /* fallthru */ |
3465 | pkt_dev->errors++; | 3465 | case NETDEV_TX_LOCKED: |
3466 | /* fallthru */ | 3466 | case NETDEV_TX_BUSY: |
3467 | case NETDEV_TX_BUSY: | 3467 | /* Retry it next time */ |
3468 | /* Retry it next time */ | 3468 | atomic_dec(&(pkt_dev->skb->users)); |
3469 | atomic_dec(&(pkt_dev->skb->users)); | 3469 | pkt_dev->last_ok = 0; |
3470 | pkt_dev->last_ok = 0; | ||
3471 | } | ||
3472 | |||
3473 | if (pkt_dev->delay) | ||
3474 | pkt_dev->next_tx = ktime_add_ns(ktime_now(), | ||
3475 | pkt_dev->delay); | ||
3476 | } | 3470 | } |
3477 | __netif_tx_unlock_bh(txq); | 3471 | __netif_tx_unlock_bh(txq); |
3478 | 3472 | ||
3479 | /* If pkt_dev->count is zero, then run forever */ | 3473 | /* If pkt_dev->count is zero, then run forever */ |
3480 | if ((pkt_dev->count != 0) && (pkt_dev->sofar >= pkt_dev->count)) { | 3474 | if ((pkt_dev->count != 0) && (pkt_dev->sofar >= pkt_dev->count)) { |
3481 | while (atomic_read(&(pkt_dev->skb->users)) != 1) { | 3475 | pktgen_wait_for_skb(pkt_dev); |
3482 | if (signal_pending(current)) | ||
3483 | break; | ||
3484 | idle(pkt_dev); | ||
3485 | } | ||
3486 | 3476 | ||
3487 | /* Done with this */ | 3477 | /* Done with this */ |
3488 | pktgen_stop_device(pkt_dev); | 3478 | pktgen_stop_device(pkt_dev); |
@@ -3515,20 +3505,24 @@ static int pktgen_thread_worker(void *arg) | |||
3515 | while (!kthread_should_stop()) { | 3505 | while (!kthread_should_stop()) { |
3516 | pkt_dev = next_to_run(t); | 3506 | pkt_dev = next_to_run(t); |
3517 | 3507 | ||
3518 | if (!pkt_dev && | 3508 | if (unlikely(!pkt_dev && t->control == 0)) { |
3519 | (t->control & (T_STOP | T_RUN | T_REMDEVALL | T_REMDEV)) | 3509 | wait_event_interruptible_timeout(t->queue, |
3520 | == 0) { | 3510 | t->control != 0, |
3521 | prepare_to_wait(&(t->queue), &wait, | 3511 | HZ/10); |
3522 | TASK_INTERRUPTIBLE); | 3512 | continue; |
3523 | schedule_timeout(HZ / 10); | ||
3524 | finish_wait(&(t->queue), &wait); | ||
3525 | } | 3513 | } |
3526 | 3514 | ||
3527 | __set_current_state(TASK_RUNNING); | 3515 | __set_current_state(TASK_RUNNING); |
3528 | 3516 | ||
3529 | if (pkt_dev) | 3517 | if (likely(pkt_dev)) { |
3530 | pktgen_xmit(pkt_dev); | 3518 | pktgen_xmit(pkt_dev); |
3531 | 3519 | ||
3520 | if (need_resched()) | ||
3521 | pktgen_resched(pkt_dev); | ||
3522 | else | ||
3523 | cpu_relax(); | ||
3524 | } | ||
3525 | |||
3532 | if (t->control & T_STOP) { | 3526 | if (t->control & T_STOP) { |
3533 | pktgen_stop(t); | 3527 | pktgen_stop(t); |
3534 | t->control &= ~(T_STOP); | 3528 | t->control &= ~(T_STOP); |
diff --git a/net/core/sock.c b/net/core/sock.c index 30d5446512f9..7626b6aacd68 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -446,7 +446,7 @@ static inline void sock_valbool_flag(struct sock *sk, int bit, int valbool) | |||
446 | */ | 446 | */ |
447 | 447 | ||
448 | int sock_setsockopt(struct socket *sock, int level, int optname, | 448 | int sock_setsockopt(struct socket *sock, int level, int optname, |
449 | char __user *optval, int optlen) | 449 | char __user *optval, unsigned int optlen) |
450 | { | 450 | { |
451 | struct sock *sk = sock->sk; | 451 | struct sock *sk = sock->sk; |
452 | int val; | 452 | int val; |
@@ -1206,12 +1206,12 @@ EXPORT_SYMBOL_GPL(sk_setup_caps); | |||
1206 | 1206 | ||
1207 | void __init sk_init(void) | 1207 | void __init sk_init(void) |
1208 | { | 1208 | { |
1209 | if (num_physpages <= 4096) { | 1209 | if (totalram_pages <= 4096) { |
1210 | sysctl_wmem_max = 32767; | 1210 | sysctl_wmem_max = 32767; |
1211 | sysctl_rmem_max = 32767; | 1211 | sysctl_rmem_max = 32767; |
1212 | sysctl_wmem_default = 32767; | 1212 | sysctl_wmem_default = 32767; |
1213 | sysctl_rmem_default = 32767; | 1213 | sysctl_rmem_default = 32767; |
1214 | } else if (num_physpages >= 131072) { | 1214 | } else if (totalram_pages >= 131072) { |
1215 | sysctl_wmem_max = 131071; | 1215 | sysctl_wmem_max = 131071; |
1216 | sysctl_rmem_max = 131071; | 1216 | sysctl_rmem_max = 131071; |
1217 | } | 1217 | } |
@@ -1228,17 +1228,22 @@ void __init sk_init(void) | |||
1228 | void sock_wfree(struct sk_buff *skb) | 1228 | void sock_wfree(struct sk_buff *skb) |
1229 | { | 1229 | { |
1230 | struct sock *sk = skb->sk; | 1230 | struct sock *sk = skb->sk; |
1231 | int res; | 1231 | unsigned int len = skb->truesize; |
1232 | 1232 | ||
1233 | /* In case it might be waiting for more memory. */ | 1233 | if (!sock_flag(sk, SOCK_USE_WRITE_QUEUE)) { |
1234 | res = atomic_sub_return(skb->truesize, &sk->sk_wmem_alloc); | 1234 | /* |
1235 | if (!sock_flag(sk, SOCK_USE_WRITE_QUEUE)) | 1235 | * Keep a reference on sk_wmem_alloc, this will be released |
1236 | * after sk_write_space() call | ||
1237 | */ | ||
1238 | atomic_sub(len - 1, &sk->sk_wmem_alloc); | ||
1236 | sk->sk_write_space(sk); | 1239 | sk->sk_write_space(sk); |
1240 | len = 1; | ||
1241 | } | ||
1237 | /* | 1242 | /* |
1238 | * if sk_wmem_alloc reached 0, we are last user and should | 1243 | * if sk_wmem_alloc reaches 0, we must finish what sk_free() |
1239 | * free this sock, as sk_free() call could not do it. | 1244 | * could not do because of in-flight packets |
1240 | */ | 1245 | */ |
1241 | if (res == 0) | 1246 | if (atomic_sub_and_test(len, &sk->sk_wmem_alloc)) |
1242 | __sk_free(sk); | 1247 | __sk_free(sk); |
1243 | } | 1248 | } |
1244 | EXPORT_SYMBOL(sock_wfree); | 1249 | EXPORT_SYMBOL(sock_wfree); |
@@ -1697,7 +1702,7 @@ int sock_no_shutdown(struct socket *sock, int how) | |||
1697 | EXPORT_SYMBOL(sock_no_shutdown); | 1702 | EXPORT_SYMBOL(sock_no_shutdown); |
1698 | 1703 | ||
1699 | int sock_no_setsockopt(struct socket *sock, int level, int optname, | 1704 | int sock_no_setsockopt(struct socket *sock, int level, int optname, |
1700 | char __user *optval, int optlen) | 1705 | char __user *optval, unsigned int optlen) |
1701 | { | 1706 | { |
1702 | return -EOPNOTSUPP; | 1707 | return -EOPNOTSUPP; |
1703 | } | 1708 | } |
@@ -2018,7 +2023,7 @@ EXPORT_SYMBOL(sock_common_recvmsg); | |||
2018 | * Set socket options on an inet socket. | 2023 | * Set socket options on an inet socket. |
2019 | */ | 2024 | */ |
2020 | int sock_common_setsockopt(struct socket *sock, int level, int optname, | 2025 | int sock_common_setsockopt(struct socket *sock, int level, int optname, |
2021 | char __user *optval, int optlen) | 2026 | char __user *optval, unsigned int optlen) |
2022 | { | 2027 | { |
2023 | struct sock *sk = sock->sk; | 2028 | struct sock *sk = sock->sk; |
2024 | 2029 | ||
@@ -2028,7 +2033,7 @@ EXPORT_SYMBOL(sock_common_setsockopt); | |||
2028 | 2033 | ||
2029 | #ifdef CONFIG_COMPAT | 2034 | #ifdef CONFIG_COMPAT |
2030 | int compat_sock_common_setsockopt(struct socket *sock, int level, int optname, | 2035 | int compat_sock_common_setsockopt(struct socket *sock, int level, int optname, |
2031 | char __user *optval, int optlen) | 2036 | char __user *optval, unsigned int optlen) |
2032 | { | 2037 | { |
2033 | struct sock *sk = sock->sk; | 2038 | struct sock *sk = sock->sk; |
2034 | 2039 | ||
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c index e0879bfb7dd5..ac1205df6c86 100644 --- a/net/dcb/dcbnl.c +++ b/net/dcb/dcbnl.c | |||
@@ -194,7 +194,7 @@ static int dcbnl_reply(u8 value, u8 event, u8 cmd, u8 attr, u32 pid, | |||
194 | nlmsg_end(dcbnl_skb, nlh); | 194 | nlmsg_end(dcbnl_skb, nlh); |
195 | ret = rtnl_unicast(dcbnl_skb, &init_net, pid); | 195 | ret = rtnl_unicast(dcbnl_skb, &init_net, pid); |
196 | if (ret) | 196 | if (ret) |
197 | goto err; | 197 | return -EINVAL; |
198 | 198 | ||
199 | return 0; | 199 | return 0; |
200 | nlmsg_failure: | 200 | nlmsg_failure: |
@@ -275,7 +275,7 @@ static int dcbnl_getpfccfg(struct net_device *netdev, struct nlattr **tb, | |||
275 | 275 | ||
276 | ret = rtnl_unicast(dcbnl_skb, &init_net, pid); | 276 | ret = rtnl_unicast(dcbnl_skb, &init_net, pid); |
277 | if (ret) | 277 | if (ret) |
278 | goto err; | 278 | goto err_out; |
279 | 279 | ||
280 | return 0; | 280 | return 0; |
281 | nlmsg_failure: | 281 | nlmsg_failure: |
@@ -316,12 +316,11 @@ static int dcbnl_getperm_hwaddr(struct net_device *netdev, struct nlattr **tb, | |||
316 | 316 | ||
317 | ret = rtnl_unicast(dcbnl_skb, &init_net, pid); | 317 | ret = rtnl_unicast(dcbnl_skb, &init_net, pid); |
318 | if (ret) | 318 | if (ret) |
319 | goto err; | 319 | goto err_out; |
320 | 320 | ||
321 | return 0; | 321 | return 0; |
322 | 322 | ||
323 | nlmsg_failure: | 323 | nlmsg_failure: |
324 | err: | ||
325 | kfree_skb(dcbnl_skb); | 324 | kfree_skb(dcbnl_skb); |
326 | err_out: | 325 | err_out: |
327 | return -EINVAL; | 326 | return -EINVAL; |
@@ -383,7 +382,7 @@ static int dcbnl_getcap(struct net_device *netdev, struct nlattr **tb, | |||
383 | 382 | ||
384 | ret = rtnl_unicast(dcbnl_skb, &init_net, pid); | 383 | ret = rtnl_unicast(dcbnl_skb, &init_net, pid); |
385 | if (ret) | 384 | if (ret) |
386 | goto err; | 385 | goto err_out; |
387 | 386 | ||
388 | return 0; | 387 | return 0; |
389 | nlmsg_failure: | 388 | nlmsg_failure: |
@@ -460,7 +459,7 @@ static int dcbnl_getnumtcs(struct net_device *netdev, struct nlattr **tb, | |||
460 | ret = rtnl_unicast(dcbnl_skb, &init_net, pid); | 459 | ret = rtnl_unicast(dcbnl_skb, &init_net, pid); |
461 | if (ret) { | 460 | if (ret) { |
462 | ret = -EINVAL; | 461 | ret = -EINVAL; |
463 | goto err; | 462 | goto err_out; |
464 | } | 463 | } |
465 | 464 | ||
466 | return 0; | 465 | return 0; |
@@ -799,7 +798,7 @@ static int __dcbnl_pg_getcfg(struct net_device *netdev, struct nlattr **tb, | |||
799 | 798 | ||
800 | ret = rtnl_unicast(dcbnl_skb, &init_net, pid); | 799 | ret = rtnl_unicast(dcbnl_skb, &init_net, pid); |
801 | if (ret) | 800 | if (ret) |
802 | goto err; | 801 | goto err_out; |
803 | 802 | ||
804 | return 0; | 803 | return 0; |
805 | 804 | ||
@@ -1063,7 +1062,7 @@ static int dcbnl_bcn_getcfg(struct net_device *netdev, struct nlattr **tb, | |||
1063 | 1062 | ||
1064 | ret = rtnl_unicast(dcbnl_skb, &init_net, pid); | 1063 | ret = rtnl_unicast(dcbnl_skb, &init_net, pid); |
1065 | if (ret) | 1064 | if (ret) |
1066 | goto err; | 1065 | goto err_out; |
1067 | 1066 | ||
1068 | return 0; | 1067 | return 0; |
1069 | 1068 | ||
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index d6bc47363b1c..5ef32c2f0d6a 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h | |||
@@ -290,14 +290,14 @@ extern int dccp_disconnect(struct sock *sk, int flags); | |||
290 | extern int dccp_getsockopt(struct sock *sk, int level, int optname, | 290 | extern int dccp_getsockopt(struct sock *sk, int level, int optname, |
291 | char __user *optval, int __user *optlen); | 291 | char __user *optval, int __user *optlen); |
292 | extern int dccp_setsockopt(struct sock *sk, int level, int optname, | 292 | extern int dccp_setsockopt(struct sock *sk, int level, int optname, |
293 | char __user *optval, int optlen); | 293 | char __user *optval, unsigned int optlen); |
294 | #ifdef CONFIG_COMPAT | 294 | #ifdef CONFIG_COMPAT |
295 | extern int compat_dccp_getsockopt(struct sock *sk, | 295 | extern int compat_dccp_getsockopt(struct sock *sk, |
296 | int level, int optname, | 296 | int level, int optname, |
297 | char __user *optval, int __user *optlen); | 297 | char __user *optval, int __user *optlen); |
298 | extern int compat_dccp_setsockopt(struct sock *sk, | 298 | extern int compat_dccp_setsockopt(struct sock *sk, |
299 | int level, int optname, | 299 | int level, int optname, |
300 | char __user *optval, int optlen); | 300 | char __user *optval, unsigned int optlen); |
301 | #endif | 301 | #endif |
302 | extern int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg); | 302 | extern int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg); |
303 | extern int dccp_sendmsg(struct kiocb *iocb, struct sock *sk, | 303 | extern int dccp_sendmsg(struct kiocb *iocb, struct sock *sk, |
diff --git a/net/dccp/proto.c b/net/dccp/proto.c index 923db06c7e55..a156319fd0ac 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c | |||
@@ -393,7 +393,7 @@ out: | |||
393 | EXPORT_SYMBOL_GPL(dccp_ioctl); | 393 | EXPORT_SYMBOL_GPL(dccp_ioctl); |
394 | 394 | ||
395 | static int dccp_setsockopt_service(struct sock *sk, const __be32 service, | 395 | static int dccp_setsockopt_service(struct sock *sk, const __be32 service, |
396 | char __user *optval, int optlen) | 396 | char __user *optval, unsigned int optlen) |
397 | { | 397 | { |
398 | struct dccp_sock *dp = dccp_sk(sk); | 398 | struct dccp_sock *dp = dccp_sk(sk); |
399 | struct dccp_service_list *sl = NULL; | 399 | struct dccp_service_list *sl = NULL; |
@@ -464,7 +464,7 @@ static int dccp_setsockopt_cscov(struct sock *sk, int cscov, bool rx) | |||
464 | } | 464 | } |
465 | 465 | ||
466 | static int dccp_setsockopt_ccid(struct sock *sk, int type, | 466 | static int dccp_setsockopt_ccid(struct sock *sk, int type, |
467 | char __user *optval, int optlen) | 467 | char __user *optval, unsigned int optlen) |
468 | { | 468 | { |
469 | u8 *val; | 469 | u8 *val; |
470 | int rc = 0; | 470 | int rc = 0; |
@@ -494,7 +494,7 @@ static int dccp_setsockopt_ccid(struct sock *sk, int type, | |||
494 | } | 494 | } |
495 | 495 | ||
496 | static int do_dccp_setsockopt(struct sock *sk, int level, int optname, | 496 | static int do_dccp_setsockopt(struct sock *sk, int level, int optname, |
497 | char __user *optval, int optlen) | 497 | char __user *optval, unsigned int optlen) |
498 | { | 498 | { |
499 | struct dccp_sock *dp = dccp_sk(sk); | 499 | struct dccp_sock *dp = dccp_sk(sk); |
500 | int val, err = 0; | 500 | int val, err = 0; |
@@ -546,7 +546,7 @@ static int do_dccp_setsockopt(struct sock *sk, int level, int optname, | |||
546 | } | 546 | } |
547 | 547 | ||
548 | int dccp_setsockopt(struct sock *sk, int level, int optname, | 548 | int dccp_setsockopt(struct sock *sk, int level, int optname, |
549 | char __user *optval, int optlen) | 549 | char __user *optval, unsigned int optlen) |
550 | { | 550 | { |
551 | if (level != SOL_DCCP) | 551 | if (level != SOL_DCCP) |
552 | return inet_csk(sk)->icsk_af_ops->setsockopt(sk, level, | 552 | return inet_csk(sk)->icsk_af_ops->setsockopt(sk, level, |
@@ -559,7 +559,7 @@ EXPORT_SYMBOL_GPL(dccp_setsockopt); | |||
559 | 559 | ||
560 | #ifdef CONFIG_COMPAT | 560 | #ifdef CONFIG_COMPAT |
561 | int compat_dccp_setsockopt(struct sock *sk, int level, int optname, | 561 | int compat_dccp_setsockopt(struct sock *sk, int level, int optname, |
562 | char __user *optval, int optlen) | 562 | char __user *optval, unsigned int optlen) |
563 | { | 563 | { |
564 | if (level != SOL_DCCP) | 564 | if (level != SOL_DCCP) |
565 | return inet_csk_compat_setsockopt(sk, level, optname, | 565 | return inet_csk_compat_setsockopt(sk, level, optname, |
@@ -1049,10 +1049,10 @@ static int __init dccp_init(void) | |||
1049 | * | 1049 | * |
1050 | * The methodology is similar to that of the buffer cache. | 1050 | * The methodology is similar to that of the buffer cache. |
1051 | */ | 1051 | */ |
1052 | if (num_physpages >= (128 * 1024)) | 1052 | if (totalram_pages >= (128 * 1024)) |
1053 | goal = num_physpages >> (21 - PAGE_SHIFT); | 1053 | goal = totalram_pages >> (21 - PAGE_SHIFT); |
1054 | else | 1054 | else |
1055 | goal = num_physpages >> (23 - PAGE_SHIFT); | 1055 | goal = totalram_pages >> (23 - PAGE_SHIFT); |
1056 | 1056 | ||
1057 | if (thash_entries) | 1057 | if (thash_entries) |
1058 | goal = (thash_entries * | 1058 | goal = (thash_entries * |
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index 77d40289653c..7a58c87baf17 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c | |||
@@ -157,7 +157,7 @@ static struct hlist_head dn_sk_hash[DN_SK_HASH_SIZE]; | |||
157 | static struct hlist_head dn_wild_sk; | 157 | static struct hlist_head dn_wild_sk; |
158 | static atomic_t decnet_memory_allocated; | 158 | static atomic_t decnet_memory_allocated; |
159 | 159 | ||
160 | static int __dn_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen, int flags); | 160 | static int __dn_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen, int flags); |
161 | static int __dn_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen, int flags); | 161 | static int __dn_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen, int flags); |
162 | 162 | ||
163 | static struct hlist_head *dn_find_list(struct sock *sk) | 163 | static struct hlist_head *dn_find_list(struct sock *sk) |
@@ -1325,7 +1325,7 @@ out: | |||
1325 | return err; | 1325 | return err; |
1326 | } | 1326 | } |
1327 | 1327 | ||
1328 | static int dn_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen) | 1328 | static int dn_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen) |
1329 | { | 1329 | { |
1330 | struct sock *sk = sock->sk; | 1330 | struct sock *sk = sock->sk; |
1331 | int err; | 1331 | int err; |
@@ -1337,7 +1337,7 @@ static int dn_setsockopt(struct socket *sock, int level, int optname, char __use | |||
1337 | return err; | 1337 | return err; |
1338 | } | 1338 | } |
1339 | 1339 | ||
1340 | static int __dn_setsockopt(struct socket *sock, int level,int optname, char __user *optval, int optlen, int flags) | 1340 | static int __dn_setsockopt(struct socket *sock, int level,int optname, char __user *optval, unsigned int optlen, int flags) |
1341 | { | 1341 | { |
1342 | struct sock *sk = sock->sk; | 1342 | struct sock *sk = sock->sk; |
1343 | struct dn_scp *scp = DN_SK(sk); | 1343 | struct dn_scp *scp = DN_SK(sk); |
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index 1c6a5bb6f0c8..6e1f085db06a 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c | |||
@@ -164,7 +164,7 @@ static int max_t3[] = { 8191 }; /* Must fit in 16 bits when multiplied by BCT3MU | |||
164 | static int min_priority[1]; | 164 | static int min_priority[1]; |
165 | static int max_priority[] = { 127 }; /* From DECnet spec */ | 165 | static int max_priority[] = { 127 }; /* From DECnet spec */ |
166 | 166 | ||
167 | static int dn_forwarding_proc(ctl_table *, int, struct file *, | 167 | static int dn_forwarding_proc(ctl_table *, int, |
168 | void __user *, size_t *, loff_t *); | 168 | void __user *, size_t *, loff_t *); |
169 | static int dn_forwarding_sysctl(ctl_table *table, | 169 | static int dn_forwarding_sysctl(ctl_table *table, |
170 | void __user *oldval, size_t __user *oldlenp, | 170 | void __user *oldval, size_t __user *oldlenp, |
@@ -274,7 +274,6 @@ static void dn_dev_sysctl_unregister(struct dn_dev_parms *parms) | |||
274 | } | 274 | } |
275 | 275 | ||
276 | static int dn_forwarding_proc(ctl_table *table, int write, | 276 | static int dn_forwarding_proc(ctl_table *table, int write, |
277 | struct file *filep, | ||
278 | void __user *buffer, | 277 | void __user *buffer, |
279 | size_t *lenp, loff_t *ppos) | 278 | size_t *lenp, loff_t *ppos) |
280 | { | 279 | { |
@@ -290,7 +289,7 @@ static int dn_forwarding_proc(ctl_table *table, int write, | |||
290 | dn_db = dev->dn_ptr; | 289 | dn_db = dev->dn_ptr; |
291 | old = dn_db->parms.forwarding; | 290 | old = dn_db->parms.forwarding; |
292 | 291 | ||
293 | err = proc_dointvec(table, write, filep, buffer, lenp, ppos); | 292 | err = proc_dointvec(table, write, buffer, lenp, ppos); |
294 | 293 | ||
295 | if ((err >= 0) && write) { | 294 | if ((err >= 0) && write) { |
296 | if (dn_db->parms.forwarding < 0) | 295 | if (dn_db->parms.forwarding < 0) |
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 9383d3e5a1ab..57662cabaf9b 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -1750,7 +1750,7 @@ void __init dn_route_init(void) | |||
1750 | dn_route_timer.expires = jiffies + decnet_dst_gc_interval * HZ; | 1750 | dn_route_timer.expires = jiffies + decnet_dst_gc_interval * HZ; |
1751 | add_timer(&dn_route_timer); | 1751 | add_timer(&dn_route_timer); |
1752 | 1752 | ||
1753 | goal = num_physpages >> (26 - PAGE_SHIFT); | 1753 | goal = totalram_pages >> (26 - PAGE_SHIFT); |
1754 | 1754 | ||
1755 | for(order = 0; (1UL << order) < goal; order++) | 1755 | for(order = 0; (1UL << order) < goal; order++) |
1756 | /* NOTHING */; | 1756 | /* NOTHING */; |
diff --git a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c index 5bcd592ae6dd..26b0ab1e9f56 100644 --- a/net/decnet/sysctl_net_decnet.c +++ b/net/decnet/sysctl_net_decnet.c | |||
@@ -165,7 +165,6 @@ static int dn_node_address_strategy(ctl_table *table, | |||
165 | } | 165 | } |
166 | 166 | ||
167 | static int dn_node_address_handler(ctl_table *table, int write, | 167 | static int dn_node_address_handler(ctl_table *table, int write, |
168 | struct file *filp, | ||
169 | void __user *buffer, | 168 | void __user *buffer, |
170 | size_t *lenp, loff_t *ppos) | 169 | size_t *lenp, loff_t *ppos) |
171 | { | 170 | { |
@@ -276,7 +275,6 @@ static int dn_def_dev_strategy(ctl_table *table, | |||
276 | 275 | ||
277 | 276 | ||
278 | static int dn_def_dev_handler(ctl_table *table, int write, | 277 | static int dn_def_dev_handler(ctl_table *table, int write, |
279 | struct file * filp, | ||
280 | void __user *buffer, | 278 | void __user *buffer, |
281 | size_t *lenp, loff_t *ppos) | 279 | size_t *lenp, loff_t *ppos) |
282 | { | 280 | { |
diff --git a/net/ieee802154/dgram.c b/net/ieee802154/dgram.c index 51593a48f2dd..a413b1bf4465 100644 --- a/net/ieee802154/dgram.c +++ b/net/ieee802154/dgram.c | |||
@@ -414,7 +414,7 @@ static int dgram_getsockopt(struct sock *sk, int level, int optname, | |||
414 | } | 414 | } |
415 | 415 | ||
416 | static int dgram_setsockopt(struct sock *sk, int level, int optname, | 416 | static int dgram_setsockopt(struct sock *sk, int level, int optname, |
417 | char __user *optval, int optlen) | 417 | char __user *optval, unsigned int optlen) |
418 | { | 418 | { |
419 | struct dgram_sock *ro = dgram_sk(sk); | 419 | struct dgram_sock *ro = dgram_sk(sk); |
420 | int val; | 420 | int val; |
diff --git a/net/ieee802154/raw.c b/net/ieee802154/raw.c index 13198859982e..30e74eee07d6 100644 --- a/net/ieee802154/raw.c +++ b/net/ieee802154/raw.c | |||
@@ -244,7 +244,7 @@ static int raw_getsockopt(struct sock *sk, int level, int optname, | |||
244 | } | 244 | } |
245 | 245 | ||
246 | static int raw_setsockopt(struct sock *sk, int level, int optname, | 246 | static int raw_setsockopt(struct sock *sk, int level, int optname, |
247 | char __user *optval, int optlen) | 247 | char __user *optval, unsigned int optlen) |
248 | { | 248 | { |
249 | return -EOPNOTSUPP; | 249 | return -EOPNOTSUPP; |
250 | } | 250 | } |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 58c4b0f7c4aa..57737b8d1711 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1119,6 +1119,7 @@ int inet_sk_rebuild_header(struct sock *sk) | |||
1119 | { | 1119 | { |
1120 | struct flowi fl = { | 1120 | struct flowi fl = { |
1121 | .oif = sk->sk_bound_dev_if, | 1121 | .oif = sk->sk_bound_dev_if, |
1122 | .mark = sk->sk_mark, | ||
1122 | .nl_u = { | 1123 | .nl_u = { |
1123 | .ip4_u = { | 1124 | .ip4_u = { |
1124 | .daddr = daddr, | 1125 | .daddr = daddr, |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 07336c6201f0..e92f1fd28aa5 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -1270,10 +1270,10 @@ static void inet_forward_change(struct net *net) | |||
1270 | } | 1270 | } |
1271 | 1271 | ||
1272 | static int devinet_conf_proc(ctl_table *ctl, int write, | 1272 | static int devinet_conf_proc(ctl_table *ctl, int write, |
1273 | struct file *filp, void __user *buffer, | 1273 | void __user *buffer, |
1274 | size_t *lenp, loff_t *ppos) | 1274 | size_t *lenp, loff_t *ppos) |
1275 | { | 1275 | { |
1276 | int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); | 1276 | int ret = proc_dointvec(ctl, write, buffer, lenp, ppos); |
1277 | 1277 | ||
1278 | if (write) { | 1278 | if (write) { |
1279 | struct ipv4_devconf *cnf = ctl->extra1; | 1279 | struct ipv4_devconf *cnf = ctl->extra1; |
@@ -1342,12 +1342,12 @@ static int devinet_conf_sysctl(ctl_table *table, | |||
1342 | } | 1342 | } |
1343 | 1343 | ||
1344 | static int devinet_sysctl_forward(ctl_table *ctl, int write, | 1344 | static int devinet_sysctl_forward(ctl_table *ctl, int write, |
1345 | struct file *filp, void __user *buffer, | 1345 | void __user *buffer, |
1346 | size_t *lenp, loff_t *ppos) | 1346 | size_t *lenp, loff_t *ppos) |
1347 | { | 1347 | { |
1348 | int *valp = ctl->data; | 1348 | int *valp = ctl->data; |
1349 | int val = *valp; | 1349 | int val = *valp; |
1350 | int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); | 1350 | int ret = proc_dointvec(ctl, write, buffer, lenp, ppos); |
1351 | 1351 | ||
1352 | if (write && *valp != val) { | 1352 | if (write && *valp != val) { |
1353 | struct net *net = ctl->extra2; | 1353 | struct net *net = ctl->extra2; |
@@ -1372,12 +1372,12 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write, | |||
1372 | } | 1372 | } |
1373 | 1373 | ||
1374 | int ipv4_doint_and_flush(ctl_table *ctl, int write, | 1374 | int ipv4_doint_and_flush(ctl_table *ctl, int write, |
1375 | struct file *filp, void __user *buffer, | 1375 | void __user *buffer, |
1376 | size_t *lenp, loff_t *ppos) | 1376 | size_t *lenp, loff_t *ppos) |
1377 | { | 1377 | { |
1378 | int *valp = ctl->data; | 1378 | int *valp = ctl->data; |
1379 | int val = *valp; | 1379 | int val = *valp; |
1380 | int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); | 1380 | int ret = proc_dointvec(ctl, write, buffer, lenp, ppos); |
1381 | struct net *net = ctl->extra2; | 1381 | struct net *net = ctl->extra2; |
1382 | 1382 | ||
1383 | if (write && *valp != val) | 1383 | if (write && *valp != val) |
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 22cd19ee44e5..4351ca2cf0b8 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -714,7 +714,7 @@ int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname, | |||
714 | EXPORT_SYMBOL_GPL(inet_csk_compat_getsockopt); | 714 | EXPORT_SYMBOL_GPL(inet_csk_compat_getsockopt); |
715 | 715 | ||
716 | int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname, | 716 | int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname, |
717 | char __user *optval, int optlen) | 717 | char __user *optval, unsigned int optlen) |
718 | { | 718 | { |
719 | const struct inet_connection_sock *icsk = inet_csk(sk); | 719 | const struct inet_connection_sock *icsk = inet_csk(sk); |
720 | 720 | ||
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index d9645c94a067..41ada9904d31 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -66,10 +66,7 @@ | |||
66 | solution, but it supposes maintaing new variable in ALL | 66 | solution, but it supposes maintaing new variable in ALL |
67 | skb, even if no tunneling is used. | 67 | skb, even if no tunneling is used. |
68 | 68 | ||
69 | Current solution: t->recursion lock breaks dead loops. It looks | 69 | Current solution: HARD_TX_LOCK lock breaks dead loops. |
70 | like dev->tbusy flag, but I preferred new variable, because | ||
71 | the semantics is different. One day, when hard_start_xmit | ||
72 | will be multithreaded we will have to use skb->encapsulation. | ||
73 | 70 | ||
74 | 71 | ||
75 | 72 | ||
@@ -678,11 +675,6 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev | |||
678 | __be32 dst; | 675 | __be32 dst; |
679 | int mtu; | 676 | int mtu; |
680 | 677 | ||
681 | if (tunnel->recursion++) { | ||
682 | stats->collisions++; | ||
683 | goto tx_error; | ||
684 | } | ||
685 | |||
686 | if (dev->type == ARPHRD_ETHER) | 678 | if (dev->type == ARPHRD_ETHER) |
687 | IPCB(skb)->flags = 0; | 679 | IPCB(skb)->flags = 0; |
688 | 680 | ||
@@ -820,7 +812,6 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev | |||
820 | ip_rt_put(rt); | 812 | ip_rt_put(rt); |
821 | stats->tx_dropped++; | 813 | stats->tx_dropped++; |
822 | dev_kfree_skb(skb); | 814 | dev_kfree_skb(skb); |
823 | tunnel->recursion--; | ||
824 | return NETDEV_TX_OK; | 815 | return NETDEV_TX_OK; |
825 | } | 816 | } |
826 | if (skb->sk) | 817 | if (skb->sk) |
@@ -888,7 +879,6 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev | |||
888 | nf_reset(skb); | 879 | nf_reset(skb); |
889 | 880 | ||
890 | IPTUNNEL_XMIT(); | 881 | IPTUNNEL_XMIT(); |
891 | tunnel->recursion--; | ||
892 | return NETDEV_TX_OK; | 882 | return NETDEV_TX_OK; |
893 | 883 | ||
894 | tx_error_icmp: | 884 | tx_error_icmp: |
@@ -897,7 +887,6 @@ tx_error_icmp: | |||
897 | tx_error: | 887 | tx_error: |
898 | stats->tx_errors++; | 888 | stats->tx_errors++; |
899 | dev_kfree_skb(skb); | 889 | dev_kfree_skb(skb); |
900 | tunnel->recursion--; | ||
901 | return NETDEV_TX_OK; | 890 | return NETDEV_TX_OK; |
902 | } | 891 | } |
903 | 892 | ||
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 9fe5d7b81580..f9895180f481 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -335,6 +335,7 @@ int ip_queue_xmit(struct sk_buff *skb, int ipfragok) | |||
335 | 335 | ||
336 | { | 336 | { |
337 | struct flowi fl = { .oif = sk->sk_bound_dev_if, | 337 | struct flowi fl = { .oif = sk->sk_bound_dev_if, |
338 | .mark = sk->sk_mark, | ||
338 | .nl_u = { .ip4_u = | 339 | .nl_u = { .ip4_u = |
339 | { .daddr = daddr, | 340 | { .daddr = daddr, |
340 | .saddr = inet->saddr, | 341 | .saddr = inet->saddr, |
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index fc7993e9061f..0c0b6e363a20 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -440,7 +440,7 @@ out: | |||
440 | */ | 440 | */ |
441 | 441 | ||
442 | static int do_ip_setsockopt(struct sock *sk, int level, | 442 | static int do_ip_setsockopt(struct sock *sk, int level, |
443 | int optname, char __user *optval, int optlen) | 443 | int optname, char __user *optval, unsigned int optlen) |
444 | { | 444 | { |
445 | struct inet_sock *inet = inet_sk(sk); | 445 | struct inet_sock *inet = inet_sk(sk); |
446 | int val = 0, err; | 446 | int val = 0, err; |
@@ -611,6 +611,9 @@ static int do_ip_setsockopt(struct sock *sk, int level, | |||
611 | * Check the arguments are allowable | 611 | * Check the arguments are allowable |
612 | */ | 612 | */ |
613 | 613 | ||
614 | if (optlen < sizeof(struct in_addr)) | ||
615 | goto e_inval; | ||
616 | |||
614 | err = -EFAULT; | 617 | err = -EFAULT; |
615 | if (optlen >= sizeof(struct ip_mreqn)) { | 618 | if (optlen >= sizeof(struct ip_mreqn)) { |
616 | if (copy_from_user(&mreq, optval, sizeof(mreq))) | 619 | if (copy_from_user(&mreq, optval, sizeof(mreq))) |
@@ -947,7 +950,7 @@ e_inval: | |||
947 | } | 950 | } |
948 | 951 | ||
949 | int ip_setsockopt(struct sock *sk, int level, | 952 | int ip_setsockopt(struct sock *sk, int level, |
950 | int optname, char __user *optval, int optlen) | 953 | int optname, char __user *optval, unsigned int optlen) |
951 | { | 954 | { |
952 | int err; | 955 | int err; |
953 | 956 | ||
@@ -972,7 +975,7 @@ EXPORT_SYMBOL(ip_setsockopt); | |||
972 | 975 | ||
973 | #ifdef CONFIG_COMPAT | 976 | #ifdef CONFIG_COMPAT |
974 | int compat_ip_setsockopt(struct sock *sk, int level, int optname, | 977 | int compat_ip_setsockopt(struct sock *sk, int level, int optname, |
975 | char __user *optval, int optlen) | 978 | char __user *optval, unsigned int optlen) |
976 | { | 979 | { |
977 | int err; | 980 | int err; |
978 | 981 | ||
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index 62548cb0923c..08ccd344de7a 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c | |||
@@ -402,11 +402,6 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
402 | __be32 dst = tiph->daddr; | 402 | __be32 dst = tiph->daddr; |
403 | int mtu; | 403 | int mtu; |
404 | 404 | ||
405 | if (tunnel->recursion++) { | ||
406 | stats->collisions++; | ||
407 | goto tx_error; | ||
408 | } | ||
409 | |||
410 | if (skb->protocol != htons(ETH_P_IP)) | 405 | if (skb->protocol != htons(ETH_P_IP)) |
411 | goto tx_error; | 406 | goto tx_error; |
412 | 407 | ||
@@ -485,7 +480,6 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
485 | ip_rt_put(rt); | 480 | ip_rt_put(rt); |
486 | stats->tx_dropped++; | 481 | stats->tx_dropped++; |
487 | dev_kfree_skb(skb); | 482 | dev_kfree_skb(skb); |
488 | tunnel->recursion--; | ||
489 | return NETDEV_TX_OK; | 483 | return NETDEV_TX_OK; |
490 | } | 484 | } |
491 | if (skb->sk) | 485 | if (skb->sk) |
@@ -523,7 +517,6 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
523 | nf_reset(skb); | 517 | nf_reset(skb); |
524 | 518 | ||
525 | IPTUNNEL_XMIT(); | 519 | IPTUNNEL_XMIT(); |
526 | tunnel->recursion--; | ||
527 | return NETDEV_TX_OK; | 520 | return NETDEV_TX_OK; |
528 | 521 | ||
529 | tx_error_icmp: | 522 | tx_error_icmp: |
@@ -531,7 +524,6 @@ tx_error_icmp: | |||
531 | tx_error: | 524 | tx_error: |
532 | stats->tx_errors++; | 525 | stats->tx_errors++; |
533 | dev_kfree_skb(skb); | 526 | dev_kfree_skb(skb); |
534 | tunnel->recursion--; | ||
535 | return NETDEV_TX_OK; | 527 | return NETDEV_TX_OK; |
536 | } | 528 | } |
537 | 529 | ||
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index c43ec2d51ce2..630a56df7b47 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -931,7 +931,7 @@ static void mrtsock_destruct(struct sock *sk) | |||
931 | * MOSPF/PIM router set up we can clean this up. | 931 | * MOSPF/PIM router set up we can clean this up. |
932 | */ | 932 | */ |
933 | 933 | ||
934 | int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, int optlen) | 934 | int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, unsigned int optlen) |
935 | { | 935 | { |
936 | int ret; | 936 | int ret; |
937 | struct vifctl vif; | 937 | struct vifctl vif; |
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index ebb1e5848bc6..757c9171e7c2 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -741,7 +741,7 @@ out: return ret; | |||
741 | } | 741 | } |
742 | 742 | ||
743 | static int do_raw_setsockopt(struct sock *sk, int level, int optname, | 743 | static int do_raw_setsockopt(struct sock *sk, int level, int optname, |
744 | char __user *optval, int optlen) | 744 | char __user *optval, unsigned int optlen) |
745 | { | 745 | { |
746 | if (optname == ICMP_FILTER) { | 746 | if (optname == ICMP_FILTER) { |
747 | if (inet_sk(sk)->num != IPPROTO_ICMP) | 747 | if (inet_sk(sk)->num != IPPROTO_ICMP) |
@@ -753,7 +753,7 @@ static int do_raw_setsockopt(struct sock *sk, int level, int optname, | |||
753 | } | 753 | } |
754 | 754 | ||
755 | static int raw_setsockopt(struct sock *sk, int level, int optname, | 755 | static int raw_setsockopt(struct sock *sk, int level, int optname, |
756 | char __user *optval, int optlen) | 756 | char __user *optval, unsigned int optlen) |
757 | { | 757 | { |
758 | if (level != SOL_RAW) | 758 | if (level != SOL_RAW) |
759 | return ip_setsockopt(sk, level, optname, optval, optlen); | 759 | return ip_setsockopt(sk, level, optname, optval, optlen); |
@@ -762,7 +762,7 @@ static int raw_setsockopt(struct sock *sk, int level, int optname, | |||
762 | 762 | ||
763 | #ifdef CONFIG_COMPAT | 763 | #ifdef CONFIG_COMPAT |
764 | static int compat_raw_setsockopt(struct sock *sk, int level, int optname, | 764 | static int compat_raw_setsockopt(struct sock *sk, int level, int optname, |
765 | char __user *optval, int optlen) | 765 | char __user *optval, unsigned int optlen) |
766 | { | 766 | { |
767 | if (level != SOL_RAW) | 767 | if (level != SOL_RAW) |
768 | return compat_ip_setsockopt(sk, level, optname, optval, optlen); | 768 | return compat_ip_setsockopt(sk, level, optname, optval, optlen); |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 91867d3e6328..bb4199252026 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -3036,7 +3036,7 @@ void ip_rt_multicast_event(struct in_device *in_dev) | |||
3036 | 3036 | ||
3037 | #ifdef CONFIG_SYSCTL | 3037 | #ifdef CONFIG_SYSCTL |
3038 | static int ipv4_sysctl_rtcache_flush(ctl_table *__ctl, int write, | 3038 | static int ipv4_sysctl_rtcache_flush(ctl_table *__ctl, int write, |
3039 | struct file *filp, void __user *buffer, | 3039 | void __user *buffer, |
3040 | size_t *lenp, loff_t *ppos) | 3040 | size_t *lenp, loff_t *ppos) |
3041 | { | 3041 | { |
3042 | if (write) { | 3042 | if (write) { |
@@ -3046,7 +3046,7 @@ static int ipv4_sysctl_rtcache_flush(ctl_table *__ctl, int write, | |||
3046 | 3046 | ||
3047 | memcpy(&ctl, __ctl, sizeof(ctl)); | 3047 | memcpy(&ctl, __ctl, sizeof(ctl)); |
3048 | ctl.data = &flush_delay; | 3048 | ctl.data = &flush_delay; |
3049 | proc_dointvec(&ctl, write, filp, buffer, lenp, ppos); | 3049 | proc_dointvec(&ctl, write, buffer, lenp, ppos); |
3050 | 3050 | ||
3051 | net = (struct net *)__ctl->extra1; | 3051 | net = (struct net *)__ctl->extra1; |
3052 | rt_cache_flush(net, flush_delay); | 3052 | rt_cache_flush(net, flush_delay); |
@@ -3106,12 +3106,11 @@ static void rt_secret_reschedule(int old) | |||
3106 | } | 3106 | } |
3107 | 3107 | ||
3108 | static int ipv4_sysctl_rt_secret_interval(ctl_table *ctl, int write, | 3108 | static int ipv4_sysctl_rt_secret_interval(ctl_table *ctl, int write, |
3109 | struct file *filp, | ||
3110 | void __user *buffer, size_t *lenp, | 3109 | void __user *buffer, size_t *lenp, |
3111 | loff_t *ppos) | 3110 | loff_t *ppos) |
3112 | { | 3111 | { |
3113 | int old = ip_rt_secret_interval; | 3112 | int old = ip_rt_secret_interval; |
3114 | int ret = proc_dointvec_jiffies(ctl, write, filp, buffer, lenp, ppos); | 3113 | int ret = proc_dointvec_jiffies(ctl, write, buffer, lenp, ppos); |
3115 | 3114 | ||
3116 | rt_secret_reschedule(old); | 3115 | rt_secret_reschedule(old); |
3117 | 3116 | ||
@@ -3414,7 +3413,7 @@ int __init ip_rt_init(void) | |||
3414 | alloc_large_system_hash("IP route cache", | 3413 | alloc_large_system_hash("IP route cache", |
3415 | sizeof(struct rt_hash_bucket), | 3414 | sizeof(struct rt_hash_bucket), |
3416 | rhash_entries, | 3415 | rhash_entries, |
3417 | (num_physpages >= 128 * 1024) ? | 3416 | (totalram_pages >= 128 * 1024) ? |
3418 | 15 : 17, | 3417 | 15 : 17, |
3419 | 0, | 3418 | 0, |
3420 | &rt_hash_log, | 3419 | &rt_hash_log, |
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 4710d219f06a..2dcf04d9b005 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c | |||
@@ -36,7 +36,7 @@ static void set_local_port_range(int range[2]) | |||
36 | } | 36 | } |
37 | 37 | ||
38 | /* Validate changes from /proc interface. */ | 38 | /* Validate changes from /proc interface. */ |
39 | static int ipv4_local_port_range(ctl_table *table, int write, struct file *filp, | 39 | static int ipv4_local_port_range(ctl_table *table, int write, |
40 | void __user *buffer, | 40 | void __user *buffer, |
41 | size_t *lenp, loff_t *ppos) | 41 | size_t *lenp, loff_t *ppos) |
42 | { | 42 | { |
@@ -51,7 +51,7 @@ static int ipv4_local_port_range(ctl_table *table, int write, struct file *filp, | |||
51 | }; | 51 | }; |
52 | 52 | ||
53 | inet_get_local_port_range(range, range + 1); | 53 | inet_get_local_port_range(range, range + 1); |
54 | ret = proc_dointvec_minmax(&tmp, write, filp, buffer, lenp, ppos); | 54 | ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos); |
55 | 55 | ||
56 | if (write && ret == 0) { | 56 | if (write && ret == 0) { |
57 | if (range[1] < range[0]) | 57 | if (range[1] < range[0]) |
@@ -91,7 +91,7 @@ static int ipv4_sysctl_local_port_range(ctl_table *table, | |||
91 | } | 91 | } |
92 | 92 | ||
93 | 93 | ||
94 | static int proc_tcp_congestion_control(ctl_table *ctl, int write, struct file * filp, | 94 | static int proc_tcp_congestion_control(ctl_table *ctl, int write, |
95 | void __user *buffer, size_t *lenp, loff_t *ppos) | 95 | void __user *buffer, size_t *lenp, loff_t *ppos) |
96 | { | 96 | { |
97 | char val[TCP_CA_NAME_MAX]; | 97 | char val[TCP_CA_NAME_MAX]; |
@@ -103,7 +103,7 @@ static int proc_tcp_congestion_control(ctl_table *ctl, int write, struct file * | |||
103 | 103 | ||
104 | tcp_get_default_congestion_control(val); | 104 | tcp_get_default_congestion_control(val); |
105 | 105 | ||
106 | ret = proc_dostring(&tbl, write, filp, buffer, lenp, ppos); | 106 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); |
107 | if (write && ret == 0) | 107 | if (write && ret == 0) |
108 | ret = tcp_set_default_congestion_control(val); | 108 | ret = tcp_set_default_congestion_control(val); |
109 | return ret; | 109 | return ret; |
@@ -129,7 +129,7 @@ static int sysctl_tcp_congestion_control(ctl_table *table, | |||
129 | } | 129 | } |
130 | 130 | ||
131 | static int proc_tcp_available_congestion_control(ctl_table *ctl, | 131 | static int proc_tcp_available_congestion_control(ctl_table *ctl, |
132 | int write, struct file * filp, | 132 | int write, |
133 | void __user *buffer, size_t *lenp, | 133 | void __user *buffer, size_t *lenp, |
134 | loff_t *ppos) | 134 | loff_t *ppos) |
135 | { | 135 | { |
@@ -140,13 +140,13 @@ static int proc_tcp_available_congestion_control(ctl_table *ctl, | |||
140 | if (!tbl.data) | 140 | if (!tbl.data) |
141 | return -ENOMEM; | 141 | return -ENOMEM; |
142 | tcp_get_available_congestion_control(tbl.data, TCP_CA_BUF_MAX); | 142 | tcp_get_available_congestion_control(tbl.data, TCP_CA_BUF_MAX); |
143 | ret = proc_dostring(&tbl, write, filp, buffer, lenp, ppos); | 143 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); |
144 | kfree(tbl.data); | 144 | kfree(tbl.data); |
145 | return ret; | 145 | return ret; |
146 | } | 146 | } |
147 | 147 | ||
148 | static int proc_allowed_congestion_control(ctl_table *ctl, | 148 | static int proc_allowed_congestion_control(ctl_table *ctl, |
149 | int write, struct file * filp, | 149 | int write, |
150 | void __user *buffer, size_t *lenp, | 150 | void __user *buffer, size_t *lenp, |
151 | loff_t *ppos) | 151 | loff_t *ppos) |
152 | { | 152 | { |
@@ -158,7 +158,7 @@ static int proc_allowed_congestion_control(ctl_table *ctl, | |||
158 | return -ENOMEM; | 158 | return -ENOMEM; |
159 | 159 | ||
160 | tcp_get_allowed_congestion_control(tbl.data, tbl.maxlen); | 160 | tcp_get_allowed_congestion_control(tbl.data, tbl.maxlen); |
161 | ret = proc_dostring(&tbl, write, filp, buffer, lenp, ppos); | 161 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); |
162 | if (write && ret == 0) | 162 | if (write && ret == 0) |
163 | ret = tcp_set_allowed_congestion_control(tbl.data); | 163 | ret = tcp_set_allowed_congestion_control(tbl.data); |
164 | kfree(tbl.data); | 164 | kfree(tbl.data); |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 19a0612b8a20..64d0af675823 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -580,7 +580,7 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos, | |||
580 | 580 | ||
581 | lock_sock(sk); | 581 | lock_sock(sk); |
582 | 582 | ||
583 | timeo = sock_rcvtimeo(sk, flags & SPLICE_F_NONBLOCK); | 583 | timeo = sock_rcvtimeo(sk, sock->file->f_flags & O_NONBLOCK); |
584 | while (tss.len) { | 584 | while (tss.len) { |
585 | ret = __tcp_splice_read(sk, &tss); | 585 | ret = __tcp_splice_read(sk, &tss); |
586 | if (ret < 0) | 586 | if (ret < 0) |
@@ -2032,7 +2032,7 @@ int tcp_disconnect(struct sock *sk, int flags) | |||
2032 | * Socket option code for TCP. | 2032 | * Socket option code for TCP. |
2033 | */ | 2033 | */ |
2034 | static int do_tcp_setsockopt(struct sock *sk, int level, | 2034 | static int do_tcp_setsockopt(struct sock *sk, int level, |
2035 | int optname, char __user *optval, int optlen) | 2035 | int optname, char __user *optval, unsigned int optlen) |
2036 | { | 2036 | { |
2037 | struct tcp_sock *tp = tcp_sk(sk); | 2037 | struct tcp_sock *tp = tcp_sk(sk); |
2038 | struct inet_connection_sock *icsk = inet_csk(sk); | 2038 | struct inet_connection_sock *icsk = inet_csk(sk); |
@@ -2047,7 +2047,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level, | |||
2047 | return -EINVAL; | 2047 | return -EINVAL; |
2048 | 2048 | ||
2049 | val = strncpy_from_user(name, optval, | 2049 | val = strncpy_from_user(name, optval, |
2050 | min(TCP_CA_NAME_MAX-1, optlen)); | 2050 | min_t(long, TCP_CA_NAME_MAX-1, optlen)); |
2051 | if (val < 0) | 2051 | if (val < 0) |
2052 | return -EFAULT; | 2052 | return -EFAULT; |
2053 | name[val] = 0; | 2053 | name[val] = 0; |
@@ -2220,7 +2220,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level, | |||
2220 | } | 2220 | } |
2221 | 2221 | ||
2222 | int tcp_setsockopt(struct sock *sk, int level, int optname, char __user *optval, | 2222 | int tcp_setsockopt(struct sock *sk, int level, int optname, char __user *optval, |
2223 | int optlen) | 2223 | unsigned int optlen) |
2224 | { | 2224 | { |
2225 | struct inet_connection_sock *icsk = inet_csk(sk); | 2225 | struct inet_connection_sock *icsk = inet_csk(sk); |
2226 | 2226 | ||
@@ -2232,7 +2232,7 @@ int tcp_setsockopt(struct sock *sk, int level, int optname, char __user *optval, | |||
2232 | 2232 | ||
2233 | #ifdef CONFIG_COMPAT | 2233 | #ifdef CONFIG_COMPAT |
2234 | int compat_tcp_setsockopt(struct sock *sk, int level, int optname, | 2234 | int compat_tcp_setsockopt(struct sock *sk, int level, int optname, |
2235 | char __user *optval, int optlen) | 2235 | char __user *optval, unsigned int optlen) |
2236 | { | 2236 | { |
2237 | if (level != SOL_TCP) | 2237 | if (level != SOL_TCP) |
2238 | return inet_csk_compat_setsockopt(sk, level, optname, | 2238 | return inet_csk_compat_setsockopt(sk, level, optname, |
@@ -2862,7 +2862,7 @@ void __init tcp_init(void) | |||
2862 | alloc_large_system_hash("TCP established", | 2862 | alloc_large_system_hash("TCP established", |
2863 | sizeof(struct inet_ehash_bucket), | 2863 | sizeof(struct inet_ehash_bucket), |
2864 | thash_entries, | 2864 | thash_entries, |
2865 | (num_physpages >= 128 * 1024) ? | 2865 | (totalram_pages >= 128 * 1024) ? |
2866 | 13 : 15, | 2866 | 13 : 15, |
2867 | 0, | 2867 | 0, |
2868 | &tcp_hashinfo.ehash_size, | 2868 | &tcp_hashinfo.ehash_size, |
@@ -2879,7 +2879,7 @@ void __init tcp_init(void) | |||
2879 | alloc_large_system_hash("TCP bind", | 2879 | alloc_large_system_hash("TCP bind", |
2880 | sizeof(struct inet_bind_hashbucket), | 2880 | sizeof(struct inet_bind_hashbucket), |
2881 | tcp_hashinfo.ehash_size, | 2881 | tcp_hashinfo.ehash_size, |
2882 | (num_physpages >= 128 * 1024) ? | 2882 | (totalram_pages >= 128 * 1024) ? |
2883 | 13 : 15, | 2883 | 13 : 15, |
2884 | 0, | 2884 | 0, |
2885 | &tcp_hashinfo.bhash_size, | 2885 | &tcp_hashinfo.bhash_size, |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 5200aab0ca97..fcd278a7080e 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -361,6 +361,7 @@ static inline int tcp_urg_mode(const struct tcp_sock *tp) | |||
361 | #define OPTION_SACK_ADVERTISE (1 << 0) | 361 | #define OPTION_SACK_ADVERTISE (1 << 0) |
362 | #define OPTION_TS (1 << 1) | 362 | #define OPTION_TS (1 << 1) |
363 | #define OPTION_MD5 (1 << 2) | 363 | #define OPTION_MD5 (1 << 2) |
364 | #define OPTION_WSCALE (1 << 3) | ||
364 | 365 | ||
365 | struct tcp_out_options { | 366 | struct tcp_out_options { |
366 | u8 options; /* bit field of OPTION_* */ | 367 | u8 options; /* bit field of OPTION_* */ |
@@ -427,7 +428,7 @@ static void tcp_options_write(__be32 *ptr, struct tcp_sock *tp, | |||
427 | TCPOLEN_SACK_PERM); | 428 | TCPOLEN_SACK_PERM); |
428 | } | 429 | } |
429 | 430 | ||
430 | if (unlikely(opts->ws)) { | 431 | if (unlikely(OPTION_WSCALE & opts->options)) { |
431 | *ptr++ = htonl((TCPOPT_NOP << 24) | | 432 | *ptr++ = htonl((TCPOPT_NOP << 24) | |
432 | (TCPOPT_WINDOW << 16) | | 433 | (TCPOPT_WINDOW << 16) | |
433 | (TCPOLEN_WINDOW << 8) | | 434 | (TCPOLEN_WINDOW << 8) | |
@@ -494,8 +495,8 @@ static unsigned tcp_syn_options(struct sock *sk, struct sk_buff *skb, | |||
494 | } | 495 | } |
495 | if (likely(sysctl_tcp_window_scaling)) { | 496 | if (likely(sysctl_tcp_window_scaling)) { |
496 | opts->ws = tp->rx_opt.rcv_wscale; | 497 | opts->ws = tp->rx_opt.rcv_wscale; |
497 | if (likely(opts->ws)) | 498 | opts->options |= OPTION_WSCALE; |
498 | size += TCPOLEN_WSCALE_ALIGNED; | 499 | size += TCPOLEN_WSCALE_ALIGNED; |
499 | } | 500 | } |
500 | if (likely(sysctl_tcp_sack)) { | 501 | if (likely(sysctl_tcp_sack)) { |
501 | opts->options |= OPTION_SACK_ADVERTISE; | 502 | opts->options |= OPTION_SACK_ADVERTISE; |
@@ -537,8 +538,8 @@ static unsigned tcp_synack_options(struct sock *sk, | |||
537 | 538 | ||
538 | if (likely(ireq->wscale_ok)) { | 539 | if (likely(ireq->wscale_ok)) { |
539 | opts->ws = ireq->rcv_wscale; | 540 | opts->ws = ireq->rcv_wscale; |
540 | if (likely(opts->ws)) | 541 | opts->options |= OPTION_WSCALE; |
541 | size += TCPOLEN_WSCALE_ALIGNED; | 542 | size += TCPOLEN_WSCALE_ALIGNED; |
542 | } | 543 | } |
543 | if (likely(doing_ts)) { | 544 | if (likely(doing_ts)) { |
544 | opts->options |= OPTION_TS; | 545 | opts->options |= OPTION_TS; |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index ebaaa7f973d7..6ec6a8a4a224 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -696,6 +696,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
696 | 696 | ||
697 | if (rt == NULL) { | 697 | if (rt == NULL) { |
698 | struct flowi fl = { .oif = ipc.oif, | 698 | struct flowi fl = { .oif = ipc.oif, |
699 | .mark = sk->sk_mark, | ||
699 | .nl_u = { .ip4_u = | 700 | .nl_u = { .ip4_u = |
700 | { .daddr = faddr, | 701 | { .daddr = faddr, |
701 | .saddr = saddr, | 702 | .saddr = saddr, |
@@ -1359,7 +1360,7 @@ void udp_destroy_sock(struct sock *sk) | |||
1359 | * Socket option code for UDP | 1360 | * Socket option code for UDP |
1360 | */ | 1361 | */ |
1361 | int udp_lib_setsockopt(struct sock *sk, int level, int optname, | 1362 | int udp_lib_setsockopt(struct sock *sk, int level, int optname, |
1362 | char __user *optval, int optlen, | 1363 | char __user *optval, unsigned int optlen, |
1363 | int (*push_pending_frames)(struct sock *)) | 1364 | int (*push_pending_frames)(struct sock *)) |
1364 | { | 1365 | { |
1365 | struct udp_sock *up = udp_sk(sk); | 1366 | struct udp_sock *up = udp_sk(sk); |
@@ -1441,7 +1442,7 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname, | |||
1441 | EXPORT_SYMBOL(udp_lib_setsockopt); | 1442 | EXPORT_SYMBOL(udp_lib_setsockopt); |
1442 | 1443 | ||
1443 | int udp_setsockopt(struct sock *sk, int level, int optname, | 1444 | int udp_setsockopt(struct sock *sk, int level, int optname, |
1444 | char __user *optval, int optlen) | 1445 | char __user *optval, unsigned int optlen) |
1445 | { | 1446 | { |
1446 | if (level == SOL_UDP || level == SOL_UDPLITE) | 1447 | if (level == SOL_UDP || level == SOL_UDPLITE) |
1447 | return udp_lib_setsockopt(sk, level, optname, optval, optlen, | 1448 | return udp_lib_setsockopt(sk, level, optname, optval, optlen, |
@@ -1451,7 +1452,7 @@ int udp_setsockopt(struct sock *sk, int level, int optname, | |||
1451 | 1452 | ||
1452 | #ifdef CONFIG_COMPAT | 1453 | #ifdef CONFIG_COMPAT |
1453 | int compat_udp_setsockopt(struct sock *sk, int level, int optname, | 1454 | int compat_udp_setsockopt(struct sock *sk, int level, int optname, |
1454 | char __user *optval, int optlen) | 1455 | char __user *optval, unsigned int optlen) |
1455 | { | 1456 | { |
1456 | if (level == SOL_UDP || level == SOL_UDPLITE) | 1457 | if (level == SOL_UDP || level == SOL_UDPLITE) |
1457 | return udp_lib_setsockopt(sk, level, optname, optval, optlen, | 1458 | return udp_lib_setsockopt(sk, level, optname, optval, optlen, |
diff --git a/net/ipv4/udp_impl.h b/net/ipv4/udp_impl.h index 9f4a6165f722..aaad650d47d9 100644 --- a/net/ipv4/udp_impl.h +++ b/net/ipv4/udp_impl.h | |||
@@ -11,13 +11,13 @@ extern void __udp4_lib_err(struct sk_buff *, u32, struct udp_table *); | |||
11 | extern int udp_v4_get_port(struct sock *sk, unsigned short snum); | 11 | extern int udp_v4_get_port(struct sock *sk, unsigned short snum); |
12 | 12 | ||
13 | extern int udp_setsockopt(struct sock *sk, int level, int optname, | 13 | extern int udp_setsockopt(struct sock *sk, int level, int optname, |
14 | char __user *optval, int optlen); | 14 | char __user *optval, unsigned int optlen); |
15 | extern int udp_getsockopt(struct sock *sk, int level, int optname, | 15 | extern int udp_getsockopt(struct sock *sk, int level, int optname, |
16 | char __user *optval, int __user *optlen); | 16 | char __user *optval, int __user *optlen); |
17 | 17 | ||
18 | #ifdef CONFIG_COMPAT | 18 | #ifdef CONFIG_COMPAT |
19 | extern int compat_udp_setsockopt(struct sock *sk, int level, int optname, | 19 | extern int compat_udp_setsockopt(struct sock *sk, int level, int optname, |
20 | char __user *optval, int optlen); | 20 | char __user *optval, unsigned int optlen); |
21 | extern int compat_udp_getsockopt(struct sock *sk, int level, int optname, | 21 | extern int compat_udp_getsockopt(struct sock *sk, int level, int optname, |
22 | char __user *optval, int __user *optlen); | 22 | char __user *optval, int __user *optlen); |
23 | #endif | 23 | #endif |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 55f486d89c88..1fd0a3d775d2 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -3986,14 +3986,14 @@ static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) | |||
3986 | #ifdef CONFIG_SYSCTL | 3986 | #ifdef CONFIG_SYSCTL |
3987 | 3987 | ||
3988 | static | 3988 | static |
3989 | int addrconf_sysctl_forward(ctl_table *ctl, int write, struct file * filp, | 3989 | int addrconf_sysctl_forward(ctl_table *ctl, int write, |
3990 | void __user *buffer, size_t *lenp, loff_t *ppos) | 3990 | void __user *buffer, size_t *lenp, loff_t *ppos) |
3991 | { | 3991 | { |
3992 | int *valp = ctl->data; | 3992 | int *valp = ctl->data; |
3993 | int val = *valp; | 3993 | int val = *valp; |
3994 | int ret; | 3994 | int ret; |
3995 | 3995 | ||
3996 | ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); | 3996 | ret = proc_dointvec(ctl, write, buffer, lenp, ppos); |
3997 | 3997 | ||
3998 | if (write) | 3998 | if (write) |
3999 | ret = addrconf_fixup_forwarding(ctl, valp, val); | 3999 | ret = addrconf_fixup_forwarding(ctl, valp, val); |
@@ -4090,14 +4090,14 @@ static int addrconf_disable_ipv6(struct ctl_table *table, int *p, int old) | |||
4090 | } | 4090 | } |
4091 | 4091 | ||
4092 | static | 4092 | static |
4093 | int addrconf_sysctl_disable(ctl_table *ctl, int write, struct file * filp, | 4093 | int addrconf_sysctl_disable(ctl_table *ctl, int write, |
4094 | void __user *buffer, size_t *lenp, loff_t *ppos) | 4094 | void __user *buffer, size_t *lenp, loff_t *ppos) |
4095 | { | 4095 | { |
4096 | int *valp = ctl->data; | 4096 | int *valp = ctl->data; |
4097 | int val = *valp; | 4097 | int val = *valp; |
4098 | int ret; | 4098 | int ret; |
4099 | 4099 | ||
4100 | ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); | 4100 | ret = proc_dointvec(ctl, write, buffer, lenp, ppos); |
4101 | 4101 | ||
4102 | if (write) | 4102 | if (write) |
4103 | ret = addrconf_disable_ipv6(ctl, valp, val); | 4103 | ret = addrconf_disable_ipv6(ctl, valp, val); |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 7d25bbe32110..c595bbe1ed99 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -1043,11 +1043,6 @@ ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1043 | struct net_device_stats *stats = &t->dev->stats; | 1043 | struct net_device_stats *stats = &t->dev->stats; |
1044 | int ret; | 1044 | int ret; |
1045 | 1045 | ||
1046 | if (t->recursion++) { | ||
1047 | stats->collisions++; | ||
1048 | goto tx_err; | ||
1049 | } | ||
1050 | |||
1051 | switch (skb->protocol) { | 1046 | switch (skb->protocol) { |
1052 | case htons(ETH_P_IP): | 1047 | case htons(ETH_P_IP): |
1053 | ret = ip4ip6_tnl_xmit(skb, dev); | 1048 | ret = ip4ip6_tnl_xmit(skb, dev); |
@@ -1062,14 +1057,12 @@ ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1062 | if (ret < 0) | 1057 | if (ret < 0) |
1063 | goto tx_err; | 1058 | goto tx_err; |
1064 | 1059 | ||
1065 | t->recursion--; | ||
1066 | return NETDEV_TX_OK; | 1060 | return NETDEV_TX_OK; |
1067 | 1061 | ||
1068 | tx_err: | 1062 | tx_err: |
1069 | stats->tx_errors++; | 1063 | stats->tx_errors++; |
1070 | stats->tx_dropped++; | 1064 | stats->tx_dropped++; |
1071 | kfree_skb(skb); | 1065 | kfree_skb(skb); |
1072 | t->recursion--; | ||
1073 | return NETDEV_TX_OK; | 1066 | return NETDEV_TX_OK; |
1074 | } | 1067 | } |
1075 | 1068 | ||
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 3907510c2ce3..716153941fc4 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -324,7 +324,7 @@ static int ipmr_mfc_seq_show(struct seq_file *seq, void *v) | |||
324 | return 0; | 324 | return 0; |
325 | } | 325 | } |
326 | 326 | ||
327 | static struct seq_operations ipmr_mfc_seq_ops = { | 327 | static const struct seq_operations ipmr_mfc_seq_ops = { |
328 | .start = ipmr_mfc_seq_start, | 328 | .start = ipmr_mfc_seq_start, |
329 | .next = ipmr_mfc_seq_next, | 329 | .next = ipmr_mfc_seq_next, |
330 | .stop = ipmr_mfc_seq_stop, | 330 | .stop = ipmr_mfc_seq_stop, |
@@ -1281,7 +1281,7 @@ int ip6mr_sk_done(struct sock *sk) | |||
1281 | * MOSPF/PIM router set up we can clean this up. | 1281 | * MOSPF/PIM router set up we can clean this up. |
1282 | */ | 1282 | */ |
1283 | 1283 | ||
1284 | int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, int optlen) | 1284 | int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, unsigned int optlen) |
1285 | { | 1285 | { |
1286 | int ret; | 1286 | int ret; |
1287 | struct mif6ctl vif; | 1287 | struct mif6ctl vif; |
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index f5e0682b402d..14f54eb5a7fc 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
@@ -123,7 +123,7 @@ struct ipv6_txoptions *ipv6_update_options(struct sock *sk, | |||
123 | } | 123 | } |
124 | 124 | ||
125 | static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, | 125 | static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, |
126 | char __user *optval, int optlen) | 126 | char __user *optval, unsigned int optlen) |
127 | { | 127 | { |
128 | struct ipv6_pinfo *np = inet6_sk(sk); | 128 | struct ipv6_pinfo *np = inet6_sk(sk); |
129 | struct net *net = sock_net(sk); | 129 | struct net *net = sock_net(sk); |
@@ -773,7 +773,7 @@ e_inval: | |||
773 | } | 773 | } |
774 | 774 | ||
775 | int ipv6_setsockopt(struct sock *sk, int level, int optname, | 775 | int ipv6_setsockopt(struct sock *sk, int level, int optname, |
776 | char __user *optval, int optlen) | 776 | char __user *optval, unsigned int optlen) |
777 | { | 777 | { |
778 | int err; | 778 | int err; |
779 | 779 | ||
@@ -801,7 +801,7 @@ EXPORT_SYMBOL(ipv6_setsockopt); | |||
801 | 801 | ||
802 | #ifdef CONFIG_COMPAT | 802 | #ifdef CONFIG_COMPAT |
803 | int compat_ipv6_setsockopt(struct sock *sk, int level, int optname, | 803 | int compat_ipv6_setsockopt(struct sock *sk, int level, int optname, |
804 | char __user *optval, int optlen) | 804 | char __user *optval, unsigned int optlen) |
805 | { | 805 | { |
806 | int err; | 806 | int err; |
807 | 807 | ||
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 7015478797f6..f74e4e2cdd06 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -658,7 +658,6 @@ void ndisc_send_rs(struct net_device *dev, const struct in6_addr *saddr, | |||
658 | &icmp6h, NULL, | 658 | &icmp6h, NULL, |
659 | send_sllao ? ND_OPT_SOURCE_LL_ADDR : 0); | 659 | send_sllao ? ND_OPT_SOURCE_LL_ADDR : 0); |
660 | } | 660 | } |
661 | EXPORT_SYMBOL(ndisc_send_rs); | ||
662 | 661 | ||
663 | 662 | ||
664 | static void ndisc_error_report(struct neighbour *neigh, struct sk_buff *skb) | 663 | static void ndisc_error_report(struct neighbour *neigh, struct sk_buff *skb) |
@@ -1735,7 +1734,7 @@ static void ndisc_warn_deprecated_sysctl(struct ctl_table *ctl, | |||
1735 | } | 1734 | } |
1736 | } | 1735 | } |
1737 | 1736 | ||
1738 | int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, struct file * filp, void __user *buffer, size_t *lenp, loff_t *ppos) | 1737 | int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos) |
1739 | { | 1738 | { |
1740 | struct net_device *dev = ctl->extra1; | 1739 | struct net_device *dev = ctl->extra1; |
1741 | struct inet6_dev *idev; | 1740 | struct inet6_dev *idev; |
@@ -1746,16 +1745,16 @@ int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, struct file * f | |||
1746 | ndisc_warn_deprecated_sysctl(ctl, "syscall", dev ? dev->name : "default"); | 1745 | ndisc_warn_deprecated_sysctl(ctl, "syscall", dev ? dev->name : "default"); |
1747 | 1746 | ||
1748 | if (strcmp(ctl->procname, "retrans_time") == 0) | 1747 | if (strcmp(ctl->procname, "retrans_time") == 0) |
1749 | ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); | 1748 | ret = proc_dointvec(ctl, write, buffer, lenp, ppos); |
1750 | 1749 | ||
1751 | else if (strcmp(ctl->procname, "base_reachable_time") == 0) | 1750 | else if (strcmp(ctl->procname, "base_reachable_time") == 0) |
1752 | ret = proc_dointvec_jiffies(ctl, write, | 1751 | ret = proc_dointvec_jiffies(ctl, write, |
1753 | filp, buffer, lenp, ppos); | 1752 | buffer, lenp, ppos); |
1754 | 1753 | ||
1755 | else if ((strcmp(ctl->procname, "retrans_time_ms") == 0) || | 1754 | else if ((strcmp(ctl->procname, "retrans_time_ms") == 0) || |
1756 | (strcmp(ctl->procname, "base_reachable_time_ms") == 0)) | 1755 | (strcmp(ctl->procname, "base_reachable_time_ms") == 0)) |
1757 | ret = proc_dointvec_ms_jiffies(ctl, write, | 1756 | ret = proc_dointvec_ms_jiffies(ctl, write, |
1758 | filp, buffer, lenp, ppos); | 1757 | buffer, lenp, ppos); |
1759 | else | 1758 | else |
1760 | ret = -1; | 1759 | ret = -1; |
1761 | 1760 | ||
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 7d675b8d82d3..4f24570b0869 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -957,7 +957,7 @@ static int rawv6_geticmpfilter(struct sock *sk, int level, int optname, | |||
957 | 957 | ||
958 | 958 | ||
959 | static int do_rawv6_setsockopt(struct sock *sk, int level, int optname, | 959 | static int do_rawv6_setsockopt(struct sock *sk, int level, int optname, |
960 | char __user *optval, int optlen) | 960 | char __user *optval, unsigned int optlen) |
961 | { | 961 | { |
962 | struct raw6_sock *rp = raw6_sk(sk); | 962 | struct raw6_sock *rp = raw6_sk(sk); |
963 | int val; | 963 | int val; |
@@ -1000,7 +1000,7 @@ static int do_rawv6_setsockopt(struct sock *sk, int level, int optname, | |||
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | static int rawv6_setsockopt(struct sock *sk, int level, int optname, | 1002 | static int rawv6_setsockopt(struct sock *sk, int level, int optname, |
1003 | char __user *optval, int optlen) | 1003 | char __user *optval, unsigned int optlen) |
1004 | { | 1004 | { |
1005 | switch(level) { | 1005 | switch(level) { |
1006 | case SOL_RAW: | 1006 | case SOL_RAW: |
@@ -1024,7 +1024,7 @@ static int rawv6_setsockopt(struct sock *sk, int level, int optname, | |||
1024 | 1024 | ||
1025 | #ifdef CONFIG_COMPAT | 1025 | #ifdef CONFIG_COMPAT |
1026 | static int compat_rawv6_setsockopt(struct sock *sk, int level, int optname, | 1026 | static int compat_rawv6_setsockopt(struct sock *sk, int level, int optname, |
1027 | char __user *optval, int optlen) | 1027 | char __user *optval, unsigned int optlen) |
1028 | { | 1028 | { |
1029 | switch (level) { | 1029 | switch (level) { |
1030 | case SOL_RAW: | 1030 | case SOL_RAW: |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 77aecbe8ff6c..d6fe7646a8ff 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -2524,13 +2524,13 @@ static const struct file_operations rt6_stats_seq_fops = { | |||
2524 | #ifdef CONFIG_SYSCTL | 2524 | #ifdef CONFIG_SYSCTL |
2525 | 2525 | ||
2526 | static | 2526 | static |
2527 | int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, struct file * filp, | 2527 | int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, |
2528 | void __user *buffer, size_t *lenp, loff_t *ppos) | 2528 | void __user *buffer, size_t *lenp, loff_t *ppos) |
2529 | { | 2529 | { |
2530 | struct net *net = current->nsproxy->net_ns; | 2530 | struct net *net = current->nsproxy->net_ns; |
2531 | int delay = net->ipv6.sysctl.flush_delay; | 2531 | int delay = net->ipv6.sysctl.flush_delay; |
2532 | if (write) { | 2532 | if (write) { |
2533 | proc_dointvec(ctl, write, filp, buffer, lenp, ppos); | 2533 | proc_dointvec(ctl, write, buffer, lenp, ppos); |
2534 | fib6_run_gc(delay <= 0 ? ~0UL : (unsigned long)delay, net); | 2534 | fib6_run_gc(delay <= 0 ? ~0UL : (unsigned long)delay, net); |
2535 | return 0; | 2535 | return 0; |
2536 | } else | 2536 | } else |
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 0ae4f6448187..dbd19a78ca73 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
@@ -15,7 +15,6 @@ | |||
15 | * Roger Venning <r.venning@telstra.com>: 6to4 support | 15 | * Roger Venning <r.venning@telstra.com>: 6to4 support |
16 | * Nate Thompson <nate@thebog.net>: 6to4 support | 16 | * Nate Thompson <nate@thebog.net>: 6to4 support |
17 | * Fred Templin <fred.l.templin@boeing.com>: isatap support | 17 | * Fred Templin <fred.l.templin@boeing.com>: isatap support |
18 | * Sascha Hlusiak <mail@saschahlusiak.de>: stateless autoconf for isatap | ||
19 | */ | 18 | */ |
20 | 19 | ||
21 | #include <linux/module.h> | 20 | #include <linux/module.h> |
@@ -223,44 +222,6 @@ failed: | |||
223 | return NULL; | 222 | return NULL; |
224 | } | 223 | } |
225 | 224 | ||
226 | static void ipip6_tunnel_rs_timer(unsigned long data) | ||
227 | { | ||
228 | struct ip_tunnel_prl_entry *p = (struct ip_tunnel_prl_entry *) data; | ||
229 | struct inet6_dev *ifp; | ||
230 | struct inet6_ifaddr *addr; | ||
231 | |||
232 | spin_lock(&p->lock); | ||
233 | ifp = __in6_dev_get(p->tunnel->dev); | ||
234 | |||
235 | read_lock_bh(&ifp->lock); | ||
236 | for (addr = ifp->addr_list; addr; addr = addr->if_next) { | ||
237 | struct in6_addr rtr; | ||
238 | |||
239 | if (!(ipv6_addr_type(&addr->addr) & IPV6_ADDR_LINKLOCAL)) | ||
240 | continue; | ||
241 | |||
242 | /* Send RS to guessed linklocal address of router | ||
243 | * | ||
244 | * Better: send to ff02::2 encapsuled in unicast directly | ||
245 | * to router-v4 instead of guessing the v6 address. | ||
246 | * | ||
247 | * Cisco/Windows seem to not set the u/l bit correctly, | ||
248 | * so we won't guess right. | ||
249 | */ | ||
250 | ipv6_addr_set(&rtr, htonl(0xFE800000), 0, 0, 0); | ||
251 | if (!__ipv6_isatap_ifid(rtr.s6_addr + 8, | ||
252 | p->addr)) { | ||
253 | ndisc_send_rs(p->tunnel->dev, &addr->addr, &rtr); | ||
254 | } | ||
255 | } | ||
256 | read_unlock_bh(&ifp->lock); | ||
257 | |||
258 | mod_timer(&p->rs_timer, jiffies + HZ * p->rs_delay); | ||
259 | spin_unlock(&p->lock); | ||
260 | |||
261 | return; | ||
262 | } | ||
263 | |||
264 | static struct ip_tunnel_prl_entry * | 225 | static struct ip_tunnel_prl_entry * |
265 | __ipip6_tunnel_locate_prl(struct ip_tunnel *t, __be32 addr) | 226 | __ipip6_tunnel_locate_prl(struct ip_tunnel *t, __be32 addr) |
266 | { | 227 | { |
@@ -313,13 +274,12 @@ static int ipip6_tunnel_get_prl(struct ip_tunnel *t, | |||
313 | 274 | ||
314 | c = 0; | 275 | c = 0; |
315 | for (prl = t->prl; prl; prl = prl->next) { | 276 | for (prl = t->prl; prl; prl = prl->next) { |
316 | if (c > cmax) | 277 | if (c >= cmax) |
317 | break; | 278 | break; |
318 | if (kprl.addr != htonl(INADDR_ANY) && prl->addr != kprl.addr) | 279 | if (kprl.addr != htonl(INADDR_ANY) && prl->addr != kprl.addr) |
319 | continue; | 280 | continue; |
320 | kp[c].addr = prl->addr; | 281 | kp[c].addr = prl->addr; |
321 | kp[c].flags = prl->flags; | 282 | kp[c].flags = prl->flags; |
322 | kp[c].rs_delay = prl->rs_delay; | ||
323 | c++; | 283 | c++; |
324 | if (kprl.addr != htonl(INADDR_ANY)) | 284 | if (kprl.addr != htonl(INADDR_ANY)) |
325 | break; | 285 | break; |
@@ -369,23 +329,11 @@ ipip6_tunnel_add_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a, int chg) | |||
369 | } | 329 | } |
370 | 330 | ||
371 | p->next = t->prl; | 331 | p->next = t->prl; |
372 | p->tunnel = t; | ||
373 | t->prl = p; | 332 | t->prl = p; |
374 | t->prl_count++; | 333 | t->prl_count++; |
375 | |||
376 | spin_lock_init(&p->lock); | ||
377 | setup_timer(&p->rs_timer, ipip6_tunnel_rs_timer, (unsigned long) p); | ||
378 | update: | 334 | update: |
379 | p->addr = a->addr; | 335 | p->addr = a->addr; |
380 | p->flags = a->flags; | 336 | p->flags = a->flags; |
381 | p->rs_delay = a->rs_delay; | ||
382 | if (p->rs_delay == 0) | ||
383 | p->rs_delay = IPTUNNEL_RS_DEFAULT_DELAY; | ||
384 | spin_lock(&p->lock); | ||
385 | del_timer(&p->rs_timer); | ||
386 | if (p->flags & PRL_DEFAULT) | ||
387 | mod_timer(&p->rs_timer, jiffies + 1); | ||
388 | spin_unlock(&p->lock); | ||
389 | out: | 337 | out: |
390 | write_unlock(&ipip6_lock); | 338 | write_unlock(&ipip6_lock); |
391 | return err; | 339 | return err; |
@@ -404,9 +352,6 @@ ipip6_tunnel_del_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a) | |||
404 | if ((*p)->addr == a->addr) { | 352 | if ((*p)->addr == a->addr) { |
405 | x = *p; | 353 | x = *p; |
406 | *p = x->next; | 354 | *p = x->next; |
407 | spin_lock(&x->lock); | ||
408 | del_timer(&x->rs_timer); | ||
409 | spin_unlock(&x->lock); | ||
410 | kfree(x); | 355 | kfree(x); |
411 | t->prl_count--; | 356 | t->prl_count--; |
412 | goto out; | 357 | goto out; |
@@ -417,9 +362,6 @@ ipip6_tunnel_del_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a) | |||
417 | while (t->prl) { | 362 | while (t->prl) { |
418 | x = t->prl; | 363 | x = t->prl; |
419 | t->prl = t->prl->next; | 364 | t->prl = t->prl->next; |
420 | spin_lock(&x->lock); | ||
421 | del_timer(&x->rs_timer); | ||
422 | spin_unlock(&x->lock); | ||
423 | kfree(x); | 365 | kfree(x); |
424 | t->prl_count--; | 366 | t->prl_count--; |
425 | } | 367 | } |
@@ -626,11 +568,6 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, | |||
626 | struct in6_addr *addr6; | 568 | struct in6_addr *addr6; |
627 | int addr_type; | 569 | int addr_type; |
628 | 570 | ||
629 | if (tunnel->recursion++) { | ||
630 | stats->collisions++; | ||
631 | goto tx_error; | ||
632 | } | ||
633 | |||
634 | if (skb->protocol != htons(ETH_P_IPV6)) | 571 | if (skb->protocol != htons(ETH_P_IPV6)) |
635 | goto tx_error; | 572 | goto tx_error; |
636 | 573 | ||
@@ -753,7 +690,6 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, | |||
753 | ip_rt_put(rt); | 690 | ip_rt_put(rt); |
754 | stats->tx_dropped++; | 691 | stats->tx_dropped++; |
755 | dev_kfree_skb(skb); | 692 | dev_kfree_skb(skb); |
756 | tunnel->recursion--; | ||
757 | return NETDEV_TX_OK; | 693 | return NETDEV_TX_OK; |
758 | } | 694 | } |
759 | if (skb->sk) | 695 | if (skb->sk) |
@@ -794,7 +730,6 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, | |||
794 | nf_reset(skb); | 730 | nf_reset(skb); |
795 | 731 | ||
796 | IPTUNNEL_XMIT(); | 732 | IPTUNNEL_XMIT(); |
797 | tunnel->recursion--; | ||
798 | return NETDEV_TX_OK; | 733 | return NETDEV_TX_OK; |
799 | 734 | ||
800 | tx_error_icmp: | 735 | tx_error_icmp: |
@@ -802,7 +737,6 @@ tx_error_icmp: | |||
802 | tx_error: | 737 | tx_error: |
803 | stats->tx_errors++; | 738 | stats->tx_errors++; |
804 | dev_kfree_skb(skb); | 739 | dev_kfree_skb(skb); |
805 | tunnel->recursion--; | ||
806 | return NETDEV_TX_OK; | 740 | return NETDEV_TX_OK; |
807 | } | 741 | } |
808 | 742 | ||
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index b265b7047d3e..3a60f12b34ed 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -1044,7 +1044,7 @@ void udpv6_destroy_sock(struct sock *sk) | |||
1044 | * Socket option code for UDP | 1044 | * Socket option code for UDP |
1045 | */ | 1045 | */ |
1046 | int udpv6_setsockopt(struct sock *sk, int level, int optname, | 1046 | int udpv6_setsockopt(struct sock *sk, int level, int optname, |
1047 | char __user *optval, int optlen) | 1047 | char __user *optval, unsigned int optlen) |
1048 | { | 1048 | { |
1049 | if (level == SOL_UDP || level == SOL_UDPLITE) | 1049 | if (level == SOL_UDP || level == SOL_UDPLITE) |
1050 | return udp_lib_setsockopt(sk, level, optname, optval, optlen, | 1050 | return udp_lib_setsockopt(sk, level, optname, optval, optlen, |
@@ -1054,7 +1054,7 @@ int udpv6_setsockopt(struct sock *sk, int level, int optname, | |||
1054 | 1054 | ||
1055 | #ifdef CONFIG_COMPAT | 1055 | #ifdef CONFIG_COMPAT |
1056 | int compat_udpv6_setsockopt(struct sock *sk, int level, int optname, | 1056 | int compat_udpv6_setsockopt(struct sock *sk, int level, int optname, |
1057 | char __user *optval, int optlen) | 1057 | char __user *optval, unsigned int optlen) |
1058 | { | 1058 | { |
1059 | if (level == SOL_UDP || level == SOL_UDPLITE) | 1059 | if (level == SOL_UDP || level == SOL_UDPLITE) |
1060 | return udp_lib_setsockopt(sk, level, optname, optval, optlen, | 1060 | return udp_lib_setsockopt(sk, level, optname, optval, optlen, |
diff --git a/net/ipv6/udp_impl.h b/net/ipv6/udp_impl.h index 6bb303471e20..d7571046bfc4 100644 --- a/net/ipv6/udp_impl.h +++ b/net/ipv6/udp_impl.h | |||
@@ -16,10 +16,10 @@ extern int udp_v6_get_port(struct sock *sk, unsigned short snum); | |||
16 | extern int udpv6_getsockopt(struct sock *sk, int level, int optname, | 16 | extern int udpv6_getsockopt(struct sock *sk, int level, int optname, |
17 | char __user *optval, int __user *optlen); | 17 | char __user *optval, int __user *optlen); |
18 | extern int udpv6_setsockopt(struct sock *sk, int level, int optname, | 18 | extern int udpv6_setsockopt(struct sock *sk, int level, int optname, |
19 | char __user *optval, int optlen); | 19 | char __user *optval, unsigned int optlen); |
20 | #ifdef CONFIG_COMPAT | 20 | #ifdef CONFIG_COMPAT |
21 | extern int compat_udpv6_setsockopt(struct sock *sk, int level, int optname, | 21 | extern int compat_udpv6_setsockopt(struct sock *sk, int level, int optname, |
22 | char __user *optval, int optlen); | 22 | char __user *optval, unsigned int optlen); |
23 | extern int compat_udpv6_getsockopt(struct sock *sk, int level, int optname, | 23 | extern int compat_udpv6_getsockopt(struct sock *sk, int level, int optname, |
24 | char __user *optval, int __user *optlen); | 24 | char __user *optval, int __user *optlen); |
25 | #endif | 25 | #endif |
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index f1118d92a191..66c7a20011f3 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c | |||
@@ -1292,7 +1292,7 @@ const char *ipx_device_name(struct ipx_interface *intrfc) | |||
1292 | * socket object. */ | 1292 | * socket object. */ |
1293 | 1293 | ||
1294 | static int ipx_setsockopt(struct socket *sock, int level, int optname, | 1294 | static int ipx_setsockopt(struct socket *sock, int level, int optname, |
1295 | char __user *optval, int optlen) | 1295 | char __user *optval, unsigned int optlen) |
1296 | { | 1296 | { |
1297 | struct sock *sk = sock->sk; | 1297 | struct sock *sk = sock->sk; |
1298 | int opt; | 1298 | int opt; |
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index 50b43c57d5d8..dd35641835f4 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c | |||
@@ -1826,7 +1826,7 @@ static int irda_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned lon | |||
1826 | * | 1826 | * |
1827 | */ | 1827 | */ |
1828 | static int irda_setsockopt(struct socket *sock, int level, int optname, | 1828 | static int irda_setsockopt(struct socket *sock, int level, int optname, |
1829 | char __user *optval, int optlen) | 1829 | char __user *optval, unsigned int optlen) |
1830 | { | 1830 | { |
1831 | struct sock *sk = sock->sk; | 1831 | struct sock *sk = sock->sk; |
1832 | struct irda_sock *self = irda_sk(sk); | 1832 | struct irda_sock *self = irda_sk(sk); |
diff --git a/net/irda/irsysctl.c b/net/irda/irsysctl.c index 57f8817c3979..5c86567e5a78 100644 --- a/net/irda/irsysctl.c +++ b/net/irda/irsysctl.c | |||
@@ -73,12 +73,12 @@ static int min_lap_keepalive_time = 100; /* 100us */ | |||
73 | /* For other sysctl, I've no idea of the range. Maybe Dag could help | 73 | /* For other sysctl, I've no idea of the range. Maybe Dag could help |
74 | * us on that - Jean II */ | 74 | * us on that - Jean II */ |
75 | 75 | ||
76 | static int do_devname(ctl_table *table, int write, struct file *filp, | 76 | static int do_devname(ctl_table *table, int write, |
77 | void __user *buffer, size_t *lenp, loff_t *ppos) | 77 | void __user *buffer, size_t *lenp, loff_t *ppos) |
78 | { | 78 | { |
79 | int ret; | 79 | int ret; |
80 | 80 | ||
81 | ret = proc_dostring(table, write, filp, buffer, lenp, ppos); | 81 | ret = proc_dostring(table, write, buffer, lenp, ppos); |
82 | if (ret == 0 && write) { | 82 | if (ret == 0 && write) { |
83 | struct ias_value *val; | 83 | struct ias_value *val; |
84 | 84 | ||
@@ -90,12 +90,12 @@ static int do_devname(ctl_table *table, int write, struct file *filp, | |||
90 | } | 90 | } |
91 | 91 | ||
92 | 92 | ||
93 | static int do_discovery(ctl_table *table, int write, struct file *filp, | 93 | static int do_discovery(ctl_table *table, int write, |
94 | void __user *buffer, size_t *lenp, loff_t *ppos) | 94 | void __user *buffer, size_t *lenp, loff_t *ppos) |
95 | { | 95 | { |
96 | int ret; | 96 | int ret; |
97 | 97 | ||
98 | ret = proc_dointvec(table, write, filp, buffer, lenp, ppos); | 98 | ret = proc_dointvec(table, write, buffer, lenp, ppos); |
99 | if (ret) | 99 | if (ret) |
100 | return ret; | 100 | return ret; |
101 | 101 | ||
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c index d985d163dcfc..bada1b9c670b 100644 --- a/net/iucv/af_iucv.c +++ b/net/iucv/af_iucv.c | |||
@@ -1387,7 +1387,7 @@ static int iucv_sock_release(struct socket *sock) | |||
1387 | 1387 | ||
1388 | /* getsockopt and setsockopt */ | 1388 | /* getsockopt and setsockopt */ |
1389 | static int iucv_sock_setsockopt(struct socket *sock, int level, int optname, | 1389 | static int iucv_sock_setsockopt(struct socket *sock, int level, int optname, |
1390 | char __user *optval, int optlen) | 1390 | char __user *optval, unsigned int optlen) |
1391 | { | 1391 | { |
1392 | struct sock *sk = sock->sk; | 1392 | struct sock *sk = sock->sk; |
1393 | struct iucv_sock *iucv = iucv_sk(sk); | 1393 | struct iucv_sock *iucv = iucv_sk(sk); |
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c index c45eee1c0e8d..7aa4fd170104 100644 --- a/net/llc/af_llc.c +++ b/net/llc/af_llc.c | |||
@@ -973,7 +973,7 @@ static int llc_ui_ioctl(struct socket *sock, unsigned int cmd, | |||
973 | * Set various connection specific parameters. | 973 | * Set various connection specific parameters. |
974 | */ | 974 | */ |
975 | static int llc_ui_setsockopt(struct socket *sock, int level, int optname, | 975 | static int llc_ui_setsockopt(struct socket *sock, int level, int optname, |
976 | char __user *optval, int optlen) | 976 | char __user *optval, unsigned int optlen) |
977 | { | 977 | { |
978 | struct sock *sk = sock->sk; | 978 | struct sock *sk = sock->sk; |
979 | struct llc_sock *llc = llc_sk(sk); | 979 | struct llc_sock *llc = llc_sk(sk); |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 97a278a2f48e..8d26e9bf8964 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -1388,8 +1388,8 @@ ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata, | |||
1388 | 1388 | ||
1389 | reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); | 1389 | reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); |
1390 | 1390 | ||
1391 | printk(KERN_DEBUG "%s: disassociated (Reason: %u)\n", | 1391 | printk(KERN_DEBUG "%s: disassociated from %pM (Reason: %u)\n", |
1392 | sdata->dev->name, reason_code); | 1392 | sdata->dev->name, mgmt->sa, reason_code); |
1393 | 1393 | ||
1394 | ieee80211_set_disassoc(sdata, false); | 1394 | ieee80211_set_disassoc(sdata, false); |
1395 | return RX_MGMT_CFG80211_DISASSOC; | 1395 | return RX_MGMT_CFG80211_DISASSOC; |
@@ -1675,7 +1675,7 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata, | |||
1675 | 1675 | ||
1676 | /* direct probe may be part of the association flow */ | 1676 | /* direct probe may be part of the association flow */ |
1677 | if (wk && wk->state == IEEE80211_MGD_STATE_PROBE) { | 1677 | if (wk && wk->state == IEEE80211_MGD_STATE_PROBE) { |
1678 | printk(KERN_DEBUG "%s direct probe responded\n", | 1678 | printk(KERN_DEBUG "%s: direct probe responded\n", |
1679 | sdata->dev->name); | 1679 | sdata->dev->name); |
1680 | wk->tries = 0; | 1680 | wk->tries = 0; |
1681 | wk->state = IEEE80211_MGD_STATE_AUTH; | 1681 | wk->state = IEEE80211_MGD_STATE_AUTH; |
@@ -2502,9 +2502,6 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, | |||
2502 | struct ieee80211_mgd_work *wk; | 2502 | struct ieee80211_mgd_work *wk; |
2503 | const u8 *bssid = NULL; | 2503 | const u8 *bssid = NULL; |
2504 | 2504 | ||
2505 | printk(KERN_DEBUG "%s: deauthenticating by local choice (reason=%d)\n", | ||
2506 | sdata->dev->name, req->reason_code); | ||
2507 | |||
2508 | mutex_lock(&ifmgd->mtx); | 2505 | mutex_lock(&ifmgd->mtx); |
2509 | 2506 | ||
2510 | if (ifmgd->associated && &ifmgd->associated->cbss == req->bss) { | 2507 | if (ifmgd->associated && &ifmgd->associated->cbss == req->bss) { |
@@ -2532,6 +2529,9 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, | |||
2532 | 2529 | ||
2533 | mutex_unlock(&ifmgd->mtx); | 2530 | mutex_unlock(&ifmgd->mtx); |
2534 | 2531 | ||
2532 | printk(KERN_DEBUG "%s: deauthenticating from %pM by local choice (reason=%d)\n", | ||
2533 | sdata->dev->name, bssid, req->reason_code); | ||
2534 | |||
2535 | ieee80211_send_deauth_disassoc(sdata, bssid, | 2535 | ieee80211_send_deauth_disassoc(sdata, bssid, |
2536 | IEEE80211_STYPE_DEAUTH, req->reason_code, | 2536 | IEEE80211_STYPE_DEAUTH, req->reason_code, |
2537 | cookie); | 2537 | cookie); |
@@ -2545,9 +2545,6 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, | |||
2545 | { | 2545 | { |
2546 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | 2546 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
2547 | 2547 | ||
2548 | printk(KERN_DEBUG "%s: disassociating by local choice (reason=%d)\n", | ||
2549 | sdata->dev->name, req->reason_code); | ||
2550 | |||
2551 | mutex_lock(&ifmgd->mtx); | 2548 | mutex_lock(&ifmgd->mtx); |
2552 | 2549 | ||
2553 | /* | 2550 | /* |
@@ -2561,6 +2558,9 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, | |||
2561 | return -ENOLINK; | 2558 | return -ENOLINK; |
2562 | } | 2559 | } |
2563 | 2560 | ||
2561 | printk(KERN_DEBUG "%s: disassociating from %pM by local choice (reason=%d)\n", | ||
2562 | sdata->dev->name, req->bss->bssid, req->reason_code); | ||
2563 | |||
2564 | ieee80211_set_disassoc(sdata, false); | 2564 | ieee80211_set_disassoc(sdata, false); |
2565 | 2565 | ||
2566 | mutex_unlock(&ifmgd->mtx); | 2566 | mutex_unlock(&ifmgd->mtx); |
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 039901109fa1..71e10cabf811 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -90,8 +90,8 @@ ieee80211_bss_info_update(struct ieee80211_local *local, | |||
90 | bss->dtim_period = tim_ie->dtim_period; | 90 | bss->dtim_period = tim_ie->dtim_period; |
91 | } | 91 | } |
92 | 92 | ||
93 | /* set default value for buggy APs */ | 93 | /* set default value for buggy AP/no TIM element */ |
94 | if (!elems->tim || bss->dtim_period == 0) | 94 | if (bss->dtim_period == 0) |
95 | bss->dtim_period = 1; | 95 | bss->dtim_period = 1; |
96 | 96 | ||
97 | bss->supp_rates_len = 0; | 97 | bss->supp_rates_len = 0; |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 5143d203256b..fd4028296613 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -367,7 +367,10 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
367 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; | 367 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; |
368 | u32 staflags; | 368 | u32 staflags; |
369 | 369 | ||
370 | if (unlikely(!sta || ieee80211_is_probe_resp(hdr->frame_control))) | 370 | if (unlikely(!sta || ieee80211_is_probe_resp(hdr->frame_control) |
371 | || ieee80211_is_auth(hdr->frame_control) | ||
372 | || ieee80211_is_assoc_resp(hdr->frame_control) | ||
373 | || ieee80211_is_reassoc_resp(hdr->frame_control))) | ||
371 | return TX_CONTINUE; | 374 | return TX_CONTINUE; |
372 | 375 | ||
373 | staflags = get_sta_flags(sta); | 376 | staflags = get_sta_flags(sta); |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index fba2892b99e1..446e9bd4b4bc 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -1496,14 +1496,14 @@ static int ip_vs_zero_all(void) | |||
1496 | 1496 | ||
1497 | 1497 | ||
1498 | static int | 1498 | static int |
1499 | proc_do_defense_mode(ctl_table *table, int write, struct file * filp, | 1499 | proc_do_defense_mode(ctl_table *table, int write, |
1500 | void __user *buffer, size_t *lenp, loff_t *ppos) | 1500 | void __user *buffer, size_t *lenp, loff_t *ppos) |
1501 | { | 1501 | { |
1502 | int *valp = table->data; | 1502 | int *valp = table->data; |
1503 | int val = *valp; | 1503 | int val = *valp; |
1504 | int rc; | 1504 | int rc; |
1505 | 1505 | ||
1506 | rc = proc_dointvec(table, write, filp, buffer, lenp, ppos); | 1506 | rc = proc_dointvec(table, write, buffer, lenp, ppos); |
1507 | if (write && (*valp != val)) { | 1507 | if (write && (*valp != val)) { |
1508 | if ((*valp < 0) || (*valp > 3)) { | 1508 | if ((*valp < 0) || (*valp > 3)) { |
1509 | /* Restore the correct value */ | 1509 | /* Restore the correct value */ |
@@ -1517,7 +1517,7 @@ proc_do_defense_mode(ctl_table *table, int write, struct file * filp, | |||
1517 | 1517 | ||
1518 | 1518 | ||
1519 | static int | 1519 | static int |
1520 | proc_do_sync_threshold(ctl_table *table, int write, struct file *filp, | 1520 | proc_do_sync_threshold(ctl_table *table, int write, |
1521 | void __user *buffer, size_t *lenp, loff_t *ppos) | 1521 | void __user *buffer, size_t *lenp, loff_t *ppos) |
1522 | { | 1522 | { |
1523 | int *valp = table->data; | 1523 | int *valp = table->data; |
@@ -1527,7 +1527,7 @@ proc_do_sync_threshold(ctl_table *table, int write, struct file *filp, | |||
1527 | /* backup the value first */ | 1527 | /* backup the value first */ |
1528 | memcpy(val, valp, sizeof(val)); | 1528 | memcpy(val, valp, sizeof(val)); |
1529 | 1529 | ||
1530 | rc = proc_dointvec(table, write, filp, buffer, lenp, ppos); | 1530 | rc = proc_dointvec(table, write, buffer, lenp, ppos); |
1531 | if (write && (valp[0] < 0 || valp[1] < 0 || valp[0] >= valp[1])) { | 1531 | if (write && (valp[0] < 0 || valp[1] < 0 || valp[0] >= valp[1])) { |
1532 | /* Restore the correct value */ | 1532 | /* Restore the correct value */ |
1533 | memcpy(valp, val, sizeof(val)); | 1533 | memcpy(valp, val, sizeof(val)); |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index b37109817a98..7c9ec3dee96e 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -1245,9 +1245,9 @@ static int nf_conntrack_init_init_net(void) | |||
1245 | * machine has 512 buckets. >= 1GB machines have 16384 buckets. */ | 1245 | * machine has 512 buckets. >= 1GB machines have 16384 buckets. */ |
1246 | if (!nf_conntrack_htable_size) { | 1246 | if (!nf_conntrack_htable_size) { |
1247 | nf_conntrack_htable_size | 1247 | nf_conntrack_htable_size |
1248 | = (((num_physpages << PAGE_SHIFT) / 16384) | 1248 | = (((totalram_pages << PAGE_SHIFT) / 16384) |
1249 | / sizeof(struct hlist_head)); | 1249 | / sizeof(struct hlist_head)); |
1250 | if (num_physpages > (1024 * 1024 * 1024 / PAGE_SIZE)) | 1250 | if (totalram_pages > (1024 * 1024 * 1024 / PAGE_SIZE)) |
1251 | nf_conntrack_htable_size = 16384; | 1251 | nf_conntrack_htable_size = 16384; |
1252 | if (nf_conntrack_htable_size < 32) | 1252 | if (nf_conntrack_htable_size < 32) |
1253 | nf_conntrack_htable_size = 32; | 1253 | nf_conntrack_htable_size = 32; |
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c index 4e620305f28c..c93494fef8ef 100644 --- a/net/netfilter/nf_log.c +++ b/net/netfilter/nf_log.c | |||
@@ -226,7 +226,7 @@ static char nf_log_sysctl_fnames[NFPROTO_NUMPROTO-NFPROTO_UNSPEC][3]; | |||
226 | static struct ctl_table nf_log_sysctl_table[NFPROTO_NUMPROTO+1]; | 226 | static struct ctl_table nf_log_sysctl_table[NFPROTO_NUMPROTO+1]; |
227 | static struct ctl_table_header *nf_log_dir_header; | 227 | static struct ctl_table_header *nf_log_dir_header; |
228 | 228 | ||
229 | static int nf_log_proc_dostring(ctl_table *table, int write, struct file *filp, | 229 | static int nf_log_proc_dostring(ctl_table *table, int write, |
230 | void __user *buffer, size_t *lenp, loff_t *ppos) | 230 | void __user *buffer, size_t *lenp, loff_t *ppos) |
231 | { | 231 | { |
232 | const struct nf_logger *logger; | 232 | const struct nf_logger *logger; |
@@ -260,7 +260,7 @@ static int nf_log_proc_dostring(ctl_table *table, int write, struct file *filp, | |||
260 | table->data = "NONE"; | 260 | table->data = "NONE"; |
261 | else | 261 | else |
262 | table->data = logger->name; | 262 | table->data = logger->name; |
263 | r = proc_dostring(table, write, filp, buffer, lenp, ppos); | 263 | r = proc_dostring(table, write, buffer, lenp, ppos); |
264 | mutex_unlock(&nf_log_mutex); | 264 | mutex_unlock(&nf_log_mutex); |
265 | } | 265 | } |
266 | 266 | ||
diff --git a/net/netfilter/nf_sockopt.c b/net/netfilter/nf_sockopt.c index 8ab829f86574..f042ae521557 100644 --- a/net/netfilter/nf_sockopt.c +++ b/net/netfilter/nf_sockopt.c | |||
@@ -113,7 +113,7 @@ static int nf_sockopt(struct sock *sk, u_int8_t pf, int val, | |||
113 | } | 113 | } |
114 | 114 | ||
115 | int nf_setsockopt(struct sock *sk, u_int8_t pf, int val, char __user *opt, | 115 | int nf_setsockopt(struct sock *sk, u_int8_t pf, int val, char __user *opt, |
116 | int len) | 116 | unsigned int len) |
117 | { | 117 | { |
118 | return nf_sockopt(sk, pf, val, opt, &len, 0); | 118 | return nf_sockopt(sk, pf, val, opt, &len, 0); |
119 | } | 119 | } |
@@ -154,7 +154,7 @@ static int compat_nf_sockopt(struct sock *sk, u_int8_t pf, int val, | |||
154 | } | 154 | } |
155 | 155 | ||
156 | int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, | 156 | int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, |
157 | int val, char __user *opt, int len) | 157 | int val, char __user *opt, unsigned int len) |
158 | { | 158 | { |
159 | return compat_nf_sockopt(sk, pf, val, opt, &len, 0); | 159 | return compat_nf_sockopt(sk, pf, val, opt, &len, 0); |
160 | } | 160 | } |
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index a6ac83a93348..f01955cce314 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c | |||
@@ -617,7 +617,7 @@ struct xt_table_info *xt_alloc_table_info(unsigned int size) | |||
617 | int cpu; | 617 | int cpu; |
618 | 618 | ||
619 | /* Pedantry: prevent them from hitting BUG() in vmalloc.c --RR */ | 619 | /* Pedantry: prevent them from hitting BUG() in vmalloc.c --RR */ |
620 | if ((SMP_ALIGN(size) >> PAGE_SHIFT) + 2 > num_physpages) | 620 | if ((SMP_ALIGN(size) >> PAGE_SHIFT) + 2 > totalram_pages) |
621 | return NULL; | 621 | return NULL; |
622 | 622 | ||
623 | newinfo = kzalloc(XT_TABLE_INFO_SZ, GFP_KERNEL); | 623 | newinfo = kzalloc(XT_TABLE_INFO_SZ, GFP_KERNEL); |
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c index 219dcdbe388c..dd16e404424f 100644 --- a/net/netfilter/xt_hashlimit.c +++ b/net/netfilter/xt_hashlimit.c | |||
@@ -194,9 +194,9 @@ static int htable_create_v0(struct xt_hashlimit_info *minfo, u_int8_t family) | |||
194 | if (minfo->cfg.size) | 194 | if (minfo->cfg.size) |
195 | size = minfo->cfg.size; | 195 | size = minfo->cfg.size; |
196 | else { | 196 | else { |
197 | size = ((num_physpages << PAGE_SHIFT) / 16384) / | 197 | size = ((totalram_pages << PAGE_SHIFT) / 16384) / |
198 | sizeof(struct list_head); | 198 | sizeof(struct list_head); |
199 | if (num_physpages > (1024 * 1024 * 1024 / PAGE_SIZE)) | 199 | if (totalram_pages > (1024 * 1024 * 1024 / PAGE_SIZE)) |
200 | size = 8192; | 200 | size = 8192; |
201 | if (size < 16) | 201 | if (size < 16) |
202 | size = 16; | 202 | size = 16; |
@@ -266,9 +266,9 @@ static int htable_create(struct xt_hashlimit_mtinfo1 *minfo, u_int8_t family) | |||
266 | if (minfo->cfg.size) { | 266 | if (minfo->cfg.size) { |
267 | size = minfo->cfg.size; | 267 | size = minfo->cfg.size; |
268 | } else { | 268 | } else { |
269 | size = (num_physpages << PAGE_SHIFT) / 16384 / | 269 | size = (totalram_pages << PAGE_SHIFT) / 16384 / |
270 | sizeof(struct list_head); | 270 | sizeof(struct list_head); |
271 | if (num_physpages > 1024 * 1024 * 1024 / PAGE_SIZE) | 271 | if (totalram_pages > 1024 * 1024 * 1024 / PAGE_SIZE) |
272 | size = 8192; | 272 | size = 8192; |
273 | if (size < 16) | 273 | if (size < 16) |
274 | size = 16; | 274 | size = 16; |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index c5aab6a368ce..19e98007691c 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -1150,7 +1150,7 @@ static void netlink_update_socket_mc(struct netlink_sock *nlk, | |||
1150 | } | 1150 | } |
1151 | 1151 | ||
1152 | static int netlink_setsockopt(struct socket *sock, int level, int optname, | 1152 | static int netlink_setsockopt(struct socket *sock, int level, int optname, |
1153 | char __user *optval, int optlen) | 1153 | char __user *optval, unsigned int optlen) |
1154 | { | 1154 | { |
1155 | struct sock *sk = sock->sk; | 1155 | struct sock *sk = sock->sk; |
1156 | struct netlink_sock *nlk = nlk_sk(sk); | 1156 | struct netlink_sock *nlk = nlk_sk(sk); |
@@ -1609,6 +1609,16 @@ int netlink_change_ngroups(struct sock *sk, unsigned int groups) | |||
1609 | return err; | 1609 | return err; |
1610 | } | 1610 | } |
1611 | 1611 | ||
1612 | void __netlink_clear_multicast_users(struct sock *ksk, unsigned int group) | ||
1613 | { | ||
1614 | struct sock *sk; | ||
1615 | struct hlist_node *node; | ||
1616 | struct netlink_table *tbl = &nl_table[ksk->sk_protocol]; | ||
1617 | |||
1618 | sk_for_each_bound(sk, node, &tbl->mc_list) | ||
1619 | netlink_update_socket_mc(nlk_sk(sk), group, 0); | ||
1620 | } | ||
1621 | |||
1612 | /** | 1622 | /** |
1613 | * netlink_clear_multicast_users - kick off multicast listeners | 1623 | * netlink_clear_multicast_users - kick off multicast listeners |
1614 | * | 1624 | * |
@@ -1619,15 +1629,8 @@ int netlink_change_ngroups(struct sock *sk, unsigned int groups) | |||
1619 | */ | 1629 | */ |
1620 | void netlink_clear_multicast_users(struct sock *ksk, unsigned int group) | 1630 | void netlink_clear_multicast_users(struct sock *ksk, unsigned int group) |
1621 | { | 1631 | { |
1622 | struct sock *sk; | ||
1623 | struct hlist_node *node; | ||
1624 | struct netlink_table *tbl = &nl_table[ksk->sk_protocol]; | ||
1625 | |||
1626 | netlink_table_grab(); | 1632 | netlink_table_grab(); |
1627 | 1633 | __netlink_clear_multicast_users(ksk, group); | |
1628 | sk_for_each_bound(sk, node, &tbl->mc_list) | ||
1629 | netlink_update_socket_mc(nlk_sk(sk), group, 0); | ||
1630 | |||
1631 | netlink_table_ungrab(); | 1634 | netlink_table_ungrab(); |
1632 | } | 1635 | } |
1633 | 1636 | ||
@@ -1785,7 +1788,7 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err) | |||
1785 | } | 1788 | } |
1786 | 1789 | ||
1787 | rep = __nlmsg_put(skb, NETLINK_CB(in_skb).pid, nlh->nlmsg_seq, | 1790 | rep = __nlmsg_put(skb, NETLINK_CB(in_skb).pid, nlh->nlmsg_seq, |
1788 | NLMSG_ERROR, sizeof(struct nlmsgerr), 0); | 1791 | NLMSG_ERROR, payload, 0); |
1789 | errmsg = nlmsg_data(rep); | 1792 | errmsg = nlmsg_data(rep); |
1790 | errmsg->error = err; | 1793 | errmsg->error = err; |
1791 | memcpy(&errmsg->msg, nlh, err ? nlh->nlmsg_len : sizeof(*nlh)); | 1794 | memcpy(&errmsg->msg, nlh, err ? nlh->nlmsg_len : sizeof(*nlh)); |
@@ -2091,10 +2094,10 @@ static int __init netlink_proto_init(void) | |||
2091 | if (!nl_table) | 2094 | if (!nl_table) |
2092 | goto panic; | 2095 | goto panic; |
2093 | 2096 | ||
2094 | if (num_physpages >= (128 * 1024)) | 2097 | if (totalram_pages >= (128 * 1024)) |
2095 | limit = num_physpages >> (21 - PAGE_SHIFT); | 2098 | limit = totalram_pages >> (21 - PAGE_SHIFT); |
2096 | else | 2099 | else |
2097 | limit = num_physpages >> (23 - PAGE_SHIFT); | 2100 | limit = totalram_pages >> (23 - PAGE_SHIFT); |
2098 | 2101 | ||
2099 | order = get_bitmask_order(limit) - 1 + PAGE_SHIFT; | 2102 | order = get_bitmask_order(limit) - 1 + PAGE_SHIFT; |
2100 | limit = (1UL << order) / sizeof(struct hlist_head); | 2103 | limit = (1UL << order) / sizeof(struct hlist_head); |
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 566941e03363..44ff3f3810fa 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
@@ -220,10 +220,12 @@ static void __genl_unregister_mc_group(struct genl_family *family, | |||
220 | struct net *net; | 220 | struct net *net; |
221 | BUG_ON(grp->family != family); | 221 | BUG_ON(grp->family != family); |
222 | 222 | ||
223 | netlink_table_grab(); | ||
223 | rcu_read_lock(); | 224 | rcu_read_lock(); |
224 | for_each_net_rcu(net) | 225 | for_each_net_rcu(net) |
225 | netlink_clear_multicast_users(net->genl_sock, grp->id); | 226 | __netlink_clear_multicast_users(net->genl_sock, grp->id); |
226 | rcu_read_unlock(); | 227 | rcu_read_unlock(); |
228 | netlink_table_ungrab(); | ||
227 | 229 | ||
228 | clear_bit(grp->id, mc_groups); | 230 | clear_bit(grp->id, mc_groups); |
229 | list_del(&grp->list); | 231 | list_del(&grp->list); |
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index ce1a34b99c23..7a834952f67f 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c | |||
@@ -301,7 +301,7 @@ void nr_destroy_socket(struct sock *sk) | |||
301 | */ | 301 | */ |
302 | 302 | ||
303 | static int nr_setsockopt(struct socket *sock, int level, int optname, | 303 | static int nr_setsockopt(struct socket *sock, int level, int optname, |
304 | char __user *optval, int optlen) | 304 | char __user *optval, unsigned int optlen) |
305 | { | 305 | { |
306 | struct sock *sk = sock->sk; | 306 | struct sock *sk = sock->sk; |
307 | struct nr_sock *nr = nr_sk(sk); | 307 | struct nr_sock *nr = nr_sk(sk); |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index d3d52c66cdc2..d7ecca0a0c07 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -1701,7 +1701,7 @@ static void packet_flush_mclist(struct sock *sk) | |||
1701 | } | 1701 | } |
1702 | 1702 | ||
1703 | static int | 1703 | static int |
1704 | packet_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen) | 1704 | packet_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen) |
1705 | { | 1705 | { |
1706 | struct sock *sk = sock->sk; | 1706 | struct sock *sk = sock->sk; |
1707 | struct packet_sock *po = pkt_sk(sk); | 1707 | struct packet_sock *po = pkt_sk(sk); |
@@ -2084,7 +2084,7 @@ static void packet_mm_close(struct vm_area_struct *vma) | |||
2084 | atomic_dec(&pkt_sk(sk)->mapped); | 2084 | atomic_dec(&pkt_sk(sk)->mapped); |
2085 | } | 2085 | } |
2086 | 2086 | ||
2087 | static struct vm_operations_struct packet_mmap_ops = { | 2087 | static const struct vm_operations_struct packet_mmap_ops = { |
2088 | .open = packet_mm_open, | 2088 | .open = packet_mm_open, |
2089 | .close = packet_mm_close, | 2089 | .close = packet_mm_close, |
2090 | }; | 2090 | }; |
diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c index a662e62a99cf..f60c0c2aacba 100644 --- a/net/phonet/af_phonet.c +++ b/net/phonet/af_phonet.c | |||
@@ -168,6 +168,12 @@ static int pn_send(struct sk_buff *skb, struct net_device *dev, | |||
168 | goto drop; | 168 | goto drop; |
169 | } | 169 | } |
170 | 170 | ||
171 | /* Broadcast sending is not implemented */ | ||
172 | if (pn_addr(dst) == PNADDR_BROADCAST) { | ||
173 | err = -EOPNOTSUPP; | ||
174 | goto drop; | ||
175 | } | ||
176 | |||
171 | skb_reset_transport_header(skb); | 177 | skb_reset_transport_header(skb); |
172 | WARN_ON(skb_headroom(skb) & 1); /* HW assumes word alignment */ | 178 | WARN_ON(skb_headroom(skb) & 1); /* HW assumes word alignment */ |
173 | skb_push(skb, sizeof(struct phonethdr)); | 179 | skb_push(skb, sizeof(struct phonethdr)); |
diff --git a/net/phonet/pep.c b/net/phonet/pep.c index b8252d289cd7..5f32d217535b 100644 --- a/net/phonet/pep.c +++ b/net/phonet/pep.c | |||
@@ -742,7 +742,7 @@ static int pep_init(struct sock *sk) | |||
742 | } | 742 | } |
743 | 743 | ||
744 | static int pep_setsockopt(struct sock *sk, int level, int optname, | 744 | static int pep_setsockopt(struct sock *sk, int level, int optname, |
745 | char __user *optval, int optlen) | 745 | char __user *optval, unsigned int optlen) |
746 | { | 746 | { |
747 | struct pep_sock *pn = pep_sk(sk); | 747 | struct pep_sock *pn = pep_sk(sk); |
748 | int val = 0, err = 0; | 748 | int val = 0, err = 0; |
diff --git a/net/phonet/socket.c b/net/phonet/socket.c index 7a4ee397d2f7..aa5b5a972bff 100644 --- a/net/phonet/socket.c +++ b/net/phonet/socket.c | |||
@@ -113,6 +113,8 @@ void pn_sock_unhash(struct sock *sk) | |||
113 | } | 113 | } |
114 | EXPORT_SYMBOL(pn_sock_unhash); | 114 | EXPORT_SYMBOL(pn_sock_unhash); |
115 | 115 | ||
116 | static DEFINE_MUTEX(port_mutex); | ||
117 | |||
116 | static int pn_socket_bind(struct socket *sock, struct sockaddr *addr, int len) | 118 | static int pn_socket_bind(struct socket *sock, struct sockaddr *addr, int len) |
117 | { | 119 | { |
118 | struct sock *sk = sock->sk; | 120 | struct sock *sk = sock->sk; |
@@ -140,9 +142,11 @@ static int pn_socket_bind(struct socket *sock, struct sockaddr *addr, int len) | |||
140 | err = -EINVAL; /* attempt to rebind */ | 142 | err = -EINVAL; /* attempt to rebind */ |
141 | goto out; | 143 | goto out; |
142 | } | 144 | } |
145 | WARN_ON(sk_hashed(sk)); | ||
146 | mutex_lock(&port_mutex); | ||
143 | err = sk->sk_prot->get_port(sk, pn_port(handle)); | 147 | err = sk->sk_prot->get_port(sk, pn_port(handle)); |
144 | if (err) | 148 | if (err) |
145 | goto out; | 149 | goto out_port; |
146 | 150 | ||
147 | /* get_port() sets the port, bind() sets the address if applicable */ | 151 | /* get_port() sets the port, bind() sets the address if applicable */ |
148 | pn->sobject = pn_object(saddr, pn_port(pn->sobject)); | 152 | pn->sobject = pn_object(saddr, pn_port(pn->sobject)); |
@@ -150,6 +154,8 @@ static int pn_socket_bind(struct socket *sock, struct sockaddr *addr, int len) | |||
150 | 154 | ||
151 | /* Enable RX on the socket */ | 155 | /* Enable RX on the socket */ |
152 | sk->sk_prot->hash(sk); | 156 | sk->sk_prot->hash(sk); |
157 | out_port: | ||
158 | mutex_unlock(&port_mutex); | ||
153 | out: | 159 | out: |
154 | release_sock(sk); | 160 | release_sock(sk); |
155 | return err; | 161 | return err; |
@@ -357,8 +363,6 @@ const struct proto_ops phonet_stream_ops = { | |||
357 | }; | 363 | }; |
358 | EXPORT_SYMBOL(phonet_stream_ops); | 364 | EXPORT_SYMBOL(phonet_stream_ops); |
359 | 365 | ||
360 | static DEFINE_MUTEX(port_mutex); | ||
361 | |||
362 | /* allocate port for a socket */ | 366 | /* allocate port for a socket */ |
363 | int pn_sock_get_port(struct sock *sk, unsigned short sport) | 367 | int pn_sock_get_port(struct sock *sk, unsigned short sport) |
364 | { | 368 | { |
@@ -370,9 +374,7 @@ int pn_sock_get_port(struct sock *sk, unsigned short sport) | |||
370 | 374 | ||
371 | memset(&try_sa, 0, sizeof(struct sockaddr_pn)); | 375 | memset(&try_sa, 0, sizeof(struct sockaddr_pn)); |
372 | try_sa.spn_family = AF_PHONET; | 376 | try_sa.spn_family = AF_PHONET; |
373 | 377 | WARN_ON(!mutex_is_locked(&port_mutex)); | |
374 | mutex_lock(&port_mutex); | ||
375 | |||
376 | if (!sport) { | 378 | if (!sport) { |
377 | /* search free port */ | 379 | /* search free port */ |
378 | int port, pmin, pmax; | 380 | int port, pmin, pmax; |
@@ -401,13 +403,10 @@ int pn_sock_get_port(struct sock *sk, unsigned short sport) | |||
401 | else | 403 | else |
402 | sock_put(tmpsk); | 404 | sock_put(tmpsk); |
403 | } | 405 | } |
404 | mutex_unlock(&port_mutex); | ||
405 | |||
406 | /* the port must be in use already */ | 406 | /* the port must be in use already */ |
407 | return -EADDRINUSE; | 407 | return -EADDRINUSE; |
408 | 408 | ||
409 | found: | 409 | found: |
410 | mutex_unlock(&port_mutex); | ||
411 | pn->sobject = pn_object(pn_addr(pn->sobject), sport); | 410 | pn->sobject = pn_object(pn_addr(pn->sobject), sport); |
412 | return 0; | 411 | return 0; |
413 | } | 412 | } |
diff --git a/net/phonet/sysctl.c b/net/phonet/sysctl.c index 7b5749ee2765..2220f3322326 100644 --- a/net/phonet/sysctl.c +++ b/net/phonet/sysctl.c | |||
@@ -56,7 +56,7 @@ void phonet_get_local_port_range(int *min, int *max) | |||
56 | } while (read_seqretry(&local_port_range_lock, seq)); | 56 | } while (read_seqretry(&local_port_range_lock, seq)); |
57 | } | 57 | } |
58 | 58 | ||
59 | static int proc_local_port_range(ctl_table *table, int write, struct file *filp, | 59 | static int proc_local_port_range(ctl_table *table, int write, |
60 | void __user *buffer, | 60 | void __user *buffer, |
61 | size_t *lenp, loff_t *ppos) | 61 | size_t *lenp, loff_t *ppos) |
62 | { | 62 | { |
@@ -70,7 +70,7 @@ static int proc_local_port_range(ctl_table *table, int write, struct file *filp, | |||
70 | .extra2 = &local_port_range_max, | 70 | .extra2 = &local_port_range_max, |
71 | }; | 71 | }; |
72 | 72 | ||
73 | ret = proc_dointvec_minmax(&tmp, write, filp, buffer, lenp, ppos); | 73 | ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos); |
74 | 74 | ||
75 | if (write && ret == 0) { | 75 | if (write && ret == 0) { |
76 | if (range[1] < range[0]) | 76 | if (range[1] < range[0]) |
diff --git a/net/rds/af_rds.c b/net/rds/af_rds.c index 6b58aeff4c7a..98e05382fd3c 100644 --- a/net/rds/af_rds.c +++ b/net/rds/af_rds.c | |||
@@ -248,7 +248,7 @@ static int rds_cong_monitor(struct rds_sock *rs, char __user *optval, | |||
248 | } | 248 | } |
249 | 249 | ||
250 | static int rds_setsockopt(struct socket *sock, int level, int optname, | 250 | static int rds_setsockopt(struct socket *sock, int level, int optname, |
251 | char __user *optval, int optlen) | 251 | char __user *optval, unsigned int optlen) |
252 | { | 252 | { |
253 | struct rds_sock *rs = rds_sk_to_rs(sock->sk); | 253 | struct rds_sock *rs = rds_sk_to_rs(sock->sk); |
254 | int ret; | 254 | int ret; |
diff --git a/net/rfkill/core.c b/net/rfkill/core.c index dbeaf2983822..ba2efb960c60 100644 --- a/net/rfkill/core.c +++ b/net/rfkill/core.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/list.h> | 27 | #include <linux/list.h> |
28 | #include <linux/mutex.h> | 28 | #include <linux/mutex.h> |
29 | #include <linux/rfkill.h> | 29 | #include <linux/rfkill.h> |
30 | #include <linux/sched.h> | ||
30 | #include <linux/spinlock.h> | 31 | #include <linux/spinlock.h> |
31 | #include <linux/miscdevice.h> | 32 | #include <linux/miscdevice.h> |
32 | #include <linux/wait.h> | 33 | #include <linux/wait.h> |
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index 1e166c9685aa..502cce76621d 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c | |||
@@ -370,7 +370,7 @@ void rose_destroy_socket(struct sock *sk) | |||
370 | */ | 370 | */ |
371 | 371 | ||
372 | static int rose_setsockopt(struct socket *sock, int level, int optname, | 372 | static int rose_setsockopt(struct socket *sock, int level, int optname, |
373 | char __user *optval, int optlen) | 373 | char __user *optval, unsigned int optlen) |
374 | { | 374 | { |
375 | struct sock *sk = sock->sk; | 375 | struct sock *sk = sock->sk; |
376 | struct rose_sock *rose = rose_sk(sk); | 376 | struct rose_sock *rose = rose_sk(sk); |
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c index bfe493ebf27c..a86afceaa94f 100644 --- a/net/rxrpc/af_rxrpc.c +++ b/net/rxrpc/af_rxrpc.c | |||
@@ -507,7 +507,7 @@ out: | |||
507 | * set RxRPC socket options | 507 | * set RxRPC socket options |
508 | */ | 508 | */ |
509 | static int rxrpc_setsockopt(struct socket *sock, int level, int optname, | 509 | static int rxrpc_setsockopt(struct socket *sock, int level, int optname, |
510 | char __user *optval, int optlen) | 510 | char __user *optval, unsigned int optlen) |
511 | { | 511 | { |
512 | struct rxrpc_sock *rx = rxrpc_sk(sock->sk); | 512 | struct rxrpc_sock *rx = rxrpc_sk(sock->sk); |
513 | unsigned min_sec_level; | 513 | unsigned min_sec_level; |
diff --git a/net/rxrpc/ar-call.c b/net/rxrpc/ar-call.c index d9231245a79a..bc0019f704fe 100644 --- a/net/rxrpc/ar-call.c +++ b/net/rxrpc/ar-call.c | |||
@@ -96,7 +96,7 @@ static struct rxrpc_call *rxrpc_alloc_call(gfp_t gfp) | |||
96 | } | 96 | } |
97 | 97 | ||
98 | /* | 98 | /* |
99 | * allocate a new client call and attempt to to get a connection slot for it | 99 | * allocate a new client call and attempt to get a connection slot for it |
100 | */ | 100 | */ |
101 | static struct rxrpc_call *rxrpc_alloc_client_call( | 101 | static struct rxrpc_call *rxrpc_alloc_client_call( |
102 | struct rxrpc_sock *rx, | 102 | struct rxrpc_sock *rx, |
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index 375d64cb1a3d..2c5c76be18f8 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c | |||
@@ -77,7 +77,7 @@ | |||
77 | * The service curve parameters are converted to the internal | 77 | * The service curve parameters are converted to the internal |
78 | * representation. The slope values are scaled to avoid overflow. | 78 | * representation. The slope values are scaled to avoid overflow. |
79 | * the inverse slope values as well as the y-projection of the 1st | 79 | * the inverse slope values as well as the y-projection of the 1st |
80 | * segment are kept in order to to avoid 64-bit divide operations | 80 | * segment are kept in order to avoid 64-bit divide operations |
81 | * that are expensive on 32-bit architectures. | 81 | * that are expensive on 32-bit architectures. |
82 | */ | 82 | */ |
83 | 83 | ||
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index c557f1fb1c66..612dc878e05c 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -1184,10 +1184,10 @@ SCTP_STATIC __init int sctp_init(void) | |||
1184 | /* Size and allocate the association hash table. | 1184 | /* Size and allocate the association hash table. |
1185 | * The methodology is similar to that of the tcp hash tables. | 1185 | * The methodology is similar to that of the tcp hash tables. |
1186 | */ | 1186 | */ |
1187 | if (num_physpages >= (128 * 1024)) | 1187 | if (totalram_pages >= (128 * 1024)) |
1188 | goal = num_physpages >> (22 - PAGE_SHIFT); | 1188 | goal = totalram_pages >> (22 - PAGE_SHIFT); |
1189 | else | 1189 | else |
1190 | goal = num_physpages >> (24 - PAGE_SHIFT); | 1190 | goal = totalram_pages >> (24 - PAGE_SHIFT); |
1191 | 1191 | ||
1192 | for (order = 0; (1UL << order) < goal; order++) | 1192 | for (order = 0; (1UL << order) < goal; order++) |
1193 | ; | 1193 | ; |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 89af37a6c871..c8d05758661d 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -2027,7 +2027,8 @@ out: | |||
2027 | * instead a error will be indicated to the user. | 2027 | * instead a error will be indicated to the user. |
2028 | */ | 2028 | */ |
2029 | static int sctp_setsockopt_disable_fragments(struct sock *sk, | 2029 | static int sctp_setsockopt_disable_fragments(struct sock *sk, |
2030 | char __user *optval, int optlen) | 2030 | char __user *optval, |
2031 | unsigned int optlen) | ||
2031 | { | 2032 | { |
2032 | int val; | 2033 | int val; |
2033 | 2034 | ||
@@ -2043,7 +2044,7 @@ static int sctp_setsockopt_disable_fragments(struct sock *sk, | |||
2043 | } | 2044 | } |
2044 | 2045 | ||
2045 | static int sctp_setsockopt_events(struct sock *sk, char __user *optval, | 2046 | static int sctp_setsockopt_events(struct sock *sk, char __user *optval, |
2046 | int optlen) | 2047 | unsigned int optlen) |
2047 | { | 2048 | { |
2048 | if (optlen > sizeof(struct sctp_event_subscribe)) | 2049 | if (optlen > sizeof(struct sctp_event_subscribe)) |
2049 | return -EINVAL; | 2050 | return -EINVAL; |
@@ -2064,7 +2065,7 @@ static int sctp_setsockopt_events(struct sock *sk, char __user *optval, | |||
2064 | * association is closed. | 2065 | * association is closed. |
2065 | */ | 2066 | */ |
2066 | static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval, | 2067 | static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval, |
2067 | int optlen) | 2068 | unsigned int optlen) |
2068 | { | 2069 | { |
2069 | struct sctp_sock *sp = sctp_sk(sk); | 2070 | struct sctp_sock *sp = sctp_sk(sk); |
2070 | 2071 | ||
@@ -2318,7 +2319,8 @@ static int sctp_apply_peer_addr_params(struct sctp_paddrparams *params, | |||
2318 | } | 2319 | } |
2319 | 2320 | ||
2320 | static int sctp_setsockopt_peer_addr_params(struct sock *sk, | 2321 | static int sctp_setsockopt_peer_addr_params(struct sock *sk, |
2321 | char __user *optval, int optlen) | 2322 | char __user *optval, |
2323 | unsigned int optlen) | ||
2322 | { | 2324 | { |
2323 | struct sctp_paddrparams params; | 2325 | struct sctp_paddrparams params; |
2324 | struct sctp_transport *trans = NULL; | 2326 | struct sctp_transport *trans = NULL; |
@@ -2430,7 +2432,7 @@ static int sctp_setsockopt_peer_addr_params(struct sock *sk, | |||
2430 | */ | 2432 | */ |
2431 | 2433 | ||
2432 | static int sctp_setsockopt_delayed_ack(struct sock *sk, | 2434 | static int sctp_setsockopt_delayed_ack(struct sock *sk, |
2433 | char __user *optval, int optlen) | 2435 | char __user *optval, unsigned int optlen) |
2434 | { | 2436 | { |
2435 | struct sctp_sack_info params; | 2437 | struct sctp_sack_info params; |
2436 | struct sctp_transport *trans = NULL; | 2438 | struct sctp_transport *trans = NULL; |
@@ -2546,7 +2548,7 @@ static int sctp_setsockopt_delayed_ack(struct sock *sk, | |||
2546 | * by the change). With TCP-style sockets, this option is inherited by | 2548 | * by the change). With TCP-style sockets, this option is inherited by |
2547 | * sockets derived from a listener socket. | 2549 | * sockets derived from a listener socket. |
2548 | */ | 2550 | */ |
2549 | static int sctp_setsockopt_initmsg(struct sock *sk, char __user *optval, int optlen) | 2551 | static int sctp_setsockopt_initmsg(struct sock *sk, char __user *optval, unsigned int optlen) |
2550 | { | 2552 | { |
2551 | struct sctp_initmsg sinit; | 2553 | struct sctp_initmsg sinit; |
2552 | struct sctp_sock *sp = sctp_sk(sk); | 2554 | struct sctp_sock *sp = sctp_sk(sk); |
@@ -2583,7 +2585,8 @@ static int sctp_setsockopt_initmsg(struct sock *sk, char __user *optval, int opt | |||
2583 | * to this call if the caller is using the UDP model. | 2585 | * to this call if the caller is using the UDP model. |
2584 | */ | 2586 | */ |
2585 | static int sctp_setsockopt_default_send_param(struct sock *sk, | 2587 | static int sctp_setsockopt_default_send_param(struct sock *sk, |
2586 | char __user *optval, int optlen) | 2588 | char __user *optval, |
2589 | unsigned int optlen) | ||
2587 | { | 2590 | { |
2588 | struct sctp_sndrcvinfo info; | 2591 | struct sctp_sndrcvinfo info; |
2589 | struct sctp_association *asoc; | 2592 | struct sctp_association *asoc; |
@@ -2622,7 +2625,7 @@ static int sctp_setsockopt_default_send_param(struct sock *sk, | |||
2622 | * association peer's addresses. | 2625 | * association peer's addresses. |
2623 | */ | 2626 | */ |
2624 | static int sctp_setsockopt_primary_addr(struct sock *sk, char __user *optval, | 2627 | static int sctp_setsockopt_primary_addr(struct sock *sk, char __user *optval, |
2625 | int optlen) | 2628 | unsigned int optlen) |
2626 | { | 2629 | { |
2627 | struct sctp_prim prim; | 2630 | struct sctp_prim prim; |
2628 | struct sctp_transport *trans; | 2631 | struct sctp_transport *trans; |
@@ -2651,7 +2654,7 @@ static int sctp_setsockopt_primary_addr(struct sock *sk, char __user *optval, | |||
2651 | * integer boolean flag. | 2654 | * integer boolean flag. |
2652 | */ | 2655 | */ |
2653 | static int sctp_setsockopt_nodelay(struct sock *sk, char __user *optval, | 2656 | static int sctp_setsockopt_nodelay(struct sock *sk, char __user *optval, |
2654 | int optlen) | 2657 | unsigned int optlen) |
2655 | { | 2658 | { |
2656 | int val; | 2659 | int val; |
2657 | 2660 | ||
@@ -2676,7 +2679,8 @@ static int sctp_setsockopt_nodelay(struct sock *sk, char __user *optval, | |||
2676 | * be changed. | 2679 | * be changed. |
2677 | * | 2680 | * |
2678 | */ | 2681 | */ |
2679 | static int sctp_setsockopt_rtoinfo(struct sock *sk, char __user *optval, int optlen) { | 2682 | static int sctp_setsockopt_rtoinfo(struct sock *sk, char __user *optval, unsigned int optlen) |
2683 | { | ||
2680 | struct sctp_rtoinfo rtoinfo; | 2684 | struct sctp_rtoinfo rtoinfo; |
2681 | struct sctp_association *asoc; | 2685 | struct sctp_association *asoc; |
2682 | 2686 | ||
@@ -2728,7 +2732,7 @@ static int sctp_setsockopt_rtoinfo(struct sock *sk, char __user *optval, int opt | |||
2728 | * See [SCTP] for more information. | 2732 | * See [SCTP] for more information. |
2729 | * | 2733 | * |
2730 | */ | 2734 | */ |
2731 | static int sctp_setsockopt_associnfo(struct sock *sk, char __user *optval, int optlen) | 2735 | static int sctp_setsockopt_associnfo(struct sock *sk, char __user *optval, unsigned int optlen) |
2732 | { | 2736 | { |
2733 | 2737 | ||
2734 | struct sctp_assocparams assocparams; | 2738 | struct sctp_assocparams assocparams; |
@@ -2800,7 +2804,7 @@ static int sctp_setsockopt_associnfo(struct sock *sk, char __user *optval, int o | |||
2800 | * addresses and a user will receive both PF_INET6 and PF_INET type | 2804 | * addresses and a user will receive both PF_INET6 and PF_INET type |
2801 | * addresses on the socket. | 2805 | * addresses on the socket. |
2802 | */ | 2806 | */ |
2803 | static int sctp_setsockopt_mappedv4(struct sock *sk, char __user *optval, int optlen) | 2807 | static int sctp_setsockopt_mappedv4(struct sock *sk, char __user *optval, unsigned int optlen) |
2804 | { | 2808 | { |
2805 | int val; | 2809 | int val; |
2806 | struct sctp_sock *sp = sctp_sk(sk); | 2810 | struct sctp_sock *sp = sctp_sk(sk); |
@@ -2844,7 +2848,7 @@ static int sctp_setsockopt_mappedv4(struct sock *sk, char __user *optval, int op | |||
2844 | * changed (effecting future associations only). | 2848 | * changed (effecting future associations only). |
2845 | * assoc_value: This parameter specifies the maximum size in bytes. | 2849 | * assoc_value: This parameter specifies the maximum size in bytes. |
2846 | */ | 2850 | */ |
2847 | static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, int optlen) | 2851 | static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, unsigned int optlen) |
2848 | { | 2852 | { |
2849 | struct sctp_assoc_value params; | 2853 | struct sctp_assoc_value params; |
2850 | struct sctp_association *asoc; | 2854 | struct sctp_association *asoc; |
@@ -2899,7 +2903,7 @@ static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, int optl | |||
2899 | * set primary request: | 2903 | * set primary request: |
2900 | */ | 2904 | */ |
2901 | static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optval, | 2905 | static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optval, |
2902 | int optlen) | 2906 | unsigned int optlen) |
2903 | { | 2907 | { |
2904 | struct sctp_sock *sp; | 2908 | struct sctp_sock *sp; |
2905 | struct sctp_endpoint *ep; | 2909 | struct sctp_endpoint *ep; |
@@ -2950,7 +2954,7 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva | |||
2950 | } | 2954 | } |
2951 | 2955 | ||
2952 | static int sctp_setsockopt_adaptation_layer(struct sock *sk, char __user *optval, | 2956 | static int sctp_setsockopt_adaptation_layer(struct sock *sk, char __user *optval, |
2953 | int optlen) | 2957 | unsigned int optlen) |
2954 | { | 2958 | { |
2955 | struct sctp_setadaptation adaptation; | 2959 | struct sctp_setadaptation adaptation; |
2956 | 2960 | ||
@@ -2979,7 +2983,7 @@ static int sctp_setsockopt_adaptation_layer(struct sock *sk, char __user *optval | |||
2979 | * saved with outbound messages. | 2983 | * saved with outbound messages. |
2980 | */ | 2984 | */ |
2981 | static int sctp_setsockopt_context(struct sock *sk, char __user *optval, | 2985 | static int sctp_setsockopt_context(struct sock *sk, char __user *optval, |
2982 | int optlen) | 2986 | unsigned int optlen) |
2983 | { | 2987 | { |
2984 | struct sctp_assoc_value params; | 2988 | struct sctp_assoc_value params; |
2985 | struct sctp_sock *sp; | 2989 | struct sctp_sock *sp; |
@@ -3030,7 +3034,7 @@ static int sctp_setsockopt_context(struct sock *sk, char __user *optval, | |||
3030 | */ | 3034 | */ |
3031 | static int sctp_setsockopt_fragment_interleave(struct sock *sk, | 3035 | static int sctp_setsockopt_fragment_interleave(struct sock *sk, |
3032 | char __user *optval, | 3036 | char __user *optval, |
3033 | int optlen) | 3037 | unsigned int optlen) |
3034 | { | 3038 | { |
3035 | int val; | 3039 | int val; |
3036 | 3040 | ||
@@ -3063,7 +3067,7 @@ static int sctp_setsockopt_fragment_interleave(struct sock *sk, | |||
3063 | */ | 3067 | */ |
3064 | static int sctp_setsockopt_partial_delivery_point(struct sock *sk, | 3068 | static int sctp_setsockopt_partial_delivery_point(struct sock *sk, |
3065 | char __user *optval, | 3069 | char __user *optval, |
3066 | int optlen) | 3070 | unsigned int optlen) |
3067 | { | 3071 | { |
3068 | u32 val; | 3072 | u32 val; |
3069 | 3073 | ||
@@ -3096,7 +3100,7 @@ static int sctp_setsockopt_partial_delivery_point(struct sock *sk, | |||
3096 | */ | 3100 | */ |
3097 | static int sctp_setsockopt_maxburst(struct sock *sk, | 3101 | static int sctp_setsockopt_maxburst(struct sock *sk, |
3098 | char __user *optval, | 3102 | char __user *optval, |
3099 | int optlen) | 3103 | unsigned int optlen) |
3100 | { | 3104 | { |
3101 | struct sctp_assoc_value params; | 3105 | struct sctp_assoc_value params; |
3102 | struct sctp_sock *sp; | 3106 | struct sctp_sock *sp; |
@@ -3140,8 +3144,8 @@ static int sctp_setsockopt_maxburst(struct sock *sk, | |||
3140 | * will only effect future associations on the socket. | 3144 | * will only effect future associations on the socket. |
3141 | */ | 3145 | */ |
3142 | static int sctp_setsockopt_auth_chunk(struct sock *sk, | 3146 | static int sctp_setsockopt_auth_chunk(struct sock *sk, |
3143 | char __user *optval, | 3147 | char __user *optval, |
3144 | int optlen) | 3148 | unsigned int optlen) |
3145 | { | 3149 | { |
3146 | struct sctp_authchunk val; | 3150 | struct sctp_authchunk val; |
3147 | 3151 | ||
@@ -3172,8 +3176,8 @@ static int sctp_setsockopt_auth_chunk(struct sock *sk, | |||
3172 | * endpoint requires the peer to use. | 3176 | * endpoint requires the peer to use. |
3173 | */ | 3177 | */ |
3174 | static int sctp_setsockopt_hmac_ident(struct sock *sk, | 3178 | static int sctp_setsockopt_hmac_ident(struct sock *sk, |
3175 | char __user *optval, | 3179 | char __user *optval, |
3176 | int optlen) | 3180 | unsigned int optlen) |
3177 | { | 3181 | { |
3178 | struct sctp_hmacalgo *hmacs; | 3182 | struct sctp_hmacalgo *hmacs; |
3179 | u32 idents; | 3183 | u32 idents; |
@@ -3215,7 +3219,7 @@ out: | |||
3215 | */ | 3219 | */ |
3216 | static int sctp_setsockopt_auth_key(struct sock *sk, | 3220 | static int sctp_setsockopt_auth_key(struct sock *sk, |
3217 | char __user *optval, | 3221 | char __user *optval, |
3218 | int optlen) | 3222 | unsigned int optlen) |
3219 | { | 3223 | { |
3220 | struct sctp_authkey *authkey; | 3224 | struct sctp_authkey *authkey; |
3221 | struct sctp_association *asoc; | 3225 | struct sctp_association *asoc; |
@@ -3260,8 +3264,8 @@ out: | |||
3260 | * the association shared key. | 3264 | * the association shared key. |
3261 | */ | 3265 | */ |
3262 | static int sctp_setsockopt_active_key(struct sock *sk, | 3266 | static int sctp_setsockopt_active_key(struct sock *sk, |
3263 | char __user *optval, | 3267 | char __user *optval, |
3264 | int optlen) | 3268 | unsigned int optlen) |
3265 | { | 3269 | { |
3266 | struct sctp_authkeyid val; | 3270 | struct sctp_authkeyid val; |
3267 | struct sctp_association *asoc; | 3271 | struct sctp_association *asoc; |
@@ -3288,8 +3292,8 @@ static int sctp_setsockopt_active_key(struct sock *sk, | |||
3288 | * This set option will delete a shared secret key from use. | 3292 | * This set option will delete a shared secret key from use. |
3289 | */ | 3293 | */ |
3290 | static int sctp_setsockopt_del_key(struct sock *sk, | 3294 | static int sctp_setsockopt_del_key(struct sock *sk, |
3291 | char __user *optval, | 3295 | char __user *optval, |
3292 | int optlen) | 3296 | unsigned int optlen) |
3293 | { | 3297 | { |
3294 | struct sctp_authkeyid val; | 3298 | struct sctp_authkeyid val; |
3295 | struct sctp_association *asoc; | 3299 | struct sctp_association *asoc; |
@@ -3332,7 +3336,7 @@ static int sctp_setsockopt_del_key(struct sock *sk, | |||
3332 | * optlen - the size of the buffer. | 3336 | * optlen - the size of the buffer. |
3333 | */ | 3337 | */ |
3334 | SCTP_STATIC int sctp_setsockopt(struct sock *sk, int level, int optname, | 3338 | SCTP_STATIC int sctp_setsockopt(struct sock *sk, int level, int optname, |
3335 | char __user *optval, int optlen) | 3339 | char __user *optval, unsigned int optlen) |
3336 | { | 3340 | { |
3337 | int retval = 0; | 3341 | int retval = 0; |
3338 | 3342 | ||
diff --git a/net/socket.c b/net/socket.c index 2a022c00d85c..75655365b5fd 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -86,6 +86,7 @@ | |||
86 | #include <linux/audit.h> | 86 | #include <linux/audit.h> |
87 | #include <linux/wireless.h> | 87 | #include <linux/wireless.h> |
88 | #include <linux/nsproxy.h> | 88 | #include <linux/nsproxy.h> |
89 | #include <linux/magic.h> | ||
89 | 90 | ||
90 | #include <asm/uaccess.h> | 91 | #include <asm/uaccess.h> |
91 | #include <asm/unistd.h> | 92 | #include <asm/unistd.h> |
@@ -235,8 +236,6 @@ int move_addr_to_user(struct sockaddr *kaddr, int klen, void __user *uaddr, | |||
235 | return __put_user(klen, ulen); | 236 | return __put_user(klen, ulen); |
236 | } | 237 | } |
237 | 238 | ||
238 | #define SOCKFS_MAGIC 0x534F434B | ||
239 | |||
240 | static struct kmem_cache *sock_inode_cachep __read_mostly; | 239 | static struct kmem_cache *sock_inode_cachep __read_mostly; |
241 | 240 | ||
242 | static struct inode *sock_alloc_inode(struct super_block *sb) | 241 | static struct inode *sock_alloc_inode(struct super_block *sb) |
@@ -285,7 +284,7 @@ static int init_inodecache(void) | |||
285 | return 0; | 284 | return 0; |
286 | } | 285 | } |
287 | 286 | ||
288 | static struct super_operations sockfs_ops = { | 287 | static const struct super_operations sockfs_ops = { |
289 | .alloc_inode = sock_alloc_inode, | 288 | .alloc_inode = sock_alloc_inode, |
290 | .destroy_inode =sock_destroy_inode, | 289 | .destroy_inode =sock_destroy_inode, |
291 | .statfs = simple_statfs, | 290 | .statfs = simple_statfs, |
@@ -2099,12 +2098,17 @@ SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args) | |||
2099 | unsigned long a[6]; | 2098 | unsigned long a[6]; |
2100 | unsigned long a0, a1; | 2099 | unsigned long a0, a1; |
2101 | int err; | 2100 | int err; |
2101 | unsigned int len; | ||
2102 | 2102 | ||
2103 | if (call < 1 || call > SYS_ACCEPT4) | 2103 | if (call < 1 || call > SYS_ACCEPT4) |
2104 | return -EINVAL; | 2104 | return -EINVAL; |
2105 | 2105 | ||
2106 | len = nargs[call]; | ||
2107 | if (len > sizeof(a)) | ||
2108 | return -EINVAL; | ||
2109 | |||
2106 | /* copy_from_user should be SMP safe. */ | 2110 | /* copy_from_user should be SMP safe. */ |
2107 | if (copy_from_user(a, args, nargs[call])) | 2111 | if (copy_from_user(a, args, len)) |
2108 | return -EFAULT; | 2112 | return -EFAULT; |
2109 | 2113 | ||
2110 | audit_socketcall(nargs[call] / sizeof(unsigned long), a); | 2114 | audit_socketcall(nargs[call] / sizeof(unsigned long), a); |
@@ -2387,7 +2391,7 @@ int kernel_getsockopt(struct socket *sock, int level, int optname, | |||
2387 | } | 2391 | } |
2388 | 2392 | ||
2389 | int kernel_setsockopt(struct socket *sock, int level, int optname, | 2393 | int kernel_setsockopt(struct socket *sock, int level, int optname, |
2390 | char *optval, int optlen) | 2394 | char *optval, unsigned int optlen) |
2391 | { | 2395 | { |
2392 | mm_segment_t oldfs = get_fs(); | 2396 | mm_segment_t oldfs = get_fs(); |
2393 | int err; | 2397 | int err; |
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index 0c431c277af5..54a4e042f104 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c | |||
@@ -385,7 +385,7 @@ rpcauth_init_cred(struct rpc_cred *cred, const struct auth_cred *acred, | |||
385 | EXPORT_SYMBOL_GPL(rpcauth_init_cred); | 385 | EXPORT_SYMBOL_GPL(rpcauth_init_cred); |
386 | 386 | ||
387 | void | 387 | void |
388 | rpcauth_generic_bind_cred(struct rpc_task *task, struct rpc_cred *cred) | 388 | rpcauth_generic_bind_cred(struct rpc_task *task, struct rpc_cred *cred, int lookupflags) |
389 | { | 389 | { |
390 | task->tk_msg.rpc_cred = get_rpccred(cred); | 390 | task->tk_msg.rpc_cred = get_rpccred(cred); |
391 | dprintk("RPC: %5u holding %s cred %p\n", task->tk_pid, | 391 | dprintk("RPC: %5u holding %s cred %p\n", task->tk_pid, |
@@ -394,7 +394,7 @@ rpcauth_generic_bind_cred(struct rpc_task *task, struct rpc_cred *cred) | |||
394 | EXPORT_SYMBOL_GPL(rpcauth_generic_bind_cred); | 394 | EXPORT_SYMBOL_GPL(rpcauth_generic_bind_cred); |
395 | 395 | ||
396 | static void | 396 | static void |
397 | rpcauth_bind_root_cred(struct rpc_task *task) | 397 | rpcauth_bind_root_cred(struct rpc_task *task, int lookupflags) |
398 | { | 398 | { |
399 | struct rpc_auth *auth = task->tk_client->cl_auth; | 399 | struct rpc_auth *auth = task->tk_client->cl_auth; |
400 | struct auth_cred acred = { | 400 | struct auth_cred acred = { |
@@ -405,7 +405,7 @@ rpcauth_bind_root_cred(struct rpc_task *task) | |||
405 | 405 | ||
406 | dprintk("RPC: %5u looking up %s cred\n", | 406 | dprintk("RPC: %5u looking up %s cred\n", |
407 | task->tk_pid, task->tk_client->cl_auth->au_ops->au_name); | 407 | task->tk_pid, task->tk_client->cl_auth->au_ops->au_name); |
408 | ret = auth->au_ops->lookup_cred(auth, &acred, 0); | 408 | ret = auth->au_ops->lookup_cred(auth, &acred, lookupflags); |
409 | if (!IS_ERR(ret)) | 409 | if (!IS_ERR(ret)) |
410 | task->tk_msg.rpc_cred = ret; | 410 | task->tk_msg.rpc_cred = ret; |
411 | else | 411 | else |
@@ -413,14 +413,14 @@ rpcauth_bind_root_cred(struct rpc_task *task) | |||
413 | } | 413 | } |
414 | 414 | ||
415 | static void | 415 | static void |
416 | rpcauth_bind_new_cred(struct rpc_task *task) | 416 | rpcauth_bind_new_cred(struct rpc_task *task, int lookupflags) |
417 | { | 417 | { |
418 | struct rpc_auth *auth = task->tk_client->cl_auth; | 418 | struct rpc_auth *auth = task->tk_client->cl_auth; |
419 | struct rpc_cred *ret; | 419 | struct rpc_cred *ret; |
420 | 420 | ||
421 | dprintk("RPC: %5u looking up %s cred\n", | 421 | dprintk("RPC: %5u looking up %s cred\n", |
422 | task->tk_pid, auth->au_ops->au_name); | 422 | task->tk_pid, auth->au_ops->au_name); |
423 | ret = rpcauth_lookupcred(auth, 0); | 423 | ret = rpcauth_lookupcred(auth, lookupflags); |
424 | if (!IS_ERR(ret)) | 424 | if (!IS_ERR(ret)) |
425 | task->tk_msg.rpc_cred = ret; | 425 | task->tk_msg.rpc_cred = ret; |
426 | else | 426 | else |
@@ -430,12 +430,16 @@ rpcauth_bind_new_cred(struct rpc_task *task) | |||
430 | void | 430 | void |
431 | rpcauth_bindcred(struct rpc_task *task, struct rpc_cred *cred, int flags) | 431 | rpcauth_bindcred(struct rpc_task *task, struct rpc_cred *cred, int flags) |
432 | { | 432 | { |
433 | int lookupflags = 0; | ||
434 | |||
435 | if (flags & RPC_TASK_ASYNC) | ||
436 | lookupflags |= RPCAUTH_LOOKUP_NEW; | ||
433 | if (cred != NULL) | 437 | if (cred != NULL) |
434 | cred->cr_ops->crbind(task, cred); | 438 | cred->cr_ops->crbind(task, cred, lookupflags); |
435 | else if (flags & RPC_TASK_ROOTCREDS) | 439 | else if (flags & RPC_TASK_ROOTCREDS) |
436 | rpcauth_bind_root_cred(task); | 440 | rpcauth_bind_root_cred(task, lookupflags); |
437 | else | 441 | else |
438 | rpcauth_bind_new_cred(task); | 442 | rpcauth_bind_new_cred(task, lookupflags); |
439 | } | 443 | } |
440 | 444 | ||
441 | void | 445 | void |
diff --git a/net/sunrpc/auth_generic.c b/net/sunrpc/auth_generic.c index 4028502f0528..bf88bf8e9365 100644 --- a/net/sunrpc/auth_generic.c +++ b/net/sunrpc/auth_generic.c | |||
@@ -55,13 +55,13 @@ struct rpc_cred *rpc_lookup_machine_cred(void) | |||
55 | EXPORT_SYMBOL_GPL(rpc_lookup_machine_cred); | 55 | EXPORT_SYMBOL_GPL(rpc_lookup_machine_cred); |
56 | 56 | ||
57 | static void | 57 | static void |
58 | generic_bind_cred(struct rpc_task *task, struct rpc_cred *cred) | 58 | generic_bind_cred(struct rpc_task *task, struct rpc_cred *cred, int lookupflags) |
59 | { | 59 | { |
60 | struct rpc_auth *auth = task->tk_client->cl_auth; | 60 | struct rpc_auth *auth = task->tk_client->cl_auth; |
61 | struct auth_cred *acred = &container_of(cred, struct generic_cred, gc_base)->acred; | 61 | struct auth_cred *acred = &container_of(cred, struct generic_cred, gc_base)->acred; |
62 | struct rpc_cred *ret; | 62 | struct rpc_cred *ret; |
63 | 63 | ||
64 | ret = auth->au_ops->lookup_cred(auth, acred, 0); | 64 | ret = auth->au_ops->lookup_cred(auth, acred, lookupflags); |
65 | if (!IS_ERR(ret)) | 65 | if (!IS_ERR(ret)) |
66 | task->tk_msg.rpc_cred = ret; | 66 | task->tk_msg.rpc_cred = ret; |
67 | else | 67 | else |
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index 2e6a148d277c..f6c51e562a02 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c | |||
@@ -1374,8 +1374,10 @@ svcauth_gss_release(struct svc_rqst *rqstp) | |||
1374 | if (stat) | 1374 | if (stat) |
1375 | goto out_err; | 1375 | goto out_err; |
1376 | break; | 1376 | break; |
1377 | default: | 1377 | /* |
1378 | goto out_err; | 1378 | * For any other gc_svc value, svcauth_gss_accept() already set |
1379 | * the auth_error appropriately; just fall through: | ||
1380 | */ | ||
1379 | } | 1381 | } |
1380 | 1382 | ||
1381 | out: | 1383 | out: |
diff --git a/net/sunrpc/auth_null.c b/net/sunrpc/auth_null.c index c70dd7f5258e..1db618f56ecb 100644 --- a/net/sunrpc/auth_null.c +++ b/net/sunrpc/auth_null.c | |||
@@ -8,7 +8,6 @@ | |||
8 | 8 | ||
9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/utsname.h> | ||
12 | #include <linux/sunrpc/clnt.h> | 11 | #include <linux/sunrpc/clnt.h> |
13 | 12 | ||
14 | #ifdef RPC_DEBUG | 13 | #ifdef RPC_DEBUG |
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 45cdaff9b361..d6eee291a0e2 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
@@ -103,23 +103,21 @@ struct cache_head *sunrpc_cache_lookup(struct cache_detail *detail, | |||
103 | EXPORT_SYMBOL_GPL(sunrpc_cache_lookup); | 103 | EXPORT_SYMBOL_GPL(sunrpc_cache_lookup); |
104 | 104 | ||
105 | 105 | ||
106 | static void queue_loose(struct cache_detail *detail, struct cache_head *ch); | 106 | static void cache_dequeue(struct cache_detail *detail, struct cache_head *ch); |
107 | 107 | ||
108 | static int cache_fresh_locked(struct cache_head *head, time_t expiry) | 108 | static void cache_fresh_locked(struct cache_head *head, time_t expiry) |
109 | { | 109 | { |
110 | head->expiry_time = expiry; | 110 | head->expiry_time = expiry; |
111 | head->last_refresh = get_seconds(); | 111 | head->last_refresh = get_seconds(); |
112 | return !test_and_set_bit(CACHE_VALID, &head->flags); | 112 | set_bit(CACHE_VALID, &head->flags); |
113 | } | 113 | } |
114 | 114 | ||
115 | static void cache_fresh_unlocked(struct cache_head *head, | 115 | static void cache_fresh_unlocked(struct cache_head *head, |
116 | struct cache_detail *detail, int new) | 116 | struct cache_detail *detail) |
117 | { | 117 | { |
118 | if (new) | ||
119 | cache_revisit_request(head); | ||
120 | if (test_and_clear_bit(CACHE_PENDING, &head->flags)) { | 118 | if (test_and_clear_bit(CACHE_PENDING, &head->flags)) { |
121 | cache_revisit_request(head); | 119 | cache_revisit_request(head); |
122 | queue_loose(detail, head); | 120 | cache_dequeue(detail, head); |
123 | } | 121 | } |
124 | } | 122 | } |
125 | 123 | ||
@@ -132,7 +130,6 @@ struct cache_head *sunrpc_cache_update(struct cache_detail *detail, | |||
132 | */ | 130 | */ |
133 | struct cache_head **head; | 131 | struct cache_head **head; |
134 | struct cache_head *tmp; | 132 | struct cache_head *tmp; |
135 | int is_new; | ||
136 | 133 | ||
137 | if (!test_bit(CACHE_VALID, &old->flags)) { | 134 | if (!test_bit(CACHE_VALID, &old->flags)) { |
138 | write_lock(&detail->hash_lock); | 135 | write_lock(&detail->hash_lock); |
@@ -141,9 +138,9 @@ struct cache_head *sunrpc_cache_update(struct cache_detail *detail, | |||
141 | set_bit(CACHE_NEGATIVE, &old->flags); | 138 | set_bit(CACHE_NEGATIVE, &old->flags); |
142 | else | 139 | else |
143 | detail->update(old, new); | 140 | detail->update(old, new); |
144 | is_new = cache_fresh_locked(old, new->expiry_time); | 141 | cache_fresh_locked(old, new->expiry_time); |
145 | write_unlock(&detail->hash_lock); | 142 | write_unlock(&detail->hash_lock); |
146 | cache_fresh_unlocked(old, detail, is_new); | 143 | cache_fresh_unlocked(old, detail); |
147 | return old; | 144 | return old; |
148 | } | 145 | } |
149 | write_unlock(&detail->hash_lock); | 146 | write_unlock(&detail->hash_lock); |
@@ -167,11 +164,11 @@ struct cache_head *sunrpc_cache_update(struct cache_detail *detail, | |||
167 | *head = tmp; | 164 | *head = tmp; |
168 | detail->entries++; | 165 | detail->entries++; |
169 | cache_get(tmp); | 166 | cache_get(tmp); |
170 | is_new = cache_fresh_locked(tmp, new->expiry_time); | 167 | cache_fresh_locked(tmp, new->expiry_time); |
171 | cache_fresh_locked(old, 0); | 168 | cache_fresh_locked(old, 0); |
172 | write_unlock(&detail->hash_lock); | 169 | write_unlock(&detail->hash_lock); |
173 | cache_fresh_unlocked(tmp, detail, is_new); | 170 | cache_fresh_unlocked(tmp, detail); |
174 | cache_fresh_unlocked(old, detail, 0); | 171 | cache_fresh_unlocked(old, detail); |
175 | cache_put(old, detail); | 172 | cache_put(old, detail); |
176 | return tmp; | 173 | return tmp; |
177 | } | 174 | } |
@@ -184,6 +181,22 @@ static int cache_make_upcall(struct cache_detail *cd, struct cache_head *h) | |||
184 | return cd->cache_upcall(cd, h); | 181 | return cd->cache_upcall(cd, h); |
185 | } | 182 | } |
186 | 183 | ||
184 | static inline int cache_is_valid(struct cache_detail *detail, struct cache_head *h) | ||
185 | { | ||
186 | if (!test_bit(CACHE_VALID, &h->flags) || | ||
187 | h->expiry_time < get_seconds()) | ||
188 | return -EAGAIN; | ||
189 | else if (detail->flush_time > h->last_refresh) | ||
190 | return -EAGAIN; | ||
191 | else { | ||
192 | /* entry is valid */ | ||
193 | if (test_bit(CACHE_NEGATIVE, &h->flags)) | ||
194 | return -ENOENT; | ||
195 | else | ||
196 | return 0; | ||
197 | } | ||
198 | } | ||
199 | |||
187 | /* | 200 | /* |
188 | * This is the generic cache management routine for all | 201 | * This is the generic cache management routine for all |
189 | * the authentication caches. | 202 | * the authentication caches. |
@@ -192,8 +205,10 @@ static int cache_make_upcall(struct cache_detail *cd, struct cache_head *h) | |||
192 | * | 205 | * |
193 | * | 206 | * |
194 | * Returns 0 if the cache_head can be used, or cache_puts it and returns | 207 | * Returns 0 if the cache_head can be used, or cache_puts it and returns |
195 | * -EAGAIN if upcall is pending, | 208 | * -EAGAIN if upcall is pending and request has been queued |
196 | * -ETIMEDOUT if upcall failed and should be retried, | 209 | * -ETIMEDOUT if upcall failed or request could not be queue or |
210 | * upcall completed but item is still invalid (implying that | ||
211 | * the cache item has been replaced with a newer one). | ||
197 | * -ENOENT if cache entry was negative | 212 | * -ENOENT if cache entry was negative |
198 | */ | 213 | */ |
199 | int cache_check(struct cache_detail *detail, | 214 | int cache_check(struct cache_detail *detail, |
@@ -203,17 +218,7 @@ int cache_check(struct cache_detail *detail, | |||
203 | long refresh_age, age; | 218 | long refresh_age, age; |
204 | 219 | ||
205 | /* First decide return status as best we can */ | 220 | /* First decide return status as best we can */ |
206 | if (!test_bit(CACHE_VALID, &h->flags) || | 221 | rv = cache_is_valid(detail, h); |
207 | h->expiry_time < get_seconds()) | ||
208 | rv = -EAGAIN; | ||
209 | else if (detail->flush_time > h->last_refresh) | ||
210 | rv = -EAGAIN; | ||
211 | else { | ||
212 | /* entry is valid */ | ||
213 | if (test_bit(CACHE_NEGATIVE, &h->flags)) | ||
214 | rv = -ENOENT; | ||
215 | else rv = 0; | ||
216 | } | ||
217 | 222 | ||
218 | /* now see if we want to start an upcall */ | 223 | /* now see if we want to start an upcall */ |
219 | refresh_age = (h->expiry_time - h->last_refresh); | 224 | refresh_age = (h->expiry_time - h->last_refresh); |
@@ -229,10 +234,11 @@ int cache_check(struct cache_detail *detail, | |||
229 | switch (cache_make_upcall(detail, h)) { | 234 | switch (cache_make_upcall(detail, h)) { |
230 | case -EINVAL: | 235 | case -EINVAL: |
231 | clear_bit(CACHE_PENDING, &h->flags); | 236 | clear_bit(CACHE_PENDING, &h->flags); |
237 | cache_revisit_request(h); | ||
232 | if (rv == -EAGAIN) { | 238 | if (rv == -EAGAIN) { |
233 | set_bit(CACHE_NEGATIVE, &h->flags); | 239 | set_bit(CACHE_NEGATIVE, &h->flags); |
234 | cache_fresh_unlocked(h, detail, | 240 | cache_fresh_locked(h, get_seconds()+CACHE_NEW_EXPIRY); |
235 | cache_fresh_locked(h, get_seconds()+CACHE_NEW_EXPIRY)); | 241 | cache_fresh_unlocked(h, detail); |
236 | rv = -ENOENT; | 242 | rv = -ENOENT; |
237 | } | 243 | } |
238 | break; | 244 | break; |
@@ -245,10 +251,14 @@ int cache_check(struct cache_detail *detail, | |||
245 | } | 251 | } |
246 | } | 252 | } |
247 | 253 | ||
248 | if (rv == -EAGAIN) | 254 | if (rv == -EAGAIN) { |
249 | if (cache_defer_req(rqstp, h) != 0) | 255 | if (cache_defer_req(rqstp, h) < 0) { |
250 | rv = -ETIMEDOUT; | 256 | /* Request is not deferred */ |
251 | 257 | rv = cache_is_valid(detail, h); | |
258 | if (rv == -EAGAIN) | ||
259 | rv = -ETIMEDOUT; | ||
260 | } | ||
261 | } | ||
252 | if (rv) | 262 | if (rv) |
253 | cache_put(h, detail); | 263 | cache_put(h, detail); |
254 | return rv; | 264 | return rv; |
@@ -396,7 +406,7 @@ static int cache_clean(void) | |||
396 | ) | 406 | ) |
397 | continue; | 407 | continue; |
398 | if (test_and_clear_bit(CACHE_PENDING, &ch->flags)) | 408 | if (test_and_clear_bit(CACHE_PENDING, &ch->flags)) |
399 | queue_loose(current_detail, ch); | 409 | cache_dequeue(current_detail, ch); |
400 | 410 | ||
401 | if (atomic_read(&ch->ref.refcount) == 1) | 411 | if (atomic_read(&ch->ref.refcount) == 1) |
402 | break; | 412 | break; |
@@ -412,8 +422,10 @@ static int cache_clean(void) | |||
412 | if (!ch) | 422 | if (!ch) |
413 | current_index ++; | 423 | current_index ++; |
414 | spin_unlock(&cache_list_lock); | 424 | spin_unlock(&cache_list_lock); |
415 | if (ch) | 425 | if (ch) { |
426 | cache_revisit_request(ch); | ||
416 | cache_put(ch, d); | 427 | cache_put(ch, d); |
428 | } | ||
417 | } else | 429 | } else |
418 | spin_unlock(&cache_list_lock); | 430 | spin_unlock(&cache_list_lock); |
419 | 431 | ||
@@ -488,7 +500,7 @@ static int cache_defer_cnt; | |||
488 | 500 | ||
489 | static int cache_defer_req(struct cache_req *req, struct cache_head *item) | 501 | static int cache_defer_req(struct cache_req *req, struct cache_head *item) |
490 | { | 502 | { |
491 | struct cache_deferred_req *dreq; | 503 | struct cache_deferred_req *dreq, *discard; |
492 | int hash = DFR_HASH(item); | 504 | int hash = DFR_HASH(item); |
493 | 505 | ||
494 | if (cache_defer_cnt >= DFR_MAX) { | 506 | if (cache_defer_cnt >= DFR_MAX) { |
@@ -496,11 +508,11 @@ static int cache_defer_req(struct cache_req *req, struct cache_head *item) | |||
496 | * or continue and drop the oldest below | 508 | * or continue and drop the oldest below |
497 | */ | 509 | */ |
498 | if (net_random()&1) | 510 | if (net_random()&1) |
499 | return -ETIMEDOUT; | 511 | return -ENOMEM; |
500 | } | 512 | } |
501 | dreq = req->defer(req); | 513 | dreq = req->defer(req); |
502 | if (dreq == NULL) | 514 | if (dreq == NULL) |
503 | return -ETIMEDOUT; | 515 | return -ENOMEM; |
504 | 516 | ||
505 | dreq->item = item; | 517 | dreq->item = item; |
506 | 518 | ||
@@ -513,23 +525,24 @@ static int cache_defer_req(struct cache_req *req, struct cache_head *item) | |||
513 | list_add(&dreq->hash, &cache_defer_hash[hash]); | 525 | list_add(&dreq->hash, &cache_defer_hash[hash]); |
514 | 526 | ||
515 | /* it is in, now maybe clean up */ | 527 | /* it is in, now maybe clean up */ |
516 | dreq = NULL; | 528 | discard = NULL; |
517 | if (++cache_defer_cnt > DFR_MAX) { | 529 | if (++cache_defer_cnt > DFR_MAX) { |
518 | dreq = list_entry(cache_defer_list.prev, | 530 | discard = list_entry(cache_defer_list.prev, |
519 | struct cache_deferred_req, recent); | 531 | struct cache_deferred_req, recent); |
520 | list_del(&dreq->recent); | 532 | list_del_init(&discard->recent); |
521 | list_del(&dreq->hash); | 533 | list_del_init(&discard->hash); |
522 | cache_defer_cnt--; | 534 | cache_defer_cnt--; |
523 | } | 535 | } |
524 | spin_unlock(&cache_defer_lock); | 536 | spin_unlock(&cache_defer_lock); |
525 | 537 | ||
526 | if (dreq) { | 538 | if (discard) |
527 | /* there was one too many */ | 539 | /* there was one too many */ |
528 | dreq->revisit(dreq, 1); | 540 | discard->revisit(discard, 1); |
529 | } | 541 | |
530 | if (!test_bit(CACHE_PENDING, &item->flags)) { | 542 | if (!test_bit(CACHE_PENDING, &item->flags)) { |
531 | /* must have just been validated... */ | 543 | /* must have just been validated... */ |
532 | cache_revisit_request(item); | 544 | cache_revisit_request(item); |
545 | return -EAGAIN; | ||
533 | } | 546 | } |
534 | return 0; | 547 | return 0; |
535 | } | 548 | } |
@@ -551,7 +564,7 @@ static void cache_revisit_request(struct cache_head *item) | |||
551 | dreq = list_entry(lp, struct cache_deferred_req, hash); | 564 | dreq = list_entry(lp, struct cache_deferred_req, hash); |
552 | lp = lp->next; | 565 | lp = lp->next; |
553 | if (dreq->item == item) { | 566 | if (dreq->item == item) { |
554 | list_del(&dreq->hash); | 567 | list_del_init(&dreq->hash); |
555 | list_move(&dreq->recent, &pending); | 568 | list_move(&dreq->recent, &pending); |
556 | cache_defer_cnt--; | 569 | cache_defer_cnt--; |
557 | } | 570 | } |
@@ -577,7 +590,7 @@ void cache_clean_deferred(void *owner) | |||
577 | 590 | ||
578 | list_for_each_entry_safe(dreq, tmp, &cache_defer_list, recent) { | 591 | list_for_each_entry_safe(dreq, tmp, &cache_defer_list, recent) { |
579 | if (dreq->owner == owner) { | 592 | if (dreq->owner == owner) { |
580 | list_del(&dreq->hash); | 593 | list_del_init(&dreq->hash); |
581 | list_move(&dreq->recent, &pending); | 594 | list_move(&dreq->recent, &pending); |
582 | cache_defer_cnt--; | 595 | cache_defer_cnt--; |
583 | } | 596 | } |
@@ -887,7 +900,7 @@ static int cache_release(struct inode *inode, struct file *filp, | |||
887 | 900 | ||
888 | 901 | ||
889 | 902 | ||
890 | static void queue_loose(struct cache_detail *detail, struct cache_head *ch) | 903 | static void cache_dequeue(struct cache_detail *detail, struct cache_head *ch) |
891 | { | 904 | { |
892 | struct cache_queue *cq; | 905 | struct cache_queue *cq; |
893 | spin_lock(&queue_lock); | 906 | spin_lock(&queue_lock); |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index fac0ca93f06b..38829e20500b 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -288,6 +288,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) | |||
288 | .srcaddr = args->saddress, | 288 | .srcaddr = args->saddress, |
289 | .dstaddr = args->address, | 289 | .dstaddr = args->address, |
290 | .addrlen = args->addrsize, | 290 | .addrlen = args->addrsize, |
291 | .bc_xprt = args->bc_xprt, | ||
291 | }; | 292 | }; |
292 | char servername[48]; | 293 | char servername[48]; |
293 | 294 | ||
@@ -639,10 +640,11 @@ EXPORT_SYMBOL_GPL(rpc_call_async); | |||
639 | /** | 640 | /** |
640 | * rpc_run_bc_task - Allocate a new RPC task for backchannel use, then run | 641 | * rpc_run_bc_task - Allocate a new RPC task for backchannel use, then run |
641 | * rpc_execute against it | 642 | * rpc_execute against it |
642 | * @ops: RPC call ops | 643 | * @req: RPC request |
644 | * @tk_ops: RPC call ops | ||
643 | */ | 645 | */ |
644 | struct rpc_task *rpc_run_bc_task(struct rpc_rqst *req, | 646 | struct rpc_task *rpc_run_bc_task(struct rpc_rqst *req, |
645 | const struct rpc_call_ops *tk_ops) | 647 | const struct rpc_call_ops *tk_ops) |
646 | { | 648 | { |
647 | struct rpc_task *task; | 649 | struct rpc_task *task; |
648 | struct xdr_buf *xbufp = &req->rq_snd_buf; | 650 | struct xdr_buf *xbufp = &req->rq_snd_buf; |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 7f676bdf70d3..49278f830367 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -860,7 +860,8 @@ static void rpc_clntdir_depopulate(struct dentry *dentry) | |||
860 | 860 | ||
861 | /** | 861 | /** |
862 | * rpc_create_client_dir - Create a new rpc_client directory in rpc_pipefs | 862 | * rpc_create_client_dir - Create a new rpc_client directory in rpc_pipefs |
863 | * @path: path from the rpc_pipefs root to the new directory | 863 | * @dentry: dentry from the rpc_pipefs root to the new directory |
864 | * @name: &struct qstr for the name | ||
864 | * @rpc_client: rpc client to associate with this directory | 865 | * @rpc_client: rpc client to associate with this directory |
865 | * | 866 | * |
866 | * This creates a directory at the given @path associated with | 867 | * This creates a directory at the given @path associated with |
@@ -930,7 +931,7 @@ void rpc_remove_cache_dir(struct dentry *dentry) | |||
930 | /* | 931 | /* |
931 | * populate the filesystem | 932 | * populate the filesystem |
932 | */ | 933 | */ |
933 | static struct super_operations s_ops = { | 934 | static const struct super_operations s_ops = { |
934 | .alloc_inode = rpc_alloc_inode, | 935 | .alloc_inode = rpc_alloc_inode, |
935 | .destroy_inode = rpc_destroy_inode, | 936 | .destroy_inode = rpc_destroy_inode, |
936 | .statfs = simple_statfs, | 937 | .statfs = simple_statfs, |
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index 8f459abe97cf..cef74ba0666c 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c | |||
@@ -21,6 +21,8 @@ | |||
21 | 21 | ||
22 | #include <linux/sunrpc/clnt.h> | 22 | #include <linux/sunrpc/clnt.h> |
23 | 23 | ||
24 | #include "sunrpc.h" | ||
25 | |||
24 | #ifdef RPC_DEBUG | 26 | #ifdef RPC_DEBUG |
25 | #define RPCDBG_FACILITY RPCDBG_SCHED | 27 | #define RPCDBG_FACILITY RPCDBG_SCHED |
26 | #define RPC_TASK_MAGIC_ID 0xf00baa | 28 | #define RPC_TASK_MAGIC_ID 0xf00baa |
@@ -711,11 +713,6 @@ static void rpc_async_schedule(struct work_struct *work) | |||
711 | __rpc_execute(container_of(work, struct rpc_task, u.tk_work)); | 713 | __rpc_execute(container_of(work, struct rpc_task, u.tk_work)); |
712 | } | 714 | } |
713 | 715 | ||
714 | struct rpc_buffer { | ||
715 | size_t len; | ||
716 | char data[]; | ||
717 | }; | ||
718 | |||
719 | /** | 716 | /** |
720 | * rpc_malloc - allocate an RPC buffer | 717 | * rpc_malloc - allocate an RPC buffer |
721 | * @task: RPC task that will use this buffer | 718 | * @task: RPC task that will use this buffer |
diff --git a/net/sunrpc/sunrpc.h b/net/sunrpc/sunrpc.h index 5d9dd742264b..90c292e2738b 100644 --- a/net/sunrpc/sunrpc.h +++ b/net/sunrpc/sunrpc.h | |||
@@ -27,11 +27,25 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
27 | #ifndef _NET_SUNRPC_SUNRPC_H | 27 | #ifndef _NET_SUNRPC_SUNRPC_H |
28 | #define _NET_SUNRPC_SUNRPC_H | 28 | #define _NET_SUNRPC_SUNRPC_H |
29 | 29 | ||
30 | #include <linux/net.h> | ||
31 | |||
32 | /* | ||
33 | * Header for dynamically allocated rpc buffers. | ||
34 | */ | ||
35 | struct rpc_buffer { | ||
36 | size_t len; | ||
37 | char data[]; | ||
38 | }; | ||
39 | |||
30 | static inline int rpc_reply_expected(struct rpc_task *task) | 40 | static inline int rpc_reply_expected(struct rpc_task *task) |
31 | { | 41 | { |
32 | return (task->tk_msg.rpc_proc != NULL) && | 42 | return (task->tk_msg.rpc_proc != NULL) && |
33 | (task->tk_msg.rpc_proc->p_decode != NULL); | 43 | (task->tk_msg.rpc_proc->p_decode != NULL); |
34 | } | 44 | } |
35 | 45 | ||
46 | int svc_send_common(struct socket *sock, struct xdr_buf *xdr, | ||
47 | struct page *headpage, unsigned long headoffset, | ||
48 | struct page *tailpage, unsigned long tailoffset); | ||
49 | |||
36 | #endif /* _NET_SUNRPC_SUNRPC_H */ | 50 | #endif /* _NET_SUNRPC_SUNRPC_H */ |
37 | 51 | ||
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index 27d44332f017..df124f78ee48 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c | |||
@@ -160,6 +160,7 @@ void svc_xprt_init(struct svc_xprt_class *xcl, struct svc_xprt *xprt, | |||
160 | mutex_init(&xprt->xpt_mutex); | 160 | mutex_init(&xprt->xpt_mutex); |
161 | spin_lock_init(&xprt->xpt_lock); | 161 | spin_lock_init(&xprt->xpt_lock); |
162 | set_bit(XPT_BUSY, &xprt->xpt_flags); | 162 | set_bit(XPT_BUSY, &xprt->xpt_flags); |
163 | rpc_init_wait_queue(&xprt->xpt_bc_pending, "xpt_bc_pending"); | ||
163 | } | 164 | } |
164 | EXPORT_SYMBOL_GPL(svc_xprt_init); | 165 | EXPORT_SYMBOL_GPL(svc_xprt_init); |
165 | 166 | ||
@@ -710,10 +711,7 @@ int svc_recv(struct svc_rqst *rqstp, long timeout) | |||
710 | spin_unlock_bh(&pool->sp_lock); | 711 | spin_unlock_bh(&pool->sp_lock); |
711 | 712 | ||
712 | len = 0; | 713 | len = 0; |
713 | if (test_bit(XPT_CLOSE, &xprt->xpt_flags)) { | 714 | if (test_bit(XPT_LISTENER, &xprt->xpt_flags)) { |
714 | dprintk("svc_recv: found XPT_CLOSE\n"); | ||
715 | svc_delete_xprt(xprt); | ||
716 | } else if (test_bit(XPT_LISTENER, &xprt->xpt_flags)) { | ||
717 | struct svc_xprt *newxpt; | 715 | struct svc_xprt *newxpt; |
718 | newxpt = xprt->xpt_ops->xpo_accept(xprt); | 716 | newxpt = xprt->xpt_ops->xpo_accept(xprt); |
719 | if (newxpt) { | 717 | if (newxpt) { |
@@ -739,7 +737,7 @@ int svc_recv(struct svc_rqst *rqstp, long timeout) | |||
739 | svc_xprt_received(newxpt); | 737 | svc_xprt_received(newxpt); |
740 | } | 738 | } |
741 | svc_xprt_received(xprt); | 739 | svc_xprt_received(xprt); |
742 | } else { | 740 | } else if (!test_bit(XPT_CLOSE, &xprt->xpt_flags)) { |
743 | dprintk("svc: server %p, pool %u, transport %p, inuse=%d\n", | 741 | dprintk("svc: server %p, pool %u, transport %p, inuse=%d\n", |
744 | rqstp, pool->sp_id, xprt, | 742 | rqstp, pool->sp_id, xprt, |
745 | atomic_read(&xprt->xpt_ref.refcount)); | 743 | atomic_read(&xprt->xpt_ref.refcount)); |
@@ -752,6 +750,11 @@ int svc_recv(struct svc_rqst *rqstp, long timeout) | |||
752 | dprintk("svc: got len=%d\n", len); | 750 | dprintk("svc: got len=%d\n", len); |
753 | } | 751 | } |
754 | 752 | ||
753 | if (test_bit(XPT_CLOSE, &xprt->xpt_flags)) { | ||
754 | dprintk("svc_recv: found XPT_CLOSE\n"); | ||
755 | svc_delete_xprt(xprt); | ||
756 | } | ||
757 | |||
755 | /* No data, incomplete (TCP) read, or accept() */ | 758 | /* No data, incomplete (TCP) read, or accept() */ |
756 | if (len == 0 || len == -EAGAIN) { | 759 | if (len == 0 || len == -EAGAIN) { |
757 | rqstp->rq_res.len = 0; | 760 | rqstp->rq_res.len = 0; |
@@ -808,6 +811,7 @@ int svc_send(struct svc_rqst *rqstp) | |||
808 | else | 811 | else |
809 | len = xprt->xpt_ops->xpo_sendto(rqstp); | 812 | len = xprt->xpt_ops->xpo_sendto(rqstp); |
810 | mutex_unlock(&xprt->xpt_mutex); | 813 | mutex_unlock(&xprt->xpt_mutex); |
814 | rpc_wake_up(&xprt->xpt_bc_pending); | ||
811 | svc_xprt_release(rqstp); | 815 | svc_xprt_release(rqstp); |
812 | 816 | ||
813 | if (len == -ECONNREFUSED || len == -ENOTCONN || len == -EAGAIN) | 817 | if (len == -ECONNREFUSED || len == -ENOTCONN || len == -EAGAIN) |
@@ -1166,11 +1170,6 @@ static void *svc_pool_stats_start(struct seq_file *m, loff_t *pos) | |||
1166 | 1170 | ||
1167 | dprintk("svc_pool_stats_start, *pidx=%u\n", pidx); | 1171 | dprintk("svc_pool_stats_start, *pidx=%u\n", pidx); |
1168 | 1172 | ||
1169 | lock_kernel(); | ||
1170 | /* bump up the pseudo refcount while traversing */ | ||
1171 | svc_get(serv); | ||
1172 | unlock_kernel(); | ||
1173 | |||
1174 | if (!pidx) | 1173 | if (!pidx) |
1175 | return SEQ_START_TOKEN; | 1174 | return SEQ_START_TOKEN; |
1176 | return (pidx > serv->sv_nrpools ? NULL : &serv->sv_pools[pidx-1]); | 1175 | return (pidx > serv->sv_nrpools ? NULL : &serv->sv_pools[pidx-1]); |
@@ -1198,12 +1197,6 @@ static void *svc_pool_stats_next(struct seq_file *m, void *p, loff_t *pos) | |||
1198 | 1197 | ||
1199 | static void svc_pool_stats_stop(struct seq_file *m, void *p) | 1198 | static void svc_pool_stats_stop(struct seq_file *m, void *p) |
1200 | { | 1199 | { |
1201 | struct svc_serv *serv = m->private; | ||
1202 | |||
1203 | lock_kernel(); | ||
1204 | /* this function really, really should have been called svc_put() */ | ||
1205 | svc_destroy(serv); | ||
1206 | unlock_kernel(); | ||
1207 | } | 1200 | } |
1208 | 1201 | ||
1209 | static int svc_pool_stats_show(struct seq_file *m, void *p) | 1202 | static int svc_pool_stats_show(struct seq_file *m, void *p) |
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c index 6caffa34ac01..117f68a8aa40 100644 --- a/net/sunrpc/svcauth_unix.c +++ b/net/sunrpc/svcauth_unix.c | |||
@@ -668,6 +668,7 @@ static int unix_gid_find(uid_t uid, struct group_info **gip, | |||
668 | case 0: | 668 | case 0: |
669 | *gip = ug->gi; | 669 | *gip = ug->gi; |
670 | get_group_info(*gip); | 670 | get_group_info(*gip); |
671 | cache_put(&ug->h, &unix_gid_cache); | ||
671 | return 0; | 672 | return 0; |
672 | default: | 673 | default: |
673 | return -EAGAIN; | 674 | return -EAGAIN; |
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 23128ee191ae..ccc5e83cae5d 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/sunrpc/msg_prot.h> | 49 | #include <linux/sunrpc/msg_prot.h> |
50 | #include <linux/sunrpc/svcsock.h> | 50 | #include <linux/sunrpc/svcsock.h> |
51 | #include <linux/sunrpc/stats.h> | 51 | #include <linux/sunrpc/stats.h> |
52 | #include <linux/sunrpc/xprt.h> | ||
52 | 53 | ||
53 | #define RPCDBG_FACILITY RPCDBG_SVCXPRT | 54 | #define RPCDBG_FACILITY RPCDBG_SVCXPRT |
54 | 55 | ||
@@ -153,49 +154,27 @@ static void svc_set_cmsg_data(struct svc_rqst *rqstp, struct cmsghdr *cmh) | |||
153 | } | 154 | } |
154 | 155 | ||
155 | /* | 156 | /* |
156 | * Generic sendto routine | 157 | * send routine intended to be shared by the fore- and back-channel |
157 | */ | 158 | */ |
158 | static int svc_sendto(struct svc_rqst *rqstp, struct xdr_buf *xdr) | 159 | int svc_send_common(struct socket *sock, struct xdr_buf *xdr, |
160 | struct page *headpage, unsigned long headoffset, | ||
161 | struct page *tailpage, unsigned long tailoffset) | ||
159 | { | 162 | { |
160 | struct svc_sock *svsk = | ||
161 | container_of(rqstp->rq_xprt, struct svc_sock, sk_xprt); | ||
162 | struct socket *sock = svsk->sk_sock; | ||
163 | int slen; | ||
164 | union { | ||
165 | struct cmsghdr hdr; | ||
166 | long all[SVC_PKTINFO_SPACE / sizeof(long)]; | ||
167 | } buffer; | ||
168 | struct cmsghdr *cmh = &buffer.hdr; | ||
169 | int len = 0; | ||
170 | int result; | 163 | int result; |
171 | int size; | 164 | int size; |
172 | struct page **ppage = xdr->pages; | 165 | struct page **ppage = xdr->pages; |
173 | size_t base = xdr->page_base; | 166 | size_t base = xdr->page_base; |
174 | unsigned int pglen = xdr->page_len; | 167 | unsigned int pglen = xdr->page_len; |
175 | unsigned int flags = MSG_MORE; | 168 | unsigned int flags = MSG_MORE; |
176 | RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]); | 169 | int slen; |
170 | int len = 0; | ||
177 | 171 | ||
178 | slen = xdr->len; | 172 | slen = xdr->len; |
179 | 173 | ||
180 | if (rqstp->rq_prot == IPPROTO_UDP) { | ||
181 | struct msghdr msg = { | ||
182 | .msg_name = &rqstp->rq_addr, | ||
183 | .msg_namelen = rqstp->rq_addrlen, | ||
184 | .msg_control = cmh, | ||
185 | .msg_controllen = sizeof(buffer), | ||
186 | .msg_flags = MSG_MORE, | ||
187 | }; | ||
188 | |||
189 | svc_set_cmsg_data(rqstp, cmh); | ||
190 | |||
191 | if (sock_sendmsg(sock, &msg, 0) < 0) | ||
192 | goto out; | ||
193 | } | ||
194 | |||
195 | /* send head */ | 174 | /* send head */ |
196 | if (slen == xdr->head[0].iov_len) | 175 | if (slen == xdr->head[0].iov_len) |
197 | flags = 0; | 176 | flags = 0; |
198 | len = kernel_sendpage(sock, rqstp->rq_respages[0], 0, | 177 | len = kernel_sendpage(sock, headpage, headoffset, |
199 | xdr->head[0].iov_len, flags); | 178 | xdr->head[0].iov_len, flags); |
200 | if (len != xdr->head[0].iov_len) | 179 | if (len != xdr->head[0].iov_len) |
201 | goto out; | 180 | goto out; |
@@ -219,16 +198,58 @@ static int svc_sendto(struct svc_rqst *rqstp, struct xdr_buf *xdr) | |||
219 | base = 0; | 198 | base = 0; |
220 | ppage++; | 199 | ppage++; |
221 | } | 200 | } |
201 | |||
222 | /* send tail */ | 202 | /* send tail */ |
223 | if (xdr->tail[0].iov_len) { | 203 | if (xdr->tail[0].iov_len) { |
224 | result = kernel_sendpage(sock, rqstp->rq_respages[0], | 204 | result = kernel_sendpage(sock, tailpage, tailoffset, |
225 | ((unsigned long)xdr->tail[0].iov_base) | 205 | xdr->tail[0].iov_len, 0); |
226 | & (PAGE_SIZE-1), | ||
227 | xdr->tail[0].iov_len, 0); | ||
228 | |||
229 | if (result > 0) | 206 | if (result > 0) |
230 | len += result; | 207 | len += result; |
231 | } | 208 | } |
209 | |||
210 | out: | ||
211 | return len; | ||
212 | } | ||
213 | |||
214 | |||
215 | /* | ||
216 | * Generic sendto routine | ||
217 | */ | ||
218 | static int svc_sendto(struct svc_rqst *rqstp, struct xdr_buf *xdr) | ||
219 | { | ||
220 | struct svc_sock *svsk = | ||
221 | container_of(rqstp->rq_xprt, struct svc_sock, sk_xprt); | ||
222 | struct socket *sock = svsk->sk_sock; | ||
223 | union { | ||
224 | struct cmsghdr hdr; | ||
225 | long all[SVC_PKTINFO_SPACE / sizeof(long)]; | ||
226 | } buffer; | ||
227 | struct cmsghdr *cmh = &buffer.hdr; | ||
228 | int len = 0; | ||
229 | unsigned long tailoff; | ||
230 | unsigned long headoff; | ||
231 | RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]); | ||
232 | |||
233 | if (rqstp->rq_prot == IPPROTO_UDP) { | ||
234 | struct msghdr msg = { | ||
235 | .msg_name = &rqstp->rq_addr, | ||
236 | .msg_namelen = rqstp->rq_addrlen, | ||
237 | .msg_control = cmh, | ||
238 | .msg_controllen = sizeof(buffer), | ||
239 | .msg_flags = MSG_MORE, | ||
240 | }; | ||
241 | |||
242 | svc_set_cmsg_data(rqstp, cmh); | ||
243 | |||
244 | if (sock_sendmsg(sock, &msg, 0) < 0) | ||
245 | goto out; | ||
246 | } | ||
247 | |||
248 | tailoff = ((unsigned long)xdr->tail[0].iov_base) & (PAGE_SIZE-1); | ||
249 | headoff = 0; | ||
250 | len = svc_send_common(sock, xdr, rqstp->rq_respages[0], headoff, | ||
251 | rqstp->rq_respages[0], tailoff); | ||
252 | |||
232 | out: | 253 | out: |
233 | dprintk("svc: socket %p sendto([%p %Zu... ], %d) = %d (addr %s)\n", | 254 | dprintk("svc: socket %p sendto([%p %Zu... ], %d) = %d (addr %s)\n", |
234 | svsk, xdr->head[0].iov_base, xdr->head[0].iov_len, | 255 | svsk, xdr->head[0].iov_base, xdr->head[0].iov_len, |
@@ -432,29 +453,49 @@ static void svc_tcp_write_space(struct sock *sk) | |||
432 | } | 453 | } |
433 | 454 | ||
434 | /* | 455 | /* |
456 | * See net/ipv6/ip_sockglue.c : ip_cmsg_recv_pktinfo | ||
457 | */ | ||
458 | static int svc_udp_get_dest_address4(struct svc_rqst *rqstp, | ||
459 | struct cmsghdr *cmh) | ||
460 | { | ||
461 | struct in_pktinfo *pki = CMSG_DATA(cmh); | ||
462 | if (cmh->cmsg_type != IP_PKTINFO) | ||
463 | return 0; | ||
464 | rqstp->rq_daddr.addr.s_addr = pki->ipi_spec_dst.s_addr; | ||
465 | return 1; | ||
466 | } | ||
467 | |||
468 | /* | ||
469 | * See net/ipv6/datagram.c : datagram_recv_ctl | ||
470 | */ | ||
471 | static int svc_udp_get_dest_address6(struct svc_rqst *rqstp, | ||
472 | struct cmsghdr *cmh) | ||
473 | { | ||
474 | struct in6_pktinfo *pki = CMSG_DATA(cmh); | ||
475 | if (cmh->cmsg_type != IPV6_PKTINFO) | ||
476 | return 0; | ||
477 | ipv6_addr_copy(&rqstp->rq_daddr.addr6, &pki->ipi6_addr); | ||
478 | return 1; | ||
479 | } | ||
480 | |||
481 | /* | ||
435 | * Copy the UDP datagram's destination address to the rqstp structure. | 482 | * Copy the UDP datagram's destination address to the rqstp structure. |
436 | * The 'destination' address in this case is the address to which the | 483 | * The 'destination' address in this case is the address to which the |
437 | * peer sent the datagram, i.e. our local address. For multihomed | 484 | * peer sent the datagram, i.e. our local address. For multihomed |
438 | * hosts, this can change from msg to msg. Note that only the IP | 485 | * hosts, this can change from msg to msg. Note that only the IP |
439 | * address changes, the port number should remain the same. | 486 | * address changes, the port number should remain the same. |
440 | */ | 487 | */ |
441 | static void svc_udp_get_dest_address(struct svc_rqst *rqstp, | 488 | static int svc_udp_get_dest_address(struct svc_rqst *rqstp, |
442 | struct cmsghdr *cmh) | 489 | struct cmsghdr *cmh) |
443 | { | 490 | { |
444 | struct svc_sock *svsk = | 491 | switch (cmh->cmsg_level) { |
445 | container_of(rqstp->rq_xprt, struct svc_sock, sk_xprt); | 492 | case SOL_IP: |
446 | switch (svsk->sk_sk->sk_family) { | 493 | return svc_udp_get_dest_address4(rqstp, cmh); |
447 | case AF_INET: { | 494 | case SOL_IPV6: |
448 | struct in_pktinfo *pki = CMSG_DATA(cmh); | 495 | return svc_udp_get_dest_address6(rqstp, cmh); |
449 | rqstp->rq_daddr.addr.s_addr = pki->ipi_spec_dst.s_addr; | ||
450 | break; | ||
451 | } | ||
452 | case AF_INET6: { | ||
453 | struct in6_pktinfo *pki = CMSG_DATA(cmh); | ||
454 | ipv6_addr_copy(&rqstp->rq_daddr.addr6, &pki->ipi6_addr); | ||
455 | break; | ||
456 | } | ||
457 | } | 496 | } |
497 | |||
498 | return 0; | ||
458 | } | 499 | } |
459 | 500 | ||
460 | /* | 501 | /* |
@@ -531,16 +572,15 @@ static int svc_udp_recvfrom(struct svc_rqst *rqstp) | |||
531 | 572 | ||
532 | rqstp->rq_prot = IPPROTO_UDP; | 573 | rqstp->rq_prot = IPPROTO_UDP; |
533 | 574 | ||
534 | if (cmh->cmsg_level != IPPROTO_IP || | 575 | if (!svc_udp_get_dest_address(rqstp, cmh)) { |
535 | cmh->cmsg_type != IP_PKTINFO) { | ||
536 | if (net_ratelimit()) | 576 | if (net_ratelimit()) |
537 | printk("rpcsvc: received unknown control message:" | 577 | printk(KERN_WARNING |
538 | "%d/%d\n", | 578 | "svc: received unknown control message %d/%d; " |
539 | cmh->cmsg_level, cmh->cmsg_type); | 579 | "dropping RPC reply datagram\n", |
580 | cmh->cmsg_level, cmh->cmsg_type); | ||
540 | skb_free_datagram(svsk->sk_sk, skb); | 581 | skb_free_datagram(svsk->sk_sk, skb); |
541 | return 0; | 582 | return 0; |
542 | } | 583 | } |
543 | svc_udp_get_dest_address(rqstp, cmh); | ||
544 | 584 | ||
545 | if (skb_is_nonlinear(skb)) { | 585 | if (skb_is_nonlinear(skb)) { |
546 | /* we have to copy */ | 586 | /* we have to copy */ |
@@ -651,8 +691,7 @@ static struct svc_xprt_class svc_udp_class = { | |||
651 | 691 | ||
652 | static void svc_udp_init(struct svc_sock *svsk, struct svc_serv *serv) | 692 | static void svc_udp_init(struct svc_sock *svsk, struct svc_serv *serv) |
653 | { | 693 | { |
654 | int one = 1; | 694 | int err, level, optname, one = 1; |
655 | mm_segment_t oldfs; | ||
656 | 695 | ||
657 | svc_xprt_init(&svc_udp_class, &svsk->sk_xprt, serv); | 696 | svc_xprt_init(&svc_udp_class, &svsk->sk_xprt, serv); |
658 | clear_bit(XPT_CACHE_AUTH, &svsk->sk_xprt.xpt_flags); | 697 | clear_bit(XPT_CACHE_AUTH, &svsk->sk_xprt.xpt_flags); |
@@ -671,12 +710,22 @@ static void svc_udp_init(struct svc_sock *svsk, struct svc_serv *serv) | |||
671 | set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); | 710 | set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); |
672 | set_bit(XPT_CHNGBUF, &svsk->sk_xprt.xpt_flags); | 711 | set_bit(XPT_CHNGBUF, &svsk->sk_xprt.xpt_flags); |
673 | 712 | ||
674 | oldfs = get_fs(); | ||
675 | set_fs(KERNEL_DS); | ||
676 | /* make sure we get destination address info */ | 713 | /* make sure we get destination address info */ |
677 | svsk->sk_sock->ops->setsockopt(svsk->sk_sock, IPPROTO_IP, IP_PKTINFO, | 714 | switch (svsk->sk_sk->sk_family) { |
678 | (char __user *)&one, sizeof(one)); | 715 | case AF_INET: |
679 | set_fs(oldfs); | 716 | level = SOL_IP; |
717 | optname = IP_PKTINFO; | ||
718 | break; | ||
719 | case AF_INET6: | ||
720 | level = SOL_IPV6; | ||
721 | optname = IPV6_RECVPKTINFO; | ||
722 | break; | ||
723 | default: | ||
724 | BUG(); | ||
725 | } | ||
726 | err = kernel_setsockopt(svsk->sk_sock, level, optname, | ||
727 | (char *)&one, sizeof(one)); | ||
728 | dprintk("svc: kernel_setsockopt returned %d\n", err); | ||
680 | } | 729 | } |
681 | 730 | ||
682 | /* | 731 | /* |
@@ -826,21 +875,15 @@ failed: | |||
826 | } | 875 | } |
827 | 876 | ||
828 | /* | 877 | /* |
829 | * Receive data from a TCP socket. | 878 | * Receive data. |
879 | * If we haven't gotten the record length yet, get the next four bytes. | ||
880 | * Otherwise try to gobble up as much as possible up to the complete | ||
881 | * record length. | ||
830 | */ | 882 | */ |
831 | static int svc_tcp_recvfrom(struct svc_rqst *rqstp) | 883 | static int svc_tcp_recv_record(struct svc_sock *svsk, struct svc_rqst *rqstp) |
832 | { | 884 | { |
833 | struct svc_sock *svsk = | ||
834 | container_of(rqstp->rq_xprt, struct svc_sock, sk_xprt); | ||
835 | struct svc_serv *serv = svsk->sk_xprt.xpt_server; | 885 | struct svc_serv *serv = svsk->sk_xprt.xpt_server; |
836 | int len; | 886 | int len; |
837 | struct kvec *vec; | ||
838 | int pnum, vlen; | ||
839 | |||
840 | dprintk("svc: tcp_recv %p data %d conn %d close %d\n", | ||
841 | svsk, test_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags), | ||
842 | test_bit(XPT_CONN, &svsk->sk_xprt.xpt_flags), | ||
843 | test_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags)); | ||
844 | 887 | ||
845 | if (test_and_clear_bit(XPT_CHNGBUF, &svsk->sk_xprt.xpt_flags)) | 888 | if (test_and_clear_bit(XPT_CHNGBUF, &svsk->sk_xprt.xpt_flags)) |
846 | /* sndbuf needs to have room for one request | 889 | /* sndbuf needs to have room for one request |
@@ -861,10 +904,6 @@ static int svc_tcp_recvfrom(struct svc_rqst *rqstp) | |||
861 | 904 | ||
862 | clear_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); | 905 | clear_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); |
863 | 906 | ||
864 | /* Receive data. If we haven't got the record length yet, get | ||
865 | * the next four bytes. Otherwise try to gobble up as much as | ||
866 | * possible up to the complete record length. | ||
867 | */ | ||
868 | if (svsk->sk_tcplen < sizeof(rpc_fraghdr)) { | 907 | if (svsk->sk_tcplen < sizeof(rpc_fraghdr)) { |
869 | int want = sizeof(rpc_fraghdr) - svsk->sk_tcplen; | 908 | int want = sizeof(rpc_fraghdr) - svsk->sk_tcplen; |
870 | struct kvec iov; | 909 | struct kvec iov; |
@@ -879,7 +918,7 @@ static int svc_tcp_recvfrom(struct svc_rqst *rqstp) | |||
879 | dprintk("svc: short recvfrom while reading record " | 918 | dprintk("svc: short recvfrom while reading record " |
880 | "length (%d of %d)\n", len, want); | 919 | "length (%d of %d)\n", len, want); |
881 | svc_xprt_received(&svsk->sk_xprt); | 920 | svc_xprt_received(&svsk->sk_xprt); |
882 | return -EAGAIN; /* record header not complete */ | 921 | goto err_again; /* record header not complete */ |
883 | } | 922 | } |
884 | 923 | ||
885 | svsk->sk_reclen = ntohl(svsk->sk_reclen); | 924 | svsk->sk_reclen = ntohl(svsk->sk_reclen); |
@@ -894,6 +933,7 @@ static int svc_tcp_recvfrom(struct svc_rqst *rqstp) | |||
894 | "per record not supported\n"); | 933 | "per record not supported\n"); |
895 | goto err_delete; | 934 | goto err_delete; |
896 | } | 935 | } |
936 | |||
897 | svsk->sk_reclen &= RPC_FRAGMENT_SIZE_MASK; | 937 | svsk->sk_reclen &= RPC_FRAGMENT_SIZE_MASK; |
898 | dprintk("svc: TCP record, %d bytes\n", svsk->sk_reclen); | 938 | dprintk("svc: TCP record, %d bytes\n", svsk->sk_reclen); |
899 | if (svsk->sk_reclen > serv->sv_max_mesg) { | 939 | if (svsk->sk_reclen > serv->sv_max_mesg) { |
@@ -914,17 +954,121 @@ static int svc_tcp_recvfrom(struct svc_rqst *rqstp) | |||
914 | dprintk("svc: incomplete TCP record (%d of %d)\n", | 954 | dprintk("svc: incomplete TCP record (%d of %d)\n", |
915 | len, svsk->sk_reclen); | 955 | len, svsk->sk_reclen); |
916 | svc_xprt_received(&svsk->sk_xprt); | 956 | svc_xprt_received(&svsk->sk_xprt); |
917 | return -EAGAIN; /* record not complete */ | 957 | goto err_again; /* record not complete */ |
918 | } | 958 | } |
919 | len = svsk->sk_reclen; | 959 | len = svsk->sk_reclen; |
920 | set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); | 960 | set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); |
921 | 961 | ||
962 | return len; | ||
963 | error: | ||
964 | if (len == -EAGAIN) { | ||
965 | dprintk("RPC: TCP recv_record got EAGAIN\n"); | ||
966 | svc_xprt_received(&svsk->sk_xprt); | ||
967 | } | ||
968 | return len; | ||
969 | err_delete: | ||
970 | set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags); | ||
971 | err_again: | ||
972 | return -EAGAIN; | ||
973 | } | ||
974 | |||
975 | static int svc_process_calldir(struct svc_sock *svsk, struct svc_rqst *rqstp, | ||
976 | struct rpc_rqst **reqpp, struct kvec *vec) | ||
977 | { | ||
978 | struct rpc_rqst *req = NULL; | ||
979 | u32 *p; | ||
980 | u32 xid; | ||
981 | u32 calldir; | ||
982 | int len; | ||
983 | |||
984 | len = svc_recvfrom(rqstp, vec, 1, 8); | ||
985 | if (len < 0) | ||
986 | goto error; | ||
987 | |||
988 | p = (u32 *)rqstp->rq_arg.head[0].iov_base; | ||
989 | xid = *p++; | ||
990 | calldir = *p; | ||
991 | |||
992 | if (calldir == 0) { | ||
993 | /* REQUEST is the most common case */ | ||
994 | vec[0] = rqstp->rq_arg.head[0]; | ||
995 | } else { | ||
996 | /* REPLY */ | ||
997 | if (svsk->sk_bc_xprt) | ||
998 | req = xprt_lookup_rqst(svsk->sk_bc_xprt, xid); | ||
999 | |||
1000 | if (!req) { | ||
1001 | printk(KERN_NOTICE | ||
1002 | "%s: Got unrecognized reply: " | ||
1003 | "calldir 0x%x sk_bc_xprt %p xid %08x\n", | ||
1004 | __func__, ntohl(calldir), | ||
1005 | svsk->sk_bc_xprt, xid); | ||
1006 | vec[0] = rqstp->rq_arg.head[0]; | ||
1007 | goto out; | ||
1008 | } | ||
1009 | |||
1010 | memcpy(&req->rq_private_buf, &req->rq_rcv_buf, | ||
1011 | sizeof(struct xdr_buf)); | ||
1012 | /* copy the xid and call direction */ | ||
1013 | memcpy(req->rq_private_buf.head[0].iov_base, | ||
1014 | rqstp->rq_arg.head[0].iov_base, 8); | ||
1015 | vec[0] = req->rq_private_buf.head[0]; | ||
1016 | } | ||
1017 | out: | ||
1018 | vec[0].iov_base += 8; | ||
1019 | vec[0].iov_len -= 8; | ||
1020 | len = svsk->sk_reclen - 8; | ||
1021 | error: | ||
1022 | *reqpp = req; | ||
1023 | return len; | ||
1024 | } | ||
1025 | |||
1026 | /* | ||
1027 | * Receive data from a TCP socket. | ||
1028 | */ | ||
1029 | static int svc_tcp_recvfrom(struct svc_rqst *rqstp) | ||
1030 | { | ||
1031 | struct svc_sock *svsk = | ||
1032 | container_of(rqstp->rq_xprt, struct svc_sock, sk_xprt); | ||
1033 | struct svc_serv *serv = svsk->sk_xprt.xpt_server; | ||
1034 | int len; | ||
1035 | struct kvec *vec; | ||
1036 | int pnum, vlen; | ||
1037 | struct rpc_rqst *req = NULL; | ||
1038 | |||
1039 | dprintk("svc: tcp_recv %p data %d conn %d close %d\n", | ||
1040 | svsk, test_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags), | ||
1041 | test_bit(XPT_CONN, &svsk->sk_xprt.xpt_flags), | ||
1042 | test_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags)); | ||
1043 | |||
1044 | len = svc_tcp_recv_record(svsk, rqstp); | ||
1045 | if (len < 0) | ||
1046 | goto error; | ||
1047 | |||
922 | vec = rqstp->rq_vec; | 1048 | vec = rqstp->rq_vec; |
923 | vec[0] = rqstp->rq_arg.head[0]; | 1049 | vec[0] = rqstp->rq_arg.head[0]; |
924 | vlen = PAGE_SIZE; | 1050 | vlen = PAGE_SIZE; |
1051 | |||
1052 | /* | ||
1053 | * We have enough data for the whole tcp record. Let's try and read the | ||
1054 | * first 8 bytes to get the xid and the call direction. We can use this | ||
1055 | * to figure out if this is a call or a reply to a callback. If | ||
1056 | * sk_reclen is < 8 (xid and calldir), then this is a malformed packet. | ||
1057 | * In that case, don't bother with the calldir and just read the data. | ||
1058 | * It will be rejected in svc_process. | ||
1059 | */ | ||
1060 | if (len >= 8) { | ||
1061 | len = svc_process_calldir(svsk, rqstp, &req, vec); | ||
1062 | if (len < 0) | ||
1063 | goto err_again; | ||
1064 | vlen -= 8; | ||
1065 | } | ||
1066 | |||
925 | pnum = 1; | 1067 | pnum = 1; |
926 | while (vlen < len) { | 1068 | while (vlen < len) { |
927 | vec[pnum].iov_base = page_address(rqstp->rq_pages[pnum]); | 1069 | vec[pnum].iov_base = (req) ? |
1070 | page_address(req->rq_private_buf.pages[pnum - 1]) : | ||
1071 | page_address(rqstp->rq_pages[pnum]); | ||
928 | vec[pnum].iov_len = PAGE_SIZE; | 1072 | vec[pnum].iov_len = PAGE_SIZE; |
929 | pnum++; | 1073 | pnum++; |
930 | vlen += PAGE_SIZE; | 1074 | vlen += PAGE_SIZE; |
@@ -934,8 +1078,18 @@ static int svc_tcp_recvfrom(struct svc_rqst *rqstp) | |||
934 | /* Now receive data */ | 1078 | /* Now receive data */ |
935 | len = svc_recvfrom(rqstp, vec, pnum, len); | 1079 | len = svc_recvfrom(rqstp, vec, pnum, len); |
936 | if (len < 0) | 1080 | if (len < 0) |
937 | goto error; | 1081 | goto err_again; |
938 | 1082 | ||
1083 | /* | ||
1084 | * Account for the 8 bytes we read earlier | ||
1085 | */ | ||
1086 | len += 8; | ||
1087 | |||
1088 | if (req) { | ||
1089 | xprt_complete_rqst(req->rq_task, len); | ||
1090 | len = 0; | ||
1091 | goto out; | ||
1092 | } | ||
939 | dprintk("svc: TCP complete record (%d bytes)\n", len); | 1093 | dprintk("svc: TCP complete record (%d bytes)\n", len); |
940 | rqstp->rq_arg.len = len; | 1094 | rqstp->rq_arg.len = len; |
941 | rqstp->rq_arg.page_base = 0; | 1095 | rqstp->rq_arg.page_base = 0; |
@@ -949,6 +1103,7 @@ static int svc_tcp_recvfrom(struct svc_rqst *rqstp) | |||
949 | rqstp->rq_xprt_ctxt = NULL; | 1103 | rqstp->rq_xprt_ctxt = NULL; |
950 | rqstp->rq_prot = IPPROTO_TCP; | 1104 | rqstp->rq_prot = IPPROTO_TCP; |
951 | 1105 | ||
1106 | out: | ||
952 | /* Reset TCP read info */ | 1107 | /* Reset TCP read info */ |
953 | svsk->sk_reclen = 0; | 1108 | svsk->sk_reclen = 0; |
954 | svsk->sk_tcplen = 0; | 1109 | svsk->sk_tcplen = 0; |
@@ -960,21 +1115,19 @@ static int svc_tcp_recvfrom(struct svc_rqst *rqstp) | |||
960 | 1115 | ||
961 | return len; | 1116 | return len; |
962 | 1117 | ||
963 | err_delete: | 1118 | err_again: |
964 | set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags); | ||
965 | return -EAGAIN; | ||
966 | |||
967 | error: | ||
968 | if (len == -EAGAIN) { | 1119 | if (len == -EAGAIN) { |
969 | dprintk("RPC: TCP recvfrom got EAGAIN\n"); | 1120 | dprintk("RPC: TCP recvfrom got EAGAIN\n"); |
970 | svc_xprt_received(&svsk->sk_xprt); | 1121 | svc_xprt_received(&svsk->sk_xprt); |
971 | } else { | 1122 | return len; |
1123 | } | ||
1124 | error: | ||
1125 | if (len != -EAGAIN) { | ||
972 | printk(KERN_NOTICE "%s: recvfrom returned errno %d\n", | 1126 | printk(KERN_NOTICE "%s: recvfrom returned errno %d\n", |
973 | svsk->sk_xprt.xpt_server->sv_name, -len); | 1127 | svsk->sk_xprt.xpt_server->sv_name, -len); |
974 | goto err_delete; | 1128 | set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags); |
975 | } | 1129 | } |
976 | 1130 | return -EAGAIN; | |
977 | return len; | ||
978 | } | 1131 | } |
979 | 1132 | ||
980 | /* | 1133 | /* |
diff --git a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c index 5231f7aaac0e..42f9748ae093 100644 --- a/net/sunrpc/sysctl.c +++ b/net/sunrpc/sysctl.c | |||
@@ -56,7 +56,7 @@ rpc_unregister_sysctl(void) | |||
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
59 | static int proc_do_xprt(ctl_table *table, int write, struct file *file, | 59 | static int proc_do_xprt(ctl_table *table, int write, |
60 | void __user *buffer, size_t *lenp, loff_t *ppos) | 60 | void __user *buffer, size_t *lenp, loff_t *ppos) |
61 | { | 61 | { |
62 | char tmpbuf[256]; | 62 | char tmpbuf[256]; |
@@ -71,7 +71,7 @@ static int proc_do_xprt(ctl_table *table, int write, struct file *file, | |||
71 | } | 71 | } |
72 | 72 | ||
73 | static int | 73 | static int |
74 | proc_dodebug(ctl_table *table, int write, struct file *file, | 74 | proc_dodebug(ctl_table *table, int write, |
75 | void __user *buffer, size_t *lenp, loff_t *ppos) | 75 | void __user *buffer, size_t *lenp, loff_t *ppos) |
76 | { | 76 | { |
77 | char tmpbuf[20], c, *s; | 77 | char tmpbuf[20], c, *s; |
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index f412a852bc73..fd46d42afa89 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -832,6 +832,11 @@ static void xprt_timer(struct rpc_task *task) | |||
832 | spin_unlock_bh(&xprt->transport_lock); | 832 | spin_unlock_bh(&xprt->transport_lock); |
833 | } | 833 | } |
834 | 834 | ||
835 | static inline int xprt_has_timer(struct rpc_xprt *xprt) | ||
836 | { | ||
837 | return xprt->idle_timeout != 0; | ||
838 | } | ||
839 | |||
835 | /** | 840 | /** |
836 | * xprt_prepare_transmit - reserve the transport before sending a request | 841 | * xprt_prepare_transmit - reserve the transport before sending a request |
837 | * @task: RPC task about to send a request | 842 | * @task: RPC task about to send a request |
@@ -1013,7 +1018,7 @@ void xprt_release(struct rpc_task *task) | |||
1013 | if (!list_empty(&req->rq_list)) | 1018 | if (!list_empty(&req->rq_list)) |
1014 | list_del(&req->rq_list); | 1019 | list_del(&req->rq_list); |
1015 | xprt->last_used = jiffies; | 1020 | xprt->last_used = jiffies; |
1016 | if (list_empty(&xprt->recv)) | 1021 | if (list_empty(&xprt->recv) && xprt_has_timer(xprt)) |
1017 | mod_timer(&xprt->timer, | 1022 | mod_timer(&xprt->timer, |
1018 | xprt->last_used + xprt->idle_timeout); | 1023 | xprt->last_used + xprt->idle_timeout); |
1019 | spin_unlock_bh(&xprt->transport_lock); | 1024 | spin_unlock_bh(&xprt->transport_lock); |
@@ -1082,8 +1087,11 @@ found: | |||
1082 | #endif /* CONFIG_NFS_V4_1 */ | 1087 | #endif /* CONFIG_NFS_V4_1 */ |
1083 | 1088 | ||
1084 | INIT_WORK(&xprt->task_cleanup, xprt_autoclose); | 1089 | INIT_WORK(&xprt->task_cleanup, xprt_autoclose); |
1085 | setup_timer(&xprt->timer, xprt_init_autodisconnect, | 1090 | if (xprt_has_timer(xprt)) |
1086 | (unsigned long)xprt); | 1091 | setup_timer(&xprt->timer, xprt_init_autodisconnect, |
1092 | (unsigned long)xprt); | ||
1093 | else | ||
1094 | init_timer(&xprt->timer); | ||
1087 | xprt->last_used = jiffies; | 1095 | xprt->last_used = jiffies; |
1088 | xprt->cwnd = RPC_INITCWND; | 1096 | xprt->cwnd = RPC_INITCWND; |
1089 | xprt->bind_index = 0; | 1097 | xprt->bind_index = 0; |
@@ -1102,7 +1110,6 @@ found: | |||
1102 | 1110 | ||
1103 | dprintk("RPC: created transport %p with %u slots\n", xprt, | 1111 | dprintk("RPC: created transport %p with %u slots\n", xprt, |
1104 | xprt->max_reqs); | 1112 | xprt->max_reqs); |
1105 | |||
1106 | return xprt; | 1113 | return xprt; |
1107 | } | 1114 | } |
1108 | 1115 | ||
diff --git a/net/sunrpc/xprtrdma/svc_rdma.c b/net/sunrpc/xprtrdma/svc_rdma.c index 87101177825b..35fb68b9c8ec 100644 --- a/net/sunrpc/xprtrdma/svc_rdma.c +++ b/net/sunrpc/xprtrdma/svc_rdma.c | |||
@@ -80,7 +80,7 @@ struct kmem_cache *svc_rdma_ctxt_cachep; | |||
80 | * current value. | 80 | * current value. |
81 | */ | 81 | */ |
82 | static int read_reset_stat(ctl_table *table, int write, | 82 | static int read_reset_stat(ctl_table *table, int write, |
83 | struct file *filp, void __user *buffer, size_t *lenp, | 83 | void __user *buffer, size_t *lenp, |
84 | loff_t *ppos) | 84 | loff_t *ppos) |
85 | { | 85 | { |
86 | atomic_t *stat = (atomic_t *)table->data; | 86 | atomic_t *stat = (atomic_t *)table->data; |
diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c index 5151f9f6c573..0cf5e8c27a10 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c | |||
@@ -730,12 +730,12 @@ static struct svc_rdma_fastreg_mr *rdma_alloc_frmr(struct svcxprt_rdma *xprt) | |||
730 | goto err; | 730 | goto err; |
731 | 731 | ||
732 | mr = ib_alloc_fast_reg_mr(xprt->sc_pd, RPCSVC_MAXPAGES); | 732 | mr = ib_alloc_fast_reg_mr(xprt->sc_pd, RPCSVC_MAXPAGES); |
733 | if (!mr) | 733 | if (IS_ERR(mr)) |
734 | goto err_free_frmr; | 734 | goto err_free_frmr; |
735 | 735 | ||
736 | pl = ib_alloc_fast_reg_page_list(xprt->sc_cm_id->device, | 736 | pl = ib_alloc_fast_reg_page_list(xprt->sc_cm_id->device, |
737 | RPCSVC_MAXPAGES); | 737 | RPCSVC_MAXPAGES); |
738 | if (!pl) | 738 | if (IS_ERR(pl)) |
739 | goto err_free_mr; | 739 | goto err_free_mr; |
740 | 740 | ||
741 | frmr->mr = mr; | 741 | frmr->mr = mr; |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 62438f3a914d..37c5475ba258 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/tcp.h> | 32 | #include <linux/tcp.h> |
33 | #include <linux/sunrpc/clnt.h> | 33 | #include <linux/sunrpc/clnt.h> |
34 | #include <linux/sunrpc/sched.h> | 34 | #include <linux/sunrpc/sched.h> |
35 | #include <linux/sunrpc/svcsock.h> | ||
35 | #include <linux/sunrpc/xprtsock.h> | 36 | #include <linux/sunrpc/xprtsock.h> |
36 | #include <linux/file.h> | 37 | #include <linux/file.h> |
37 | #ifdef CONFIG_NFS_V4_1 | 38 | #ifdef CONFIG_NFS_V4_1 |
@@ -43,6 +44,7 @@ | |||
43 | #include <net/udp.h> | 44 | #include <net/udp.h> |
44 | #include <net/tcp.h> | 45 | #include <net/tcp.h> |
45 | 46 | ||
47 | #include "sunrpc.h" | ||
46 | /* | 48 | /* |
47 | * xprtsock tunables | 49 | * xprtsock tunables |
48 | */ | 50 | */ |
@@ -771,6 +773,7 @@ static void xs_close(struct rpc_xprt *xprt) | |||
771 | dprintk("RPC: xs_close xprt %p\n", xprt); | 773 | dprintk("RPC: xs_close xprt %p\n", xprt); |
772 | 774 | ||
773 | xs_reset_transport(transport); | 775 | xs_reset_transport(transport); |
776 | xprt->reestablish_timeout = 0; | ||
774 | 777 | ||
775 | smp_mb__before_clear_bit(); | 778 | smp_mb__before_clear_bit(); |
776 | clear_bit(XPRT_CONNECTION_ABORT, &xprt->state); | 779 | clear_bit(XPRT_CONNECTION_ABORT, &xprt->state); |
@@ -1262,6 +1265,12 @@ static void xs_tcp_data_ready(struct sock *sk, int bytes) | |||
1262 | if (xprt->shutdown) | 1265 | if (xprt->shutdown) |
1263 | goto out; | 1266 | goto out; |
1264 | 1267 | ||
1268 | /* Any data means we had a useful conversation, so | ||
1269 | * the we don't need to delay the next reconnect | ||
1270 | */ | ||
1271 | if (xprt->reestablish_timeout) | ||
1272 | xprt->reestablish_timeout = 0; | ||
1273 | |||
1265 | /* We use rd_desc to pass struct xprt to xs_tcp_data_recv */ | 1274 | /* We use rd_desc to pass struct xprt to xs_tcp_data_recv */ |
1266 | rd_desc.arg.data = xprt; | 1275 | rd_desc.arg.data = xprt; |
1267 | do { | 1276 | do { |
@@ -2032,6 +2041,8 @@ static void xs_connect(struct rpc_task *task) | |||
2032 | &transport->connect_worker, | 2041 | &transport->connect_worker, |
2033 | xprt->reestablish_timeout); | 2042 | xprt->reestablish_timeout); |
2034 | xprt->reestablish_timeout <<= 1; | 2043 | xprt->reestablish_timeout <<= 1; |
2044 | if (xprt->reestablish_timeout < XS_TCP_INIT_REEST_TO) | ||
2045 | xprt->reestablish_timeout = XS_TCP_INIT_REEST_TO; | ||
2035 | if (xprt->reestablish_timeout > XS_TCP_MAX_REEST_TO) | 2046 | if (xprt->reestablish_timeout > XS_TCP_MAX_REEST_TO) |
2036 | xprt->reestablish_timeout = XS_TCP_MAX_REEST_TO; | 2047 | xprt->reestablish_timeout = XS_TCP_MAX_REEST_TO; |
2037 | } else { | 2048 | } else { |
@@ -2098,6 +2109,134 @@ static void xs_tcp_print_stats(struct rpc_xprt *xprt, struct seq_file *seq) | |||
2098 | xprt->stat.bklog_u); | 2109 | xprt->stat.bklog_u); |
2099 | } | 2110 | } |
2100 | 2111 | ||
2112 | /* | ||
2113 | * Allocate a bunch of pages for a scratch buffer for the rpc code. The reason | ||
2114 | * we allocate pages instead doing a kmalloc like rpc_malloc is because we want | ||
2115 | * to use the server side send routines. | ||
2116 | */ | ||
2117 | void *bc_malloc(struct rpc_task *task, size_t size) | ||
2118 | { | ||
2119 | struct page *page; | ||
2120 | struct rpc_buffer *buf; | ||
2121 | |||
2122 | BUG_ON(size > PAGE_SIZE - sizeof(struct rpc_buffer)); | ||
2123 | page = alloc_page(GFP_KERNEL); | ||
2124 | |||
2125 | if (!page) | ||
2126 | return NULL; | ||
2127 | |||
2128 | buf = page_address(page); | ||
2129 | buf->len = PAGE_SIZE; | ||
2130 | |||
2131 | return buf->data; | ||
2132 | } | ||
2133 | |||
2134 | /* | ||
2135 | * Free the space allocated in the bc_alloc routine | ||
2136 | */ | ||
2137 | void bc_free(void *buffer) | ||
2138 | { | ||
2139 | struct rpc_buffer *buf; | ||
2140 | |||
2141 | if (!buffer) | ||
2142 | return; | ||
2143 | |||
2144 | buf = container_of(buffer, struct rpc_buffer, data); | ||
2145 | free_page((unsigned long)buf); | ||
2146 | } | ||
2147 | |||
2148 | /* | ||
2149 | * Use the svc_sock to send the callback. Must be called with svsk->sk_mutex | ||
2150 | * held. Borrows heavily from svc_tcp_sendto and xs_tcp_send_request. | ||
2151 | */ | ||
2152 | static int bc_sendto(struct rpc_rqst *req) | ||
2153 | { | ||
2154 | int len; | ||
2155 | struct xdr_buf *xbufp = &req->rq_snd_buf; | ||
2156 | struct rpc_xprt *xprt = req->rq_xprt; | ||
2157 | struct sock_xprt *transport = | ||
2158 | container_of(xprt, struct sock_xprt, xprt); | ||
2159 | struct socket *sock = transport->sock; | ||
2160 | unsigned long headoff; | ||
2161 | unsigned long tailoff; | ||
2162 | |||
2163 | /* | ||
2164 | * Set up the rpc header and record marker stuff | ||
2165 | */ | ||
2166 | xs_encode_tcp_record_marker(xbufp); | ||
2167 | |||
2168 | tailoff = (unsigned long)xbufp->tail[0].iov_base & ~PAGE_MASK; | ||
2169 | headoff = (unsigned long)xbufp->head[0].iov_base & ~PAGE_MASK; | ||
2170 | len = svc_send_common(sock, xbufp, | ||
2171 | virt_to_page(xbufp->head[0].iov_base), headoff, | ||
2172 | xbufp->tail[0].iov_base, tailoff); | ||
2173 | |||
2174 | if (len != xbufp->len) { | ||
2175 | printk(KERN_NOTICE "Error sending entire callback!\n"); | ||
2176 | len = -EAGAIN; | ||
2177 | } | ||
2178 | |||
2179 | return len; | ||
2180 | } | ||
2181 | |||
2182 | /* | ||
2183 | * The send routine. Borrows from svc_send | ||
2184 | */ | ||
2185 | static int bc_send_request(struct rpc_task *task) | ||
2186 | { | ||
2187 | struct rpc_rqst *req = task->tk_rqstp; | ||
2188 | struct svc_xprt *xprt; | ||
2189 | struct svc_sock *svsk; | ||
2190 | u32 len; | ||
2191 | |||
2192 | dprintk("sending request with xid: %08x\n", ntohl(req->rq_xid)); | ||
2193 | /* | ||
2194 | * Get the server socket associated with this callback xprt | ||
2195 | */ | ||
2196 | xprt = req->rq_xprt->bc_xprt; | ||
2197 | svsk = container_of(xprt, struct svc_sock, sk_xprt); | ||
2198 | |||
2199 | /* | ||
2200 | * Grab the mutex to serialize data as the connection is shared | ||
2201 | * with the fore channel | ||
2202 | */ | ||
2203 | if (!mutex_trylock(&xprt->xpt_mutex)) { | ||
2204 | rpc_sleep_on(&xprt->xpt_bc_pending, task, NULL); | ||
2205 | if (!mutex_trylock(&xprt->xpt_mutex)) | ||
2206 | return -EAGAIN; | ||
2207 | rpc_wake_up_queued_task(&xprt->xpt_bc_pending, task); | ||
2208 | } | ||
2209 | if (test_bit(XPT_DEAD, &xprt->xpt_flags)) | ||
2210 | len = -ENOTCONN; | ||
2211 | else | ||
2212 | len = bc_sendto(req); | ||
2213 | mutex_unlock(&xprt->xpt_mutex); | ||
2214 | |||
2215 | if (len > 0) | ||
2216 | len = 0; | ||
2217 | |||
2218 | return len; | ||
2219 | } | ||
2220 | |||
2221 | /* | ||
2222 | * The close routine. Since this is client initiated, we do nothing | ||
2223 | */ | ||
2224 | |||
2225 | static void bc_close(struct rpc_xprt *xprt) | ||
2226 | { | ||
2227 | return; | ||
2228 | } | ||
2229 | |||
2230 | /* | ||
2231 | * The xprt destroy routine. Again, because this connection is client | ||
2232 | * initiated, we do nothing | ||
2233 | */ | ||
2234 | |||
2235 | static void bc_destroy(struct rpc_xprt *xprt) | ||
2236 | { | ||
2237 | return; | ||
2238 | } | ||
2239 | |||
2101 | static struct rpc_xprt_ops xs_udp_ops = { | 2240 | static struct rpc_xprt_ops xs_udp_ops = { |
2102 | .set_buffer_size = xs_udp_set_buffer_size, | 2241 | .set_buffer_size = xs_udp_set_buffer_size, |
2103 | .reserve_xprt = xprt_reserve_xprt_cong, | 2242 | .reserve_xprt = xprt_reserve_xprt_cong, |
@@ -2134,6 +2273,22 @@ static struct rpc_xprt_ops xs_tcp_ops = { | |||
2134 | .print_stats = xs_tcp_print_stats, | 2273 | .print_stats = xs_tcp_print_stats, |
2135 | }; | 2274 | }; |
2136 | 2275 | ||
2276 | /* | ||
2277 | * The rpc_xprt_ops for the server backchannel | ||
2278 | */ | ||
2279 | |||
2280 | static struct rpc_xprt_ops bc_tcp_ops = { | ||
2281 | .reserve_xprt = xprt_reserve_xprt, | ||
2282 | .release_xprt = xprt_release_xprt, | ||
2283 | .buf_alloc = bc_malloc, | ||
2284 | .buf_free = bc_free, | ||
2285 | .send_request = bc_send_request, | ||
2286 | .set_retrans_timeout = xprt_set_retrans_timeout_def, | ||
2287 | .close = bc_close, | ||
2288 | .destroy = bc_destroy, | ||
2289 | .print_stats = xs_tcp_print_stats, | ||
2290 | }; | ||
2291 | |||
2137 | static struct rpc_xprt *xs_setup_xprt(struct xprt_create *args, | 2292 | static struct rpc_xprt *xs_setup_xprt(struct xprt_create *args, |
2138 | unsigned int slot_table_size) | 2293 | unsigned int slot_table_size) |
2139 | { | 2294 | { |
@@ -2322,11 +2477,93 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args) | |||
2322 | return ERR_PTR(-EINVAL); | 2477 | return ERR_PTR(-EINVAL); |
2323 | } | 2478 | } |
2324 | 2479 | ||
2480 | /** | ||
2481 | * xs_setup_bc_tcp - Set up transport to use a TCP backchannel socket | ||
2482 | * @args: rpc transport creation arguments | ||
2483 | * | ||
2484 | */ | ||
2485 | static struct rpc_xprt *xs_setup_bc_tcp(struct xprt_create *args) | ||
2486 | { | ||
2487 | struct sockaddr *addr = args->dstaddr; | ||
2488 | struct rpc_xprt *xprt; | ||
2489 | struct sock_xprt *transport; | ||
2490 | struct svc_sock *bc_sock; | ||
2491 | |||
2492 | if (!args->bc_xprt) | ||
2493 | ERR_PTR(-EINVAL); | ||
2494 | |||
2495 | xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries); | ||
2496 | if (IS_ERR(xprt)) | ||
2497 | return xprt; | ||
2498 | transport = container_of(xprt, struct sock_xprt, xprt); | ||
2499 | |||
2500 | xprt->prot = IPPROTO_TCP; | ||
2501 | xprt->tsh_size = sizeof(rpc_fraghdr) / sizeof(u32); | ||
2502 | xprt->max_payload = RPC_MAX_FRAGMENT_SIZE; | ||
2503 | xprt->timeout = &xs_tcp_default_timeout; | ||
2504 | |||
2505 | /* backchannel */ | ||
2506 | xprt_set_bound(xprt); | ||
2507 | xprt->bind_timeout = 0; | ||
2508 | xprt->connect_timeout = 0; | ||
2509 | xprt->reestablish_timeout = 0; | ||
2510 | xprt->idle_timeout = 0; | ||
2511 | |||
2512 | /* | ||
2513 | * The backchannel uses the same socket connection as the | ||
2514 | * forechannel | ||
2515 | */ | ||
2516 | xprt->bc_xprt = args->bc_xprt; | ||
2517 | bc_sock = container_of(args->bc_xprt, struct svc_sock, sk_xprt); | ||
2518 | bc_sock->sk_bc_xprt = xprt; | ||
2519 | transport->sock = bc_sock->sk_sock; | ||
2520 | transport->inet = bc_sock->sk_sk; | ||
2521 | |||
2522 | xprt->ops = &bc_tcp_ops; | ||
2523 | |||
2524 | switch (addr->sa_family) { | ||
2525 | case AF_INET: | ||
2526 | xs_format_peer_addresses(xprt, "tcp", | ||
2527 | RPCBIND_NETID_TCP); | ||
2528 | break; | ||
2529 | case AF_INET6: | ||
2530 | xs_format_peer_addresses(xprt, "tcp", | ||
2531 | RPCBIND_NETID_TCP6); | ||
2532 | break; | ||
2533 | default: | ||
2534 | kfree(xprt); | ||
2535 | return ERR_PTR(-EAFNOSUPPORT); | ||
2536 | } | ||
2537 | |||
2538 | if (xprt_bound(xprt)) | ||
2539 | dprintk("RPC: set up xprt to %s (port %s) via %s\n", | ||
2540 | xprt->address_strings[RPC_DISPLAY_ADDR], | ||
2541 | xprt->address_strings[RPC_DISPLAY_PORT], | ||
2542 | xprt->address_strings[RPC_DISPLAY_PROTO]); | ||
2543 | else | ||
2544 | dprintk("RPC: set up xprt to %s (autobind) via %s\n", | ||
2545 | xprt->address_strings[RPC_DISPLAY_ADDR], | ||
2546 | xprt->address_strings[RPC_DISPLAY_PROTO]); | ||
2547 | |||
2548 | /* | ||
2549 | * Since we don't want connections for the backchannel, we set | ||
2550 | * the xprt status to connected | ||
2551 | */ | ||
2552 | xprt_set_connected(xprt); | ||
2553 | |||
2554 | |||
2555 | if (try_module_get(THIS_MODULE)) | ||
2556 | return xprt; | ||
2557 | kfree(xprt->slot); | ||
2558 | kfree(xprt); | ||
2559 | return ERR_PTR(-EINVAL); | ||
2560 | } | ||
2561 | |||
2325 | static struct xprt_class xs_udp_transport = { | 2562 | static struct xprt_class xs_udp_transport = { |
2326 | .list = LIST_HEAD_INIT(xs_udp_transport.list), | 2563 | .list = LIST_HEAD_INIT(xs_udp_transport.list), |
2327 | .name = "udp", | 2564 | .name = "udp", |
2328 | .owner = THIS_MODULE, | 2565 | .owner = THIS_MODULE, |
2329 | .ident = IPPROTO_UDP, | 2566 | .ident = XPRT_TRANSPORT_UDP, |
2330 | .setup = xs_setup_udp, | 2567 | .setup = xs_setup_udp, |
2331 | }; | 2568 | }; |
2332 | 2569 | ||
@@ -2334,10 +2571,18 @@ static struct xprt_class xs_tcp_transport = { | |||
2334 | .list = LIST_HEAD_INIT(xs_tcp_transport.list), | 2571 | .list = LIST_HEAD_INIT(xs_tcp_transport.list), |
2335 | .name = "tcp", | 2572 | .name = "tcp", |
2336 | .owner = THIS_MODULE, | 2573 | .owner = THIS_MODULE, |
2337 | .ident = IPPROTO_TCP, | 2574 | .ident = XPRT_TRANSPORT_TCP, |
2338 | .setup = xs_setup_tcp, | 2575 | .setup = xs_setup_tcp, |
2339 | }; | 2576 | }; |
2340 | 2577 | ||
2578 | static struct xprt_class xs_bc_tcp_transport = { | ||
2579 | .list = LIST_HEAD_INIT(xs_bc_tcp_transport.list), | ||
2580 | .name = "tcp NFSv4.1 backchannel", | ||
2581 | .owner = THIS_MODULE, | ||
2582 | .ident = XPRT_TRANSPORT_BC_TCP, | ||
2583 | .setup = xs_setup_bc_tcp, | ||
2584 | }; | ||
2585 | |||
2341 | /** | 2586 | /** |
2342 | * init_socket_xprt - set up xprtsock's sysctls, register with RPC client | 2587 | * init_socket_xprt - set up xprtsock's sysctls, register with RPC client |
2343 | * | 2588 | * |
@@ -2351,6 +2596,7 @@ int init_socket_xprt(void) | |||
2351 | 2596 | ||
2352 | xprt_register_transport(&xs_udp_transport); | 2597 | xprt_register_transport(&xs_udp_transport); |
2353 | xprt_register_transport(&xs_tcp_transport); | 2598 | xprt_register_transport(&xs_tcp_transport); |
2599 | xprt_register_transport(&xs_bc_tcp_transport); | ||
2354 | 2600 | ||
2355 | return 0; | 2601 | return 0; |
2356 | } | 2602 | } |
@@ -2370,6 +2616,7 @@ void cleanup_socket_xprt(void) | |||
2370 | 2616 | ||
2371 | xprt_unregister_transport(&xs_udp_transport); | 2617 | xprt_unregister_transport(&xs_udp_transport); |
2372 | xprt_unregister_transport(&xs_tcp_transport); | 2618 | xprt_unregister_transport(&xs_tcp_transport); |
2619 | xprt_unregister_transport(&xs_bc_tcp_transport); | ||
2373 | } | 2620 | } |
2374 | 2621 | ||
2375 | static int param_set_uint_minmax(const char *val, struct kernel_param *kp, | 2622 | static int param_set_uint_minmax(const char *val, struct kernel_param *kp, |
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index e8254e809b79..e6d9abf7440e 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -1658,7 +1658,7 @@ restart: | |||
1658 | */ | 1658 | */ |
1659 | 1659 | ||
1660 | static int setsockopt(struct socket *sock, | 1660 | static int setsockopt(struct socket *sock, |
1661 | int lvl, int opt, char __user *ov, int ol) | 1661 | int lvl, int opt, char __user *ov, unsigned int ol) |
1662 | { | 1662 | { |
1663 | struct sock *sk = sock->sk; | 1663 | struct sock *sk = sock->sk; |
1664 | struct tipc_port *tport = tipc_sk_port(sk); | 1664 | struct tipc_port *tport = tipc_sk_port(sk); |
diff --git a/net/wireless/sme.c b/net/wireless/sme.c index 7fae7eee65de..93c3ed329204 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c | |||
@@ -762,9 +762,8 @@ int __cfg80211_connect(struct cfg80211_registered_device *rdev, | |||
762 | wdev->conn->params.ssid = wdev->ssid; | 762 | wdev->conn->params.ssid = wdev->ssid; |
763 | wdev->conn->params.ssid_len = connect->ssid_len; | 763 | wdev->conn->params.ssid_len = connect->ssid_len; |
764 | 764 | ||
765 | /* don't care about result -- but fill bssid & channel */ | 765 | /* see if we have the bss already */ |
766 | if (!wdev->conn->params.bssid || !wdev->conn->params.channel) | 766 | bss = cfg80211_get_conn_bss(wdev); |
767 | bss = cfg80211_get_conn_bss(wdev); | ||
768 | 767 | ||
769 | wdev->sme_state = CFG80211_SME_CONNECTING; | 768 | wdev->sme_state = CFG80211_SME_CONNECTING; |
770 | wdev->connect_keys = connkeys; | 769 | wdev->connect_keys = connkeys; |
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c index 429dd06a4ecc..561a45cf2a6a 100644 --- a/net/wireless/wext-compat.c +++ b/net/wireless/wext-compat.c | |||
@@ -834,7 +834,7 @@ int cfg80211_wext_siwtxpower(struct net_device *dev, | |||
834 | return 0; | 834 | return 0; |
835 | } | 835 | } |
836 | 836 | ||
837 | return rdev->ops->set_tx_power(wdev->wiphy, type, dbm);; | 837 | return rdev->ops->set_tx_power(wdev->wiphy, type, dbm); |
838 | } | 838 | } |
839 | EXPORT_SYMBOL_GPL(cfg80211_wext_siwtxpower); | 839 | EXPORT_SYMBOL_GPL(cfg80211_wext_siwtxpower); |
840 | 840 | ||
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c index d16cd9ea4d00..5615a8802536 100644 --- a/net/wireless/wext-sme.c +++ b/net/wireless/wext-sme.c | |||
@@ -26,11 +26,12 @@ int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev, | |||
26 | 26 | ||
27 | wdev->wext.connect.ie = wdev->wext.ie; | 27 | wdev->wext.connect.ie = wdev->wext.ie; |
28 | wdev->wext.connect.ie_len = wdev->wext.ie_len; | 28 | wdev->wext.connect.ie_len = wdev->wext.ie_len; |
29 | wdev->wext.connect.privacy = wdev->wext.default_key != -1; | ||
30 | 29 | ||
31 | if (wdev->wext.keys) { | 30 | if (wdev->wext.keys) { |
32 | wdev->wext.keys->def = wdev->wext.default_key; | 31 | wdev->wext.keys->def = wdev->wext.default_key; |
33 | wdev->wext.keys->defmgmt = wdev->wext.default_mgmt_key; | 32 | wdev->wext.keys->defmgmt = wdev->wext.default_mgmt_key; |
33 | if (wdev->wext.default_key != -1) | ||
34 | wdev->wext.connect.privacy = true; | ||
34 | } | 35 | } |
35 | 36 | ||
36 | if (!wdev->wext.connect.ssid_len) | 37 | if (!wdev->wext.connect.ssid_len) |
@@ -229,8 +230,7 @@ int cfg80211_mgd_wext_giwessid(struct net_device *dev, | |||
229 | data->flags = 1; | 230 | data->flags = 1; |
230 | data->length = wdev->wext.connect.ssid_len; | 231 | data->length = wdev->wext.connect.ssid_len; |
231 | memcpy(ssid, wdev->wext.connect.ssid, data->length); | 232 | memcpy(ssid, wdev->wext.connect.ssid, data->length); |
232 | } else | 233 | } |
233 | data->flags = 0; | ||
234 | wdev_unlock(wdev); | 234 | wdev_unlock(wdev); |
235 | 235 | ||
236 | return 0; | 236 | return 0; |
@@ -306,8 +306,6 @@ int cfg80211_mgd_wext_giwap(struct net_device *dev, | |||
306 | wdev_lock(wdev); | 306 | wdev_lock(wdev); |
307 | if (wdev->current_bss) | 307 | if (wdev->current_bss) |
308 | memcpy(ap_addr->sa_data, wdev->current_bss->pub.bssid, ETH_ALEN); | 308 | memcpy(ap_addr->sa_data, wdev->current_bss->pub.bssid, ETH_ALEN); |
309 | else if (wdev->wext.connect.bssid) | ||
310 | memcpy(ap_addr->sa_data, wdev->wext.connect.bssid, ETH_ALEN); | ||
311 | else | 309 | else |
312 | memset(ap_addr->sa_data, 0, ETH_ALEN); | 310 | memset(ap_addr->sa_data, 0, ETH_ALEN); |
313 | wdev_unlock(wdev); | 311 | wdev_unlock(wdev); |
diff --git a/net/wireless/wext.c b/net/wireless/wext.c index 5b4a0cee4418..60fe57761ca9 100644 --- a/net/wireless/wext.c +++ b/net/wireless/wext.c | |||
@@ -470,7 +470,7 @@ static iw_handler get_handler(struct net_device *dev, unsigned int cmd) | |||
470 | /* | 470 | /* |
471 | * Get statistics out of the driver | 471 | * Get statistics out of the driver |
472 | */ | 472 | */ |
473 | static struct iw_statistics *get_wireless_stats(struct net_device *dev) | 473 | struct iw_statistics *get_wireless_stats(struct net_device *dev) |
474 | { | 474 | { |
475 | /* New location */ | 475 | /* New location */ |
476 | if ((dev->wireless_handlers != NULL) && | 476 | if ((dev->wireless_handlers != NULL) && |
@@ -773,10 +773,13 @@ static int ioctl_standard_iw_point(struct iw_point *iwp, unsigned int cmd, | |||
773 | essid_compat = 1; | 773 | essid_compat = 1; |
774 | else if (IW_IS_SET(cmd) && (iwp->length != 0)) { | 774 | else if (IW_IS_SET(cmd) && (iwp->length != 0)) { |
775 | char essid[IW_ESSID_MAX_SIZE + 1]; | 775 | char essid[IW_ESSID_MAX_SIZE + 1]; |
776 | unsigned int len; | ||
777 | len = iwp->length * descr->token_size; | ||
776 | 778 | ||
777 | err = copy_from_user(essid, iwp->pointer, | 779 | if (len > IW_ESSID_MAX_SIZE) |
778 | iwp->length * | 780 | return -EFAULT; |
779 | descr->token_size); | 781 | |
782 | err = copy_from_user(essid, iwp->pointer, len); | ||
780 | if (err) | 783 | if (err) |
781 | return -EFAULT; | 784 | return -EFAULT; |
782 | 785 | ||
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 5e6c072c64d3..7fa9c7ad3d3b 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c | |||
@@ -409,7 +409,7 @@ static void x25_destroy_socket(struct sock *sk) | |||
409 | */ | 409 | */ |
410 | 410 | ||
411 | static int x25_setsockopt(struct socket *sock, int level, int optname, | 411 | static int x25_setsockopt(struct socket *sock, int level, int optname, |
412 | char __user *optval, int optlen) | 412 | char __user *optval, unsigned int optlen) |
413 | { | 413 | { |
414 | int opt; | 414 | int opt; |
415 | struct sock *sk = sock->sk; | 415 | struct sock *sk = sock->sk; |