Mailing List archive

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

[linux-dvb] Re: Oops in dvbdmx_release_ts_feed (2.6.0-test9)



On Sun, 2003-11-02 at 14:05, Ralph Metzler wrote:
> Pekka Pietikainen writes:
>  > On Sun, Nov 02, 2003 at 01:22:35PM +0200, Pekka Pietikainen wrote:
>  > 
>  > > Hopefully this is enough to debug the problem, I'll try to figure it out
>  > > myself as well, but since I'm quite unfamiliar with the code it might take
>  > > some time :/
>  > Is it just me, or shouldn't dmx_pid_set get demux->mutex before deleting 
>  > entries from feed->list?
> 
> No, it only is called from functions which already got the mutex.
> But it should disable irq/bh (see dmx_pid_set in dvb_sw_demux.c in our
> driver).

Thank you, Ralph. Can anyone please test the attached patch for the
dvb-kernel tree to see if it fixes the problem?
Index: linux/drivers/media/dvb/dvb-core/dvb_demux.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/dvb-core/dvb_demux.c,v
retrieving revision 1.40
diff -u -r1.40 dvb_demux.c
--- linux/drivers/media/dvb/dvb-core/dvb_demux.c	31 Oct 2003 13:13:13 -0000	1.40
+++ linux/drivers/media/dvb/dvb-core/dvb_demux.c	7 Nov 2003 05:32:30 -0000
@@ -536,15 +536,20 @@
 		return 0;
 
 	if (feed->pid <= DMX_MAX_PID) {
+		spin_lock_irq(&demux->lock);
 		list_for_each_safe(pos, n, head) {
 			if (DMX_FEED_ENTRY(pos)->pid == feed->pid) {
 				list_del(pos);
 				break;
 			}
 		}
+		spin_unlock_irq(&demux->lock);
 	}
 
+	spin_lock_irq(&demux->lock);
 	list_add(&feed->list_head, head);
+	spin_unlock_irq(&demux->lock);
+
 	feed->pid = pid;
 
 	return 0;
@@ -759,13 +764,17 @@
 	feed->filter->state = DMX_STATE_FREE;
 
 	if (feed->pid <= DMX_MAX_PID) {
-		list_for_each_safe(pos, n, head)
+		spin_lock_irq(&demux->lock);
+		list_for_each_safe(pos, n, head) {
 			if (DMX_FEED_ENTRY(pos)->pid == feed->pid) {
 				list_del(pos);
 				break;
 			}
+		}
+		spin_unlock_irq(&demux->lock);
 		feed->pid = 0xffff;
 	}
+
 	
 	if (feed->ts_type & TS_DECODER)
 		demux->pesfilter[feed->pes_type] = NULL;
@@ -824,17 +833,21 @@
 
 	if (down_interruptible (&dvbdmx->mutex))
 		return -ERESTARTSYS;
-	
+
 	if (dvbdmxfeed->pid <= DMX_MAX_PID) {
+		spin_lock_irq(&dvbdmx->lock);
 		list_for_each_safe(pos, n, head) {
 			if (DMX_FEED_ENTRY(pos)->pid == dvbdmxfeed->pid) {
 				list_del(pos);
 				break;
 			}
 		}
+		spin_unlock_irq(&dvbdmx->lock);
 	}
 
+	spin_lock_irq(&dvbdmx->lock);
 	list_add(&dvbdmxfeed->list_head, head);
+	spin_unlock_irq(&dvbdmx->lock);
 
 	dvbdmxfeed->pid = pid;
 	dvbdmxfeed->buffer_size = circular_buffer_size;
@@ -1051,12 +1064,14 @@
 	dvbdmxfeed->state=DMX_STATE_FREE;
 
 	if (dvbdmxfeed->pid <= DMX_MAX_PID) {
+		spin_lock_irq(&dvbdmx->lock);
 		list_for_each_safe(pos, n, head) {
 			if (DMX_FEED_ENTRY(pos)->pid == dvbdmxfeed->pid) {
 				list_del(pos);
 				break;
 			}
 		}
+		spin_unlock_irq(&dvbdmx->lock);
 		dvbdmxfeed->pid = 0xffff;
 	}
 

Home | Main Index | Thread Index