diff options
author | Jiri Kosina <jkosina@suse.cz> | 2010-12-10 09:19:18 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2010-12-10 09:19:18 -0500 |
commit | 2ade0c1d9d93b7642212657ef76f4a1e30233711 (patch) | |
tree | 63bc720c0ffe5f4760cac4ed617b9870b050175e /net/socket.c | |
parent | 504499f22c08a03e2e19dc88d31aa0ecd2ac815e (diff) | |
parent | 6313e3c21743cc88bb5bd8aa72948ee1e83937b6 (diff) |
Merge branch 'master' into upstream
Diffstat (limited to 'net/socket.c')
-rw-r--r-- | net/socket.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/net/socket.c b/net/socket.c index abf3e2561521..3ca2fd9e3720 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -305,19 +305,17 @@ static const struct super_operations sockfs_ops = { | |||
305 | .statfs = simple_statfs, | 305 | .statfs = simple_statfs, |
306 | }; | 306 | }; |
307 | 307 | ||
308 | static int sockfs_get_sb(struct file_system_type *fs_type, | 308 | static struct dentry *sockfs_mount(struct file_system_type *fs_type, |
309 | int flags, const char *dev_name, void *data, | 309 | int flags, const char *dev_name, void *data) |
310 | struct vfsmount *mnt) | ||
311 | { | 310 | { |
312 | return get_sb_pseudo(fs_type, "socket:", &sockfs_ops, SOCKFS_MAGIC, | 311 | return mount_pseudo(fs_type, "socket:", &sockfs_ops, SOCKFS_MAGIC); |
313 | mnt); | ||
314 | } | 312 | } |
315 | 313 | ||
316 | static struct vfsmount *sock_mnt __read_mostly; | 314 | static struct vfsmount *sock_mnt __read_mostly; |
317 | 315 | ||
318 | static struct file_system_type sock_fs_type = { | 316 | static struct file_system_type sock_fs_type = { |
319 | .name = "sockfs", | 317 | .name = "sockfs", |
320 | .get_sb = sockfs_get_sb, | 318 | .mount = sockfs_mount, |
321 | .kill_sb = kill_anon_super, | 319 | .kill_sb = kill_anon_super, |
322 | }; | 320 | }; |
323 | 321 | ||
@@ -377,7 +375,7 @@ static int sock_alloc_file(struct socket *sock, struct file **f, int flags) | |||
377 | &socket_file_ops); | 375 | &socket_file_ops); |
378 | if (unlikely(!file)) { | 376 | if (unlikely(!file)) { |
379 | /* drop dentry, keep inode */ | 377 | /* drop dentry, keep inode */ |
380 | atomic_inc(&path.dentry->d_inode->i_count); | 378 | ihold(path.dentry->d_inode); |
381 | path_put(&path); | 379 | path_put(&path); |
382 | put_unused_fd(fd); | 380 | put_unused_fd(fd); |
383 | return -ENFILE; | 381 | return -ENFILE; |
@@ -480,6 +478,7 @@ static struct socket *sock_alloc(void) | |||
480 | sock = SOCKET_I(inode); | 478 | sock = SOCKET_I(inode); |
481 | 479 | ||
482 | kmemcheck_annotate_bitfield(sock, type); | 480 | kmemcheck_annotate_bitfield(sock, type); |
481 | inode->i_ino = get_next_ino(); | ||
483 | inode->i_mode = S_IFSOCK | S_IRWXUGO; | 482 | inode->i_mode = S_IFSOCK | S_IRWXUGO; |
484 | inode->i_uid = current_fsuid(); | 483 | inode->i_uid = current_fsuid(); |
485 | inode->i_gid = current_fsgid(); | 484 | inode->i_gid = current_fsgid(); |
@@ -1145,7 +1144,7 @@ call_kill: | |||
1145 | } | 1144 | } |
1146 | EXPORT_SYMBOL(sock_wake_async); | 1145 | EXPORT_SYMBOL(sock_wake_async); |
1147 | 1146 | ||
1148 | static int __sock_create(struct net *net, int family, int type, int protocol, | 1147 | int __sock_create(struct net *net, int family, int type, int protocol, |
1149 | struct socket **res, int kern) | 1148 | struct socket **res, int kern) |
1150 | { | 1149 | { |
1151 | int err; | 1150 | int err; |
@@ -1257,6 +1256,7 @@ out_release: | |||
1257 | rcu_read_unlock(); | 1256 | rcu_read_unlock(); |
1258 | goto out_sock_release; | 1257 | goto out_sock_release; |
1259 | } | 1258 | } |
1259 | EXPORT_SYMBOL(__sock_create); | ||
1260 | 1260 | ||
1261 | int sock_create(int family, int type, int protocol, struct socket **res) | 1261 | int sock_create(int family, int type, int protocol, struct socket **res) |
1262 | { | 1262 | { |
@@ -1652,6 +1652,8 @@ SYSCALL_DEFINE6(sendto, int, fd, void __user *, buff, size_t, len, | |||
1652 | struct iovec iov; | 1652 | struct iovec iov; |
1653 | int fput_needed; | 1653 | int fput_needed; |
1654 | 1654 | ||
1655 | if (len > INT_MAX) | ||
1656 | len = INT_MAX; | ||
1655 | sock = sockfd_lookup_light(fd, &err, &fput_needed); | 1657 | sock = sockfd_lookup_light(fd, &err, &fput_needed); |
1656 | if (!sock) | 1658 | if (!sock) |
1657 | goto out; | 1659 | goto out; |
@@ -1709,6 +1711,8 @@ SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size, | |||
1709 | int err, err2; | 1711 | int err, err2; |
1710 | int fput_needed; | 1712 | int fput_needed; |
1711 | 1713 | ||
1714 | if (size > INT_MAX) | ||
1715 | size = INT_MAX; | ||
1712 | sock = sockfd_lookup_light(fd, &err, &fput_needed); | 1716 | sock = sockfd_lookup_light(fd, &err, &fput_needed); |
1713 | if (!sock) | 1717 | if (!sock) |
1714 | goto out; | 1718 | goto out; |