Re: [PATCH] configfs: add missing mutex_unlock()

From: Arnd Bergmann
Date: Sun Mar 04 2007 - 09:10:37 EST


On Sunday 04 March 2007 14:38:12 Akinobu Mita wrote:
> @@ -1168,8 +1168,10 @@ int configfs_register_subsystem(struct c
>  
>         err = -ENOMEM;
>         dentry = d_alloc(configfs_sb->s_root, &name);
> -       if (!dentry)
> +       if (!dentry) {
> +               mutex_unlock(&configfs_sb->s_root->d_inode->i_mutex);
>                 goto out_release;
> +       }
>  
>         d_add(dentry, NULL);

This should be changed to jump to a new exit point, before the mutex_unlock
at the end of the function. Having multiple places in the function that
release the same lock easily leads to the kind of bug you are fixing here.

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