rt2800usb: Added rx packet length validity check
authorSergei Poselenov <sposelenov@emcraft.com>
Sun, 2 Sep 2012 09:14:32 +0000 (13:14 +0400)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 19 Sep 2012 14:05:11 +0000 (15:05 +0100)
commit9cab0e1c7f5872173d40f188b430d1348b118710
tree56c4ba674156d707790ca4505140cd9be998911d
parentd1a0322803c21b12abeb9070959d7aeb549634e4
rt2800usb: Added rx packet length validity check

commit efd5d6b03bd9c9e0df646c56fb5f4f3e25e5c1ac upstream.

On our system (ARM Cortex-M3 SOC running linux-2.6.33)
frequent crashes were observed in the rt2800usb module
because of the invalid length of the received packet (3392,
46920...). This patch adds the sanity check on the packet
legth. Also, changed WARNING to ERROR in rt2x00lib_rxdone()
so that the bad packet condition would be noticed.

The fix was tested on the latest compat-wireless-3.5.1-1-snpc.

Signed-off-by: Sergei Poselenov <sposelenov@emcraft.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/net/wireless/rt2x00/rt2800usb.c
drivers/net/wireless/rt2x00/rt2x00dev.c