]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.4.29/fs-cifs-cifs_dfs_ref.c-fix-potential-memory-leakage.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.4.29 / fs-cifs-cifs_dfs_ref.c-fix-potential-memory-leakage.patch
1 From 10b8c7dff5d3633b69e77f57d404dab54ead3787 Mon Sep 17 00:00:00 2001
2 From: Cong Ding <dinggnu@gmail.com>
3 Date: Tue, 22 Jan 2013 19:20:58 -0500
4 Subject: fs/cifs/cifs_dfs_ref.c: fix potential memory leakage
5
6 From: Cong Ding <dinggnu@gmail.com>
7
8 commit 10b8c7dff5d3633b69e77f57d404dab54ead3787 upstream.
9
10 When it goes to error through line 144, the memory allocated to *devname is
11 not freed, and the caller doesn't free it either in line 250. So we free the
12 memroy of *devname in function cifs_compose_mount_options() when it goes to
13 error.
14
15 Signed-off-by: Cong Ding <dinggnu@gmail.com>
16 Reviewed-by: Jeff Layton <jlayton@redhat.com>
17 Signed-off-by: Steve French <smfrench@gmail.com>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19
20 ---
21 fs/cifs/cifs_dfs_ref.c | 2 ++
22 1 file changed, 2 insertions(+)
23
24 --- a/fs/cifs/cifs_dfs_ref.c
25 +++ b/fs/cifs/cifs_dfs_ref.c
26 @@ -226,6 +226,8 @@ compose_mount_options_out:
27 compose_mount_options_err:
28 kfree(mountdata);
29 mountdata = ERR_PTR(rc);
30 + kfree(*devname);
31 + *devname = NULL;
32 goto compose_mount_options_out;
33 }
34