提交 555fa0fa 编写于 作者: A Al Viro 提交者: Mike Marshall

fs: out of bounds on stack in iov_iter_advance

On Wed, Nov 11, 2015 at 10:19:48AM +0000, Al Viro wrote:

> I'll cook the minimal fixup for API change after I get some sleep and
> send it your way, unless somebody gets there first...

This should do it - switches ->ioctl() to pvfs2_inode_[gs]etxattr() and
converts xattr_handler ->[gs]et() to new API.
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: NMike Marshall <hubcap@omnibond.com>
上级 a52079da
...@@ -506,11 +506,10 @@ static long pvfs2_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -506,11 +506,10 @@ static long pvfs2_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
*/ */
if (cmd == FS_IOC_GETFLAGS) { if (cmd == FS_IOC_GETFLAGS) {
val = 0; val = 0;
ret = pvfs2_xattr_get_default(file->f_path.dentry, ret = pvfs2_inode_getxattr(file_inode(file),
"user.pvfs2.meta_hint", PVFS2_XATTR_NAME_DEFAULT_PREFIX,
&val, "user.pvfs2.meta_hint",
sizeof(val), &val, sizeof(val));
0);
if (ret < 0 && ret != -ENODATA) if (ret < 0 && ret != -ENODATA)
return ret; return ret;
else if (ret == -ENODATA) else if (ret == -ENODATA)
...@@ -540,12 +539,10 @@ static long pvfs2_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -540,12 +539,10 @@ static long pvfs2_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
gossip_debug(GOSSIP_FILE_DEBUG, gossip_debug(GOSSIP_FILE_DEBUG,
"pvfs2_ioctl: FS_IOC_SETFLAGS: %llu\n", "pvfs2_ioctl: FS_IOC_SETFLAGS: %llu\n",
(unsigned long long)val); (unsigned long long)val);
ret = pvfs2_xattr_set_default(file->f_path.dentry, ret = pvfs2_inode_setxattr(file_inode(file),
"user.pvfs2.meta_hint", PVFS2_XATTR_NAME_DEFAULT_PREFIX,
&val, "user.pvfs2.meta_hint",
sizeof(val), &val, sizeof(val), 0);
0,
0);
} }
return ret; return ret;
......
...@@ -234,19 +234,6 @@ extern const struct xattr_handler *pvfs2_xattr_handlers[]; ...@@ -234,19 +234,6 @@ extern const struct xattr_handler *pvfs2_xattr_handlers[];
extern struct posix_acl *pvfs2_get_acl(struct inode *inode, int type); extern struct posix_acl *pvfs2_get_acl(struct inode *inode, int type);
extern int pvfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type); extern int pvfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type);
int pvfs2_xattr_set_default(struct dentry *dentry,
const char *name,
const void *buffer,
size_t size,
int flags,
int handler_flags);
int pvfs2_xattr_get_default(struct dentry *dentry,
const char *name,
void *buffer,
size_t size,
int handler_flags);
/* /*
* Redefine xtvec structure so that we could move helper functions out of * Redefine xtvec structure so that we could move helper functions out of
* the define * the define
......
...@@ -447,12 +447,12 @@ ssize_t pvfs2_listxattr(struct dentry *dentry, char *buffer, size_t size) ...@@ -447,12 +447,12 @@ ssize_t pvfs2_listxattr(struct dentry *dentry, char *buffer, size_t size)
return ret; return ret;
} }
int pvfs2_xattr_set_default(struct dentry *dentry, static int pvfs2_xattr_set_default(const struct xattr_handler *handler,
const char *name, struct dentry *dentry,
const void *buffer, const char *name,
size_t size, const void *buffer,
int flags, size_t size,
int handler_flags) int flags)
{ {
return pvfs2_inode_setxattr(dentry->d_inode, return pvfs2_inode_setxattr(dentry->d_inode,
PVFS2_XATTR_NAME_DEFAULT_PREFIX, PVFS2_XATTR_NAME_DEFAULT_PREFIX,
...@@ -462,11 +462,11 @@ int pvfs2_xattr_set_default(struct dentry *dentry, ...@@ -462,11 +462,11 @@ int pvfs2_xattr_set_default(struct dentry *dentry,
flags); flags);
} }
int pvfs2_xattr_get_default(struct dentry *dentry, static int pvfs2_xattr_get_default(const struct xattr_handler *handler,
const char *name, struct dentry *dentry,
void *buffer, const char *name,
size_t size, void *buffer,
int handler_flags) size_t size)
{ {
return pvfs2_inode_getxattr(dentry->d_inode, return pvfs2_inode_getxattr(dentry->d_inode,
PVFS2_XATTR_NAME_DEFAULT_PREFIX, PVFS2_XATTR_NAME_DEFAULT_PREFIX,
...@@ -476,12 +476,12 @@ int pvfs2_xattr_get_default(struct dentry *dentry, ...@@ -476,12 +476,12 @@ int pvfs2_xattr_get_default(struct dentry *dentry,
} }
static int pvfs2_xattr_set_trusted(struct dentry *dentry, static int pvfs2_xattr_set_trusted(const struct xattr_handler *handler,
const char *name, struct dentry *dentry,
const void *buffer, const char *name,
size_t size, const void *buffer,
int flags, size_t size,
int handler_flags) int flags)
{ {
return pvfs2_inode_setxattr(dentry->d_inode, return pvfs2_inode_setxattr(dentry->d_inode,
PVFS2_XATTR_NAME_TRUSTED_PREFIX, PVFS2_XATTR_NAME_TRUSTED_PREFIX,
...@@ -491,11 +491,11 @@ static int pvfs2_xattr_set_trusted(struct dentry *dentry, ...@@ -491,11 +491,11 @@ static int pvfs2_xattr_set_trusted(struct dentry *dentry,
flags); flags);
} }
static int pvfs2_xattr_get_trusted(struct dentry *dentry, static int pvfs2_xattr_get_trusted(const struct xattr_handler *handler,
const char *name, struct dentry *dentry,
void *buffer, const char *name,
size_t size, void *buffer,
int handler_flags) size_t size)
{ {
return pvfs2_inode_getxattr(dentry->d_inode, return pvfs2_inode_getxattr(dentry->d_inode,
PVFS2_XATTR_NAME_TRUSTED_PREFIX, PVFS2_XATTR_NAME_TRUSTED_PREFIX,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册