diff options
| author | Ingo Molnar <mingo@elte.hu> | 2009-10-01 05:20:33 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2009-10-01 05:20:48 -0400 |
| commit | 0aa73ba1c4e1ad1d51a29e0df95ccd9f746918b6 (patch) | |
| tree | f0714ddcd02812b4fbe3b5405df9e4068f5587e2 /net/socket.c | |
| parent | 925936ebf35a95c290e010b784c962164e6728f3 (diff) | |
| parent | 33974093c024f08caadd2fc71a83bd811ed1831d (diff) | |
Merge branch 'tracing/urgent' into tracing/core
Merge reason: Pick up latest fixes and update to latest upstream.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'net/socket.c')
| -rw-r--r-- | net/socket.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/net/socket.c b/net/socket.c index 6d4716559047..41e8847508aa 100644 --- a/net/socket.c +++ b/net/socket.c | |||
| @@ -86,6 +86,7 @@ | |||
| 86 | #include <linux/audit.h> | 86 | #include <linux/audit.h> |
| 87 | #include <linux/wireless.h> | 87 | #include <linux/wireless.h> |
| 88 | #include <linux/nsproxy.h> | 88 | #include <linux/nsproxy.h> |
| 89 | #include <linux/magic.h> | ||
| 89 | 90 | ||
| 90 | #include <asm/uaccess.h> | 91 | #include <asm/uaccess.h> |
| 91 | #include <asm/unistd.h> | 92 | #include <asm/unistd.h> |
| @@ -235,8 +236,6 @@ int move_addr_to_user(struct sockaddr *kaddr, int klen, void __user *uaddr, | |||
| 235 | return __put_user(klen, ulen); | 236 | return __put_user(klen, ulen); |
| 236 | } | 237 | } |
| 237 | 238 | ||
| 238 | #define SOCKFS_MAGIC 0x534F434B | ||
| 239 | |||
| 240 | static struct kmem_cache *sock_inode_cachep __read_mostly; | 239 | static struct kmem_cache *sock_inode_cachep __read_mostly; |
| 241 | 240 | ||
| 242 | static struct inode *sock_alloc_inode(struct super_block *sb) | 241 | static struct inode *sock_alloc_inode(struct super_block *sb) |
| @@ -285,7 +284,7 @@ static int init_inodecache(void) | |||
| 285 | return 0; | 284 | return 0; |
| 286 | } | 285 | } |
| 287 | 286 | ||
| 288 | static struct super_operations sockfs_ops = { | 287 | static const struct super_operations sockfs_ops = { |
| 289 | .alloc_inode = sock_alloc_inode, | 288 | .alloc_inode = sock_alloc_inode, |
| 290 | .destroy_inode =sock_destroy_inode, | 289 | .destroy_inode =sock_destroy_inode, |
| 291 | .statfs = simple_statfs, | 290 | .statfs = simple_statfs, |
| @@ -489,6 +488,7 @@ static struct socket *sock_alloc(void) | |||
| 489 | 488 | ||
| 490 | sock = SOCKET_I(inode); | 489 | sock = SOCKET_I(inode); |
| 491 | 490 | ||
| 491 | kmemcheck_annotate_bitfield(sock, type); | ||
| 492 | inode->i_mode = S_IFSOCK | S_IRWXUGO; | 492 | inode->i_mode = S_IFSOCK | S_IRWXUGO; |
| 493 | inode->i_uid = current_fsuid(); | 493 | inode->i_uid = current_fsuid(); |
| 494 | inode->i_gid = current_fsgid(); | 494 | inode->i_gid = current_fsgid(); |
| @@ -2098,12 +2098,17 @@ SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args) | |||
| 2098 | unsigned long a[6]; | 2098 | unsigned long a[6]; |
| 2099 | unsigned long a0, a1; | 2099 | unsigned long a0, a1; |
| 2100 | int err; | 2100 | int err; |
| 2101 | unsigned int len; | ||
| 2101 | 2102 | ||
| 2102 | if (call < 1 || call > SYS_ACCEPT4) | 2103 | if (call < 1 || call > SYS_ACCEPT4) |
| 2103 | return -EINVAL; | 2104 | return -EINVAL; |
| 2104 | 2105 | ||
| 2106 | len = nargs[call]; | ||
| 2107 | if (len > sizeof(a)) | ||
| 2108 | return -EINVAL; | ||
| 2109 | |||
| 2105 | /* copy_from_user should be SMP safe. */ | 2110 | /* copy_from_user should be SMP safe. */ |
| 2106 | if (copy_from_user(a, args, nargs[call])) | 2111 | if (copy_from_user(a, args, len)) |
| 2107 | return -EFAULT; | 2112 | return -EFAULT; |
| 2108 | 2113 | ||
| 2109 | audit_socketcall(nargs[call] / sizeof(unsigned long), a); | 2114 | audit_socketcall(nargs[call] / sizeof(unsigned long), a); |
