Commit b1d7a6ca authored by Linus Torvalds's avatar Linus Torvalds

Tag more user-supplied path strings as being user pointers for

type evaluation.  This tags the system call interfaces in
fs/open.c, fs/dcache.c and mm/swapfile.c - and tags the path
walking helper functions.
parent 7c32f3a2
...@@ -1366,7 +1366,7 @@ char * d_path(struct dentry *dentry, struct vfsmount *vfsmnt, ...@@ -1366,7 +1366,7 @@ char * d_path(struct dentry *dentry, struct vfsmount *vfsmnt,
* return NULL; * return NULL;
* } * }
*/ */
asmlinkage long sys_getcwd(char *buf, unsigned long size) asmlinkage long sys_getcwd(char __user *buf, unsigned long size)
{ {
int error; int error;
struct vfsmount *pwdmnt, *rootmnt; struct vfsmount *pwdmnt, *rootmnt;
......
...@@ -41,7 +41,7 @@ int vfs_statfs(struct super_block *sb, struct statfs *buf) ...@@ -41,7 +41,7 @@ int vfs_statfs(struct super_block *sb, struct statfs *buf)
} }
asmlinkage long sys_statfs(const char * path, struct statfs * buf) asmlinkage long sys_statfs(const char __user * path, struct statfs __user * buf)
{ {
struct nameidata nd; struct nameidata nd;
int error; int error;
...@@ -57,7 +57,7 @@ asmlinkage long sys_statfs(const char * path, struct statfs * buf) ...@@ -57,7 +57,7 @@ asmlinkage long sys_statfs(const char * path, struct statfs * buf)
return error; return error;
} }
asmlinkage long sys_fstatfs(unsigned int fd, struct statfs * buf) asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user * buf)
{ {
struct file * file; struct file * file;
struct statfs tmp; struct statfs tmp;
...@@ -92,7 +92,7 @@ int do_truncate(struct dentry *dentry, loff_t length) ...@@ -92,7 +92,7 @@ int do_truncate(struct dentry *dentry, loff_t length)
return err; return err;
} }
static inline long do_sys_truncate(const char * path, loff_t length) static inline long do_sys_truncate(const char __user * path, loff_t length)
{ {
struct nameidata nd; struct nameidata nd;
struct inode * inode; struct inode * inode;
...@@ -152,7 +152,7 @@ static inline long do_sys_truncate(const char * path, loff_t length) ...@@ -152,7 +152,7 @@ static inline long do_sys_truncate(const char * path, loff_t length)
return error; return error;
} }
asmlinkage long sys_truncate(const char * path, unsigned long length) asmlinkage long sys_truncate(const char __user * path, unsigned long length)
{ {
/* on 32-bit boxen it will cut the range 2^31--2^32-1 off */ /* on 32-bit boxen it will cut the range 2^31--2^32-1 off */
return do_sys_truncate(path, (long)length); return do_sys_truncate(path, (long)length);
...@@ -208,7 +208,7 @@ asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length) ...@@ -208,7 +208,7 @@ asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length)
/* LFS versions of truncate are only needed on 32 bit machines */ /* LFS versions of truncate are only needed on 32 bit machines */
#if BITS_PER_LONG == 32 #if BITS_PER_LONG == 32
asmlinkage long sys_truncate64(const char * path, loff_t length) asmlinkage long sys_truncate64(const char __user * path, loff_t length)
{ {
return do_sys_truncate(path, length); return do_sys_truncate(path, length);
} }
...@@ -232,7 +232,7 @@ asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length) ...@@ -232,7 +232,7 @@ asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length)
* must be owner or have write permission. * must be owner or have write permission.
* Else, update from *times, must be owner or super user. * Else, update from *times, must be owner or super user.
*/ */
asmlinkage long sys_utime(char * filename, struct utimbuf * times) asmlinkage long sys_utime(char __user * filename, struct utimbuf __user * times)
{ {
int error; int error;
struct nameidata nd; struct nameidata nd;
...@@ -280,7 +280,7 @@ asmlinkage long sys_utime(char * filename, struct utimbuf * times) ...@@ -280,7 +280,7 @@ asmlinkage long sys_utime(char * filename, struct utimbuf * times)
* must be owner or have write permission. * must be owner or have write permission.
* Else, update from *times, must be owner or super user. * Else, update from *times, must be owner or super user.
*/ */
long do_utimes(char * filename, struct timeval * times) long do_utimes(char __user * filename, struct timeval __user * times)
{ {
int error; int error;
struct nameidata nd; struct nameidata nd;
...@@ -319,7 +319,7 @@ long do_utimes(char * filename, struct timeval * times) ...@@ -319,7 +319,7 @@ long do_utimes(char * filename, struct timeval * times)
return error; return error;
} }
asmlinkage long sys_utimes(char * filename, struct timeval * utimes) asmlinkage long sys_utimes(char __user * filename, struct timeval __user * utimes)
{ {
struct timeval times[2]; struct timeval times[2];
...@@ -334,7 +334,7 @@ asmlinkage long sys_utimes(char * filename, struct timeval * utimes) ...@@ -334,7 +334,7 @@ asmlinkage long sys_utimes(char * filename, struct timeval * utimes)
* We do this by temporarily clearing all FS-related capabilities and * We do this by temporarily clearing all FS-related capabilities and
* switching the fsuid/fsgid around to the real ones. * switching the fsuid/fsgid around to the real ones.
*/ */
asmlinkage long sys_access(const char * filename, int mode) asmlinkage long sys_access(const char __user * filename, int mode)
{ {
struct nameidata nd; struct nameidata nd;
int old_fsuid, old_fsgid; int old_fsuid, old_fsgid;
...@@ -381,7 +381,7 @@ asmlinkage long sys_access(const char * filename, int mode) ...@@ -381,7 +381,7 @@ asmlinkage long sys_access(const char * filename, int mode)
return res; return res;
} }
asmlinkage long sys_chdir(const char * filename) asmlinkage long sys_chdir(const char __user * filename)
{ {
struct nameidata nd; struct nameidata nd;
int error; int error;
...@@ -432,7 +432,7 @@ asmlinkage long sys_fchdir(unsigned int fd) ...@@ -432,7 +432,7 @@ asmlinkage long sys_fchdir(unsigned int fd)
return error; return error;
} }
asmlinkage long sys_chroot(const char * filename) asmlinkage long sys_chroot(const char __user * filename)
{ {
struct nameidata nd; struct nameidata nd;
int error; int error;
...@@ -493,7 +493,7 @@ asmlinkage long sys_fchmod(unsigned int fd, mode_t mode) ...@@ -493,7 +493,7 @@ asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
return err; return err;
} }
asmlinkage long sys_chmod(const char * filename, mode_t mode) asmlinkage long sys_chmod(const char __user * filename, mode_t mode)
{ {
struct nameidata nd; struct nameidata nd;
struct inode * inode; struct inode * inode;
...@@ -562,7 +562,7 @@ static int chown_common(struct dentry * dentry, uid_t user, gid_t group) ...@@ -562,7 +562,7 @@ static int chown_common(struct dentry * dentry, uid_t user, gid_t group)
return error; return error;
} }
asmlinkage long sys_chown(const char * filename, uid_t user, gid_t group) asmlinkage long sys_chown(const char __user * filename, uid_t user, gid_t group)
{ {
struct nameidata nd; struct nameidata nd;
int error; int error;
...@@ -575,7 +575,7 @@ asmlinkage long sys_chown(const char * filename, uid_t user, gid_t group) ...@@ -575,7 +575,7 @@ asmlinkage long sys_chown(const char * filename, uid_t user, gid_t group)
return error; return error;
} }
asmlinkage long sys_lchown(const char * filename, uid_t user, gid_t group) asmlinkage long sys_lchown(const char __user * filename, uid_t user, gid_t group)
{ {
struct nameidata nd; struct nameidata nd;
int error; int error;
...@@ -793,7 +793,7 @@ void fd_install(unsigned int fd, struct file * file) ...@@ -793,7 +793,7 @@ void fd_install(unsigned int fd, struct file * file)
write_unlock(&files->file_lock); write_unlock(&files->file_lock);
} }
asmlinkage long sys_open(const char * filename, int flags, int mode) asmlinkage long sys_open(const char __user * filename, int flags, int mode)
{ {
char * tmp; char * tmp;
int fd, error; int fd, error;
...@@ -829,7 +829,7 @@ asmlinkage long sys_open(const char * filename, int flags, int mode) ...@@ -829,7 +829,7 @@ asmlinkage long sys_open(const char * filename, int flags, int mode)
* For backward compatibility? Maybe this should be moved * For backward compatibility? Maybe this should be moved
* into arch/i386 instead? * into arch/i386 instead?
*/ */
asmlinkage long sys_creat(const char * pathname, int mode) asmlinkage long sys_creat(const char __user * pathname, int mode)
{ {
return sys_open(pathname, O_CREAT | O_WRONLY | O_TRUNC, mode); return sys_open(pathname, O_CREAT | O_WRONLY | O_TRUNC, mode);
} }
......
...@@ -1024,7 +1024,7 @@ extern int do_truncate(struct dentry *, loff_t start); ...@@ -1024,7 +1024,7 @@ extern int do_truncate(struct dentry *, loff_t start);
extern struct file *filp_open(const char *, int, int); extern struct file *filp_open(const char *, int, int);
extern struct file * dentry_open(struct dentry *, struct vfsmount *, int); extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
extern int filp_close(struct file *, fl_owner_t id); extern int filp_close(struct file *, fl_owner_t id);
extern char * getname(const char *); extern char * getname(const char __user *);
/* fs/dcache.c */ /* fs/dcache.c */
extern void vfs_caches_init(unsigned long); extern void vfs_caches_init(unsigned long);
......
...@@ -33,7 +33,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND}; ...@@ -33,7 +33,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
#define LOOKUP_NOALT 32 #define LOOKUP_NOALT 32
extern int FASTCALL(__user_walk(const char *, unsigned, struct nameidata *)); extern int FASTCALL(__user_walk(const char __user *, unsigned, struct nameidata *));
#define user_path_walk(name,nd) \ #define user_path_walk(name,nd) \
__user_walk(name, LOOKUP_FOLLOW, nd) __user_walk(name, LOOKUP_FOLLOW, nd)
#define user_path_walk_link(name,nd) \ #define user_path_walk_link(name,nd) \
......
...@@ -995,7 +995,7 @@ int page_queue_congested(struct page *page) ...@@ -995,7 +995,7 @@ int page_queue_congested(struct page *page)
} }
#endif #endif
asmlinkage long sys_swapoff(const char * specialfile) asmlinkage long sys_swapoff(const char __user * specialfile)
{ {
struct swap_info_struct * p = NULL; struct swap_info_struct * p = NULL;
unsigned short *swap_map; unsigned short *swap_map;
...@@ -1199,7 +1199,7 @@ __initcall(procswaps_init); ...@@ -1199,7 +1199,7 @@ __initcall(procswaps_init);
* *
* The swapon system call * The swapon system call
*/ */
asmlinkage long sys_swapon(const char * specialfile, int swap_flags) asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags)
{ {
struct swap_info_struct * p; struct swap_info_struct * p;
char *name = NULL; char *name = NULL;
......
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