]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
lockd: use locks_inode_context helper
authorJeff Layton <jlayton@kernel.org>
Wed, 16 Nov 2022 14:19:43 +0000 (09:19 -0500)
committerJeff Layton <jlayton@kernel.org>
Wed, 30 Nov 2022 10:08:10 +0000 (05:08 -0500)
lockd currently doesn't access i_flctx safely. This requires a
smp_load_acquire, as the pointer is set via cmpxchg (a release
operation).

Cc: Trond Myklebust <trond.myklebust@hammerspace.com>
Cc: Anna Schumaker <anna@kernel.org>
Cc: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
fs/lockd/svcsubs.c

index e1c4617de7714735302e5889aaf2cb80d045d5cf..720684345817c82b0d85ec93fe5f39a254076b85 100644 (file)
@@ -207,7 +207,7 @@ nlm_traverse_locks(struct nlm_host *host, struct nlm_file *file,
 {
        struct inode     *inode = nlmsvc_file_inode(file);
        struct file_lock *fl;
-       struct file_lock_context *flctx = inode->i_flctx;
+       struct file_lock_context *flctx = locks_inode_context(inode);
        struct nlm_host  *lockhost;
 
        if (!flctx || list_empty_careful(&flctx->flc_posix))
@@ -262,7 +262,7 @@ nlm_file_inuse(struct nlm_file *file)
 {
        struct inode     *inode = nlmsvc_file_inode(file);
        struct file_lock *fl;
-       struct file_lock_context *flctx = inode->i_flctx;
+       struct file_lock_context *flctx = locks_inode_context(inode);
 
        if (file->f_count || !list_empty(&file->f_blocks) || file->f_shares)
                return 1;