Skip to content

Commit 555fa0f

Browse files
Al Virohubcapsc
authored andcommitted
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: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Mike Marshall <hubcap@omnibond.com>
1 parent a52079d commit 555fa0f

3 files changed

Lines changed: 30 additions & 46 deletions

File tree

‎fs/orangefs/file.c‎

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -506,11 +506,10 @@ static long pvfs2_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
506506
*/
507507
if (cmd == FS_IOC_GETFLAGS) {
508508
val = 0;
509-
ret = pvfs2_xattr_get_default(file->f_path.dentry,
510-
"user.pvfs2.meta_hint",
511-
&val,
512-
sizeof(val),
513-
0);
509+
ret = pvfs2_inode_getxattr(file_inode(file),
510+
PVFS2_XATTR_NAME_DEFAULT_PREFIX,
511+
"user.pvfs2.meta_hint",
512+
&val, sizeof(val));
514513
if (ret < 0 && ret != -ENODATA)
515514
return ret;
516515
else if (ret == -ENODATA)
@@ -540,12 +539,10 @@ static long pvfs2_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
540539
gossip_debug(GOSSIP_FILE_DEBUG,
541540
"pvfs2_ioctl: FS_IOC_SETFLAGS: %llu\n",
542541
(unsigned long long)val);
543-
ret = pvfs2_xattr_set_default(file->f_path.dentry,
544-
"user.pvfs2.meta_hint",
545-
&val,
546-
sizeof(val),
547-
0,
548-
0);
542+
ret = pvfs2_inode_setxattr(file_inode(file),
543+
PVFS2_XATTR_NAME_DEFAULT_PREFIX,
544+
"user.pvfs2.meta_hint",
545+
&val, sizeof(val), 0);
549546
}
550547

551548
return ret;

‎fs/orangefs/pvfs2-kernel.h‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -234,19 +234,6 @@ extern const struct xattr_handler *pvfs2_xattr_handlers[];
234234
extern struct posix_acl *pvfs2_get_acl(struct inode *inode, int type);
235235
extern int pvfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type);
236236

237-
int pvfs2_xattr_set_default(struct dentry *dentry,
238-
const char *name,
239-
const void *buffer,
240-
size_t size,
241-
int flags,
242-
int handler_flags);
243-
244-
int pvfs2_xattr_get_default(struct dentry *dentry,
245-
const char *name,
246-
void *buffer,
247-
size_t size,
248-
int handler_flags);
249-
250237
/*
251238
* Redefine xtvec structure so that we could move helper functions out of
252239
* the define

‎fs/orangefs/xattr.c‎

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -447,12 +447,12 @@ ssize_t pvfs2_listxattr(struct dentry *dentry, char *buffer, size_t size)
447447
return ret;
448448
}
449449

450-
int pvfs2_xattr_set_default(struct dentry *dentry,
451-
const char *name,
452-
const void *buffer,
453-
size_t size,
454-
int flags,
455-
int handler_flags)
450+
static int pvfs2_xattr_set_default(const struct xattr_handler *handler,
451+
struct dentry *dentry,
452+
const char *name,
453+
const void *buffer,
454+
size_t size,
455+
int flags)
456456
{
457457
return pvfs2_inode_setxattr(dentry->d_inode,
458458
PVFS2_XATTR_NAME_DEFAULT_PREFIX,
@@ -462,11 +462,11 @@ int pvfs2_xattr_set_default(struct dentry *dentry,
462462
flags);
463463
}
464464

465-
int pvfs2_xattr_get_default(struct dentry *dentry,
466-
const char *name,
467-
void *buffer,
468-
size_t size,
469-
int handler_flags)
465+
static int pvfs2_xattr_get_default(const struct xattr_handler *handler,
466+
struct dentry *dentry,
467+
const char *name,
468+
void *buffer,
469+
size_t size)
470470
{
471471
return pvfs2_inode_getxattr(dentry->d_inode,
472472
PVFS2_XATTR_NAME_DEFAULT_PREFIX,
@@ -476,12 +476,12 @@ int pvfs2_xattr_get_default(struct dentry *dentry,
476476

477477
}
478478

479-
static int pvfs2_xattr_set_trusted(struct dentry *dentry,
480-
const char *name,
481-
const void *buffer,
482-
size_t size,
483-
int flags,
484-
int handler_flags)
479+
static int pvfs2_xattr_set_trusted(const struct xattr_handler *handler,
480+
struct dentry *dentry,
481+
const char *name,
482+
const void *buffer,
483+
size_t size,
484+
int flags)
485485
{
486486
return pvfs2_inode_setxattr(dentry->d_inode,
487487
PVFS2_XATTR_NAME_TRUSTED_PREFIX,
@@ -491,11 +491,11 @@ static int pvfs2_xattr_set_trusted(struct dentry *dentry,
491491
flags);
492492
}
493493

494-
static int pvfs2_xattr_get_trusted(struct dentry *dentry,
495-
const char *name,
496-
void *buffer,
497-
size_t size,
498-
int handler_flags)
494+
static int pvfs2_xattr_get_trusted(const struct xattr_handler *handler,
495+
struct dentry *dentry,
496+
const char *name,
497+
void *buffer,
498+
size_t size)
499499
{
500500
return pvfs2_inode_getxattr(dentry->d_inode,
501501
PVFS2_XATTR_NAME_TRUSTED_PREFIX,

0 commit comments

Comments
 (0)