[PATCH] sanitize __user_walk_fd() et.al.
* do not pass nameidata; struct path is all the callers want. * switch to new helpers: user_path_at(dfd, pathname, flags, &path) user_path(pathname, &path) user_lpath(pathname, &path) user_path_dir(pathname, &path) (fail if not a directory) The last 3 are trivial macro wrappers for the first one. * remove nameidata in callers. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@ -84,17 +84,15 @@ xfs_find_handle(
|
||||
switch (cmd) {
|
||||
case XFS_IOC_PATH_TO_FSHANDLE:
|
||||
case XFS_IOC_PATH_TO_HANDLE: {
|
||||
struct nameidata nd;
|
||||
int error;
|
||||
|
||||
error = user_path_walk_link((const char __user *)hreq.path, &nd);
|
||||
struct path path;
|
||||
int error = user_lpath((const char __user *)hreq.path, &path);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
ASSERT(nd.path.dentry);
|
||||
ASSERT(nd.path.dentry->d_inode);
|
||||
inode = igrab(nd.path.dentry->d_inode);
|
||||
path_put(&nd.path);
|
||||
ASSERT(path.dentry);
|
||||
ASSERT(path.dentry->d_inode);
|
||||
inode = igrab(path.dentry->d_inode);
|
||||
path_put(&path);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user