lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4D6D7673.9070508@gmail.com>
Date:	Tue, 01 Mar 2011 23:42:59 +0100
From:	Jiri Slaby <jirislaby@...il.com>
To:	Jiri Slaby <jslaby@...e.cz>, npiggin@...nel.dk,
	Al Viro <viro@...iv.linux.org.uk>,
	linux-fsdevel@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>
Subject: Re: OOPS in configfs when doing d_delete

On 02/22/2011 10:14 AM, Joel Becker wrote:
> On Mon, Feb 21, 2011 at 11:47:09AM +0100, Jiri Slaby wrote:
>>> 	I think you're right about the superfluous test, but I need more
>>> investigation to see what's going on.  Thanks for the report.
>>> 	What was causing attach_group() to fail?  Do you know?
>>
>> Dunno, I just modprobe'd the configfs example from Doc dir
>> (configfs_example_macros).
> 
> 	I'm going to revisit the failed example (which shouldn't fail, I
> would think).

Got it. One needs to load both of the examples. The second loaded kills
the box.

>  Can you try the following patch to safely handle the
> failure rather than crashing the kernel?

Yes, it helps. But I need also (cut & paste):
--- a/Documentation/filesystems/configfs/configfs_example_explicit.c
+++ b/Documentation/filesystems/configfs/configfs_example_explicit.c
@@ -464,7 +464,7 @@ static int __init configfs_example_init(void)
        return 0;

 out_unregister:
-       for (; i >= 0; i--) {
+       for (i--; i >= 0; i--) {
                configfs_unregister_subsystem(example_subsys[i]);
        }

--- a/Documentation/filesystems/configfs/configfs_example_macros.c
+++ b/Documentation/filesystems/configfs/configfs_example_macros.c
@@ -427,7 +427,7 @@ static int __init configfs_example_init(void)
        return 0;

 out_unregister:
-       for (; i >= 0; i--) {
+       for (i--; i >= 0; i--) {
                configfs_unregister_subsystem(example_subsys[i]);
        }

> From 68bbb327c48fdcdc48b71435d19b9e899745adf0 Mon Sep 17 00:00:00 2001
> From: Joel Becker <jlbec@...lplan.org>
> Date: Tue, 22 Feb 2011 01:09:49 -0800
> Subject: [PATCH] configfs: Don't try to d_delete() negative dentries.
> 
> When configfs is faking mkdir() on its subsystem or default group
> objects, it starts by adding a negative dentry.  It then tries to
> instantiate the group.  If that should fail, it must clean up after
> itself.
> 
> I was using d_delete() here, but configfs_attach_group() promises to
> return an empty dentry on error.  d_delete() explodes with the entry
> dentry.  Let's try d_drop() instead.  The unhashing is what we want for
> our dentry.
> 
> Signed-off-by: Joel Becker <jlbec@...lplan.org>
> ---
>  fs/configfs/dir.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
> index 90ff3cb..2af26b8 100644
> --- a/fs/configfs/dir.c
> +++ b/fs/configfs/dir.c
> @@ -689,7 +689,8 @@ static int create_default_group(struct config_group *parent_group,
>  			sd = child->d_fsdata;
>  			sd->s_type |= CONFIGFS_USET_DEFAULT;
>  		} else {
> -			d_delete(child);
> +			BUG_ON(child->d_inode);
> +			d_drop(child);
>  			dput(child);
>  		}
>  	}
> @@ -1683,7 +1684,8 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
>  		err = configfs_attach_group(sd->s_element, &group->cg_item,
>  					    dentry);
>  		if (err) {
> -			d_delete(dentry);
> +			BUG_ON(dentry->d_inode);
> +			d_drop(dentry);
>  			dput(dentry);
>  		} else {
>  			spin_lock(&configfs_dirent_lock);

thanks,
-- 
js
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ