Skip to contentSkip to conversation

hp_accel: Fix race in device removal

PATCH In review Oliver Neukum 4 participants 7 messages May 7, 2010 – May 11, 2010 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hp_accel: Fix race in device removal

From 505056649f5ecb1ebb086981243b9870ce961a87 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <[email protected]>
Date: Fri, 7 May 2010 18:02:07 +0200
Subject: [PATCH] hp_accel: Fix race in device removal

The work queue has to be flushed after the device has been made inaccessible.

---
 drivers/hwmon/hp_accel.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/hp_accel.c +1 -1
index c8ab505..7580f55 100644
@@ -328,8 +328,8 @@ static int lis3lv02d_remove(struct acpi_device *device, int type)
 	lis3lv02d_joystick_disable();
 	lis3lv02d_poweroff(&lis3_dev);
 
-	flush_work(&hpled_led.work);
 	led_classdev_unregister(&hpled_led.led_classdev);
+	flush_work(&hpled_led.work);
 
 	return lis3lv02d_remove_fs(&lis3_dev);
 }
Signature · 7 lines
1.6.4.2


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#1 lore raw
Quoted 9 lines · Oliver Neukum

From 505056649f5ecb1ebb086981243b9870ce961a87 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <[email protected]>
Date: Fri, 7 May 2010 18:02:07 +0200
Subject: [PATCH] hp_accel: Fix race in device removal

The work queue has to be flushed after the device has been made inaccessible.

ACK.

Quoted 18 lines
---
 drivers/hwmon/hp_accel.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/hp_accel.c +1 -1
index c8ab505..7580f55 100644
@@ -328,8 +328,8 @@ static int lis3lv02d_remove(struct acpi_device *device, int type)
 	lis3lv02d_joystick_disable();
 	lis3lv02d_poweroff(&lis3_dev);
 
-	flush_work(&hpled_led.work);
 	led_classdev_unregister(&hpled_led.led_classdev);
+	flush_work(&hpled_led.work);
 
 	return lis3lv02d_remove_fs(&lis3_dev);
 }
Signature · 7 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Acked-by on v1 1/1
#2 lore raw
In reply to Oliver Neukum

Op 07-05-10 18:04, Oliver Neukum schreef:

Quoted 9 lines

From 505056649f5ecb1ebb086981243b9870ce961a87 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <[email protected]>
Date: Fri, 7 May 2010 18:02:07 +0200
Subject: [PATCH] hp_accel: Fix race in device removal

The work queue has to be flushed after the device has been made inaccessible.

Ah, flushing the work before unregistering the device seemed more logical... but now that you mention it, I understand the race.

Thanks

Quoted 9 lines
---
 drivers/hwmon/hp_accel.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/hp_accel.c +0 -0
index c8ab505..7580f55 100644

drivers/hwmon/hp_accel.c static int lis3lv02d_remove(struct acpi_device *device, int type) · line 335

Quoted 9 lines
drivers/hwmon/hp_accel.c +1 -1
@@ -328,8 +328,8 @@ static int lis3lv02d_remove(struct acpi_device *device, int type)
 	lis3lv02d_joystick_disable();
 	lis3lv02d_poweroff(&lis3_dev);
 
-	flush_work(&hpled_led.work);
 	led_classdev_unregister(&hpled_led.led_classdev);
+	flush_work(&hpled_led.work);
 
 	return lis3lv02d_remove_fs(&lis3_dev);
 }

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#3 lore raw
In reply to Oliver Neukum
Quoted 8 lines · On Fri, 7 May 2010 18:04:20 +0200 Oliver Neukum <[email protected]> wrote:
Quoted 1 line

From 505056649f5ecb1ebb086981243b9870ce961a87 Mon Sep 17 00:00:00 2001

From: Oliver Neukum <[email protected]>
Date: Fri, 7 May 2010 18:02:07 +0200
Subject: [PATCH] hp_accel: Fix race in device removal

The work queue has to be flushed after the device has been made inaccessible.

You cc'ed [email protected] so presumably you think it's a pretty serious bug.

But alas, I (and presumably others) cannot confirm that, because you didn't describe the bug :( This also means that if someone hits a problem with this driver, they won't easily be able to work out whether this patch will fix it.

Under what circumstances does it trigger?

What are the observed effects when it triggers?

Please always include this sort of information when sending bugfixes, thanks.

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#4 lore raw

Am Dienstag, 11. Mai 2010 00:46:32 schrieb Andrew Morton:

Quoted 11 lines

But alas, I (and presumably others) cannot confirm that, because you didn't describe the bug :( This also means that if someone hits a problem with this driver, they won't easily be able to work out whether this patch will fix it.

Under what circumstances does it trigger?

What are the observed effects when it triggers?

Please always include this sort of information when sending bugfixes, thanks.

Sorry,

the patch closes a window during which a work queue might remain active after the device is removed and would then lead to ACPI calls with undefined behavior.

Regards
Oliver

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#5 lore raw
Quoted 11 lines · On Tue, 11 May 2010 07:55:07 +0200 Oliver Neukum <[email protected]> wrote:

Am Dienstag, 11. Mai 2010 00:46:32 schrieb Andrew Morton:

Quoted 10 lines

But alas, I (and presumably others) cannot confirm that, because you didn't describe the bug :( This also means that if someone hits a problem with this driver, they won't easily be able to work out whether this patch will fix it.

Under what circumstances does it trigger?

What are the observed effects when it triggers?

Quoted 7 lines
Quoted 1 line

Please always include this sort of information when sending bugfixes, thanks.

Sorry,

the patch closes a window during which a work queue might remain active after the device is removed and would then lead to ACPI calls with undefined behavior.

Had anyone observed this in the field? Was a machine crashing, perhaps?

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#6 lore raw

Am Dienstag, 11. Mai 2010 04:57:25 schrieb Andrew Morton:

Quoted 15 lines · On Tue, 11 May 2010 07:55:07 +0200 Oliver Neukum <[email protected]> wrote:
Quoted 14 lines

Am Dienstag, 11. Mai 2010 00:46:32 schrieb Andrew Morton:

Quoted 11 lines

But alas, I (and presumably others) cannot confirm that, because you didn't describe the bug :( This also means that if someone hits a problem with this driver, they won't easily be able to work out whether this patch will fix it.

Under what circumstances does it trigger?

What are the observed effects when it triggers?

Please always include this sort of information when sending bugfixes, thanks.

Quoted 7 lines
Quoted 5 lines

Sorry,

the patch closes a window during which a work queue might remain active after the device is removed and would then lead to ACPI calls with undefined behavior.

Had anyone observed this in the field? Was a machine crashing, perhaps?

No, this was found during a code review.

Regards
Oliver

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors