From: Richard Weinberger Date: Fri, 10 Feb 2017 16:46:01 +0000 (+0100) Subject: ubifs: Fix memory leak in error path in ubifs_mknod X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=63ed657362509b54635fe17af980fba722a008d8;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 --- 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));