]> www.infradead.org Git - users/dwmw2/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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:19:20 +0000 (16:19 +0200)
[ Upstream commit 98b41ffe0afdfeaa1439a5d6bd2db4a94277e31b ]

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>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/lockd/svcsubs.c

index 3515f17eaf3fb5bc1deda4c4e7352546f135c80b..e3b6229e7ae5cdd807198a47bbb8e8546a6ff3ba 100644 (file)
@@ -210,7 +210,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))
@@ -265,7 +265,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;