Commit 88f6cd0c authored by Johannes Stezenbach's avatar Johannes Stezenbach Committed by Linus Torvalds

[PATCH] uml: fix mknod

Fix UML hostfs mknod(): userspace has differernt dev_t size and encoding
than kernel, so extract major/minor and reencode using glibc makedev()
macro.
Signed-off-by: default avatarJohannes Stezenbach <js@linuxtv.org>
Acked-by: default avatarPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: <stable@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 7a238fcb
...@@ -76,7 +76,7 @@ extern int make_symlink(const char *from, const char *to); ...@@ -76,7 +76,7 @@ extern int make_symlink(const char *from, const char *to);
extern int unlink_file(const char *file); extern int unlink_file(const char *file);
extern int do_mkdir(const char *file, int mode); extern int do_mkdir(const char *file, int mode);
extern int do_rmdir(const char *file); extern int do_rmdir(const char *file);
extern int do_mknod(const char *file, int mode, int dev); extern int do_mknod(const char *file, int mode, unsigned int major, unsigned int minor);
extern int link_file(const char *from, const char *to); extern int link_file(const char *from, const char *to);
extern int do_readlink(char *file, char *buf, int size); extern int do_readlink(char *file, char *buf, int size);
extern int rename_file(char *from, char *to); extern int rename_file(char *from, char *to);
......
...@@ -755,7 +755,7 @@ int hostfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) ...@@ -755,7 +755,7 @@ int hostfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
goto out_put; goto out_put;
init_special_inode(inode, mode, dev); init_special_inode(inode, mode, dev);
err = do_mknod(name, mode, dev); err = do_mknod(name, mode, MAJOR(dev), MINOR(dev));
if(err) if(err)
goto out_free; goto out_free;
......
...@@ -295,11 +295,11 @@ int do_rmdir(const char *file) ...@@ -295,11 +295,11 @@ int do_rmdir(const char *file)
return(0); return(0);
} }
int do_mknod(const char *file, int mode, int dev) int do_mknod(const char *file, int mode, unsigned int major, unsigned int minor)
{ {
int err; int err;
err = mknod(file, mode, dev); err = mknod(file, mode, makedev(major, minor));
if(err) return(-errno); if(err) return(-errno);
return(0); return(0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment