Patchwork [3.5.y.z,extended,stable] Patch "fs/cifs/cifs_dfs_ref.c: fix potential memory leakage" has been added to staging queue

mail settings
Submitter Herton Ronaldo Krzesinski
Date Jan. 30, 2013, 9:58 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/217019/
State New
Headers show


Herton Ronaldo Krzesinski - Jan. 30, 2013, 9:58 p.m.
This is a note to let you know that I have just added a patch titled

    fs/cifs/cifs_dfs_ref.c: fix potential memory leakage

to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree 
which can be found at:;a=shortlog;h=refs/heads/linux-3.5.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.5.y.z tree, see



From 62c5b93ecb5b15de05dbc864287dc10f818af896 Mon Sep 17 00:00:00 2001
From: Cong Ding <>
Date: Tue, 22 Jan 2013 19:20:58 -0500
Subject: [PATCH] fs/cifs/cifs_dfs_ref.c: fix potential memory leakage

commit 10b8c7dff5d3633b69e77f57d404dab54ead3787 upstream.

When it goes to error through line 144, the memory allocated to *devname is
not freed, and the caller doesn't free it either in line 250. So we free the
memroy of *devname in function cifs_compose_mount_options() when it goes to

Signed-off-by: Cong Ding <>
Reviewed-by: Jeff Layton <>
Signed-off-by: Steve French <>
Signed-off-by: Herton Ronaldo Krzesinski <>
 fs/cifs/cifs_dfs_ref.c |    2 ++
 1 file changed, 2 insertions(+)



diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
index 6873bb6..2263144 100644
--- a/fs/cifs/cifs_dfs_ref.c
+++ b/fs/cifs/cifs_dfs_ref.c
@@ -226,6 +226,8 @@  compose_mount_options_out:
 	mountdata = ERR_PTR(rc);
+	kfree(*devname);
+	*devname = NULL;
 	goto compose_mount_options_out;