ksmbd: use locks_inode_context helper
authorJeff Layton <jlayton@kernel.org>
Wed, 16 Nov 2022 13:50:52 +0000 (08:50 -0500)
committerJeff Layton <jlayton@kernel.org>
Wed, 30 Nov 2022 10:08:10 +0000 (05:08 -0500)
ksmbd currently doesn't access i_flctx safely. This requires a
smp_load_acquire, as the pointer is set via cmpxchg (a release
operation).

Cc: Steve French <sfrench@samba.org>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
fs/ksmbd/vfs.c

index 8de970d..f9e85d6 100644 (file)
@@ -321,7 +321,7 @@ static int check_lock_range(struct file *filp, loff_t start, loff_t end,
                            unsigned char type)
 {
        struct file_lock *flock;
-       struct file_lock_context *ctx = file_inode(filp)->i_flctx;
+       struct file_lock_context *ctx = locks_inode_context(file_inode(filp));
        int error = 0;
 
        if (!ctx || list_empty_careful(&ctx->flc_posix))