From patchwork Wed Nov 16 15:17:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13045410 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25D4FC4332F for ; Wed, 16 Nov 2022 15:17:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233730AbiKPPRi (ORCPT ); Wed, 16 Nov 2022 10:17:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233587AbiKPPRf (ORCPT ); Wed, 16 Nov 2022 10:17:35 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B312C4D5FD; Wed, 16 Nov 2022 07:17:34 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4E49661E83; Wed, 16 Nov 2022 15:17:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C25FCC433D6; Wed, 16 Nov 2022 15:17:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668611853; bh=8KrKIuKkrzJCTsiPbPUqyZLF65iFtFpKOQstJ9arhYc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HCEhv/8Y/mWsgPSYs53gpC08w3XrYZJ20nGZe8Hp79eCkD5X80wAgzEnC3NfA8qr7 lYtnAqzD6AX+UK6QrRATqQPUzI2ROz0hFYo6Pom+R9EzErazlOQ4BcWe7r/dZ8U62/ iI57ksOVfMduWNBIdjzbPomvjEJgtrcQGhXA/DKUvWhGCqI9jk+dM+yJ7O+UoIyRwp NZO1uuvJaQigBjkaSMfwwoYTajtn4PtowBGK8QS1kZu/me3D5MsIStVKGcxjtE66Bk ncTlJ+HAt2gRNlqmkjWW+DimxA+11t24ePQ5KuulGPpi+6C9w4zPCS0rIzHXHcXzsy qMwhVsEvHm0wQ== From: Jeff Layton To: linux-fsdevel@vger.kernel.org Cc: linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, linux-cifs@vger.kernel.org, chuck.lever@oracle.com, viro@zeniv.linux.org.uk, hch@lst.de, Namjae Jeon , Steve French Subject: [PATCH 4/7] ksmbd: use locks_inode_context helper Date: Wed, 16 Nov 2022 10:17:23 -0500 Message-Id: <20221116151726.129217-5-jlayton@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116151726.129217-1-jlayton@kernel.org> References: <20221116151726.129217-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org 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: Namjae Jeon Cc: Steve French Signed-off-by: Jeff Layton Reviewed-by: Christoph Hellwig Acked-by: Namjae Jeon --- fs/ksmbd/vfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ksmbd/vfs.c b/fs/ksmbd/vfs.c index 8de970d6146f..f9e85d6a160e 100644 --- a/fs/ksmbd/vfs.c +++ b/fs/ksmbd/vfs.c @@ -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))