Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 410033

Summary: sys-power/cpufreqd crashes on AC transition or startup with ACPI battery support
Product: Gentoo Linux Reporter: Steven Newbury <steve>
Component: [OLD] Core systemAssignee: No maintainer - Look at if you want to take care of it <maintainer-needed>
Severity: normal CC: poletti.marco, steve
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: AMD64   
OS: Linux   
See Also:
Package list:
Runtime testing required: ---
Attachments: Do not call close_battery() when open_battery() fails

Description Steven Newbury 2012-03-28 16:32:53 UTC
A race condition exists between enumeration and reading of attributes.  This is triggered in my case by the ACPI BIOS randomally making the battery disappear and reappear whilst transitioning between AC/Battery, it's much more likely to occur with multiple batteries due to the larger window.

The actual cause of the crash: close_battery() is called after open_battery() fails, which obviously won't work since close_battery() attempts to free unallocated memory; glibc detects info[x] is an invalid pointer.

Reproducible: Sometimes

Steps to Reproduce:
1.Emerge cpufreqd with ACPI support
2.Use on an ACPI supported platform with one or more batteries (+ buggy bios?)
3.Insert or remove AC power
Actual Results:  
cpufreqd daemon crashes

Expected Results:  
Should not crash.
Comment 1 Steven Newbury 2012-03-28 16:34:13 UTC
Created attachment 307007 [details, diff]
Do not call close_battery() when open_battery() fails
Comment 2 Pacho Ramos gentoo-dev 2014-05-11 08:06:42 UTC