Skip to content

Commit a77592a

Browse files
Ronnie Sahlbergsmfrench
authored andcommitted
cifs: fix reference leak for tlink
Don't leak a reference to tlink during the NOTIFY ioctl Signed-off-by: Ronnie Sahlberg <[email protected]> Signed-off-by: Steve French <[email protected]> Reviewed-by: Aurelien Aptel <[email protected]> CC: Stable <[email protected]> # v5.6+
1 parent 8668115 commit a77592a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

fs/cifs/ioctl.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
169169
unsigned int xid;
170170
struct cifsFileInfo *pSMBFile = filep->private_data;
171171
struct cifs_tcon *tcon;
172+
struct tcon_link *tlink;
172173
struct cifs_sb_info *cifs_sb;
173174
__u64 ExtAttrBits = 0;
174175
__u64 caps;
@@ -307,13 +308,19 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
307308
break;
308309
}
309310
cifs_sb = CIFS_SB(inode->i_sb);
310-
tcon = tlink_tcon(cifs_sb_tlink(cifs_sb));
311+
tlink = cifs_sb_tlink(cifs_sb);
312+
if (IS_ERR(tlink)) {
313+
rc = PTR_ERR(tlink);
314+
break;
315+
}
316+
tcon = tlink_tcon(tlink);
311317
if (tcon && tcon->ses->server->ops->notify) {
312318
rc = tcon->ses->server->ops->notify(xid,
313319
filep, (void __user *)arg);
314320
cifs_dbg(FYI, "ioctl notify rc %d\n", rc);
315321
} else
316322
rc = -EOPNOTSUPP;
323+
cifs_put_tlink(tlink);
317324
break;
318325
default:
319326
cifs_dbg(FYI, "unsupported ioctl\n");

0 commit comments

Comments
 (0)