LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] Fix race in efi variable delete code.
@ 2007-01-22 15:22 Prarit Bhargava
  2007-01-25 20:34 ` Matt Domsch
  0 siblings, 1 reply; 4+ messages in thread
From: Prarit Bhargava @ 2007-01-22 15:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: matt_domsch, matthew.e.tolentino, anil.s.keshavamurthy, Prarit Bhargava

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@redhat.com>

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);
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-01-26  6:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-22 15:22 [PATCH] Fix race in efi variable delete code Prarit Bhargava
2007-01-25 20:34 ` Matt Domsch
2007-01-25 22:20   ` Matt Domsch
2007-01-26  6:00     ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).