summaryrefslogtreecommitdiffstats
path: root/fs/ubifs
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2017-02-10 17:46:01 +0100
committerRichard Weinberger <richard@nod.at>2017-03-30 09:27:27 +0200
commit63ed657362509b54635fe17af980fba722a008d8 (patch)
treec6615e75adc6c4380270bae40ad1d0a886bd55d5 /fs/ubifs
parent9cd9a21ce070be8a918ffd3381468315a7a76ba6 (diff)
downloadlinux-stable-63ed657362509b54635fe17af980fba722a008d8.tar.gz
linux-stable-63ed657362509b54635fe17af980fba722a008d8.tar.bz2
linux-stable-63ed657362509b54635fe17af980fba722a008d8.zip
ubifs: Fix memory leak in error path in ubifs_mknod
When fscrypt_setup_filename() fails we have to free dev. Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/dir.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 30825d882aa9..51929be655c3 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -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));