lkml.org 
[lkml]   [2004]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] cleanup in do_kern_mount()
This patch cleans up the error handling in do_kern_mount(), it also
helps me maintain the external user-mount patch. Linus, please apply.

Thanks,
Miklos

diff -rup -X dontdiff /usr/src/linux-2.6.3/fs/super.c linux-2.6.3/fs/super.c
--- /usr/src/linux-2.6.3/fs/super.c 2004-02-18 14:25:11.000000000 +0100
+++ linux-2.6.3/fs/super.c 2004-02-19 13:34:28.000000000 +0100
@@ -705,9 +705,9 @@ struct vfsmount *
do_kern_mount(const char *fstype, int flags, const char *name, void *data)
{
struct file_system_type *type = get_fs_type(fstype);
- struct super_block *sb = ERR_PTR(-ENOMEM);
+ struct super_block *sb;
struct vfsmount *mnt;
- int error;
+ int error = -ENOMEM;
char *secdata = NULL;

if (!type)
@@ -719,19 +719,16 @@ do_kern_mount(const char *fstype, int fl

if (data) {
secdata = alloc_secdata();
- if (!secdata) {
- sb = ERR_PTR(-ENOMEM);
+ if (!secdata)
goto out_mnt;
- }

error = security_sb_copy_data(fstype, data, secdata);
- if (error) {
- sb = ERR_PTR(error);
+ if (error)
goto out_free_secdata;
- }
}

sb = type->get_sb(type, flags, name, data);
+ error = PTR_ERR(sb);
if (IS_ERR(sb))
goto out_free_secdata;
error = security_sb_kern_mount(sb, secdata);
@@ -747,14 +744,13 @@ do_kern_mount(const char *fstype, int fl
out_sb:
up_write(&sb->s_umount);
deactivate_super(sb);
- sb = ERR_PTR(error);
out_free_secdata:
free_secdata(secdata);
out_mnt:
free_vfsmnt(mnt);
out:
put_filesystem(type);
- return (struct vfsmount *)sb;
+ return ERR_PTR(error);
}

struct vfsmount *kern_mount(struct file_system_type *type)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:01    [W:0.091 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site