ubifs: Fix memory leak in error path in ubifs_mknod
authorRichard Weinberger <richard@nod.at>
Fri, 10 Feb 2017 16:46:01 +0000 (17:46 +0100)
committerRichard Weinberger <richard@nod.at>
Thu, 30 Mar 2017 07:27:27 +0000 (09:27 +0200)
When fscrypt_setup_filename() fails we have to free dev.

Signed-off-by: Richard Weinberger <richard@nod.at>
fs/ubifs/dir.c

index 30825d882aa94a4c2486d47581f33d1dfca1a409..51929be655c32638ff5047507e186057c16ab4e4 100644 (file)
@@ -1068,8 +1068,10 @@ static int ubifs_mknod(struct inode *dir, struct dentry *dentry,
        }
 
        err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm);
-       if (err)
+       if (err) {
+               kfree(dev);
                goto out_budg;
+       }
 
        sz_change = CALC_DENT_SIZE(fname_len(&nm));