diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_ioctl.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c index 5bb523d7f37e..7b26cc2fd284 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl.c +++ b/fs/xfs/linux-2.6/xfs_ioctl.c | |||
@@ -51,12 +51,14 @@ | |||
51 | #include "xfs_quota.h" | 51 | #include "xfs_quota.h" |
52 | #include "xfs_inode_item.h" | 52 | #include "xfs_inode_item.h" |
53 | #include "xfs_export.h" | 53 | #include "xfs_export.h" |
54 | #include "xfs_trace.h" | ||
54 | 55 | ||
55 | #include <linux/capability.h> | 56 | #include <linux/capability.h> |
56 | #include <linux/dcache.h> | 57 | #include <linux/dcache.h> |
57 | #include <linux/mount.h> | 58 | #include <linux/mount.h> |
58 | #include <linux/namei.h> | 59 | #include <linux/namei.h> |
59 | #include <linux/pagemap.h> | 60 | #include <linux/pagemap.h> |
61 | #include <linux/slab.h> | ||
60 | #include <linux/exportfs.h> | 62 | #include <linux/exportfs.h> |
61 | 63 | ||
62 | /* | 64 | /* |
@@ -446,12 +448,12 @@ xfs_attrlist_by_handle( | |||
446 | int | 448 | int |
447 | xfs_attrmulti_attr_get( | 449 | xfs_attrmulti_attr_get( |
448 | struct inode *inode, | 450 | struct inode *inode, |
449 | char *name, | 451 | unsigned char *name, |
450 | char __user *ubuf, | 452 | unsigned char __user *ubuf, |
451 | __uint32_t *len, | 453 | __uint32_t *len, |
452 | __uint32_t flags) | 454 | __uint32_t flags) |
453 | { | 455 | { |
454 | char *kbuf; | 456 | unsigned char *kbuf; |
455 | int error = EFAULT; | 457 | int error = EFAULT; |
456 | 458 | ||
457 | if (*len > XATTR_SIZE_MAX) | 459 | if (*len > XATTR_SIZE_MAX) |
@@ -475,12 +477,12 @@ xfs_attrmulti_attr_get( | |||
475 | int | 477 | int |
476 | xfs_attrmulti_attr_set( | 478 | xfs_attrmulti_attr_set( |
477 | struct inode *inode, | 479 | struct inode *inode, |
478 | char *name, | 480 | unsigned char *name, |
479 | const char __user *ubuf, | 481 | const unsigned char __user *ubuf, |
480 | __uint32_t len, | 482 | __uint32_t len, |
481 | __uint32_t flags) | 483 | __uint32_t flags) |
482 | { | 484 | { |
483 | char *kbuf; | 485 | unsigned char *kbuf; |
484 | int error = EFAULT; | 486 | int error = EFAULT; |
485 | 487 | ||
486 | if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) | 488 | if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) |
@@ -500,7 +502,7 @@ xfs_attrmulti_attr_set( | |||
500 | int | 502 | int |
501 | xfs_attrmulti_attr_remove( | 503 | xfs_attrmulti_attr_remove( |
502 | struct inode *inode, | 504 | struct inode *inode, |
503 | char *name, | 505 | unsigned char *name, |
504 | __uint32_t flags) | 506 | __uint32_t flags) |
505 | { | 507 | { |
506 | if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) | 508 | if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) |
@@ -518,7 +520,7 @@ xfs_attrmulti_by_handle( | |||
518 | xfs_fsop_attrmulti_handlereq_t am_hreq; | 520 | xfs_fsop_attrmulti_handlereq_t am_hreq; |
519 | struct dentry *dentry; | 521 | struct dentry *dentry; |
520 | unsigned int i, size; | 522 | unsigned int i, size; |
521 | char *attr_name; | 523 | unsigned char *attr_name; |
522 | 524 | ||
523 | if (!capable(CAP_SYS_ADMIN)) | 525 | if (!capable(CAP_SYS_ADMIN)) |
524 | return -XFS_ERROR(EPERM); | 526 | return -XFS_ERROR(EPERM); |
@@ -546,7 +548,7 @@ xfs_attrmulti_by_handle( | |||
546 | 548 | ||
547 | error = 0; | 549 | error = 0; |
548 | for (i = 0; i < am_hreq.opcount; i++) { | 550 | for (i = 0; i < am_hreq.opcount; i++) { |
549 | ops[i].am_error = strncpy_from_user(attr_name, | 551 | ops[i].am_error = strncpy_from_user((char *)attr_name, |
550 | ops[i].am_attrname, MAXNAMELEN); | 552 | ops[i].am_attrname, MAXNAMELEN); |
551 | if (ops[i].am_error == 0 || ops[i].am_error == MAXNAMELEN) | 553 | if (ops[i].am_error == 0 || ops[i].am_error == MAXNAMELEN) |
552 | error = -ERANGE; | 554 | error = -ERANGE; |
@@ -1430,6 +1432,9 @@ xfs_file_ioctl( | |||
1430 | if (!capable(CAP_SYS_ADMIN)) | 1432 | if (!capable(CAP_SYS_ADMIN)) |
1431 | return -EPERM; | 1433 | return -EPERM; |
1432 | 1434 | ||
1435 | if (mp->m_flags & XFS_MOUNT_RDONLY) | ||
1436 | return -XFS_ERROR(EROFS); | ||
1437 | |||
1433 | if (copy_from_user(&inout, arg, sizeof(inout))) | 1438 | if (copy_from_user(&inout, arg, sizeof(inout))) |
1434 | return -XFS_ERROR(EFAULT); | 1439 | return -XFS_ERROR(EFAULT); |
1435 | 1440 | ||