[Tinyos-2-commits] CVS: tinyos-2.x/tos/system AMQueueImplP.nc, 1.5, 1.6

Phil Levis scipio at users.sourceforge.net
Fri Apr 13 10:31:17 PDT 2007


Update of /cvsroot/tinyos/tinyos-2.x/tos/system
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv13165

Modified Files:
	AMQueueImplP.nc 
Log Message:
Patch from John Regehr. Make queue catch it when the underlying radio
stack issues a spurious sendDone. Currently, if the queue is empty this
will cause it to access invalid memory (past the end of an array).

The real bug is the spurious sendDone, which he observed on the mica2.
However, until this bug is fixed, we need to catch it.



Index: AMQueueImplP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/system/AMQueueImplP.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** AMQueueImplP.nc	15 Mar 2007 13:03:06 -0000	1.5
--- AMQueueImplP.nc	13 Apr 2007 17:31:15 -0000	1.6
***************
*** 180,190 ****
    
      event void AMSend.sendDone[am_id_t id](message_t* msg, error_t err) {
!         if(queue[current].msg == msg) {
!             sendDone(current, msg, err);
!         }
!         else {
!             dbg("PointerBug", "%s received send done for %p, signaling for %p.\n",
!                 __FUNCTION__, msg, queue[current].msg);
!         }
      }
      
--- 180,198 ----
    
      event void AMSend.sendDone[am_id_t id](message_t* msg, error_t err) {
!       // Bug fix from John Regehr: if the underlying radio mixes things
!       // up, we don't want to read memory incorrectly. This can occur
!       // on the mica2.
!       // Note that since all AM packets go through this queue, this
!       // means that the radio has a problem. -pal
!       if (current >= numClients) {
! 	return;
!       }
!       if(queue[current].msg == msg) {
! 	sendDone(current, msg, err);
!       }
!       else {
! 	dbg("PointerBug", "%s received send done for %p, signaling for %p.\n",
! 	    __FUNCTION__, msg, queue[current].msg);
!       }
      }
      



More information about the Tinyos-2-commits mailing list