diff options
author | David Howells <dhowells@redhat.com> | 2018-10-20 02:57:59 +0300 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2018-10-24 02:41:09 +0300 |
commit | 18ac61853cc4e44eb30e125fc8344a3b25c7b6fe (patch) | |
tree | 9565bfd8b0dec553d351ca13ce841a5e2bbeae7a /fs/afs/internal.h | |
parent | 2feeaf8433c8e68de3d0a06a0ffe7742bcd13c1a (diff) | |
download | linux-18ac61853cc4e44eb30e125fc8344a3b25c7b6fe.tar.xz |
afs: Fix callback handling
In some circumstances, the callback interest pointer is NULL, so in such a
case we can't dereference it when checking to see if the callback is
broken. This causes an oops in some circumstances.
Fix this by replacing the function that worked out the aggregate break
counter with one that actually does the comparison, and then make that
return true (ie. broken) if there is no callback interest as yet (ie. the
pointer is NULL).
Fixes: 68251f0a6818 ("afs: Fix whole-volume callback handling")
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/afs/internal.h')
-rw-r--r-- | fs/afs/internal.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/afs/internal.h b/fs/afs/internal.h index e5b596bd8acf..b60d15212975 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h @@ -776,10 +776,13 @@ static inline unsigned int afs_calc_vnode_cb_break(struct afs_vnode *vnode) return vnode->cb_break + vnode->cb_s_break + vnode->cb_v_break; } -static inline unsigned int afs_cb_break_sum(struct afs_vnode *vnode, - struct afs_cb_interest *cbi) +static inline bool afs_cb_is_broken(unsigned int cb_break, + const struct afs_vnode *vnode, + const struct afs_cb_interest *cbi) { - return vnode->cb_break + cbi->server->cb_s_break + vnode->volume->cb_v_break; + return !cbi || cb_break != (vnode->cb_break + + cbi->server->cb_s_break + + vnode->volume->cb_v_break); } /* |