afs: Fix key refcounting in file locking code
Fix the refcounting of the authentication keys in the file locking code.
The vnode->lock_key member points to a key on which it expects to be
holding a ref, but it isn't always given an extra ref, however.
Fixes: 0fafdc9f88
("afs: Fix file locking")
Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:
parent
4882a27cec
commit
59d49076ae
|
@ -208,7 +208,7 @@ void afs_lock_work(struct work_struct *work)
|
||||||
/* The new front of the queue now owns the state variables. */
|
/* The new front of the queue now owns the state variables. */
|
||||||
next = list_entry(vnode->pending_locks.next,
|
next = list_entry(vnode->pending_locks.next,
|
||||||
struct file_lock, fl_u.afs.link);
|
struct file_lock, fl_u.afs.link);
|
||||||
vnode->lock_key = afs_file_key(next->fl_file);
|
vnode->lock_key = key_get(afs_file_key(next->fl_file));
|
||||||
vnode->lock_type = (next->fl_type == F_RDLCK) ? AFS_LOCK_READ : AFS_LOCK_WRITE;
|
vnode->lock_type = (next->fl_type == F_RDLCK) ? AFS_LOCK_READ : AFS_LOCK_WRITE;
|
||||||
vnode->lock_state = AFS_VNODE_LOCK_WAITING_FOR_CB;
|
vnode->lock_state = AFS_VNODE_LOCK_WAITING_FOR_CB;
|
||||||
goto again;
|
goto again;
|
||||||
|
@ -413,7 +413,7 @@ static void afs_dequeue_lock(struct afs_vnode *vnode, struct file_lock *fl)
|
||||||
/* The new front of the queue now owns the state variables. */
|
/* The new front of the queue now owns the state variables. */
|
||||||
next = list_entry(vnode->pending_locks.next,
|
next = list_entry(vnode->pending_locks.next,
|
||||||
struct file_lock, fl_u.afs.link);
|
struct file_lock, fl_u.afs.link);
|
||||||
vnode->lock_key = afs_file_key(next->fl_file);
|
vnode->lock_key = key_get(afs_file_key(next->fl_file));
|
||||||
vnode->lock_type = (next->fl_type == F_RDLCK) ? AFS_LOCK_READ : AFS_LOCK_WRITE;
|
vnode->lock_type = (next->fl_type == F_RDLCK) ? AFS_LOCK_READ : AFS_LOCK_WRITE;
|
||||||
vnode->lock_state = AFS_VNODE_LOCK_WAITING_FOR_CB;
|
vnode->lock_state = AFS_VNODE_LOCK_WAITING_FOR_CB;
|
||||||
afs_lock_may_be_available(vnode);
|
afs_lock_may_be_available(vnode);
|
||||||
|
|
|
@ -545,6 +545,8 @@ void afs_evict_inode(struct inode *inode)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
afs_put_permits(rcu_access_pointer(vnode->permit_cache));
|
afs_put_permits(rcu_access_pointer(vnode->permit_cache));
|
||||||
|
key_put(vnode->lock_key);
|
||||||
|
vnode->lock_key = NULL;
|
||||||
_leave("");
|
_leave("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue