From: Michael Halcrow <mhalcrow@us.ibm.com>
To: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Cc: Andrew Morton <akpm@linux-foundation.org>,
ecryptfs-devel@lists.sourceforge.net,
moriai.satoshi@lab.ntt.co.jp, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2.6.23-rc1] eCryptfs: fix error handling in ecryptfs_init
Date: Thu, 2 Aug 2007 08:56:43 -0500 [thread overview]
Message-ID: <20070802135642.GH30416@halcrow.austin.ibm.com> (raw)
In-Reply-To: <200708021306.AA00225@paprika.lab.ntt.co.jp>
On Thu, Aug 02, 2007 at 10:06:19PM +0900, Ryusuke Konishi wrote:
> ecryptfs_init() exits without doing any cleanup jobs if
> ecryptfs_init_messaging() fails. In that case, eCryptfs leaves
> sysfs entries, leaks memory, and causes an invalid page fault.
> This patch fixes the problem.
>
> Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Acked-by: Michael Halcrow <mhalcrow@us.ibm.com>
> ---
> fs/ecryptfs/main.c | 18 +++++++++++++-----
> 1 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
> index e557a67..a984972 100644
> --- a/fs/ecryptfs/main.c
> +++ b/fs/ecryptfs/main.c
> @@ -813,6 +813,15 @@ out:
> return rc;
> }
>
> +static void do_sysfs_unregistration(void)
> +{
> + sysfs_remove_file(&ecryptfs_subsys.kobj,
> + &sysfs_attr_version.attr);
> + sysfs_remove_file(&ecryptfs_subsys.kobj,
> + &sysfs_attr_version_str.attr);
> + subsystem_unregister(&ecryptfs_subsys);
> +}
> +
> static int __init ecryptfs_init(void)
> {
> int rc;
> @@ -851,6 +860,9 @@ static int __init ecryptfs_init(void)
> if (rc) {
> ecryptfs_printk(KERN_ERR, "Failure occured while attempting to "
> "initialize the eCryptfs netlink socket\n");
> + do_sysfs_unregistration();
> + unregister_filesystem(&ecryptfs_fs_type);
> + ecryptfs_free_kmem_caches();
> }
> out:
> return rc;
> @@ -858,11 +870,7 @@ out:
>
> static void __exit ecryptfs_exit(void)
> {
> - sysfs_remove_file(&ecryptfs_subsys.kobj,
> - &sysfs_attr_version.attr);
> - sysfs_remove_file(&ecryptfs_subsys.kobj,
> - &sysfs_attr_version_str.attr);
> - subsystem_unregister(&ecryptfs_subsys);
> + do_sysfs_unregistration();
> ecryptfs_release_messaging(ecryptfs_transport);
> unregister_filesystem(&ecryptfs_fs_type);
> ecryptfs_free_kmem_caches();
parent reply other threads:[~2007-08-02 13:58 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <200708021306.AA00225@paprika.lab.ntt.co.jp>]
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=20070802135642.GH30416@halcrow.austin.ibm.com \
--to=mhalcrow@us.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=ecryptfs-devel@lists.sourceforge.net \
--cc=konishi.ryusuke@lab.ntt.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=moriai.satoshi@lab.ntt.co.jp \
/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®