diff options
Diffstat (limited to 'net/compat.c')
-rw-r--r-- | net/compat.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/net/compat.c b/net/compat.c index c3a2f868e8af..959d1c51826d 100644 --- a/net/compat.c +++ b/net/compat.c | |||
@@ -358,7 +358,7 @@ static int do_set_sock_timeout(struct socket *sock, int level, | |||
358 | 358 | ||
359 | if (optlen < sizeof(*up)) | 359 | if (optlen < sizeof(*up)) |
360 | return -EINVAL; | 360 | return -EINVAL; |
361 | if (!access_ok(VERIFY_READ, up, sizeof(*up)) || | 361 | if (!access_ok(up, sizeof(*up)) || |
362 | __get_user(ktime.tv_sec, &up->tv_sec) || | 362 | __get_user(ktime.tv_sec, &up->tv_sec) || |
363 | __get_user(ktime.tv_usec, &up->tv_usec)) | 363 | __get_user(ktime.tv_usec, &up->tv_usec)) |
364 | return -EFAULT; | 364 | return -EFAULT; |
@@ -438,7 +438,7 @@ static int do_get_sock_timeout(struct socket *sock, int level, int optname, | |||
438 | 438 | ||
439 | if (!err) { | 439 | if (!err) { |
440 | if (put_user(sizeof(*up), optlen) || | 440 | if (put_user(sizeof(*up), optlen) || |
441 | !access_ok(VERIFY_WRITE, up, sizeof(*up)) || | 441 | !access_ok(up, sizeof(*up)) || |
442 | __put_user(ktime.tv_sec, &up->tv_sec) || | 442 | __put_user(ktime.tv_sec, &up->tv_sec) || |
443 | __put_user(ktime.tv_usec, &up->tv_usec)) | 443 | __put_user(ktime.tv_usec, &up->tv_usec)) |
444 | err = -EFAULT; | 444 | err = -EFAULT; |
@@ -590,8 +590,8 @@ int compat_mc_setsockopt(struct sock *sock, int level, int optname, | |||
590 | compat_alloc_user_space(sizeof(struct group_req)); | 590 | compat_alloc_user_space(sizeof(struct group_req)); |
591 | u32 interface; | 591 | u32 interface; |
592 | 592 | ||
593 | if (!access_ok(VERIFY_READ, gr32, sizeof(*gr32)) || | 593 | if (!access_ok(gr32, sizeof(*gr32)) || |
594 | !access_ok(VERIFY_WRITE, kgr, sizeof(struct group_req)) || | 594 | !access_ok(kgr, sizeof(struct group_req)) || |
595 | __get_user(interface, &gr32->gr_interface) || | 595 | __get_user(interface, &gr32->gr_interface) || |
596 | __put_user(interface, &kgr->gr_interface) || | 596 | __put_user(interface, &kgr->gr_interface) || |
597 | copy_in_user(&kgr->gr_group, &gr32->gr_group, | 597 | copy_in_user(&kgr->gr_group, &gr32->gr_group, |
@@ -611,8 +611,8 @@ int compat_mc_setsockopt(struct sock *sock, int level, int optname, | |||
611 | sizeof(struct group_source_req)); | 611 | sizeof(struct group_source_req)); |
612 | u32 interface; | 612 | u32 interface; |
613 | 613 | ||
614 | if (!access_ok(VERIFY_READ, gsr32, sizeof(*gsr32)) || | 614 | if (!access_ok(gsr32, sizeof(*gsr32)) || |
615 | !access_ok(VERIFY_WRITE, kgsr, | 615 | !access_ok(kgsr, |
616 | sizeof(struct group_source_req)) || | 616 | sizeof(struct group_source_req)) || |
617 | __get_user(interface, &gsr32->gsr_interface) || | 617 | __get_user(interface, &gsr32->gsr_interface) || |
618 | __put_user(interface, &kgsr->gsr_interface) || | 618 | __put_user(interface, &kgsr->gsr_interface) || |
@@ -631,7 +631,7 @@ int compat_mc_setsockopt(struct sock *sock, int level, int optname, | |||
631 | struct group_filter __user *kgf; | 631 | struct group_filter __user *kgf; |
632 | u32 interface, fmode, numsrc; | 632 | u32 interface, fmode, numsrc; |
633 | 633 | ||
634 | if (!access_ok(VERIFY_READ, gf32, __COMPAT_GF0_SIZE) || | 634 | if (!access_ok(gf32, __COMPAT_GF0_SIZE) || |
635 | __get_user(interface, &gf32->gf_interface) || | 635 | __get_user(interface, &gf32->gf_interface) || |
636 | __get_user(fmode, &gf32->gf_fmode) || | 636 | __get_user(fmode, &gf32->gf_fmode) || |
637 | __get_user(numsrc, &gf32->gf_numsrc)) | 637 | __get_user(numsrc, &gf32->gf_numsrc)) |
@@ -641,7 +641,7 @@ int compat_mc_setsockopt(struct sock *sock, int level, int optname, | |||
641 | if (koptlen < GROUP_FILTER_SIZE(numsrc)) | 641 | if (koptlen < GROUP_FILTER_SIZE(numsrc)) |
642 | return -EINVAL; | 642 | return -EINVAL; |
643 | kgf = compat_alloc_user_space(koptlen); | 643 | kgf = compat_alloc_user_space(koptlen); |
644 | if (!access_ok(VERIFY_WRITE, kgf, koptlen) || | 644 | if (!access_ok(kgf, koptlen) || |
645 | __put_user(interface, &kgf->gf_interface) || | 645 | __put_user(interface, &kgf->gf_interface) || |
646 | __put_user(fmode, &kgf->gf_fmode) || | 646 | __put_user(fmode, &kgf->gf_fmode) || |
647 | __put_user(numsrc, &kgf->gf_numsrc) || | 647 | __put_user(numsrc, &kgf->gf_numsrc) || |
@@ -675,7 +675,7 @@ int compat_mc_getsockopt(struct sock *sock, int level, int optname, | |||
675 | return getsockopt(sock, level, optname, optval, optlen); | 675 | return getsockopt(sock, level, optname, optval, optlen); |
676 | 676 | ||
677 | koptlen = compat_alloc_user_space(sizeof(*koptlen)); | 677 | koptlen = compat_alloc_user_space(sizeof(*koptlen)); |
678 | if (!access_ok(VERIFY_READ, optlen, sizeof(*optlen)) || | 678 | if (!access_ok(optlen, sizeof(*optlen)) || |
679 | __get_user(ulen, optlen)) | 679 | __get_user(ulen, optlen)) |
680 | return -EFAULT; | 680 | return -EFAULT; |
681 | 681 | ||
@@ -685,14 +685,14 @@ int compat_mc_getsockopt(struct sock *sock, int level, int optname, | |||
685 | if (klen < GROUP_FILTER_SIZE(0)) | 685 | if (klen < GROUP_FILTER_SIZE(0)) |
686 | return -EINVAL; | 686 | return -EINVAL; |
687 | 687 | ||
688 | if (!access_ok(VERIFY_WRITE, koptlen, sizeof(*koptlen)) || | 688 | if (!access_ok(koptlen, sizeof(*koptlen)) || |
689 | __put_user(klen, koptlen)) | 689 | __put_user(klen, koptlen)) |
690 | return -EFAULT; | 690 | return -EFAULT; |
691 | 691 | ||
692 | /* have to allow space for previous compat_alloc_user_space, too */ | 692 | /* have to allow space for previous compat_alloc_user_space, too */ |
693 | kgf = compat_alloc_user_space(klen+sizeof(*optlen)); | 693 | kgf = compat_alloc_user_space(klen+sizeof(*optlen)); |
694 | 694 | ||
695 | if (!access_ok(VERIFY_READ, gf32, __COMPAT_GF0_SIZE) || | 695 | if (!access_ok(gf32, __COMPAT_GF0_SIZE) || |
696 | __get_user(interface, &gf32->gf_interface) || | 696 | __get_user(interface, &gf32->gf_interface) || |
697 | __get_user(fmode, &gf32->gf_fmode) || | 697 | __get_user(fmode, &gf32->gf_fmode) || |
698 | __get_user(numsrc, &gf32->gf_numsrc) || | 698 | __get_user(numsrc, &gf32->gf_numsrc) || |
@@ -706,18 +706,18 @@ int compat_mc_getsockopt(struct sock *sock, int level, int optname, | |||
706 | if (err) | 706 | if (err) |
707 | return err; | 707 | return err; |
708 | 708 | ||
709 | if (!access_ok(VERIFY_READ, koptlen, sizeof(*koptlen)) || | 709 | if (!access_ok(koptlen, sizeof(*koptlen)) || |
710 | __get_user(klen, koptlen)) | 710 | __get_user(klen, koptlen)) |
711 | return -EFAULT; | 711 | return -EFAULT; |
712 | 712 | ||
713 | ulen = klen - (sizeof(*kgf)-sizeof(*gf32)); | 713 | ulen = klen - (sizeof(*kgf)-sizeof(*gf32)); |
714 | 714 | ||
715 | if (!access_ok(VERIFY_WRITE, optlen, sizeof(*optlen)) || | 715 | if (!access_ok(optlen, sizeof(*optlen)) || |
716 | __put_user(ulen, optlen)) | 716 | __put_user(ulen, optlen)) |
717 | return -EFAULT; | 717 | return -EFAULT; |
718 | 718 | ||
719 | if (!access_ok(VERIFY_READ, kgf, klen) || | 719 | if (!access_ok(kgf, klen) || |
720 | !access_ok(VERIFY_WRITE, gf32, ulen) || | 720 | !access_ok(gf32, ulen) || |
721 | __get_user(interface, &kgf->gf_interface) || | 721 | __get_user(interface, &kgf->gf_interface) || |
722 | __get_user(fmode, &kgf->gf_fmode) || | 722 | __get_user(fmode, &kgf->gf_fmode) || |
723 | __get_user(numsrc, &kgf->gf_numsrc) || | 723 | __get_user(numsrc, &kgf->gf_numsrc) || |