cifs: fix reference leak for tlink
Subsystems (2)
PATCH 1/1 cifs: fix reference leak for tlink
Don't leak a reference to tlink during the NOTIFY ioctl
Signed-off-by Ronnie Sahlberg <[email protected]>
--- fs/cifs/ioctl.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
fs/cifs/ioctl.c +8 -1
@@ -169,6 +169,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)unsigned int xid;struct cifsFileInfo *pSMBFile = filep->private_data;struct cifs_tcon *tcon; +struct tcon_link *tlink;struct cifs_sb_info *cifs_sb;__u64 ExtAttrBits =0 ;__u64 caps;
@@ -307,13 +308,19 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)break ; } cifs_sb =CIFS_SB (inode->i_sb); - tcon =tlink_tcon (cifs_sb_tlink (cifs_sb)); + tlink =cifs_sb_tlink (cifs_sb); +if (IS_ERR (tlink)) { + rc =PTR_ERR (tlink); +break ; + } + tcon =tlink_tcon (tlink);if (tcon && tcon->ses->server->ops->notify) { rc = tcon->ses->server->ops->notify (xid, filep, (void __user *)arg);cifs_dbg (FYI ,"ioctl notify rc %d\n" , rc); }else rc = -EOPNOTSUPP ; +cifs_put_tlink (tlink);break ;default :cifs_dbg (FYI ,"unsupported ioctl\n" );
Signature · 1 line
2.13.6
Reviewed-by Aurelien Aptel <[email protected]>
Signature · 4 lines
Aurélien Aptel / SUSE Labs Samba Team GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
Steve French
Appliedmerged into cifs-2.6.git for-next
Quoted 9 lines · Aurélien Aptel
Reviewed-by Aurelien Aptel <[email protected]>--
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
Signature · 3 lines
Thanks, Steve
http://smb3-test-rhel-75.southcentralus.cloudapp.azure.com/#/builders/2/builds/367
running regression tests with this and the other 3 patches
Quoted 44 lines · Ronnie Sahlberg
Don't leak a reference to tlink during the NOTIFY ioctl
Signed-off-by Ronnie Sahlberg <[email protected]>--- fs/cifs/ioctl.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)fs/cifs/ioctl.c +8
-2@@ -169,6 +169,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)unsigned int xid;struct cifsFileInfo *pSMBFile = filep->private_data;struct cifs_tcon *tcon; +struct tcon_link *tlink;struct cifs_sb_info *cifs_sb;__u64 ExtAttrBits =0 ;__u64 caps;@@ -307,13 +308,19 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)break ; } cifs_sb =CIFS_SB (inode->i_sb); - tcon =tlink_tcon (cifs_sb_tlink (cifs_sb)); + tlink =cifs_sb_tlink (cifs_sb); +if (IS_ERR (tlink)) { + rc =PTR_ERR (tlink); +break ; + } + tcon =tlink_tcon (tlink);if (tcon && tcon->ses->server->ops->notify) { rc = tcon->ses->server->ops->notify (xid, filep, (void __user *)arg);cifs_dbg (FYI ,"ioctl notify rc %d\n" , rc); }else rc = -EOPNOTSUPP ; +cifs_put_tlink (tlink);break ;default :cifs_dbg (FYI ,"unsupported ioctl\n" ); --2.13.6
Signature · 3 lines
Thanks, Steve