[openbsc-commits] r285 - trunk/openbsc/src

zecke at bs11-abis.gnumonks.org zecke at bs11-abis.gnumonks.org
Mon Feb 9 22:05:56 CET 2009


Author: zecke
Date: 2009-02-09 22:05:56 +0100 (Mon, 09 Feb 2009)
New Revision: 285

Modified:
   trunk/openbsc/src/subchan_demux.c
Log:
fix segfault when trying to dequeue list head as list element


Modified: trunk/openbsc/src/subchan_demux.c
===================================================================
--- trunk/openbsc/src/subchan_demux.c	2009-02-09 18:14:24 UTC (rev 284)
+++ trunk/openbsc/src/subchan_demux.c	2009-02-09 21:05:56 UTC (rev 285)
@@ -202,13 +202,13 @@
 
 		/* make sure we have a valid entry at top of tx queue.
 		 * if not, add an idle frame */
-		if (llist_empty(&sch->tx_queue))	
+		if (llist_empty(&sch->tx_queue))
 			alloc_add_idle_frame(mx, subch);
 	
 		if (llist_empty(&sch->tx_queue))
 			return -EIO;
 
-		txe = llist_entry(&sch->tx_queue, struct subch_txq_entry, list);
+		txe = llist_entry(sch->tx_queue.next, struct subch_txq_entry, list);
 		num_bits_left = txe->bit_len - txe->next_bit;
 
 		if (num_bits_left < num_requested)
@@ -291,7 +291,7 @@
 	tqe->bit_len = len;
 	memcpy(tqe->bits, data, len);
 
-	llist_add(&tqe->list, &sch->tx_queue);
+	llist_add_tail(&tqe->list, &sch->tx_queue);
 
 	return 0;
 }





More information about the OpenBSC-commits mailing list