[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux1394-devel
Subject:    Re: [Bug 11824] raw1394: possible deadlock if accessed by
From:       Stefan Richter <stefanr () s5r6 ! in-berlin ! de>
Date:       2008-10-25 10:46:35
Message-ID: 4902F90B.4030309 () s5r6 ! in-berlin ! de
[Download RAW message or body]

I wrote:
> (It is possible to comment simultaneously on the list and in bugzilla by 
> replying with Cc: bugme-daemon@bugzilla.kernel.org and keeping [Bug 
> 11823] in the subject.)

[Bug 11824] of course.

> So far my ideas of a fix are:
> 
>   - Use mutex_trylock() in raw1394_mmap() [and possibly --- but not
>     necessarily --- anywhere else where fi->state_mutex is taken],
>     and exit with -EAGAIN if the mutex cannot be acquired.  A
>     simultaneous raw1394_ioctl() would then become unstuck as soon
>     as mmap() finished as failed.

Similarly, mutex_trylock() could be used in dv1394_mmap() to fix bug 
11823.  It would change previous behavior, but I suspect the effect of 
that change is irrelevant in practice.

>   - Same effect as replacing all mutex_lock() by mutex_trylock():
>     Access the state variables by atomic cmpxchg().  Every code site
>     which needs to change the state or has a critical region during
>     whose execution the state must not be changed will thus ensure
>     exclusive control over the state or will fail with -EAGAIN.

The effect of this would actually be like using mutex_trylock() 
everywhere /and/ using two different mutexes for write() on one hand and 
mmap() and ioctl() on the other hand.
-- 
Stefan Richter
-=====-==--- =-=- ==--=
http://arcgraph.de/sr/

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
mailing list linux1394-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux1394-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic