diff options
author | Paulo Alcantara <pc@manguebit.com> | 2023-06-19 16:52:01 -0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2023-06-19 18:16:26 -0500 |
commit | fc1bd51d110e206da5bee07e889d285c267a6874 (patch) | |
tree | c81c4f114f75d988ad0aa53c6e7b82427a233414 /fs/smb | |
parent | dc765027ed2941985fbb8ef86139e6289b36fc43 (diff) | |
download | linux-fc1bd51d110e206da5bee07e889d285c267a6874.tar.gz linux-fc1bd51d110e206da5bee07e889d285c267a6874.tar.bz2 linux-fc1bd51d110e206da5bee07e889d285c267a6874.zip |
smb: client: fix warning in cifs_match_super()
Fix potential dereference of ERR_PTR @tlink as reported by kernel test
robot
fs/smb/client/connect.c:2775 cifs_match_super() error: 'tlink'
dereferencing possible ERR_PTR()
Link: https://lore.kernel.org/all/202306170124.CtQqzf0I-lkp@intel.com/
Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/smb')
-rw-r--r-- | fs/smb/client/connect.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index 9d16626e7a66..f9e0b59802d5 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -2767,8 +2767,9 @@ cifs_match_super(struct super_block *sb, void *data) } tlink = cifs_get_tlink(cifs_sb_master_tlink(cifs_sb)); - if (tlink == NULL) { - /* can not match superblock if tlink were ever null */ + if (IS_ERR_OR_NULL(tlink)) { + pr_warn_once("%s: skip super matching due to bad tlink(%p)\n", + __func__, tlink); spin_unlock(&cifs_tcp_ses_lock); return 0; } |