diff options
Diffstat (limited to 'net/socket.c')
-rw-r--r-- | net/socket.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/net/socket.c b/net/socket.c index c1663c0ff3d3..ccc576a6a508 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -262,6 +262,7 @@ static struct inode *sock_alloc_inode(struct super_block *sb) | |||
262 | } | 262 | } |
263 | 263 | ||
264 | 264 | ||
265 | |||
265 | static void wq_free_rcu(struct rcu_head *head) | 266 | static void wq_free_rcu(struct rcu_head *head) |
266 | { | 267 | { |
267 | struct socket_wq *wq = container_of(head, struct socket_wq, rcu); | 268 | struct socket_wq *wq = container_of(head, struct socket_wq, rcu); |
@@ -360,14 +361,14 @@ static int sock_alloc_file(struct socket *sock, struct file **f, int flags) | |||
360 | if (unlikely(fd < 0)) | 361 | if (unlikely(fd < 0)) |
361 | return fd; | 362 | return fd; |
362 | 363 | ||
363 | path.dentry = d_alloc(sock_mnt->mnt_sb->s_root, &name); | 364 | path.dentry = d_alloc_pseudo(sock_mnt->mnt_sb, &name); |
364 | if (unlikely(!path.dentry)) { | 365 | if (unlikely(!path.dentry)) { |
365 | put_unused_fd(fd); | 366 | put_unused_fd(fd); |
366 | return -ENOMEM; | 367 | return -ENOMEM; |
367 | } | 368 | } |
368 | path.mnt = mntget(sock_mnt); | 369 | path.mnt = mntget(sock_mnt); |
369 | 370 | ||
370 | path.dentry->d_op = &sockfs_dentry_operations; | 371 | d_set_d_op(path.dentry, &sockfs_dentry_operations); |
371 | d_instantiate(path.dentry, SOCK_INODE(sock)); | 372 | d_instantiate(path.dentry, SOCK_INODE(sock)); |
372 | SOCK_INODE(sock)->i_fop = &socket_file_ops; | 373 | SOCK_INODE(sock)->i_fop = &socket_file_ops; |
373 | 374 | ||
@@ -2390,6 +2391,8 @@ EXPORT_SYMBOL(sock_unregister); | |||
2390 | 2391 | ||
2391 | static int __init sock_init(void) | 2392 | static int __init sock_init(void) |
2392 | { | 2393 | { |
2394 | int err; | ||
2395 | |||
2393 | /* | 2396 | /* |
2394 | * Initialize sock SLAB cache. | 2397 | * Initialize sock SLAB cache. |
2395 | */ | 2398 | */ |
@@ -2406,8 +2409,15 @@ static int __init sock_init(void) | |||
2406 | */ | 2409 | */ |
2407 | 2410 | ||
2408 | init_inodecache(); | 2411 | init_inodecache(); |
2409 | register_filesystem(&sock_fs_type); | 2412 | |
2413 | err = register_filesystem(&sock_fs_type); | ||
2414 | if (err) | ||
2415 | goto out_fs; | ||
2410 | sock_mnt = kern_mount(&sock_fs_type); | 2416 | sock_mnt = kern_mount(&sock_fs_type); |
2417 | if (IS_ERR(sock_mnt)) { | ||
2418 | err = PTR_ERR(sock_mnt); | ||
2419 | goto out_mount; | ||
2420 | } | ||
2411 | 2421 | ||
2412 | /* The real protocol initialization is performed in later initcalls. | 2422 | /* The real protocol initialization is performed in later initcalls. |
2413 | */ | 2423 | */ |
@@ -2420,7 +2430,13 @@ static int __init sock_init(void) | |||
2420 | skb_timestamping_init(); | 2430 | skb_timestamping_init(); |
2421 | #endif | 2431 | #endif |
2422 | 2432 | ||
2423 | return 0; | 2433 | out: |
2434 | return err; | ||
2435 | |||
2436 | out_mount: | ||
2437 | unregister_filesystem(&sock_fs_type); | ||
2438 | out_fs: | ||
2439 | goto out; | ||
2424 | } | 2440 | } |
2425 | 2441 | ||
2426 | core_initcall(sock_init); /* early initcall */ | 2442 | core_initcall(sock_init); /* early initcall */ |