From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4068E45A2BC; Fri, 9 Oct 2026 14:40:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791556814; cv=none; b=hQBn+ljAqvZDrzesAqQp7pKHOjNYYsvIfgpnQNa2crXEX6HL5GK5GjX2BV1UDqM++BIsRIkEhzpgIjajHKngZAWlNQHDczZNJeWqe4Q4jAdG9WAspjVbhqYZiz4lQaTDxISWxol/8H6S+pIROijludY211sxrX2mEi81gie0vGA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791556814; c=relaxed/simple; bh=6R37lbfwiEfNUYX2gRscCVUkmjkgzuPP2lY7AUAi7ts=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LLhnBi4Aa1LNIC5iNDZmRC4DnQvuq0SuNvQsVzV5l44oxXYEN2H9EhqB/v06oGdkpQZMCJWETWBuGvBrxZPYPalabUgmEtbXMDQZV3doWtkIamRg/bWD9Do3syxyyLyCn5FNTq7msWg/KHMJ/TbuCDV8ubN30smbp7H1Oh1CLLY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=O31izFnR; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="O31izFnR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A7CD1F000FF; Fri, 9 Oct 2026 14:40:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791556812; bh=yXP8XCOw8HGPjOTuSgdXfme+0yhxZsMs2JBVfdLf2yM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=O31izFnRn4fKVuzj1WQbXn5wVCFk+zy5uNR2N5rl13Fl7Cs6Q9VcbKsof4wusrVOd EASJXs11/hk6I39CsLCD7Oed8+BBjoyQ2yeiIBHW9gIib1ZCr5ELEzINjCtklEWVfl vKvNw5TXz2DIMVt55t6y2i6yRCv6+opRcYqhx62Q= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Frank Sorenson , Namjae Jeon , Paulo Alcantara Subject: [PATCH 6.18 297/403] smb: client: split cifsFileInfo bitfields to avoid shared-byte RMW races Date: Fri, 9 Oct 2026 16:10:58 +0200 Message-ID: <20261009140959.150790987@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009140952.119038291@linuxfoundation.org> References: <20261009140952.119038291@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Frank Sorenson commit 19465a9aeb664f1d710d0d22c07c31bfb7c85446 upstream. The invalidHandle, swapfile, oplock_break_cancelled, offload, and status_file_deleted fields are stored in the same bitfield byte in struct cifsFileInfo, but are updated in different code paths that may run simultaneously, and are protected by different locks. Since bitfield assignments generate byte-level read-modify-write operations, a modification to one flag can overwrite a concurrent modification to another flag. To avoid these races, convert these flags from a bitfield to separate bool fields. Closes: https://lore.kernel.org/r/7689764e-c0f6-4016-9557-b54cf4a3de4e@redhat.com Fixes: 3bc303c254335 ("cifs: convert oplock breaks to use slow_work facility (try #4)") Fixes: 4e8aea30f7751 ("smb3: enable swap on SMB3 mounts") Fixes: ffceb7640cbfe ("smb: client: do not defer close open handles to deleted files") Fixes: 173217bd73365 ("smb3: retrying on failed server close") Signed-off-by: Frank Sorenson Cc: stable@vger.kernel.org Reviewed-by: Namjae Jeon Signed-off-by: Paulo Alcantara Signed-off-by: Greg Kroah-Hartman --- fs/smb/client/cifsglob.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/fs/smb/client/cifsglob.h +++ b/fs/smb/client/cifsglob.h @@ -1457,11 +1457,11 @@ struct cifsFileInfo { struct dentry *dentry; struct tcon_link *tlink; unsigned int f_flags; - bool invalidHandle:1; /* file closed via session abend */ - bool swapfile:1; - bool oplock_break_cancelled:1; - bool status_file_deleted:1; /* file has been deleted */ - bool offload:1; /* offload final part of _put to a wq */ + bool invalidHandle; /* file closed via session abend */ + bool swapfile; + bool oplock_break_cancelled; + bool status_file_deleted; /* file has been deleted */ + bool offload; /* offload final part of _put to a wq */ __u16 oplock_epoch; /* epoch from the lease break */ __u32 oplock_level; /* oplock/lease level from the lease break */ int count;