public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@kernel.org>
To: gregkh@suse.de
Cc: linux-kernel@vger.kernel.org, Pekka Enberg <penberg@kernel.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>
Subject: [PATCH] firmware: fix request_firmware() error handling
Date: Sun, 22 Aug 2010 18:09:30 +0300	[thread overview]
Message-ID: <1282489770-2757-1-git-send-email-penberg@kernel.org> (raw)

If _request_firmware() fails and we do release_firmware(), update the pointer
pointed to by 'firmware_p' so that we don't return a free'd pointer to the
caller.

This patch fixes a boot-time crash on my MacBook that's caused by failing
isight_firmware_load(). The bug was introduced in commit f8a4bd34 ("firmware
loader: embed device into firmware_priv structure") and makes 2.6.36-rc1
unusable on my box.

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
---
Here's a picture of the oops:

  http://twitpic.com/2h76gv

Unfortunately I don't have a serial console hooked up so I couldn't get a text
version of it.

 drivers/base/firmware_class.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index c8a44f5..40af43e 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -568,7 +568,7 @@ static int _request_firmware(const struct firmware **firmware_p,
 out:
 	if (retval) {
 		release_firmware(firmware);
-		firmware_p = NULL;
+		*firmware_p = NULL;
 	}
 
 	return retval;
-- 
1.6.3.3


             reply	other threads:[~2010-08-22 15:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-22 15:09 Pekka Enberg [this message]
2010-08-22 17:10 ` [PATCH] firmware: fix request_firmware() error handling Greg KH

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=1282489770-2757-1-git-send-email-penberg@kernel.org \
    --to=penberg@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /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