Skip to content

Commit 7a2158b

Browse files
Dan CarpenterSteve French
authored andcommitted
smb/client: Prevent error pointer dereference
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 <[email protected]> Reviewed-by: Bharath SM <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent d413eab commit 7a2158b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/smb/client/cifsacl.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,14 +1592,16 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 *pnmode,
15921592
struct smb_ntsd *pntsd = NULL; /* acl obtained from server */
15931593
struct smb_ntsd *pnntsd = NULL; /* modified acl to be sent to server */
15941594
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
1595-
struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
1595+
struct tcon_link *tlink;
15961596
struct smb_version_operations *ops;
15971597
bool mode_from_sid, id_from_sid;
1598-
bool posix = tlink_tcon(tlink)->posix_extensions;
15991598
const u32 info = 0;
1599+
bool posix;
16001600

1601+
tlink = cifs_sb_tlink(cifs_sb);
16011602
if (IS_ERR(tlink))
16021603
return PTR_ERR(tlink);
1604+
posix = tlink_tcon(tlink)->posix_extensions;
16031605

16041606
ops = tlink_tcon(tlink)->ses->server->ops;
16051607

0 commit comments

Comments
 (0)