radio-gemtek-pci.c: double mutex_lock
KERNEL_VERSION: 2.6.31 DESCRIBE:
In driver ./drivers/media/radio/radio-gemtek-pci.c mutex_lock is called first time in line 184, then in line 186 gemtek_pci_setfrequency is called.
182 static void gemtek_pci_unmute(struct gemtek_pci *card) 183 {
184 mutex_lock(&card->lock);
185 if (card->mute) {
186 gemtek_pci_setfrequency(card, card->current_frequency);
187 card->mute = false;
188 }
189 mutex_unlock(&card->lock);190 }
In gemtek_pci_setfrequency we call mutex_lock again in line 152
144 static void gemtek_pci_setfrequency(struct gemtek_pci *card, unsigned long frequency)
145 {
146 int i; 147 u32 value = frequency / 200 + 856; 148 u16 mask = 0x8000; 149 u8 last_byte; 150 u32 port = card->iobase;
151
152 mutex_lock(&card->lock);
Found by : Linux Driver Verification project
Quoted 20 lines · Alexander Strakh
KERNEL_VERSION: 2.6.31 DESCRIBE:In driver
./drivers/media/radio/radio-gemtek-pci.cmutex_lockis called first time in line 184, then in line 186gemtek_pci_setfrequencyis called.182 static void
gemtek_pci_unmute(struct gemtek_pci *card)183 {
184mutex_lock(&card->lock);
185 if (card->mute) {
186gemtek_pci_setfrequency(card, card->current_frequency);
187card->mute= false;
188 }
189 mutex_unlock(&card->lock);190 }In
gemtek_pci_setfrequencywe callmutex_lockagain in line 152144 static void
gemtek_pci_setfrequency(struct gemtek_pci *card, unsigned long frequency)
145 {
Quoted 7 lines
146 int i; 147 u32 value = frequency / 200 + 856; 148 u16 mask = 0x8000; 149 u8 last_byte; 150 u32 port = card->iobase;151
152mutex_lock(&card->lock);
Good catch. Adding Hans, who added the (incorrect) locking into gemtek_pci_unmute(), to CC.
Signature · 2 lines
Jiri Kosina SUSE Labs, Novell Inc.
Quoted 30 lines · On Thursday 08 October 2009 20:47:25 Jiri Kosina wrote:
Quoted 20 lines · Alexander Strakh
KERNEL_VERSION: 2.6.31 DESCRIBE:In driver
./drivers/media/radio/radio-gemtek-pci.cmutex_lockis called first time in line 184, then in line 186gemtek_pci_setfrequencyis called.182 static void
gemtek_pci_unmute(struct gemtek_pci *card)183 {
184mutex_lock(&card->lock);
185 if (card->mute) {
186gemtek_pci_setfrequency(card, card->current_frequency);
187card->mute= false;
188 }
189 mutex_unlock(&card->lock);190 }In
gemtek_pci_setfrequencywe callmutex_lockagain in line 152144 static void
gemtek_pci_setfrequency(struct gemtek_pci *card, unsigned long frequency)
145 {Quoted 7 lines
146 int i; 147 u32 value = frequency / 200 + 856; 148 u16 mask = 0x8000; 149 u8 last_byte; 150 u32 port = card->iobase;151
152mutex_lock(&card->lock);
Quoted 3 lines
Good catch. Adding Hans, who added the (incorrect) locking into
gemtek_pci_unmute(), to CC.
Thanks, I've committed a fix and will post a pull request later today.
Sorry for the late reply, but I've been abroad for some time.
Regards,
Hans
Signature · 1 line
Hans Verkuil - video4linux developer - sponsored by TANDBERG Telecom