Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 450

kernel-2.6.18-238.el5.src.rpm

From: Jeff Layton <jlayton@redhat.com>
Date: Thu, 19 Nov 2009 14:38:31 -0500
Subject: [cifs] free nativeFileSystem before allocating new one
Message-id: <1258641517-20756-5-git-send-email-jlayton@redhat.com>
Patchwork-id: 21436
O-Subject: [RHEL5.5 PATCH 04/10] BZ#500838: cifs: free nativeFileSystem field
	before allocating a new one
Bugzilla: 500838
RH-Acked-by: Peter Staubach <staubach@redhat.com>

(Upstream commit 90a98b2f3f3647fb17667768a348b2b219f2a9f7)

...otherwise, we'll leak this memory if we have to reconnect (e.g. after
network failure).

Signed-off-by: Jeff Layton <jlayton@redhat.com>
CC: Stable <stable@kernel.org>
Signed-off-by: Steve French <sfrench@us.ibm.com>

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index f2dc067..e949b4e 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2805,6 +2805,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
 		strncpy(tcon->treeName, tree, MAX_TREE_SIZE);
 
 		/* mostly informational -- no need to fail on error here */
+		kfree(tcon->nativeFileSystem);
 		tcon->nativeFileSystem = cifs_strndup_from_ucs(bcc_ptr,
 						      bytes_left,
 						      smb_buffer->Flags2 &