some missing spin_unlocks
Subsystems (2)
I think these are all real bugs.
sound/synth/emux/emux_synth.c snd_emux_note_on, line 101 snd_assert will return without unlocking emu->voice_lock (line 89)
sound/pci/au88x0/au88x0_core.c vortex_adb_allocroute, search for EBUSY returns without unlocking vortex->lock
net/rose/rose_route.c rose_route_frame, line 998
returns without unlocking rose_node_list_lock, rose_neigh_list_lock, or rose_route_list_lock
net/rose/rose_timer.c rose_heartbeat_expiry, line 141 rose_destroy_socket does not unlock sk as far as i can see
drivers/net/irda/donauboe.c toshoboe_net_ioctl, search for EPERM returns without unlocking self->lock
Signature · 1 line
Ted Unangst www.coverity.com Coverity, Inc.
David S. Miller
maintainerFrom: Ted Unangst <[email protected]>
Date: Mon, 22 Aug 2005 15:26:47 -0700
Quoted 3 lines
net/rose/rose_route.crose_route_frame, line 998
returns without unlockingrose_node_list_lock,rose_neigh_list_lock, orrose_route_list_lock
I fixed this one with the patch below.
Quoted 2 lines
net/rose/rose_timer.crose_heartbeat_expiry, line 141rose_destroy_socketdoes not unlock sk as far as i can see
This one needs more care. We can't drop the lock, because the destroy actions need to be protected by that lock, but we can't release the lock after rose_destroy_socket() because the object may not even exist any longer.
The problem there, at the core, is that the timer doesn't grab a reference to the socket, which would make the solution to this bug very straight forward.
Someone should work on that :-)
diff-tree 61ef36aa6cf356649863a24a850c2183cb762c61 (from daf53344fadaa8c47c6b0864e7f34efcbb66e391)
Author: David S. Miller <[email protected]> Date: Tue Aug 23 09:42:38 2005 -0700
[ROSE]: Fix missing unlocks in rose_route_frame()
Noticed by Coverity checker.
net/rose/rose_route.c +4 -2
@@ -994,8 +994,10 @@ int rose_route_frame(struct sk_buff *skb* 1. The frame isn't for us, * 2. It isn't "owned" by any existing route. */ -if (frametype !=ROSE_CALL_REQUEST )/* XXX */ -return 0 ; +if (frametype !=ROSE_CALL_REQUEST ) {/* XXX */ + ret =0 ; + goto out; + } len = (((skb->data[3 ] >>4 ) &0x0F ) +1 ) /2 ; len += (((skb->data[3 ] >>0 ) &0x0F ) +1 ) /2 ;
Quoted 5 lines
This one needs more care. We can't drop the lock, because the destroy actions need to be protected by that lock, but we can't release the lock after
rose_destroy_socket()because the object may not even exist any longer.
does it matter? can ANYTHING be spinning on the lock? if not .. can we just let the lock go poof and not unlock it...
David S. Miller
maintainerFrom: Arjan van de Ven <[email protected]>
Date: Tue, 23 Aug 2005 18:54:03 +0200
Quoted 2 lines
does it matter? can ANYTHING be spinning on the lock? if not .. can we just let the lock go poof and not unlock it...
I believe socket lookup can, otherwise the code is OK as-is.
Quoted 7 lines · David S. Miller
From: Arjan van de Ven <[email protected]>
Date: Tue, 23 Aug 2005 18:54:03 +0200Quoted 2 lines
does it matter? can ANYTHING be spinning on the lock? if not .. can we just let the lock go poof and not unlock it...
I believe socket lookup can, otherwise the code is OK as-is.
lookup while the object is in progress of being destroyed sounds really bad though....
David S. Miller
maintainerFrom: Arjan van de Ven <[email protected]>
Subject: Re: some missing spin_unlocks
Date: Tue, 23 Aug 2005 19:40:06 +0200
Quoted 11 lines · David S. Miller
Quoted 7 lines
From: Arjan van de Ven <[email protected]>
Date: Tue, 23 Aug 2005 18:54:03 +0200Quoted 2 lines
does it matter? can ANYTHING be spinning on the lock? if not .. can we just let the lock go poof and not unlock it...
I believe socket lookup can, otherwise the code is OK as-is.
lookup while the object is in progress of being destroyed sounds really bad though....
This happens all the time with TCP sockets, for example. When we're trying to kill off a socket which is in time wait state, the receive path can find it, grab a reference, and process a packet against it right as we're trying to kill it off.
This is completely normal.
[added alsa-devel to cc:]
Quoted 4 lines · Ted Unangst
I think these are all real bugs.
sound/synth/emux/emux_synth.csnd_emux_note_on, line 101snd_assertwill return without unlockingemu->voice_lock(line 89)
This one is probably a real bug.
Lee
At Wed, 24 Aug 2005 11:56:58 -0400,
Quoted 10 lines · Lee Revell
[added alsa-devel to cc:]
Quoted 4 lines · Ted Unangst
I think these are all real bugs.
sound/synth/emux/emux_synth.csnd_emux_note_on, line 101snd_assertwill return without unlockingemu->voice_lock(line 89)This one is probably a real bug.
The patch below fixes them (already applied to ALSA CVS tree).
================================================================
[PATCH] Fix missing spin_unlock
Fixed missing spin_unlock.
sound/pci/au88x0/au88x0_pcm.c renamed from sound/pci/au88x0/au88x0_pcm.c:1.9 +3 -1
@@ -220,8 +220,10 @@vortex_adb_allocroute (chip,-1 ,params_channels (hw_params), substream->stream, type); -if (dma <0 ) +if (dma <0 ) { +spin_unlock_irq (&chip->lock);return dma; + } stream = substream->runtime->private_data = &chip->dma_adb[dma]; stream->substream = substream;/* Setup Buffers. */
sound/synth/emux/emux_synth.c renamed from sound/synth/emux/emux_synth.c:1.11 +0 -1
@@ -98,7 +98,6 @@ vp = emu->ops.get_voice (emu, port);if (vp ==NULL || vp->ch <0 )continue ; -snd_assert (vp->emu !=NULL && vp->hw !=NULL , return);if (STATE_IS_PLAYING (vp->state)) emu->ops.terminate (vp);
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf