diff mbox series

cifs: add missing return value check for cifs_sb_tlink

Message ID 20230726170211.378839-1-sprasad@microsoft.com (mailing list archive)
State New, archived
Headers show
Series cifs: add missing return value check for cifs_sb_tlink | expand

Commit Message

Shyam Prasad N July 26, 2023, 5:02 p.m. UTC
From: Shyam Prasad N <sprasad@microsoft.com>

Whenever a tlink is obtained by cifs_sb_tlink, we need
to check that the tlink returned is not an error.
It was missing with the last change here.

Fixes: b3edef6b9cd0 ("cifs: allow dumping keys for directories too")
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
---
 fs/smb/client/ioctl.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/fs/smb/client/ioctl.c b/fs/smb/client/ioctl.c
index e1904b86ed96..f7160003e0ed 100644
--- a/fs/smb/client/ioctl.c
+++ b/fs/smb/client/ioctl.c
@@ -478,6 +478,11 @@  long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
 			}
 			cifs_sb = CIFS_SB(inode->i_sb);
 			tlink = cifs_sb_tlink(cifs_sb);
+			if (IS_ERR(tlink)) {
+				rc = PTR_ERR(tlink);
+				break;
+			}
+
 			tcon = tlink_tcon(tlink);
 			rc = cifs_dump_full_key(tcon, (void __user *)arg);
 			cifs_put_tlink(tlink);