diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-03-12 16:08:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-03-12 16:08:09 -0400 |
commit | 609eb39c8d8a8d2930780428f6cbe2f63eb84734 (patch) | |
tree | 0cf74a0e6e64531b31c5a1c9d45fbcb88f5e4d1f /net/sctp/socket.c | |
parent | 123d43acd2e55cd7db792d17c7e906db42cada42 (diff) | |
parent | 22626216c46f2ec86287e75ea86dd9ac3df54265 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (47 commits)
[SCTP]: Fix local_addr deletions during list traversals.
net: fix build with CONFIG_NET=n
[TCP]: Prevent sending past receiver window with TSO (at last skb)
rt2x00: Add new D-Link USB ID
rt2x00: never disable multicast because it disables broadcast too
libertas: fix the 'compare command with itself' properly
drivers/net/Kconfig: fix whitespace for GELIC_WIRELESS entry
[NETFILTER]: nf_queue: don't return error when unregistering a non-existant handler
[NETFILTER]: nfnetlink_queue: fix EPERM when binding/unbinding and instance 0 exists
[NETFILTER]: nfnetlink_log: fix EPERM when binding/unbinding and instance 0 exists
[NETFILTER]: nf_conntrack: replace horrible hack with ksize()
[NETFILTER]: nf_conntrack: add \n to "expectation table full" message
[NETFILTER]: xt_time: fix failure to match on Sundays
[NETFILTER]: nfnetlink_log: fix computation of netlink skb size
[NETFILTER]: nfnetlink_queue: fix computation of allocated size for netlink skb.
[NETFILTER]: nfnetlink: fix ifdef in nfnetlink_compat.h
[NET]: include <linux/types.h> into linux/ethtool.h for __u* typedef
[NET]: Make /proc/net a symlink on /proc/self/net (v3)
RxRPC: fix rxrpc_recvmsg()'s returning of msg_name
net/enc28j60: oops fix
...
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r-- | net/sctp/socket.c | 73 |
1 files changed, 60 insertions, 13 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 939892691a26..d994d822900d 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -2933,17 +2933,39 @@ static int sctp_setsockopt_maxburst(struct sock *sk, | |||
2933 | char __user *optval, | 2933 | char __user *optval, |
2934 | int optlen) | 2934 | int optlen) |
2935 | { | 2935 | { |
2936 | struct sctp_assoc_value params; | ||
2937 | struct sctp_sock *sp; | ||
2938 | struct sctp_association *asoc; | ||
2936 | int val; | 2939 | int val; |
2940 | int assoc_id = 0; | ||
2937 | 2941 | ||
2938 | if (optlen != sizeof(int)) | 2942 | if (optlen < sizeof(int)) |
2939 | return -EINVAL; | 2943 | return -EINVAL; |
2940 | if (get_user(val, (int __user *)optval)) | ||
2941 | return -EFAULT; | ||
2942 | 2944 | ||
2943 | if (val < 0) | 2945 | if (optlen == sizeof(int)) { |
2946 | printk(KERN_WARNING | ||
2947 | "SCTP: Use of int in max_burst socket option deprecated\n"); | ||
2948 | printk(KERN_WARNING | ||
2949 | "SCTP: Use struct sctp_assoc_value instead\n"); | ||
2950 | if (copy_from_user(&val, optval, optlen)) | ||
2951 | return -EFAULT; | ||
2952 | } else if (optlen == sizeof(struct sctp_assoc_value)) { | ||
2953 | if (copy_from_user(¶ms, optval, optlen)) | ||
2954 | return -EFAULT; | ||
2955 | val = params.assoc_value; | ||
2956 | assoc_id = params.assoc_id; | ||
2957 | } else | ||
2944 | return -EINVAL; | 2958 | return -EINVAL; |
2945 | 2959 | ||
2946 | sctp_sk(sk)->max_burst = val; | 2960 | sp = sctp_sk(sk); |
2961 | |||
2962 | if (assoc_id != 0) { | ||
2963 | asoc = sctp_id2assoc(sk, assoc_id); | ||
2964 | if (!asoc) | ||
2965 | return -EINVAL; | ||
2966 | asoc->max_burst = val; | ||
2967 | } else | ||
2968 | sp->max_burst = val; | ||
2947 | 2969 | ||
2948 | return 0; | 2970 | return 0; |
2949 | } | 2971 | } |
@@ -5005,20 +5027,45 @@ static int sctp_getsockopt_maxburst(struct sock *sk, int len, | |||
5005 | char __user *optval, | 5027 | char __user *optval, |
5006 | int __user *optlen) | 5028 | int __user *optlen) |
5007 | { | 5029 | { |
5008 | int val; | 5030 | struct sctp_assoc_value params; |
5031 | struct sctp_sock *sp; | ||
5032 | struct sctp_association *asoc; | ||
5009 | 5033 | ||
5010 | if (len < sizeof(int)) | 5034 | if (len < sizeof(int)) |
5011 | return -EINVAL; | 5035 | return -EINVAL; |
5012 | 5036 | ||
5013 | len = sizeof(int); | 5037 | if (len == sizeof(int)) { |
5038 | printk(KERN_WARNING | ||
5039 | "SCTP: Use of int in max_burst socket option deprecated\n"); | ||
5040 | printk(KERN_WARNING | ||
5041 | "SCTP: Use struct sctp_assoc_value instead\n"); | ||
5042 | params.assoc_id = 0; | ||
5043 | } else if (len == sizeof (struct sctp_assoc_value)) { | ||
5044 | if (copy_from_user(¶ms, optval, len)) | ||
5045 | return -EFAULT; | ||
5046 | } else | ||
5047 | return -EINVAL; | ||
5014 | 5048 | ||
5015 | val = sctp_sk(sk)->max_burst; | 5049 | sp = sctp_sk(sk); |
5016 | if (put_user(len, optlen)) | 5050 | |
5017 | return -EFAULT; | 5051 | if (params.assoc_id != 0) { |
5018 | if (copy_to_user(optval, &val, len)) | 5052 | asoc = sctp_id2assoc(sk, params.assoc_id); |
5019 | return -EFAULT; | 5053 | if (!asoc) |
5054 | return -EINVAL; | ||
5055 | params.assoc_value = asoc->max_burst; | ||
5056 | } else | ||
5057 | params.assoc_value = sp->max_burst; | ||
5058 | |||
5059 | if (len == sizeof(int)) { | ||
5060 | if (copy_to_user(optval, ¶ms.assoc_value, len)) | ||
5061 | return -EFAULT; | ||
5062 | } else { | ||
5063 | if (copy_to_user(optval, ¶ms, len)) | ||
5064 | return -EFAULT; | ||
5065 | } | ||
5066 | |||
5067 | return 0; | ||
5020 | 5068 | ||
5021 | return -ENOTSUPP; | ||
5022 | } | 5069 | } |
5023 | 5070 | ||
5024 | static int sctp_getsockopt_hmac_ident(struct sock *sk, int len, | 5071 | static int sctp_getsockopt_hmac_ident(struct sock *sk, int len, |