lkml.org 
[lkml]   [2008]   [Oct]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] MMC: Fix race condition in resume/card detect code
2008/10/19 Yauhen Kharuzhy <jekhor@gmail.com>:
> On Sat, Oct 18, 2008 at 07:11:47PM +0200, Pierre Ossman wrote:
>> On Thu, 16 Oct 2008 19:09:36 +0300
>> Yauhen Kharuzhy <jekhor@gmail.com> wrote:
>>
>> > When device wakes up by card change interrupt and MMC_UNSAFE_RESUME is
>> > enabled then race condition between mmc_rescan() and
>> > mmc_resume()/mmc_sd_resume() appeared.
>> >
>> > Resume functions can sleep into mmc_remove_card() and at this time
>> > mmc_rescan() can be called by delayed work handler. Double-free of
>> > kobject or double-remove of host->card can be result of this.
>> >
>> > This patch adds an mutex which deny simultaneous executing of
>> > mmc_sd_resume()/mmc_resume() and mmc_rescan() functions. Probably, it is
>> > not right way.
>> >
>> > Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com>
>> > ---
>>
>> Can't we just ask the PM layer if this device is currently resuming,
>> and if so ignore card notifications from the driver?
>
> What about another idea: mmc_sd_resume() checks if host->detect is
> scheduled and if true then it don't try to reinitialize card.
> host->detect can be scheduled at this moment only in one case: if device has been waked up by
> card change interrupt.
Hmm... But it will cause a race condition if SD card change interrupt
will be raised during resume process.

--
Best regards,
Yauhen Kharuzhy jekhor_(at)_gmail.com

A: No
Q: Should I quote below my post?


\
 
 \ /
  Last update: 2008-10-19 18:35    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site