[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1486322541-8206-66-git-send-email-w@1wt.eu>
Date: Sun, 5 Feb 2017 20:19:47 +0100
From: Willy Tarreau <w@....eu>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
linux@...ck-us.net
Cc: Richard Weinberger <richard@....at>, Willy Tarreau <w@....eu>
Subject: [PATCH 3.10 165/319] UBIFS: Fix possible memory leak in ubifs_readdir()
From: Richard Weinberger <richard@....at>
commit aeeb14f763917ccf639a602cfbeee6957fd944a2 upstream.
If ubifs_tnc_next_ent() returns something else than -ENOENT
we leak file->private_data.
Signed-off-by: Richard Weinberger <richard@....at>
Reviewed-by: David Gstir <david@...ma-star.at>
Signed-off-by: Willy Tarreau <w@....eu>
---
fs/ubifs/dir.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 605af51..879242b 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -467,13 +467,14 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir)
}
out:
+ kfree(file->private_data);
+ file->private_data = NULL;
+
if (err != -ENOENT) {
ubifs_err("cannot find next direntry, error %d", err);
return err;
}
- kfree(file->private_data);
- file->private_data = NULL;
/* 2 is a special value indicating that there are no more direntries */
file->f_pos = 2;
return 0;
--
2.8.0.rc2.1.gbe9624a
Powered by blists - more mailing lists