於 五,2012-10-26 於 12:13 +0100,Matt Fleming 提到: > On Fri, 2012-10-26 at 11:13 +0100, Alan Cox wrote: > > On Fri, 26 Oct 2012 08:51:46 +0100 > > Matt Fleming <matt@xxxxxxxxxxxxxxxxx> wrote: > > > > > From: "Lee, Chun-Yi" <joeyli.kernel@xxxxxxxxx> > > > > > > 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 <mjg@xxxxxxxxxx> > > > Cc: H. Peter Anvin <hpa@xxxxxxxxx> > > > Signed-off-by: Lee, Chun-Yi <jlee@xxxxxxxx> > > > Signed-off-by: Jeremy Kerr <jeremy.kerr@xxxxxxxxxxxxx> > > > Signed-off-by: Matt Fleming <matt.fleming@xxxxxxxxx> > > > --- > > > 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? > Sorry for my mistake and thanks for Alan's review. I just sent the following patch to fix the problem. Thanks Joey Lee >From 49f036dd4e5e702a344f115177a58952c8aa5b0d Mon Sep 17 00:00:00 2001 From: Lee, Chun-Yi <jlee@xxxxxxxx> Date: Mon, 29 Oct 2012 13:42:33 +0800 Subject: [PATCH] efi: fix always unregister kset of efivars in register_efivars The cc9c97b76aa7235d5a1de0f74f990097f77008b4 patch introduced a issue that always unregister kset of efivars in register_efivars. This patch moved the kset_unregister function call to the kobject create check block for fix issue. Cc: Matthew Garrett <mjg@xxxxxxxxxx> Cc: H. Peter Anvin <hpa@xxxxxxxxx> Cc: Jeremy Kerr <jeremy.kerr@xxxxxxxxxxxxx> Cc: Matt Fleming <matt.fleming@xxxxxxxxx> Signed-off-by: Lee, Chun-Yi <jlee@xxxxxxxx> --- drivers/firmware/efivars.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index 03e0df2..8870907 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c @@ -1595,7 +1595,8 @@ int register_efivars(struct efivars *efivars, if (!efivars->kobject) { pr_err("efivars: Subsystem registration failed.\n"); error = -ENOMEM; - goto err_unreg_vars; + kset_unregister(efivars->kset); + goto out; } /* @@ -1642,9 +1643,6 @@ int register_efivars(struct efivars *efivars, register_filesystem(&efivarfs_type); -err_unreg_vars: - kset_unregister(efivars->kset); - out: kfree(variable_name); -- 1.6.0.2 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html