All of lore.kernel.org
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: matt_domsch@dell.com, matthew.e.tolentino@intel.com,
	anil.s.keshavamurthy@intel.com,
	Prarit Bhargava <prarit@redhat.com>
Subject: [PATCH] Fix race in efi variable delete code.
Date: Mon, 22 Jan 2007 10:22:09 -0500	[thread overview]
Message-ID: <20070122152209.29717.52473.sendpatchset@prarit.boston.redhat.com> (raw)

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

             reply	other threads:[~2007-01-22 15:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-22 15:22 Prarit Bhargava [this message]
2007-01-25 20:34 ` [PATCH] Fix race in efi variable delete code Matt Domsch
2007-01-25 22:20   ` Matt Domsch
2007-01-26  6:00     ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070122152209.29717.52473.sendpatchset@prarit.boston.redhat.com \
    --to=prarit@redhat.com \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt_domsch@dell.com \
    --cc=matthew.e.tolentino@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.