Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1578729 > unrolled thread

[PATCH] ubifs: Fix memory leak in error path in ubifs_mknod

Started byRichard Weinberger <richard@nod.at>
First post2017-02-10 20:20 +0100
Last post2017-02-10 20:20 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] ubifs: Fix memory leak in error path in ubifs_mknod Richard Weinberger <richard@nod.at> - 2017-02-10 20:20 +0100

#1578729 — [PATCH] ubifs: Fix memory leak in error path in ubifs_mknod

FromRichard Weinberger <richard@nod.at>
Date2017-02-10 20:20 +0100
Subject[PATCH] ubifs: Fix memory leak in error path in ubifs_mknod
Message-ID<t9oTD-7BA-1@gated-at.bofh.it>
When fscrypt_setup_filename() fails we have to free dev.

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 fs/ubifs/dir.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 528369f3e472..e164782f8bc8 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));
 
-- 
2.10.2

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web