public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [BUG] radio-gemtek-pci.c: double mutex_lock
  2009-10-08 18:52 [BUG] radio-gemtek-pci.c: double mutex_lock Alexander Strakh
@ 2009-10-08 18:47 ` Jiri Kosina
  2009-11-05 16:27   ` Hans Verkuil
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Kosina @ 2009-10-08 18:47 UTC (permalink / raw)
  To: Alexander Strakh
  Cc: Vladimir Shebordaev, Mauro Carvalho Chehab, linux-media,
	Linux Kernlel Mailing List, Hans Verkuil

On Thu, 8 Oct 2009, Alexander Strakh wrote:

> 	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);

Good catch. Adding Hans, who added the (incorrect) locking into 
gemtek_pci_unmute(), to CC.

-- 
Jiri Kosina
SUSE Labs, Novell Inc.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [BUG] radio-gemtek-pci.c: double mutex_lock
@ 2009-10-08 18:52 Alexander Strakh
  2009-10-08 18:47 ` Jiri Kosina
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Strakh @ 2009-10-08 18:52 UTC (permalink / raw)
  To: Vladimir Shebordaev, Mauro Carvalho Chehab, linux-media,
	Linux Kernlel Mailing List

	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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] radio-gemtek-pci.c: double mutex_lock
  2009-10-08 18:47 ` Jiri Kosina
@ 2009-11-05 16:27   ` Hans Verkuil
  0 siblings, 0 replies; 3+ messages in thread
From: Hans Verkuil @ 2009-11-05 16:27 UTC (permalink / raw)
  To: Jiri Kosina
  Cc: Alexander Strakh, Vladimir Shebordaev, Mauro Carvalho Chehab,
	linux-media, Linux Kernlel Mailing List

On Thursday 08 October 2009 20:47:25 Jiri Kosina wrote:
> On Thu, 8 Oct 2009, Alexander Strakh wrote:
> 
> > 	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);
> 
> 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

-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG Telecom

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-11-05 16:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-08 18:52 [BUG] radio-gemtek-pci.c: double mutex_lock Alexander Strakh
2009-10-08 18:47 ` Jiri Kosina
2009-11-05 16:27   ` Hans Verkuil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox