linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Matt Fleming <matt.fleming@intel.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, mjg@redhat.com, hpa@zytor.com,
	mingo@kernel.org, tglx@linutronix.de, matt.fleming@intel.com
Subject: [tip:x86/efi] x86, efi: Only close open files in error path
Date: Fri, 1 Jun 2012 12:11:06 -0700	[thread overview]
Message-ID: <tip-30dc0d0fe5d08396dbdaa2d70972149131340960@git.kernel.org> (raw)
In-Reply-To: <1331907517-3985-2-git-send-email-matt@console-pimps.org>

Commit-ID:  30dc0d0fe5d08396dbdaa2d70972149131340960
Gitweb:     http://git.kernel.org/tip/30dc0d0fe5d08396dbdaa2d70972149131340960
Author:     Matt Fleming <matt.fleming@intel.com>
AuthorDate: Thu, 15 Mar 2012 19:13:25 +0000
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Fri, 1 Jun 2012 09:11:10 -0700

x86, efi: Only close open files in error path

The loop at the 'close_handles' label in handle_ramdisks() should be
using 'i', which represents the number of initrd files that were
successfully opened, not 'nr_initrds' which is the number of initrd=
arguments passed on the command line.

Currently, if we execute the loop to close all file handles and we
failed to open any initrds we'll try to call the close function on a
garbage pointer, causing the machine to hang.

Cc: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Link: http://lkml.kernel.org/r/1331907517-3985-2-git-send-email-matt@console-pimps.org
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/boot/compressed/eboot.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index 2c14e76..52a4e66 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -674,7 +674,7 @@ free_initrd_total:
 	low_free(initrd_total, initrd_addr);
 
 close_handles:
-	for (k = j; k < nr_initrds; k++)
+	for (k = j; k < i; k++)
 		efi_call_phys1(fh->close, initrds[k].handle);
 free_initrds:
 	efi_call_phys1(sys_table->boottime->free_pool, initrds);

  reply	other threads:[~2012-06-01 19:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-16 14:18 [PATCH 0/3] x86, efi: EFI boot stub documentation Matt Fleming
2012-03-16 14:18 ` [PATCH 1/3] x86, efi: Only close open files in error path Matt Fleming
2012-06-01 19:11   ` tip-bot for Matt Fleming [this message]
2012-03-16 14:18 ` [PATCH 2/3] x86, efi; Add EFI boot stub console support Matt Fleming
2012-06-01 19:11   ` [tip:x86/efi] " tip-bot for Matt Fleming
2012-03-16 14:18 ` [PATCH 3/3] x86, efi: Add EFI boot stub documentation Matt Fleming
2012-06-01 19:13   ` [tip:x86/efi] " tip-bot for Matt Fleming
2012-03-20 23:57 ` [PATCH 0/3] x86, efi: " Shea Levy
2012-03-21  0:00   ` H. Peter Anvin
2012-05-04 10:27 ` 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=tip-30dc0d0fe5d08396dbdaa2d70972149131340960@git.kernel.org \
    --to=matt.fleming@intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mjg@redhat.com \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).