[PATCH] Fix race in efi variable delete code.
- From: Prarit Bhargava <prarit@xxxxxxxxxx>
- Date: Mon, 22 Jan 2007 10:22:09 -0500
Fix race when deleting an EFI variable and issuing another EFI command on the
same variable. The removal of the variable from the efivars_list should be
done in efivar_delete and not delayed until the kprobes release.
Signed-off-by: Prarit Bhargava <prarit@xxxxxxxxxx>
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index 5ab5e39..bf2ca97 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -385,10 +385,8 @@ static struct sysfs_ops efivar_attr_ops = {
static void efivar_release(struct kobject *kobj)
{
- struct efivar_entry *var = container_of(kobj, struct efivar_entry, kobj);
- spin_lock(&efivars_lock);
- list_del(&var->list);
- spin_unlock(&efivars_lock);
+ struct efivar_entry *var = container_of(kobj, struct efivar_entry,
+ kobj);
kfree(var);
}
@@ -537,6 +535,9 @@ efivar_delete(struct subsystem *sub, const char *buf, size_t count)
spin_unlock(&efivars_lock);
return -EIO;
}
+
+ list_del(&search_efivar->list);
+
/* We need to release this lock before unregistering. */
spin_unlock(&efivars_lock);
-
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/
- Follow-Ups:
- Re: [PATCH] Fix race in efi variable delete code.
- From: Matt Domsch
- Re: [PATCH] Fix race in efi variable delete code.
- Prev by Date: Re: change strip_cache_size freeze the whole raid
- Next by Date: Re: [RFC 1/6] bidi support: request dma_data_direction
- Previous by thread: [PATCH 3/3] ufs: rellocation fix
- Next by thread: Re: [PATCH] Fix race in efi variable delete code.
- Index(es):