From patchwork Wed Nov 10 21:06:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oskar Schirmer X-Patchwork-Id: 315732 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAALl1RZ020102 for ; Wed, 10 Nov 2010 21:47:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757078Ab0KJVrB (ORCPT ); Wed, 10 Nov 2010 16:47:01 -0500 Received: from skyrme.org ([193.175.80.135]:44538 "EHLO skyrme.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757067Ab0KJVrA (ORCPT ); Wed, 10 Nov 2010 16:47:00 -0500 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 10 Nov 2010 21:47:02 +0000 (UTC) X-Greylist: delayed 2442 seconds by postgrey-1.27 at vger.kernel.org; Wed, 10 Nov 2010 16:47:00 EST Received: from p5484c669.dip.t-dialin.net ([84.132.198.105] helo=curry.scara.com) by skyrme.org with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1PGHsM-0001C3-0A for linux-cifs@vger.kernel.org; Wed, 10 Nov 2010 21:06:38 +0000 Received: (qmail 7065 invoked by uid 500); 10 Nov 2010 21:06:13 -0000 From: Oskar Schirmer To: Steve French Cc: stable@kernel.org, linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org, Suresh Jayaraman , Andrew Hendry , Oskar Schirmer Subject: [PATCH] cifs: fix another memleak, in cifs_root_iget Date: Wed, 10 Nov 2010 21:06:13 +0000 Message-Id: <1289423173-7044-1-git-send-email-oskar@scara.com> X-Mailer: git-send-email 1.6.0.3 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index ef3a55b..ff7d299 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -881,8 +881,10 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) rc = cifs_get_inode_info(&inode, full_path, NULL, sb, xid, NULL); - if (!inode) - return ERR_PTR(rc); + if (!inode) { + inode = ERR_PTR(rc); + goto out; + } #ifdef CONFIG_CIFS_FSCACHE /* populate tcon->resource_id */ @@ -898,13 +900,11 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) inode->i_uid = cifs_sb->mnt_uid; inode->i_gid = cifs_sb->mnt_gid; } else if (rc) { - kfree(full_path); - _FreeXid(xid); iget_failed(inode); - return ERR_PTR(rc); + inode = ERR_PTR(rc); } - +out: kfree(full_path); /* can not call macro FreeXid here since in a void func * TODO: This is no longer true