afs: Prevent callback expiry timer overflow
get_seconds() returns real wall-clock seconds. On 32-bit systems this value will overflow in year 2038 and beyond. This patch changes afs_vnode record to use ktime_get_real_seconds() instead, for the fields cb_expires and cb_expires_at. Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com> Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:

committed by
David Howells

parent
8a79790bf0
commit
56e714312e
@@ -246,12 +246,13 @@ struct inode *afs_iget(struct super_block *sb, struct key *key,
|
||||
vnode->cb_version = 0;
|
||||
vnode->cb_expiry = 0;
|
||||
vnode->cb_type = 0;
|
||||
vnode->cb_expires = get_seconds();
|
||||
vnode->cb_expires = ktime_get_real_seconds();
|
||||
} else {
|
||||
vnode->cb_version = cb->version;
|
||||
vnode->cb_expiry = cb->expiry;
|
||||
vnode->cb_type = cb->type;
|
||||
vnode->cb_expires = vnode->cb_expiry + get_seconds();
|
||||
vnode->cb_expires = vnode->cb_expiry +
|
||||
ktime_get_real_seconds();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,7 +325,7 @@ int afs_validate(struct afs_vnode *vnode, struct key *key)
|
||||
!test_bit(AFS_VNODE_CB_BROKEN, &vnode->flags) &&
|
||||
!test_bit(AFS_VNODE_MODIFIED, &vnode->flags) &&
|
||||
!test_bit(AFS_VNODE_ZAP_DATA, &vnode->flags)) {
|
||||
if (vnode->cb_expires < get_seconds() + 10) {
|
||||
if (vnode->cb_expires < ktime_get_real_seconds() + 10) {
|
||||
_debug("callback expired");
|
||||
set_bit(AFS_VNODE_CB_BROKEN, &vnode->flags);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user