Commit 8ba74517e4cc30e6fd92925fd134b820cbeb9249
Exists in
master
and in
16 other branches
Merge branch 'for-3.14' of git://linux-nfs.org/~bfields/linux
Pull two nfsd bugfixes from Bruce Fields. * 'for-3.14' of git://linux-nfs.org/~bfields/linux: lockd: send correct lock when granting a delayed lock. nfsd4: fix acl buffer overrun
Showing 2 changed files Side-by-side Diff
fs/lockd/svclock.c
... | ... | @@ -779,6 +779,7 @@ |
779 | 779 | struct nlm_file *file = block->b_file; |
780 | 780 | struct nlm_lock *lock = &block->b_call->a_args.lock; |
781 | 781 | int error; |
782 | + loff_t fl_start, fl_end; | |
782 | 783 | |
783 | 784 | dprintk("lockd: grant blocked lock %p\n", block); |
784 | 785 | |
785 | 786 | |
786 | 787 | |
... | ... | @@ -796,9 +797,16 @@ |
796 | 797 | } |
797 | 798 | |
798 | 799 | /* Try the lock operation again */ |
800 | + /* vfs_lock_file() can mangle fl_start and fl_end, but we need | |
801 | + * them unchanged for the GRANT_MSG | |
802 | + */ | |
799 | 803 | lock->fl.fl_flags |= FL_SLEEP; |
804 | + fl_start = lock->fl.fl_start; | |
805 | + fl_end = lock->fl.fl_end; | |
800 | 806 | error = vfs_lock_file(file->f_file, F_SETLK, &lock->fl, NULL); |
801 | 807 | lock->fl.fl_flags &= ~FL_SLEEP; |
808 | + lock->fl.fl_start = fl_start; | |
809 | + lock->fl.fl_end = fl_end; | |
802 | 810 | |
803 | 811 | switch (error) { |
804 | 812 | case 0: |
fs/nfsd/nfs4acl.c
... | ... | @@ -151,17 +151,15 @@ |
151 | 151 | pacl = posix_acl_from_mode(inode->i_mode, GFP_KERNEL); |
152 | 152 | if (IS_ERR(pacl)) |
153 | 153 | return PTR_ERR(pacl); |
154 | - /* allocate for worst case: one (deny, allow) pair each: */ | |
155 | - size += 2 * pacl->a_count; | |
156 | 154 | } |
155 | + /* allocate for worst case: one (deny, allow) pair each: */ | |
156 | + size += 2 * pacl->a_count; | |
157 | 157 | |
158 | 158 | if (S_ISDIR(inode->i_mode)) { |
159 | 159 | flags = NFS4_ACL_DIR; |
160 | 160 | dpacl = get_acl(inode, ACL_TYPE_DEFAULT); |
161 | 161 | if (dpacl) |
162 | 162 | size += 2 * dpacl->a_count; |
163 | - } else { | |
164 | - dpacl = NULL; | |
165 | 163 | } |
166 | 164 | |
167 | 165 | *acl = nfs4_acl_new(size); |
... | ... | @@ -170,8 +168,7 @@ |
170 | 168 | goto out; |
171 | 169 | } |
172 | 170 | |
173 | - if (pacl) | |
174 | - _posix_to_nfsv4_one(pacl, *acl, flags & ~NFS4_ACL_TYPE_DEFAULT); | |
171 | + _posix_to_nfsv4_one(pacl, *acl, flags & ~NFS4_ACL_TYPE_DEFAULT); | |
175 | 172 | |
176 | 173 | if (dpacl) |
177 | 174 | _posix_to_nfsv4_one(dpacl, *acl, flags | NFS4_ACL_TYPE_DEFAULT); |