From: Inaky Perez-Gonzalez Date: Thu, 21 May 2009 00:40:35 +0000 (-0700) Subject: wimax/i2400m: fix panic due to missed corner cases on tail_room calculation X-Git-Tag: v2.6.31-rc1~330^2~34^2~12 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2971a5bac8cab3cb56f19e9c494ecb3b120c5199;p=pandora-kernel.git wimax/i2400m: fix panic due to missed corner cases on tail_room calculation i2400m_tx_skip_tail() needs to handle the special case of being called when the tail room that is left over in the FIFO is zero. This happens when a TX message header was opened at the very end of the FIFO (without payloads). The i2400m_tx_close() code already marked said TX message (header) to be skipped and this function should be doing nothing. It is called anyway because it is part of a common "corner case" path handling which takes care of more cases than only this one. The tail room computation was also improved to take care of the case when tx_in is at the end of the buffer boundary; tail_room has to be modded (%) to the buffer size. To do that in a single well-documented place, __i2400m_tx_tail_room() is introduced and used. Treat i2400m->tx_in == 0 as a corner case and handle it accordingly. Found and diagnosed by Cindy H. Kao. Signed-off-by: Inaky Perez-Gonzalez --- Reading git-diff-tree failed