[riot-devel] question on a possibility for a netdev deadlock

Martin martin.landsmann at haw-hamburg.de
Wed Jun 24 09:54:09 CEST 2015


Hi all,

I've tested the ng_ stack with samr21-xpro boards using the new 
ng_at86rf2xx driver.
Since I sometimes encountered hardfaults I took a look in the ISR 
handling of the driver [1].

There we handle incoming packets when the receiver has finished the RX 
process [2].
Since we are in a ISR, all other processes has been interrupted.

Now when we call _receive_data() function inside the ISR, that in turn 
calls pktbuf handling/manipulating functions [3],
we try to acquire the mutex protecting the pktbuf [4].

Since we are still inside of the ISR probably the mutex is acquired by 
someone else.
If true this leads to a deadlock since the ISR would wait forever to 
acquire the mutex and never return to leave the ISR.

Additionally if we successfully acquire the mutex,
we could produce inconsistencies iff the protection is not performed 
consistently.

Just wanted to ask if I'm mistaken here and missed something.

Best regards,
Martin

[1] 
https://github.com/RIOT-OS/RIOT/blob/master/drivers/ng_at86rf2xx/ng_at86rf2xx_netdev.c#L671
[2] 
https://github.com/RIOT-OS/RIOT/blob/master/drivers/ng_at86rf2xx/ng_at86rf2xx_netdev.c#L688
[3] 
https://github.com/RIOT-OS/RIOT/blob/master/drivers/ng_at86rf2xx/ng_at86rf2xx_netdev.c#L271
[4] 
https://github.com/RIOT-OS/RIOT/blob/master/sys/net/crosslayer/ng_pktbuf/ng_pktbuf.c#L81


More information about the devel mailing list