aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-30 20:36:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-30 20:36:45 -0400
commit817b33d38f81c8736d39283c35c886ae4668f1af (patch)
tree64f60a88baf8b48c350d680f8b69fa6c759c3a82
parent84d88d5d4efc37dfb8a93a4a58d8a227ee86ffa4 (diff)
parent8c185ab6185bf5e67766edb000ce428269364c86 (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: ax25: Fix possible oops in ax25_make_new net: restore tx timestamping for accelerated vlans Phonet: fix mutex imbalance sit: fix off-by-one in ipip6_tunnel_get_prl net: Fix sock_wfree() race net: Make setsockopt() optlen be unsigned.
-rw-r--r--drivers/atm/ambassador.c8
-rw-r--r--drivers/atm/eni.c2
-rw-r--r--drivers/atm/firestream.c2
-rw-r--r--drivers/atm/fore200e.c2
-rw-r--r--drivers/atm/horizon.c2
-rw-r--r--drivers/atm/iphase.c2
-rw-r--r--drivers/atm/zatm.c2
-rw-r--r--drivers/isdn/mISDN/socket.c2
-rw-r--r--drivers/net/pppol2tp.c2
-rw-r--r--include/linux/atmdev.h2
-rw-r--r--include/linux/mroute.h4
-rw-r--r--include/linux/mroute6.h4
-rw-r--r--include/linux/net.h8
-rw-r--r--include/linux/netfilter.h4
-rw-r--r--include/net/compat.h4
-rw-r--r--include/net/inet_connection_sock.h6
-rw-r--r--include/net/ip.h4
-rw-r--r--include/net/ipv6.h4
-rw-r--r--include/net/sctp/structs.h4
-rw-r--r--include/net/sock.h12
-rw-r--r--include/net/tcp.h4
-rw-r--r--include/net/udp.h2
-rw-r--r--net/atm/common.c2
-rw-r--r--net/atm/common.h2
-rw-r--r--net/atm/pvc.c2
-rw-r--r--net/atm/svc.c2
-rw-r--r--net/ax25/af_ax25.c4
-rw-r--r--net/bluetooth/hci_sock.c2
-rw-r--r--net/bluetooth/l2cap.c4
-rw-r--r--net/bluetooth/rfcomm/sock.c4
-rw-r--r--net/bluetooth/sco.c2
-rw-r--r--net/can/raw.c2
-rw-r--r--net/compat.c12
-rw-r--r--net/core/dev.c6
-rw-r--r--net/core/sock.c27
-rw-r--r--net/dccp/dccp.h4
-rw-r--r--net/dccp/proto.c10
-rw-r--r--net/decnet/af_decnet.c6
-rw-r--r--net/ieee802154/dgram.c2
-rw-r--r--net/ieee802154/raw.c2
-rw-r--r--net/ipv4/inet_connection_sock.c2
-rw-r--r--net/ipv4/ip_sockglue.c6
-rw-r--r--net/ipv4/ipmr.c2
-rw-r--r--net/ipv4/raw.c6
-rw-r--r--net/ipv4/tcp.c6
-rw-r--r--net/ipv4/udp.c6
-rw-r--r--net/ipv4/udp_impl.h4
-rw-r--r--net/ipv6/ip6mr.c2
-rw-r--r--net/ipv6/ipv6_sockglue.c6
-rw-r--r--net/ipv6/raw.c6
-rw-r--r--net/ipv6/sit.c2
-rw-r--r--net/ipv6/udp.c4
-rw-r--r--net/ipv6/udp_impl.h4
-rw-r--r--net/ipx/af_ipx.c2
-rw-r--r--net/irda/af_irda.c2
-rw-r--r--net/iucv/af_iucv.c2
-rw-r--r--net/llc/af_llc.c2
-rw-r--r--net/netfilter/nf_sockopt.c4
-rw-r--r--net/netlink/af_netlink.c2
-rw-r--r--net/netrom/af_netrom.c2
-rw-r--r--net/packet/af_packet.c2
-rw-r--r--net/phonet/pep.c2
-rw-r--r--net/phonet/socket.c1
-rw-r--r--net/rds/af_rds.c2
-rw-r--r--net/rose/af_rose.c2
-rw-r--r--net/rxrpc/af_rxrpc.c2
-rw-r--r--net/sctp/socket.c62
-rw-r--r--net/socket.c2
-rw-r--r--net/tipc/socket.c2
-rw-r--r--net/x25/af_x25.c2
70 files changed, 166 insertions, 166 deletions
diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c
index 703364b52170..66e181345b3a 100644
--- a/drivers/atm/ambassador.c
+++ b/drivers/atm/ambassador.c
@@ -1306,14 +1306,6 @@ static void amb_close (struct atm_vcc * atm_vcc) {
1306 return; 1306 return;
1307} 1307}
1308 1308
1309/********** Set socket options for a VC **********/
1310
1311// int amb_getsockopt (struct atm_vcc * atm_vcc, int level, int optname, void * optval, int optlen);
1312
1313/********** Set socket options for a VC **********/
1314
1315// int amb_setsockopt (struct atm_vcc * atm_vcc, int level, int optname, void * optval, int optlen);
1316
1317/********** Send **********/ 1309/********** Send **********/
1318 1310
1319static int amb_send (struct atm_vcc * atm_vcc, struct sk_buff * skb) { 1311static int amb_send (struct atm_vcc * atm_vcc, struct sk_buff * skb) {
diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c
index 5503bfc8e132..0c3026145443 100644
--- a/drivers/atm/eni.c
+++ b/drivers/atm/eni.c
@@ -2031,7 +2031,7 @@ static int eni_getsockopt(struct atm_vcc *vcc,int level,int optname,
2031 2031
2032 2032
2033static int eni_setsockopt(struct atm_vcc *vcc,int level,int optname, 2033static int eni_setsockopt(struct atm_vcc *vcc,int level,int optname,
2034 void __user *optval,int optlen) 2034 void __user *optval,unsigned int optlen)
2035{ 2035{
2036 return -EINVAL; 2036 return -EINVAL;
2037} 2037}
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index b119640e1ee9..cd5049af47a9 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -1244,7 +1244,7 @@ static int fs_getsockopt(struct atm_vcc *vcc,int level,int optname,
1244 1244
1245 1245
1246static int fs_setsockopt(struct atm_vcc *vcc,int level,int optname, 1246static int fs_setsockopt(struct atm_vcc *vcc,int level,int optname,
1247 void __user *optval,int optlen) 1247 void __user *optval,unsigned int optlen)
1248{ 1248{
1249 func_enter (); 1249 func_enter ();
1250 func_exit (); 1250 func_exit ();
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
index 10f000dbe448..f766cc46b4c4 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -1795,7 +1795,7 @@ fore200e_getsockopt(struct atm_vcc* vcc, int level, int optname, void __user *op
1795 1795
1796 1796
1797static int 1797static int
1798fore200e_setsockopt(struct atm_vcc* vcc, int level, int optname, void __user *optval, int optlen) 1798fore200e_setsockopt(struct atm_vcc* vcc, int level, int optname, void __user *optval, unsigned int optlen)
1799{ 1799{
1800 /* struct fore200e* fore200e = FORE200E_DEV(vcc->dev); */ 1800 /* struct fore200e* fore200e = FORE200E_DEV(vcc->dev); */
1801 1801
diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c
index 01ce241dbeae..4e49021e67ee 100644
--- a/drivers/atm/horizon.c
+++ b/drivers/atm/horizon.c
@@ -2590,7 +2590,7 @@ static int hrz_getsockopt (struct atm_vcc * atm_vcc, int level, int optname,
2590} 2590}
2591 2591
2592static int hrz_setsockopt (struct atm_vcc * atm_vcc, int level, int optname, 2592static int hrz_setsockopt (struct atm_vcc * atm_vcc, int level, int optname,
2593 void *optval, int optlen) { 2593 void *optval, unsigned int optlen) {
2594 hrz_dev * dev = HRZ_DEV(atm_vcc->dev); 2594 hrz_dev * dev = HRZ_DEV(atm_vcc->dev);
2595 PRINTD (DBG_FLOW|DBG_VCC, "hrz_setsockopt"); 2595 PRINTD (DBG_FLOW|DBG_VCC, "hrz_setsockopt");
2596 switch (level) { 2596 switch (level) {
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index 78c9736c3579..b2c1b37ab2e4 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -2862,7 +2862,7 @@ static int ia_getsockopt(struct atm_vcc *vcc, int level, int optname,
2862} 2862}
2863 2863
2864static int ia_setsockopt(struct atm_vcc *vcc, int level, int optname, 2864static int ia_setsockopt(struct atm_vcc *vcc, int level, int optname,
2865 void __user *optval, int optlen) 2865 void __user *optval, unsigned int optlen)
2866{ 2866{
2867 IF_EVENT(printk(">ia_setsockopt\n");) 2867 IF_EVENT(printk(">ia_setsockopt\n");)
2868 return -EINVAL; 2868 return -EINVAL;
diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c
index 752b1ba81f7e..2e9635be048c 100644
--- a/drivers/atm/zatm.c
+++ b/drivers/atm/zatm.c
@@ -1517,7 +1517,7 @@ static int zatm_getsockopt(struct atm_vcc *vcc,int level,int optname,
1517 1517
1518 1518
1519static int zatm_setsockopt(struct atm_vcc *vcc,int level,int optname, 1519static int zatm_setsockopt(struct atm_vcc *vcc,int level,int optname,
1520 void __user *optval,int optlen) 1520 void __user *optval,unsigned int optlen)
1521{ 1521{
1522 return -EINVAL; 1522 return -EINVAL;
1523} 1523}
diff --git a/drivers/isdn/mISDN/socket.c b/drivers/isdn/mISDN/socket.c
index c36f52137456..feb0fa45b664 100644
--- a/drivers/isdn/mISDN/socket.c
+++ b/drivers/isdn/mISDN/socket.c
@@ -415,7 +415,7 @@ data_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
415} 415}
416 416
417static int data_sock_setsockopt(struct socket *sock, int level, int optname, 417static int data_sock_setsockopt(struct socket *sock, int level, int optname,
418 char __user *optval, int len) 418 char __user *optval, unsigned int len)
419{ 419{
420 struct sock *sk = sock->sk; 420 struct sock *sk = sock->sk;
421 int err = 0, opt = 0; 421 int err = 0, opt = 0;
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c
index cc394d073755..5910df60c93e 100644
--- a/drivers/net/pppol2tp.c
+++ b/drivers/net/pppol2tp.c
@@ -2179,7 +2179,7 @@ static int pppol2tp_session_setsockopt(struct sock *sk,
2179 * session or the special tunnel type. 2179 * session or the special tunnel type.
2180 */ 2180 */
2181static int pppol2tp_setsockopt(struct socket *sock, int level, int optname, 2181static int pppol2tp_setsockopt(struct socket *sock, int level, int optname,
2182 char __user *optval, int optlen) 2182 char __user *optval, unsigned int optlen)
2183{ 2183{
2184 struct sock *sk = sock->sk; 2184 struct sock *sk = sock->sk;
2185 struct pppol2tp_session *session = sk->sk_user_data; 2185 struct pppol2tp_session *session = sk->sk_user_data;
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 086e5c362d3a..817b23705c91 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -397,7 +397,7 @@ struct atmdev_ops { /* only send is required */
397 int (*getsockopt)(struct atm_vcc *vcc,int level,int optname, 397 int (*getsockopt)(struct atm_vcc *vcc,int level,int optname,
398 void __user *optval,int optlen); 398 void __user *optval,int optlen);
399 int (*setsockopt)(struct atm_vcc *vcc,int level,int optname, 399 int (*setsockopt)(struct atm_vcc *vcc,int level,int optname,
400 void __user *optval,int optlen); 400 void __user *optval,unsigned int optlen);
401 int (*send)(struct atm_vcc *vcc,struct sk_buff *skb); 401 int (*send)(struct atm_vcc *vcc,struct sk_buff *skb);
402 int (*send_oam)(struct atm_vcc *vcc,void *cell,int flags); 402 int (*send_oam)(struct atm_vcc *vcc,void *cell,int flags);
403 void (*phy_put)(struct atm_dev *dev,unsigned char value, 403 void (*phy_put)(struct atm_dev *dev,unsigned char value,
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index 0d45b4e8d367..08bc776d05e2 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -145,14 +145,14 @@ static inline int ip_mroute_opt(int opt)
145#endif 145#endif
146 146
147#ifdef CONFIG_IP_MROUTE 147#ifdef CONFIG_IP_MROUTE
148extern int ip_mroute_setsockopt(struct sock *, int, char __user *, int); 148extern int ip_mroute_setsockopt(struct sock *, int, char __user *, unsigned int);
149extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *); 149extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
150extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg); 150extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
151extern int ip_mr_init(void); 151extern int ip_mr_init(void);
152#else 152#else
153static inline 153static inline
154int ip_mroute_setsockopt(struct sock *sock, 154int ip_mroute_setsockopt(struct sock *sock,
155 int optname, char __user *optval, int optlen) 155 int optname, char __user *optval, unsigned int optlen)
156{ 156{
157 return -ENOPROTOOPT; 157 return -ENOPROTOOPT;
158} 158}
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index 43dc97e32183..b191865a6ca3 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -134,7 +134,7 @@ static inline int ip6_mroute_opt(int opt)
134struct sock; 134struct sock;
135 135
136#ifdef CONFIG_IPV6_MROUTE 136#ifdef CONFIG_IPV6_MROUTE
137extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, int); 137extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, unsigned int);
138extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *); 138extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
139extern int ip6_mr_input(struct sk_buff *skb); 139extern int ip6_mr_input(struct sk_buff *skb);
140extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg); 140extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg);
@@ -143,7 +143,7 @@ extern void ip6_mr_cleanup(void);
143#else 143#else
144static inline 144static inline
145int ip6_mroute_setsockopt(struct sock *sock, 145int ip6_mroute_setsockopt(struct sock *sock,
146 int optname, char __user *optval, int optlen) 146 int optname, char __user *optval, unsigned int optlen)
147{ 147{
148 return -ENOPROTOOPT; 148 return -ENOPROTOOPT;
149} 149}
diff --git a/include/linux/net.h b/include/linux/net.h
index 9040a10584f7..529a0931711d 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -178,11 +178,11 @@ struct proto_ops {
178 int (*listen) (struct socket *sock, int len); 178 int (*listen) (struct socket *sock, int len);
179 int (*shutdown) (struct socket *sock, int flags); 179 int (*shutdown) (struct socket *sock, int flags);
180 int (*setsockopt)(struct socket *sock, int level, 180 int (*setsockopt)(struct socket *sock, int level,
181 int optname, char __user *optval, int optlen); 181 int optname, char __user *optval, unsigned int optlen);
182 int (*getsockopt)(struct socket *sock, int level, 182 int (*getsockopt)(struct socket *sock, int level,
183 int optname, char __user *optval, int __user *optlen); 183 int optname, char __user *optval, int __user *optlen);
184 int (*compat_setsockopt)(struct socket *sock, int level, 184 int (*compat_setsockopt)(struct socket *sock, int level,
185 int optname, char __user *optval, int optlen); 185 int optname, char __user *optval, unsigned int optlen);
186 int (*compat_getsockopt)(struct socket *sock, int level, 186 int (*compat_getsockopt)(struct socket *sock, int level,
187 int optname, char __user *optval, int __user *optlen); 187 int optname, char __user *optval, int __user *optlen);
188 int (*sendmsg) (struct kiocb *iocb, struct socket *sock, 188 int (*sendmsg) (struct kiocb *iocb, struct socket *sock,
@@ -256,7 +256,7 @@ extern int kernel_getpeername(struct socket *sock, struct sockaddr *addr,
256extern int kernel_getsockopt(struct socket *sock, int level, int optname, 256extern int kernel_getsockopt(struct socket *sock, int level, int optname,
257 char *optval, int *optlen); 257 char *optval, int *optlen);
258extern int kernel_setsockopt(struct socket *sock, int level, int optname, 258extern int kernel_setsockopt(struct socket *sock, int level, int optname,
259 char *optval, int optlen); 259 char *optval, unsigned int optlen);
260extern int kernel_sendpage(struct socket *sock, struct page *page, int offset, 260extern int kernel_sendpage(struct socket *sock, struct page *page, int offset,
261 size_t size, int flags); 261 size_t size, int flags);
262extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg); 262extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg);
@@ -313,7 +313,7 @@ SOCKCALL_WRAP(name, compat_ioctl, (struct socket *sock, unsigned int cmd, \
313SOCKCALL_WRAP(name, listen, (struct socket *sock, int len), (sock, len)) \ 313SOCKCALL_WRAP(name, listen, (struct socket *sock, int len), (sock, len)) \
314SOCKCALL_WRAP(name, shutdown, (struct socket *sock, int flags), (sock, flags)) \ 314SOCKCALL_WRAP(name, shutdown, (struct socket *sock, int flags), (sock, flags)) \
315SOCKCALL_WRAP(name, setsockopt, (struct socket *sock, int level, int optname, \ 315SOCKCALL_WRAP(name, setsockopt, (struct socket *sock, int level, int optname, \
316 char __user *optval, int optlen), (sock, level, optname, optval, optlen)) \ 316 char __user *optval, unsigned int optlen), (sock, level, optname, optval, optlen)) \
317SOCKCALL_WRAP(name, getsockopt, (struct socket *sock, int level, int optname, \ 317SOCKCALL_WRAP(name, getsockopt, (struct socket *sock, int level, int optname, \
318 char __user *optval, int __user *optlen), (sock, level, optname, optval, optlen)) \ 318 char __user *optval, int __user *optlen), (sock, level, optname, optval, optlen)) \
319SOCKCALL_WRAP(name, sendmsg, (struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t len), \ 319SOCKCALL_WRAP(name, sendmsg, (struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t len), \
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 48cfe51bfddc..6132b5e6d9d3 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -221,12 +221,12 @@ __ret;})
221 221
222/* Call setsockopt() */ 222/* Call setsockopt() */
223int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, 223int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt,
224 int len); 224 unsigned int len);
225int nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, 225int nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt,
226 int *len); 226 int *len);
227 227
228int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, 228int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, int optval,
229 char __user *opt, int len); 229 char __user *opt, unsigned int len);
230int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, 230int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval,
231 char __user *opt, int *len); 231 char __user *opt, int *len);
232 232
diff --git a/include/net/compat.h b/include/net/compat.h
index 5bbf8bf9efea..7c3002832d05 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -40,8 +40,8 @@ extern int put_cmsg_compat(struct msghdr*, int, int, int, void *);
40 40
41extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *, int); 41extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *, int);
42 42
43extern int compat_mc_setsockopt(struct sock *, int, int, char __user *, int, 43extern int compat_mc_setsockopt(struct sock *, int, int, char __user *, unsigned int,
44 int (*)(struct sock *, int, int, char __user *, int)); 44 int (*)(struct sock *, int, int, char __user *, unsigned int));
45extern int compat_mc_getsockopt(struct sock *, int, int, char __user *, 45extern int compat_mc_getsockopt(struct sock *, int, int, char __user *,
46 int __user *, int (*)(struct sock *, int, int, char __user *, 46 int __user *, int (*)(struct sock *, int, int, char __user *,
47 int __user *)); 47 int __user *));
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 03cffd9f64e3..696d6e4ce68a 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -48,13 +48,13 @@ struct inet_connection_sock_af_ops {
48 u16 net_header_len; 48 u16 net_header_len;
49 u16 sockaddr_len; 49 u16 sockaddr_len;
50 int (*setsockopt)(struct sock *sk, int level, int optname, 50 int (*setsockopt)(struct sock *sk, int level, int optname,
51 char __user *optval, int optlen); 51 char __user *optval, unsigned int optlen);
52 int (*getsockopt)(struct sock *sk, int level, int optname, 52 int (*getsockopt)(struct sock *sk, int level, int optname,
53 char __user *optval, int __user *optlen); 53 char __user *optval, int __user *optlen);
54#ifdef CONFIG_COMPAT 54#ifdef CONFIG_COMPAT
55 int (*compat_setsockopt)(struct sock *sk, 55 int (*compat_setsockopt)(struct sock *sk,
56 int level, int optname, 56 int level, int optname,
57 char __user *optval, int optlen); 57 char __user *optval, unsigned int optlen);
58 int (*compat_getsockopt)(struct sock *sk, 58 int (*compat_getsockopt)(struct sock *sk,
59 int level, int optname, 59 int level, int optname,
60 char __user *optval, int __user *optlen); 60 char __user *optval, int __user *optlen);
@@ -332,5 +332,5 @@ extern void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
332extern int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname, 332extern int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname,
333 char __user *optval, int __user *optlen); 333 char __user *optval, int __user *optlen);
334extern int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname, 334extern int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname,
335 char __user *optval, int optlen); 335 char __user *optval, unsigned int optlen);
336#endif /* _INET_CONNECTION_SOCK_H */ 336#endif /* _INET_CONNECTION_SOCK_H */
diff --git a/include/net/ip.h b/include/net/ip.h
index 5b26a0bd178e..2f47e5482b55 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -381,10 +381,10 @@ extern int ip_options_rcv_srr(struct sk_buff *skb);
381extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb); 381extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb);
382extern int ip_cmsg_send(struct net *net, 382extern int ip_cmsg_send(struct net *net,
383 struct msghdr *msg, struct ipcm_cookie *ipc); 383 struct msghdr *msg, struct ipcm_cookie *ipc);
384extern int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, int optlen); 384extern int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, unsigned int optlen);
385extern int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen); 385extern int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen);
386extern int compat_ip_setsockopt(struct sock *sk, int level, 386extern int compat_ip_setsockopt(struct sock *sk, int level,
387 int optname, char __user *optval, int optlen); 387 int optname, char __user *optval, unsigned int optlen);
388extern int compat_ip_getsockopt(struct sock *sk, int level, 388extern int compat_ip_getsockopt(struct sock *sk, int level,
389 int optname, char __user *optval, int __user *optlen); 389 int optname, char __user *optval, int __user *optlen);
390extern int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct sock *)); 390extern int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct sock *));
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index ad9a51130254..8c31d8a0c1fe 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -550,7 +550,7 @@ extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type);
550extern int ipv6_setsockopt(struct sock *sk, int level, 550extern int ipv6_setsockopt(struct sock *sk, int level,
551 int optname, 551 int optname,
552 char __user *optval, 552 char __user *optval,
553 int optlen); 553 unsigned int optlen);
554extern int ipv6_getsockopt(struct sock *sk, int level, 554extern int ipv6_getsockopt(struct sock *sk, int level,
555 int optname, 555 int optname,
556 char __user *optval, 556 char __user *optval,
@@ -559,7 +559,7 @@ extern int compat_ipv6_setsockopt(struct sock *sk,
559 int level, 559 int level,
560 int optname, 560 int optname,
561 char __user *optval, 561 char __user *optval,
562 int optlen); 562 unsigned int optlen);
563extern int compat_ipv6_getsockopt(struct sock *sk, 563extern int compat_ipv6_getsockopt(struct sock *sk,
564 int level, 564 int level,
565 int optname, 565 int optname,
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 42d00ced5eb8..6e5f0e0c7967 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -544,7 +544,7 @@ struct sctp_af {
544 int level, 544 int level,
545 int optname, 545 int optname,
546 char __user *optval, 546 char __user *optval,
547 int optlen); 547 unsigned int optlen);
548 int (*getsockopt) (struct sock *sk, 548 int (*getsockopt) (struct sock *sk,
549 int level, 549 int level,
550 int optname, 550 int optname,
@@ -554,7 +554,7 @@ struct sctp_af {
554 int level, 554 int level,
555 int optname, 555 int optname,
556 char __user *optval, 556 char __user *optval,
557 int optlen); 557 unsigned int optlen);
558 int (*compat_getsockopt) (struct sock *sk, 558 int (*compat_getsockopt) (struct sock *sk,
559 int level, 559 int level,
560 int optname, 560 int optname,
diff --git a/include/net/sock.h b/include/net/sock.h
index 950409dcec3d..1621935aad5b 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -624,7 +624,7 @@ struct proto {
624 void (*shutdown)(struct sock *sk, int how); 624 void (*shutdown)(struct sock *sk, int how);
625 int (*setsockopt)(struct sock *sk, int level, 625 int (*setsockopt)(struct sock *sk, int level,
626 int optname, char __user *optval, 626 int optname, char __user *optval,
627 int optlen); 627 unsigned int optlen);
628 int (*getsockopt)(struct sock *sk, int level, 628 int (*getsockopt)(struct sock *sk, int level,
629 int optname, char __user *optval, 629 int optname, char __user *optval,
630 int __user *option); 630 int __user *option);
@@ -632,7 +632,7 @@ struct proto {
632 int (*compat_setsockopt)(struct sock *sk, 632 int (*compat_setsockopt)(struct sock *sk,
633 int level, 633 int level,
634 int optname, char __user *optval, 634 int optname, char __user *optval,
635 int optlen); 635 unsigned int optlen);
636 int (*compat_getsockopt)(struct sock *sk, 636 int (*compat_getsockopt)(struct sock *sk,
637 int level, 637 int level,
638 int optname, char __user *optval, 638 int optname, char __user *optval,
@@ -951,7 +951,7 @@ extern void sock_rfree(struct sk_buff *skb);
951 951
952extern int sock_setsockopt(struct socket *sock, int level, 952extern int sock_setsockopt(struct socket *sock, int level,
953 int op, char __user *optval, 953 int op, char __user *optval,
954 int optlen); 954 unsigned int optlen);
955 955
956extern int sock_getsockopt(struct socket *sock, int level, 956extern int sock_getsockopt(struct socket *sock, int level,
957 int op, char __user *optval, 957 int op, char __user *optval,
@@ -993,7 +993,7 @@ extern int sock_no_shutdown(struct socket *, int);
993extern int sock_no_getsockopt(struct socket *, int , int, 993extern int sock_no_getsockopt(struct socket *, int , int,
994 char __user *, int __user *); 994 char __user *, int __user *);
995extern int sock_no_setsockopt(struct socket *, int, int, 995extern int sock_no_setsockopt(struct socket *, int, int,
996 char __user *, int); 996 char __user *, unsigned int);
997extern int sock_no_sendmsg(struct kiocb *, struct socket *, 997extern int sock_no_sendmsg(struct kiocb *, struct socket *,
998 struct msghdr *, size_t); 998 struct msghdr *, size_t);
999extern int sock_no_recvmsg(struct kiocb *, struct socket *, 999extern int sock_no_recvmsg(struct kiocb *, struct socket *,
@@ -1015,11 +1015,11 @@ extern int sock_common_getsockopt(struct socket *sock, int level, int optname,
1015extern int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock, 1015extern int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock,
1016 struct msghdr *msg, size_t size, int flags); 1016 struct msghdr *msg, size_t size, int flags);
1017extern int sock_common_setsockopt(struct socket *sock, int level, int optname, 1017extern int sock_common_setsockopt(struct socket *sock, int level, int optname,
1018 char __user *optval, int optlen); 1018 char __user *optval, unsigned int optlen);
1019extern int compat_sock_common_getsockopt(struct socket *sock, int level, 1019extern int compat_sock_common_getsockopt(struct socket *sock, int level,
1020 int optname, char __user *optval, int __user *optlen); 1020 int optname, char __user *optval, int __user *optlen);
1021extern int compat_sock_common_setsockopt(struct socket *sock, int level, 1021extern int compat_sock_common_setsockopt(struct socket *sock, int level,
1022 int optname, char __user *optval, int optlen); 1022 int optname, char __user *optval, unsigned int optlen);
1023 1023
1024extern void sk_common_release(struct sock *sk); 1024extern void sk_common_release(struct sock *sk);
1025 1025
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 56b76027b85e..03a49c703377 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -394,13 +394,13 @@ extern int tcp_getsockopt(struct sock *sk, int level,
394 int __user *optlen); 394 int __user *optlen);
395extern int tcp_setsockopt(struct sock *sk, int level, 395extern int tcp_setsockopt(struct sock *sk, int level,
396 int optname, char __user *optval, 396 int optname, char __user *optval,
397 int optlen); 397 unsigned int optlen);
398extern int compat_tcp_getsockopt(struct sock *sk, 398extern int compat_tcp_getsockopt(struct sock *sk,
399 int level, int optname, 399 int level, int optname,
400 char __user *optval, int __user *optlen); 400 char __user *optval, int __user *optlen);
401extern int compat_tcp_setsockopt(struct sock *sk, 401extern int compat_tcp_setsockopt(struct sock *sk,
402 int level, int optname, 402 int level, int optname,
403 char __user *optval, int optlen); 403 char __user *optval, unsigned int optlen);
404extern void tcp_set_keepalive(struct sock *sk, int val); 404extern void tcp_set_keepalive(struct sock *sk, int val);
405extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, 405extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk,
406 struct msghdr *msg, 406 struct msghdr *msg,
diff --git a/include/net/udp.h b/include/net/udp.h
index 5fb029f817a3..f98abd2ce709 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -144,7 +144,7 @@ extern unsigned int udp_poll(struct file *file, struct socket *sock,
144extern int udp_lib_getsockopt(struct sock *sk, int level, int optname, 144extern int udp_lib_getsockopt(struct sock *sk, int level, int optname,
145 char __user *optval, int __user *optlen); 145 char __user *optval, int __user *optlen);
146extern int udp_lib_setsockopt(struct sock *sk, int level, int optname, 146extern int udp_lib_setsockopt(struct sock *sk, int level, int optname,
147 char __user *optval, int optlen, 147 char __user *optval, unsigned int optlen,
148 int (*push_pending_frames)(struct sock *)); 148 int (*push_pending_frames)(struct sock *));
149 149
150extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, 150extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
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
681int vcc_setsockopt(struct socket *sock, int level, int optname, 681int 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);
21int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); 21int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
22int vcc_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); 22int vcc_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
23int vcc_setsockopt(struct socket *sock, int level, int optname, 23int vcc_setsockopt(struct socket *sock, int level, int optname,
24 char __user *optval, int optlen); 24 char __user *optval, unsigned int optlen);
25int vcc_getsockopt(struct socket *sock, int level, int optname, 25int 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
61static int pvc_setsockopt(struct socket *sock, int level, int optname, 61static 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
448static int svc_setsockopt(struct socket *sock, int level, int optname, 448static 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 4102de1022ee..f45460730371 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -534,7 +534,7 @@ ax25_cb *ax25_create_cb(void)
534 */ 534 */
535 535
536static int ax25_setsockopt(struct socket *sock, int level, int optname, 536static int ax25_setsockopt(struct socket *sock, int level, int optname,
537 char __user *optval, int optlen) 537 char __user *optval, unsigned int optlen)
538{ 538{
539 struct sock *sk = sock->sk; 539 struct sock *sk = sock->sk;
540 ax25_cb *ax25; 540 ax25_cb *ax25;
@@ -901,7 +901,6 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev)
901 901
902 sock_init_data(NULL, sk); 902 sock_init_data(NULL, sk);
903 903
904 sk->sk_destruct = ax25_free_sock;
905 sk->sk_type = osk->sk_type; 904 sk->sk_type = osk->sk_type;
906 sk->sk_priority = osk->sk_priority; 905 sk->sk_priority = osk->sk_priority;
907 sk->sk_protocol = osk->sk_protocol; 906 sk->sk_protocol = osk->sk_protocol;
@@ -939,6 +938,7 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev)
939 } 938 }
940 939
941 sk->sk_protinfo = ax25; 940 sk->sk_protinfo = ax25;
941 sk->sk_destruct = ax25_free_sock;
942 ax25->sk = sk; 942 ax25->sk = sk;
943 943
944 return sk; 944 return sk;
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
469static int hci_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int len) 469static 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/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
1701static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __user *optval, int optlen) 1701static 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
1758static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen) 1758static 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
733static int rfcomm_sock_setsockopt_old(struct socket *sock, int optname, char __user *optval, int optlen) 733static 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
769static int rfcomm_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen) 769static 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
647static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen) 647static 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/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
413static int raw_setsockopt(struct socket *sock, int level, int optname, 413static 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
333static int do_set_attach_filter(struct socket *sock, int level, int optname, 333static 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
353static int do_set_sock_timeout(struct socket *sock, int level, 353static 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
375static int compat_sock_setsockopt(struct socket *sock, int level, int optname, 375static 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
387asmlinkage long compat_sys_setsockopt(int fd, int level, int optname, 387asmlinkage 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
560int compat_mc_setsockopt(struct sock *sock, int level, int optname, 560int 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/sock.c b/net/core/sock.c
index 524712a7b154..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
448int sock_setsockopt(struct socket *sock, int level, int optname, 448int 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;
@@ -1228,17 +1228,22 @@ void __init sk_init(void)
1228void sock_wfree(struct sk_buff *skb) 1228void 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}
1244EXPORT_SYMBOL(sock_wfree); 1249EXPORT_SYMBOL(sock_wfree);
@@ -1697,7 +1702,7 @@ int sock_no_shutdown(struct socket *sock, int how)
1697EXPORT_SYMBOL(sock_no_shutdown); 1702EXPORT_SYMBOL(sock_no_shutdown);
1698 1703
1699int sock_no_setsockopt(struct socket *sock, int level, int optname, 1704int 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 */
2020int sock_common_setsockopt(struct socket *sock, int level, int optname, 2025int 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
2030int compat_sock_common_setsockopt(struct socket *sock, int level, int optname, 2035int 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/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);
290extern int dccp_getsockopt(struct sock *sk, int level, int optname, 290extern int dccp_getsockopt(struct sock *sk, int level, int optname,
291 char __user *optval, int __user *optlen); 291 char __user *optval, int __user *optlen);
292extern int dccp_setsockopt(struct sock *sk, int level, int optname, 292extern 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
295extern int compat_dccp_getsockopt(struct sock *sk, 295extern 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);
298extern int compat_dccp_setsockopt(struct sock *sk, 298extern 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
302extern int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg); 302extern int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg);
303extern int dccp_sendmsg(struct kiocb *iocb, struct sock *sk, 303extern int dccp_sendmsg(struct kiocb *iocb, struct sock *sk,
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index bc4467082a00..a156319fd0ac 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -393,7 +393,7 @@ out:
393EXPORT_SYMBOL_GPL(dccp_ioctl); 393EXPORT_SYMBOL_GPL(dccp_ioctl);
394 394
395static int dccp_setsockopt_service(struct sock *sk, const __be32 service, 395static 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
466static int dccp_setsockopt_ccid(struct sock *sk, int type, 466static 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
496static int do_dccp_setsockopt(struct sock *sk, int level, int optname, 496static 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
548int dccp_setsockopt(struct sock *sk, int level, int optname, 548int 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
561int compat_dccp_setsockopt(struct sock *sk, int level, int optname, 561int 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,
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];
157static struct hlist_head dn_wild_sk; 157static struct hlist_head dn_wild_sk;
158static atomic_t decnet_memory_allocated; 158static atomic_t decnet_memory_allocated;
159 159
160static int __dn_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen, int flags); 160static int __dn_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen, int flags);
161static int __dn_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen, int flags); 161static int __dn_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen, int flags);
162 162
163static struct hlist_head *dn_find_list(struct sock *sk) 163static struct hlist_head *dn_find_list(struct sock *sk)
@@ -1325,7 +1325,7 @@ out:
1325 return err; 1325 return err;
1326} 1326}
1327 1327
1328static int dn_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen) 1328static 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
1340static int __dn_setsockopt(struct socket *sock, int level,int optname, char __user *optval, int optlen, int flags) 1340static 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/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
416static int dgram_setsockopt(struct sock *sk, int level, int optname, 416static 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
246static int raw_setsockopt(struct sock *sk, int level, int optname, 246static 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/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,
714EXPORT_SYMBOL_GPL(inet_csk_compat_getsockopt); 714EXPORT_SYMBOL_GPL(inet_csk_compat_getsockopt);
715 715
716int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname, 716int 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_sockglue.c b/net/ipv4/ip_sockglue.c
index 5a0693576e82..0c0b6e363a20 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -440,7 +440,7 @@ out:
440 */ 440 */
441 441
442static int do_ip_setsockopt(struct sock *sk, int level, 442static 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;
@@ -950,7 +950,7 @@ e_inval:
950} 950}
951 951
952int ip_setsockopt(struct sock *sk, int level, 952int ip_setsockopt(struct sock *sk, int level,
953 int optname, char __user *optval, int optlen) 953 int optname, char __user *optval, unsigned int optlen)
954{ 954{
955 int err; 955 int err;
956 956
@@ -975,7 +975,7 @@ EXPORT_SYMBOL(ip_setsockopt);
975 975
976#ifdef CONFIG_COMPAT 976#ifdef CONFIG_COMPAT
977int compat_ip_setsockopt(struct sock *sk, int level, int optname, 977int compat_ip_setsockopt(struct sock *sk, int level, int optname,
978 char __user *optval, int optlen) 978 char __user *optval, unsigned int optlen)
979{ 979{
980 int err; 980 int err;
981 981
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
934int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, int optlen) 934int 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
743static int do_raw_setsockopt(struct sock *sk, int level, int optname, 743static 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
755static int raw_setsockopt(struct sock *sk, int level, int optname, 755static 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
764static int compat_raw_setsockopt(struct sock *sk, int level, int optname, 764static 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/tcp.c b/net/ipv4/tcp.c
index 21387ebabf00..5a15e7629d8e 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -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 */
2034static int do_tcp_setsockopt(struct sock *sk, int level, 2034static 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);
@@ -2220,7 +2220,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
2220} 2220}
2221 2221
2222int tcp_setsockopt(struct sock *sk, int level, int optname, char __user *optval, 2222int 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
2234int compat_tcp_setsockopt(struct sock *sk, int level, int optname, 2234int 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,
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index ebaaa7f973d7..3326aff65906 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1359,7 +1359,7 @@ void udp_destroy_sock(struct sock *sk)
1359 * Socket option code for UDP 1359 * Socket option code for UDP
1360 */ 1360 */
1361int udp_lib_setsockopt(struct sock *sk, int level, int optname, 1361int udp_lib_setsockopt(struct sock *sk, int level, int optname,
1362 char __user *optval, int optlen, 1362 char __user *optval, unsigned int optlen,
1363 int (*push_pending_frames)(struct sock *)) 1363 int (*push_pending_frames)(struct sock *))
1364{ 1364{
1365 struct udp_sock *up = udp_sk(sk); 1365 struct udp_sock *up = udp_sk(sk);
@@ -1441,7 +1441,7 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
1441EXPORT_SYMBOL(udp_lib_setsockopt); 1441EXPORT_SYMBOL(udp_lib_setsockopt);
1442 1442
1443int udp_setsockopt(struct sock *sk, int level, int optname, 1443int udp_setsockopt(struct sock *sk, int level, int optname,
1444 char __user *optval, int optlen) 1444 char __user *optval, unsigned int optlen)
1445{ 1445{
1446 if (level == SOL_UDP || level == SOL_UDPLITE) 1446 if (level == SOL_UDP || level == SOL_UDPLITE)
1447 return udp_lib_setsockopt(sk, level, optname, optval, optlen, 1447 return udp_lib_setsockopt(sk, level, optname, optval, optlen,
@@ -1451,7 +1451,7 @@ int udp_setsockopt(struct sock *sk, int level, int optname,
1451 1451
1452#ifdef CONFIG_COMPAT 1452#ifdef CONFIG_COMPAT
1453int compat_udp_setsockopt(struct sock *sk, int level, int optname, 1453int compat_udp_setsockopt(struct sock *sk, int level, int optname,
1454 char __user *optval, int optlen) 1454 char __user *optval, unsigned int optlen)
1455{ 1455{
1456 if (level == SOL_UDP || level == SOL_UDPLITE) 1456 if (level == SOL_UDP || level == SOL_UDPLITE)
1457 return udp_lib_setsockopt(sk, level, optname, optval, optlen, 1457 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 *);
11extern int udp_v4_get_port(struct sock *sk, unsigned short snum); 11extern int udp_v4_get_port(struct sock *sk, unsigned short snum);
12 12
13extern int udp_setsockopt(struct sock *sk, int level, int optname, 13extern int udp_setsockopt(struct sock *sk, int level, int optname,
14 char __user *optval, int optlen); 14 char __user *optval, unsigned int optlen);
15extern int udp_getsockopt(struct sock *sk, int level, int optname, 15extern 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
19extern int compat_udp_setsockopt(struct sock *sk, int level, int optname, 19extern int compat_udp_setsockopt(struct sock *sk, int level, int optname,
20 char __user *optval, int optlen); 20 char __user *optval, unsigned int optlen);
21extern int compat_udp_getsockopt(struct sock *sk, int level, int optname, 21extern 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/ip6mr.c b/net/ipv6/ip6mr.c
index 090675e269ee..716153941fc4 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -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
1284int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, int optlen) 1284int 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
125static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, 125static 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
775int ipv6_setsockopt(struct sock *sk, int level, int optname, 775int 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
803int compat_ipv6_setsockopt(struct sock *sk, int level, int optname, 803int 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/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
959static int do_rawv6_setsockopt(struct sock *sk, int level, int optname, 959static 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
1002static int rawv6_setsockopt(struct sock *sk, int level, int optname, 1002static 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
1026static int compat_rawv6_setsockopt(struct sock *sk, int level, int optname, 1026static 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/sit.c b/net/ipv6/sit.c
index d65e0c496cc0..dbd19a78ca73 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -274,7 +274,7 @@ static int ipip6_tunnel_get_prl(struct ip_tunnel *t,
274 274
275 c = 0; 275 c = 0;
276 for (prl = t->prl; prl; prl = prl->next) { 276 for (prl = t->prl; prl; prl = prl->next) {
277 if (c > cmax) 277 if (c >= cmax)
278 break; 278 break;
279 if (kprl.addr != htonl(INADDR_ANY) && prl->addr != kprl.addr) 279 if (kprl.addr != htonl(INADDR_ANY) && prl->addr != kprl.addr)
280 continue; 280 continue;
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 */
1046int udpv6_setsockopt(struct sock *sk, int level, int optname, 1046int 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
1056int compat_udpv6_setsockopt(struct sock *sk, int level, int optname, 1056int 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);
16extern int udpv6_getsockopt(struct sock *sk, int level, int optname, 16extern int udpv6_getsockopt(struct sock *sk, int level, int optname,
17 char __user *optval, int __user *optlen); 17 char __user *optval, int __user *optlen);
18extern int udpv6_setsockopt(struct sock *sk, int level, int optname, 18extern 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
21extern int compat_udpv6_setsockopt(struct sock *sk, int level, int optname, 21extern int compat_udpv6_setsockopt(struct sock *sk, int level, int optname,
22 char __user *optval, int optlen); 22 char __user *optval, unsigned int optlen);
23extern int compat_udpv6_getsockopt(struct sock *sk, int level, int optname, 23extern 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
1294static int ipx_setsockopt(struct socket *sock, int level, int optname, 1294static 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 */
1828static int irda_setsockopt(struct socket *sock, int level, int optname, 1828static 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/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 */
1389static int iucv_sock_setsockopt(struct socket *sock, int level, int optname, 1389static 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 */
975static int llc_ui_setsockopt(struct socket *sock, int level, int optname, 975static 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/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
115int nf_setsockopt(struct sock *sk, u_int8_t pf, int val, char __user *opt, 115int 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
156int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, 156int 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/netlink/af_netlink.c b/net/netlink/af_netlink.c
index dd85320907cb..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
1152static int netlink_setsockopt(struct socket *sock, int level, int optname, 1152static 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);
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
303static int nr_setsockopt(struct socket *sock, int level, int optname, 303static 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 103d5611b818..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
1703static int 1703static int
1704packet_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen) 1704packet_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);
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
744static int pep_setsockopt(struct sock *sk, int level, int optname, 744static 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 07aa9f08d5fb..aa5b5a972bff 100644
--- a/net/phonet/socket.c
+++ b/net/phonet/socket.c
@@ -407,7 +407,6 @@ int pn_sock_get_port(struct sock *sk, unsigned short sport)
407 return -EADDRINUSE; 407 return -EADDRINUSE;
408 408
409found: 409found:
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/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
250static int rds_setsockopt(struct socket *sock, int level, int optname, 250static 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/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
372static int rose_setsockopt(struct socket *sock, int level, int optname, 372static 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 */
509static int rxrpc_setsockopt(struct socket *sock, int level, int optname, 509static 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/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 */
2029static int sctp_setsockopt_disable_fragments(struct sock *sk, 2029static 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
2045static int sctp_setsockopt_events(struct sock *sk, char __user *optval, 2046static 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 */
2066static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval, 2067static 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
2320static int sctp_setsockopt_peer_addr_params(struct sock *sk, 2321static 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
2432static int sctp_setsockopt_delayed_ack(struct sock *sk, 2434static 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 */
2549static int sctp_setsockopt_initmsg(struct sock *sk, char __user *optval, int optlen) 2551static 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 */
2585static int sctp_setsockopt_default_send_param(struct sock *sk, 2587static 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 */
2624static int sctp_setsockopt_primary_addr(struct sock *sk, char __user *optval, 2627static 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 */
2653static int sctp_setsockopt_nodelay(struct sock *sk, char __user *optval, 2656static 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 */
2679static int sctp_setsockopt_rtoinfo(struct sock *sk, char __user *optval, int optlen) { 2682static 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 */
2731static int sctp_setsockopt_associnfo(struct sock *sk, char __user *optval, int optlen) 2735static 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 */
2803static int sctp_setsockopt_mappedv4(struct sock *sk, char __user *optval, int optlen) 2807static 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 */
2847static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, int optlen) 2851static 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 */
2901static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optval, 2905static 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
2952static int sctp_setsockopt_adaptation_layer(struct sock *sk, char __user *optval, 2956static 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 */
2981static int sctp_setsockopt_context(struct sock *sk, char __user *optval, 2985static 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 */
3031static int sctp_setsockopt_fragment_interleave(struct sock *sk, 3035static 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 */
3064static int sctp_setsockopt_partial_delivery_point(struct sock *sk, 3068static 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 */
3097static int sctp_setsockopt_maxburst(struct sock *sk, 3101static 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 */
3142static int sctp_setsockopt_auth_chunk(struct sock *sk, 3146static 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 */
3174static int sctp_setsockopt_hmac_ident(struct sock *sk, 3178static 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 */
3216static int sctp_setsockopt_auth_key(struct sock *sk, 3220static 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 */
3262static int sctp_setsockopt_active_key(struct sock *sk, 3266static 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 */
3290static int sctp_setsockopt_del_key(struct sock *sk, 3294static 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 */
3334SCTP_STATIC int sctp_setsockopt(struct sock *sk, int level, int optname, 3338SCTP_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 41e8847508aa..75655365b5fd 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2391,7 +2391,7 @@ int kernel_getsockopt(struct socket *sock, int level, int optname,
2391} 2391}
2392 2392
2393int kernel_setsockopt(struct socket *sock, int level, int optname, 2393int kernel_setsockopt(struct socket *sock, int level, int optname,
2394 char *optval, int optlen) 2394 char *optval, unsigned int optlen)
2395{ 2395{
2396 mm_segment_t oldfs = get_fs(); 2396 mm_segment_t oldfs = get_fs();
2397 int err; 2397 int err;
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
1660static int setsockopt(struct socket *sock, 1660static 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/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
411static int x25_setsockopt(struct socket *sock, int level, int optname, 411static 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;