From: Christian Engelmayer Date: Sat, 11 Jan 2014 00:57:22 +0000 (+0100) Subject: cifs: Fix memory leak in cifs_hardlink() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=abf9767c823bf57837c2032f21332a6efc38a13e;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git cifs: Fix memory leak in cifs_hardlink() Fix a potential memory leak in the cifs_hardlink() error handling path. Detected by Coverity: CID 728510, CID 728511. Signed-off-by: Christian Engelmayer Signed-off-by: Steve French --- diff --git a/fs/cifs/link.c b/fs/cifs/link.c index 92aee08483a5..28bc8ee97056 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c @@ -438,8 +438,10 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode, CIFS_MOUNT_MAP_SPECIAL_CHR); else { server = tcon->ses->server; - if (!server->ops->create_hardlink) - return -ENOSYS; + if (!server->ops->create_hardlink) { + rc = -ENOSYS; + goto cifs_hl_exit; + } rc = server->ops->create_hardlink(xid, tcon, from_name, to_name, cifs_sb); if ((rc == -EIO) || (rc == -EINVAL))