Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  fs/ncpfs: fix error paths and goto statements in ncp_fill_super()
  configfs: register_filesystem() called too early
  fuse: register_filesystem() called too early
  ubifs: too early register_filesystem()
  ... and the same kind of leak for mqueue
  procfs: fix a vfsmount longterm reference leak
This commit is contained in:
Linus Torvalds 2011-12-14 18:22:55 -08:00
Родитель 373da0a2a3 759c361eb9
Коммит ddb360778a
8 изменённых файлов: 49 добавлений и 62 удалений

Просмотреть файл

@ -292,7 +292,7 @@ int __init configfs_inode_init(void)
return bdi_init(&configfs_backing_dev_info);
}
void __exit configfs_inode_exit(void)
void configfs_inode_exit(void)
{
bdi_destroy(&configfs_backing_dev_info);
}

Просмотреть файл

@ -143,28 +143,26 @@ static int __init configfs_init(void)
goto out;
config_kobj = kobject_create_and_add("config", kernel_kobj);
if (!config_kobj) {
kmem_cache_destroy(configfs_dir_cachep);
configfs_dir_cachep = NULL;
goto out;
}
err = register_filesystem(&configfs_fs_type);
if (err) {
printk(KERN_ERR "configfs: Unable to register filesystem!\n");
kobject_put(config_kobj);
kmem_cache_destroy(configfs_dir_cachep);
configfs_dir_cachep = NULL;
goto out;
}
if (!config_kobj)
goto out2;
err = configfs_inode_init();
if (err) {
unregister_filesystem(&configfs_fs_type);
kobject_put(config_kobj);
kmem_cache_destroy(configfs_dir_cachep);
configfs_dir_cachep = NULL;
}
if (err)
goto out3;
err = register_filesystem(&configfs_fs_type);
if (err)
goto out4;
return 0;
out4:
printk(KERN_ERR "configfs: Unable to register filesystem!\n");
configfs_inode_exit();
out3:
kobject_put(config_kobj);
out2:
kmem_cache_destroy(configfs_dir_cachep);
configfs_dir_cachep = NULL;
out:
return err;
}

Просмотреть файл

@ -1138,28 +1138,28 @@ static int __init fuse_fs_init(void)
{
int err;
err = register_filesystem(&fuse_fs_type);
if (err)
goto out;
err = register_fuseblk();
if (err)
goto out_unreg;
fuse_inode_cachep = kmem_cache_create("fuse_inode",
sizeof(struct fuse_inode),
0, SLAB_HWCACHE_ALIGN,
fuse_inode_init_once);
err = -ENOMEM;
if (!fuse_inode_cachep)
goto out_unreg2;
goto out;
err = register_fuseblk();
if (err)
goto out2;
err = register_filesystem(&fuse_fs_type);
if (err)
goto out3;
return 0;
out_unreg2:
out3:
unregister_fuseblk();
out_unreg:
unregister_filesystem(&fuse_fs_type);
out2:
kmem_cache_destroy(fuse_inode_cachep);
out:
return err;
}

Просмотреть файл

@ -548,7 +548,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
error = bdi_setup_and_register(&server->bdi, "ncpfs", BDI_CAP_MAP_COPY);
if (error)
goto out_bdi;
goto out_fput;
server->ncp_filp = ncp_filp;
server->ncp_sock = sock;
@ -559,7 +559,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
error = -EBADF;
server->info_filp = fget(data.info_fd);
if (!server->info_filp)
goto out_fput;
goto out_bdi;
error = -ENOTSOCK;
sock_inode = server->info_filp->f_path.dentry->d_inode;
if (!S_ISSOCK(sock_inode->i_mode))
@ -746,9 +746,9 @@ out_nls:
out_fput2:
if (server->info_filp)
fput(server->info_filp);
out_fput:
bdi_destroy(&server->bdi);
out_bdi:
bdi_destroy(&server->bdi);
out_fput:
/* 23/12/1998 Marcin Dalecki <dalecki@cs.net.pl>:
*
* The previously used put_filp(ncp_filp); was bogus, since

Просмотреть файл

@ -91,20 +91,18 @@ static struct file_system_type proc_fs_type = {
void __init proc_root_init(void)
{
struct vfsmount *mnt;
int err;
proc_init_inodecache();
err = register_filesystem(&proc_fs_type);
if (err)
return;
mnt = kern_mount_data(&proc_fs_type, &init_pid_ns);
if (IS_ERR(mnt)) {
err = pid_ns_prepare_proc(&init_pid_ns);
if (err) {
unregister_filesystem(&proc_fs_type);
return;
}
init_pid_ns.proc_mnt = mnt;
proc_symlink("mounts", NULL, "self/mounts");
proc_net_init();
@ -209,5 +207,5 @@ int pid_ns_prepare_proc(struct pid_namespace *ns)
void pid_ns_release_proc(struct pid_namespace *ns)
{
mntput(ns->proc_mnt);
kern_unmount(ns->proc_mnt);
}

Просмотреть файл

@ -2264,19 +2264,12 @@ static int __init ubifs_init(void)
return -EINVAL;
}
err = register_filesystem(&ubifs_fs_type);
if (err) {
ubifs_err("cannot register file system, error %d", err);
return err;
}
err = -ENOMEM;
ubifs_inode_slab = kmem_cache_create("ubifs_inode_slab",
sizeof(struct ubifs_inode), 0,
SLAB_MEM_SPREAD | SLAB_RECLAIM_ACCOUNT,
&inode_slab_ctor);
if (!ubifs_inode_slab)
goto out_reg;
return -ENOMEM;
register_shrinker(&ubifs_shrinker_info);
@ -2288,15 +2281,20 @@ static int __init ubifs_init(void)
if (err)
goto out_compr;
err = register_filesystem(&ubifs_fs_type);
if (err) {
ubifs_err("cannot register file system, error %d", err);
goto out_dbg;
}
return 0;
out_dbg:
dbg_debugfs_exit();
out_compr:
ubifs_compressors_exit();
out_shrinker:
unregister_shrinker(&ubifs_shrinker_info);
kmem_cache_destroy(ubifs_inode_slab);
out_reg:
unregister_filesystem(&ubifs_fs_type);
return err;
}
/* late_initcall to let compressors initialize first */

Просмотреть файл

@ -1269,7 +1269,7 @@ void mq_clear_sbinfo(struct ipc_namespace *ns)
void mq_put_mnt(struct ipc_namespace *ns)
{
mntput(ns->mq_mnt);
kern_unmount(ns->mq_mnt);
}
static int __init init_mqueue_fs(void)
@ -1291,11 +1291,9 @@ static int __init init_mqueue_fs(void)
spin_lock_init(&mq_lock);
init_ipc_ns.mq_mnt = kern_mount_data(&mqueue_fs_type, &init_ipc_ns);
if (IS_ERR(init_ipc_ns.mq_mnt)) {
error = PTR_ERR(init_ipc_ns.mq_mnt);
error = mq_init_ns(&init_ipc_ns);
if (error)
goto out_filesystem;
}
return 0;

Просмотреть файл

@ -27,11 +27,6 @@ DEFINE_SPINLOCK(mq_lock);
*/
struct ipc_namespace init_ipc_ns = {
.count = ATOMIC_INIT(1),
#ifdef CONFIG_POSIX_MQUEUE
.mq_queues_max = DFLT_QUEUESMAX,
.mq_msg_max = DFLT_MSGMAX,
.mq_msgsize_max = DFLT_MSGSIZEMAX,
#endif
.user_ns = &init_user_ns,
};