On Fri, 2012-10-26 at 11:13 +0100, Alan Cox wrote:
> On Fri, 26 Oct 2012 08:51:46 +0100
> Matt Fleming <[email protected]> wrote:
>
> > From: "Lee, Chun-Yi" <[email protected]>
> >
> > UEFI variable filesystem need a new mount point, so this patch add
> > efivars kobject to efi_kobj for create a /sys/firmware/efi/efivars
> > folder.
> >
> > Cc: Matthew Garrett <[email protected]>
> > Cc: H. Peter Anvin <[email protected]>
> > Signed-off-by: Lee, Chun-Yi <[email protected]>
> > Signed-off-by: Jeremy Kerr <[email protected]>
> > Signed-off-by: Matt Fleming <[email protected]>
> > ---
> > drivers/firmware/efivars.c | 11 +++++++++++
> > include/linux/efi.h | 1 +
> > 2 files changed, 12 insertions(+)
> >
> > diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
> > index 6d43bbd..4b12a8fd 100644
> > --- a/drivers/firmware/efivars.c
> > +++ b/drivers/firmware/efivars.c
> > @@ -1527,6 +1527,7 @@ void unregister_efivars(struct efivars *efivars)
> > sysfs_remove_bin_file(&efivars->kset->kobj, efivars->del_var);
> > kfree(efivars->new_var);
> > kfree(efivars->del_var);
> > + kobject_put(efivars->kobject);
>
> This makes no sense - you already always unregister the kset in
> register_efivars ?
Crap. Yes, you're completely right. Thanks Alan.
Joey, this chunk of your patch is incorrect,
@@ -1558,6 +1559,13 @@ int register_efivars(struct efivars *efivars,
goto out;
}
+ efivars->kobject = kobject_create_and_add("efivars", parent_kobj);
+ if (!efivars->kobject) {
+ pr_err("efivars: Subsystem registration failed.\n");
+ error = -ENOMEM;
+ goto err_unreg_vars;
+ }
+
/*
* Per EFI spec, the maximum storage allocated for both
* the variable name and variable data is 1024 bytes.
@@ -1602,6 +1610,9 @@ int register_efivars(struct efivars *efivars,
register_filesystem(&efivarfs_type);
+err_unreg_vars:
+ kset_unregister(efivars->kset);
+
out:
kfree(variable_name);
because err_unreg_vars is in the *success* path, not the error path. So
even if we successfully register efivarfs, we still call
kset_unregister().
Could you please fix this and resubmit?
--
Matt Fleming, Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html