[PATCH] [media] dvb-frontends/stv0910: prevent consecutive mutex_unlock()'s

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Daniel Scheller writes:
 > From: Daniel Scheller <d.scheller@xxxxxxx>
 > 
 > When calling gate_ctrl() with enable=0 if previously the mutex wasn't
 > locked (ie. on enable=1 failure and subdrivers not handling this properly,
 > or by otherwise badly behaving drivers), the i2c_lock could be unlocked

I think drivers and subdrivers should rather be fixed so that this
cannot happen.
But to do this we will first need to define exactly how a failure in
gate_ctrl() is supposed to be handled, both inside gate_ctrl() and
by calling drivers.


 > consecutively which isn't allowed. Prevent this by keeping track of the
 > lock state, and actually call mutex_unlock() only when certain the lock
 > is held.

Why not use mutex_is_locked()?
And there should be a debug message if it (tried double unlocking) happens.


Regards,
Ralph



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux