Fix a potential memory leak in the cifs_hardlink() error handling path.
Detected by Coverity: CID 728510, CID 728511.

Signed-off-by: Christian Engelmayer <[email protected]>
---
 fs/cifs/link.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index 92aee08..28bc8ee 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))
-- 
1.8.3.2
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to