From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
Julia Lawall <julia@diku.dk>,
Tyler Hicks <tyhicks@linux.vnet.ibm.com>
Subject: [06/11] fs/ecryptfs/file.c: introduce missing free
Date: Wed, 11 Aug 2010 16:45:45 -0700 [thread overview]
Message-ID: <20100811234625.450905833@clark.site> (raw)
In-Reply-To: <20100811234809.GA676@kroah.com>
2.6.27-stable review patch. If anyone has any objections, please let us know.
------------------
From: Julia Lawall <julia@diku.dk>
commit ceeab92971e8af05c1e81a4ff2c271124b55bb9b upstream.
The comments in the code indicate that file_info should be released if the
function fails. This releasing is done at the label out_free, not out.
The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@r exists@
local idexpression x;
statement S;
expression E;
identifier f,f1,l;
position p1,p2;
expression *ptr != NULL;
@@
x@p1 = kmem_cache_zalloc(...);
...
if (x == NULL) S
<... when != x
when != if (...) { <+...x...+> }
(
x->f1 = E
|
(x->f1 == NULL || ...)
|
f(...,x->f1,...)
)
...>
(
return <+...x...+>;
|
return@p2 ...;
)
@script:python@
p1 << r.p1;
p2 << r.p2;
@@
print "* file: %s kmem_cache_zalloc %s" % (p1[0].file,p1[0].line)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
fs/ecryptfs/file.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -199,7 +199,7 @@ static int ecryptfs_open(struct inode *i
"the persistent file for the dentry with name "
"[%s]; rc = [%d]\n", __func__,
ecryptfs_dentry->d_name.name, rc);
- goto out;
+ goto out_free;
}
}
if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_RDONLY)
@@ -207,7 +207,7 @@ static int ecryptfs_open(struct inode *i
rc = -EPERM;
printk(KERN_WARNING "%s: Lower persistent file is RO; eCryptfs "
"file must hence be opened RO\n", __func__);
- goto out;
+ goto out_free;
}
ecryptfs_set_file_lower(
file, ecryptfs_inode_to_private(inode)->lower_file);
next prev parent reply other threads:[~2010-08-11 23:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-11 23:48 [00/11] 2.6.27.51-stable review Greg KH
2010-08-11 23:45 ` [01/11] nvram: Fix write beyond end condition; prove to gcc copy is safe Greg KH
2010-08-11 23:45 ` [02/11] splice: fix misuse of SPLICE_F_NONBLOCK Greg KH
2010-08-11 23:45 ` [03/11] PCI: disable MSI on VIA K8M800 Greg KH
2010-08-11 23:45 ` [04/11] md/raid10: fix deadlock with unaligned read during resync Greg KH
2010-08-11 23:45 ` [05/11] eCryptfs: Handle ioctl calls with unlocked and compat functions Greg KH
2010-08-11 23:45 ` Greg KH [this message]
2010-08-11 23:45 ` [07/11] signalfd: fill in ssi_int for posix timers and message queues Greg KH
2010-08-11 23:45 ` [08/11] jfs: dont allow os2 xattr namespace overlap with others Greg KH
2010-08-11 23:45 ` [09/11] xen: drop xen_sched_clock in favour of using plain wallclock time Greg KH
2010-08-11 23:45 ` [10/11] bdi: register sysfs bdi device only once per queue Greg KH
2010-08-11 23:45 ` [11/11] mm/backing-dev.c: remove recently-added WARN_ON() Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100811234625.450905833@clark.site \
--to=gregkh@suse.de \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=julia@diku.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=stable-review@kernel.org \
--cc=stable@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=tyhicks@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®