public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matt Fleming <matt.fleming@intel.com>
To: Michel Lespinasse <walken@google.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	Matthew Garrett <matthew.garrett@nebula.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	"H. Peter Anvin" <hpa@linux.intel.com>,
	Borislav Petkov <bp@suse.de>, Ingo Molnar <mingo@elte.hu>,
	Josh Boyer <jwboyer@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Paul Bolle <pebolle@tiscali.nl>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [GIT PULL] x86 fixes for 3.9
Date: Fri, 26 Apr 2013 09:49:36 +0100	[thread overview]
Message-ID: <517A3FA0.8030702@intel.com> (raw)
In-Reply-To: <CANN689F7c8UbxGEHyAOH+uwZxFf7VoQDmCM3Nv862s2b=21bQg@mail.gmail.com>

On 26/04/13 08:43, Michel Lespinasse wrote:
> Still seeing the crash.
> 
> I went and compared the crash dump with the vmlinux disassembly; the
> issue is a NULL pointer dereference in list_for_each_entry_safe().
> list_empty() checks that the head node points to itself, but here the
> head node has NULL. I think this may be due to gsmi_init() being
> called before efivars_init(). Not sure what's the proper fix though.

Ohh... I see what you mean. The bug is in variable_is_present() because
it accesses __efivars directly, which a) isn't the struct efivars gsmi.c
uses and b) hasn't been initialised. Something like this might work.

---

diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index 182ce94..f4baa11 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -1628,10 +1628,11 @@ static ssize_t efivar_delete(struct file *filp, struct kobject *kobj,
 	return count;
 }
 
-static bool variable_is_present(efi_char16_t *variable_name, efi_guid_t *vendor)
+static bool variable_is_present(struct efivars *efivars,
+				efi_char16_t *variable_name,
+				efi_guid_t *vendor)
 {
 	struct efivar_entry *entry, *n;
-	struct efivars *efivars = &__efivars;
 	unsigned long strsize1, strsize2;
 	bool found = false;
 
@@ -1703,8 +1704,8 @@ static void efivar_update_sysfs_entries(struct work_struct *work)
 			if (status != EFI_SUCCESS) {
 				break;
 			} else {
-				if (!variable_is_present(variable_name,
-				    &vendor)) {
+				if (!variable_is_present(efivars,
+				    variable_name, &vendor)) {
 					found = true;
 					break;
 				}
@@ -2008,7 +2009,8 @@ int register_efivars(struct efivars *efivars,
 			 * we'll ever see a different variable name,
 			 * and may end up looping here forever.
 			 */
-			if (variable_is_present(variable_name, &vendor_guid)) {
+			if (variable_is_present(efivars, variable_name,
+						&vendor_guid)) {
 				dup_variable_bug(variable_name, &vendor_guid,
 						 variable_name_size);
 				status = EFI_NOT_FOUND;

  reply	other threads:[~2013-04-26  8:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-25 21:44 [GIT PULL] x86 fixes for 3.9 H. Peter Anvin
2013-04-25 22:20 ` Linus Torvalds
2013-04-25 22:23   ` Matthew Garrett
2013-04-25 22:53     ` Michel Lespinasse
2013-04-25 22:54       ` H. Peter Anvin
2013-04-25 23:11         ` Michel Lespinasse
2013-04-26  7:12           ` Matt Fleming
2013-04-26  7:43             ` Michel Lespinasse
2013-04-26  8:49               ` Matt Fleming [this message]
2013-04-26  9:02                 ` Michel Lespinasse
2013-04-26  9:44                   ` Matt Fleming
2013-04-26  7:29     ` Ingo Molnar
2013-04-26  9:01       ` Matt Fleming

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=517A3FA0.8030702@intel.com \
    --to=matt.fleming@intel.com \
    --cc=bp@suse.de \
    --cc=hpa@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jwboyer@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.garrett@nebula.com \
    --cc=mingo@elte.hu \
    --cc=pebolle@tiscali.nl \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=walken@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox