Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Subclassing AppleMediaBay (bug report)



There is a bug in AppleMediaBay which prevents it from being successfully subclassed. (Actually, it prevents any other driver that wants to match a media-bay device from working properly). Here's the bug report which I contributed to Radar (I am posting it here as well since Radar's web site hasn't been working for a while).

-- Steps to Reproduce:

Subclass AppleMediaBay with a higher IOProbeScore than AppleMediaBay has.

-- Expected Results:

The subclass will out-match AppleMediaBay, and AppleMediaBay will be free()'d gracefully.

-- Actual Results:

Kernel panic, with what appears to be an infinite recursion in OSCollection (error message is "corrupt stack" and the backtrace is repetitive and truncated).

-- Diagnosis

AppleMediaBay's free method calls PMStop. The problem is that PMInit is not called in the init method. Instead, it is called in initForPM, which in turn is called by the start method. This means that in cases where start is never called, PMStop is called without PMInit having ever been called. And this is exactly what happens if you subclass AppleMediaBay and out-match it. AppleMediaBay gets probed, but not started, and then when it is freed PMStop gets called when it shouldn't be.

One solution would be to add an instance variable which would keep track of whether PMInit has been called. Then the free method could use that to decide whether to call PMStop.
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.