mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Vegard Nossum" <vegard.nossum@gmail.com>
To: "Zdenek Kabelac" <zdenek.kabelac@gmail.com>
Cc: "Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Richard Purdie" <rpurdie@rpsys.net>,
	"Henrique de Moraes Holschuh" <hmh@hmh.eng.br>
Subject: Re: BUG: spinlock bad magic on CPU#1, modprobe/815 - led-triggers
Date: Wed, 16 Jul 2008 16:22:37 +0200	[thread overview]
Message-ID: <19f34abd0807160722y64f93b56v83faf12e23ae9013@mail.gmail.com> (raw)
In-Reply-To: <c4e36d110807160524i51f12d8eof0b1d58219725c3c@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1061 bytes --]

On Wed, Jul 16, 2008 at 2:24 PM, Zdenek Kabelac
<zdenek.kabelac@gmail.com> wrote:
> Hello
>
> I'm running 2.6.26 kernel - git commit: bce7f793daec3e65ec5c5705d2457b81fe7b5725
> I've T61, 2GB, C2D, x86_64
>
>  I'm getting this oops while using 64bit kernel and running mostly 32bit system.
>
> This one happens sometimes during boot - unpredictible - usually once
> in 15 boots.
>

Thanks for the report.

It looks like the error is in led_classdev_register(); the led_cdev is
added to the leds_list *before* the led_cdev->trigger_lock is
initialized.

(This might also explain why you don't always hit it.)

On the other hand, I might be completely wrong. The following NULL
pointer dereference bothers me somewhat as it isn't entirely clear why
it appears.

I've added a couple of Ccs.

Can you try the patch I've attached?


Vegard

-- 
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
	-- E. W. Dijkstra, EWD1036

[-- Attachment #2: led-class.patch --]
[-- Type: application/octet-stream, Size: 1222 bytes --]

diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index 559a408..44d13ac 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -113,13 +113,6 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
 	if (rc)
 		goto err_out;
 
-	/* add to the list of leds */
-	down_write(&leds_list_lock);
-	list_add_tail(&led_cdev->node, &leds_list);
-	up_write(&leds_list_lock);
-
-	led_update_brightness(led_cdev);
-
 #ifdef CONFIG_LEDS_TRIGGERS
 	init_rwsem(&led_cdev->trigger_lock);
 
@@ -130,6 +123,13 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
 	led_trigger_set_default(led_cdev);
 #endif
 
+	led_update_brightness(led_cdev);
+
+	/* add to the list of leds */
+	down_write(&leds_list_lock);
+	list_add_tail(&led_cdev->node, &leds_list);
+	up_write(&leds_list_lock);
+
 	printk(KERN_INFO "Registered led device: %s\n",
 			led_cdev->name);
 
@@ -138,7 +138,6 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
 #ifdef CONFIG_LEDS_TRIGGERS
 err_out_led_list:
 	device_remove_file(led_cdev->dev, &dev_attr_brightness);
-	list_del(&led_cdev->node);
 #endif
 err_out:
 	device_unregister(led_cdev->dev);

      reply	other threads:[~2008-07-16 14:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-16 12:24 Zdenek Kabelac
2008-07-16 14:22 ` Vegard Nossum [this message]

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=19f34abd0807160722y64f93b56v83faf12e23ae9013@mail.gmail.com \
    --to=vegard.nossum@gmail.com \
    --cc=hmh@hmh.eng.br \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    --cc=zdenek.kabelac@gmail.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

all inboxes | Powered by JetHome®