From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Dan Carpenter <dan.carpenter@linaro.org>,
Bharath SM <bharathsm@microsoft.com>,
Steve French <stfrench@microsoft.com>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.12.y 1/3] smb/client: Prevent error pointer dereference
Date: Wed, 25 Nov 2026 23:23:34 -0500 [thread overview]
Message-ID: <20261126042229.1926905-1-sashal@kernel.org> (raw)
In-Reply-To: <2026112506-zipfile-subpanel-c0d3@gregkh>
From: Dan Carpenter <dan.carpenter@linaro.org>
[ Upstream commit 7a2158b73c36903e8822dae5442c27d6d0e1014b ]
The cifs_sb_tlink() function can return error pointers, but this code
dereferences it before checking for error pointers. Re-order the code
to fix that.
Fixes: 0f9b6b045bb2 ("fs/smb/client: implement chmod() for SMB3 POSIX Extensions")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Bharath SM <bharathsm@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Stable-dep-of: ffb59029c0d5 ("smb: client: validate descriptor headers before query result allocation")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/client/cifsacl.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/smb/client/cifsacl.c b/fs/smb/client/cifsacl.c
index ac2e09eacabc7..dd88f0ad23915 100644
--- a/fs/smb/client/cifsacl.c
+++ b/fs/smb/client/cifsacl.c
@@ -1734,14 +1734,16 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 *pnmode,
struct smb_ntsd *pntsd = NULL; /* acl obtained from server */
struct smb_ntsd *pnntsd = NULL; /* modified acl to be sent to server */
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
- struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
+ struct tcon_link *tlink;
struct smb_version_operations *ops;
bool mode_from_sid, id_from_sid;
- bool posix = tlink_tcon(tlink)->posix_extensions;
const u32 info = 0;
+ bool posix;
+ tlink = cifs_sb_tlink(cifs_sb);
if (IS_ERR(tlink))
return PTR_ERR(tlink);
+ posix = tlink_tcon(tlink)->posix_extensions;
ops = tlink_tcon(tlink)->ses->server->ops;
--
2.53.0
next prev parent reply other threads:[~2026-11-26 4:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 11:13 FAILED: patch "[PATCH] smb: client: validate descriptor headers before query result" failed to apply to 6.12-stable tree gregkh
2026-11-26 4:23 ` Sasha Levin [this message]
2026-11-26 4:23 ` [PATCH 6.12.y 2/3] cifs: Fix getting DACL-only xattr system.cifs_acl and system.smb3_acl Sasha Levin
2026-11-26 4:23 ` [PATCH 6.12.y 3/3] smb: client: validate descriptor headers before query result allocation Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261126042229.1926905-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=bharathsm@microsoft.com \
--cc=dan.carpenter@linaro.org \
--cc=stable@vger.kernel.org \
--cc=stfrench@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox