diff options
Diffstat (limited to 'fs/nfs/proc.c')
-rw-r--r-- | fs/nfs/proc.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index 03599bfe81cf..4dbb84df1b68 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c | |||
@@ -129,6 +129,8 @@ nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, | |||
129 | sattr->ia_mode &= S_IALLUGO; | 129 | sattr->ia_mode &= S_IALLUGO; |
130 | 130 | ||
131 | dprintk("NFS call setattr\n"); | 131 | dprintk("NFS call setattr\n"); |
132 | if (sattr->ia_valid & ATTR_FILE) | ||
133 | msg.rpc_cred = nfs_file_cred(sattr->ia_file); | ||
132 | nfs_fattr_init(fattr); | 134 | nfs_fattr_init(fattr); |
133 | status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); | 135 | status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); |
134 | if (status == 0) | 136 | if (status == 0) |
@@ -598,6 +600,29 @@ nfs_proc_lock(struct file *filp, int cmd, struct file_lock *fl) | |||
598 | return nlmclnt_proc(NFS_SERVER(inode)->nlm_host, cmd, fl); | 600 | return nlmclnt_proc(NFS_SERVER(inode)->nlm_host, cmd, fl); |
599 | } | 601 | } |
600 | 602 | ||
603 | /* Helper functions for NFS lock bounds checking */ | ||
604 | #define NFS_LOCK32_OFFSET_MAX ((__s32)0x7fffffffUL) | ||
605 | static int nfs_lock_check_bounds(const struct file_lock *fl) | ||
606 | { | ||
607 | __s32 start, end; | ||
608 | |||
609 | start = (__s32)fl->fl_start; | ||
610 | if ((loff_t)start != fl->fl_start) | ||
611 | goto out_einval; | ||
612 | |||
613 | if (fl->fl_end != OFFSET_MAX) { | ||
614 | end = (__s32)fl->fl_end; | ||
615 | if ((loff_t)end != fl->fl_end) | ||
616 | goto out_einval; | ||
617 | } else | ||
618 | end = NFS_LOCK32_OFFSET_MAX; | ||
619 | |||
620 | if (start < 0 || start > end) | ||
621 | goto out_einval; | ||
622 | return 0; | ||
623 | out_einval: | ||
624 | return -EINVAL; | ||
625 | } | ||
601 | 626 | ||
602 | const struct nfs_rpc_ops nfs_v2_clientops = { | 627 | const struct nfs_rpc_ops nfs_v2_clientops = { |
603 | .version = 2, /* protocol version */ | 628 | .version = 2, /* protocol version */ |
@@ -630,7 +655,6 @@ const struct nfs_rpc_ops nfs_v2_clientops = { | |||
630 | .write_setup = nfs_proc_write_setup, | 655 | .write_setup = nfs_proc_write_setup, |
631 | .write_done = nfs_write_done, | 656 | .write_done = nfs_write_done, |
632 | .commit_setup = nfs_proc_commit_setup, | 657 | .commit_setup = nfs_proc_commit_setup, |
633 | .file_open = nfs_open, | ||
634 | .file_release = nfs_release, | ||
635 | .lock = nfs_proc_lock, | 658 | .lock = nfs_proc_lock, |
659 | .lock_check_bounds = nfs_lock_check_bounds, | ||
636 | }; | 660 | }; |