]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Staging: rtl8192u: fix a reversed test
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 6 Jun 2013 07:30:49 +0000 (10:30 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Jun 2013 18:57:15 +0000 (11:57 -0700)
Sean MacLennan fixed this in the rtl8192e driver and we should fix
it here as well.

It's pretty harmless.  This information comes from the firmware, if
we were to hit this bug we would read beyond the end of the array
once or twice before returning and update our statistics with bogus
data.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8192u/r819xU_cmdpkt.c

index 002d9b4e47c547853b823e0abad904d0c201fcdc..6810766edfcf19fa9f8d5578c1ae229536f9fdae 100644 (file)
@@ -727,7 +727,7 @@ cmpk_message_handle_rx(
              element type. Because FW may aggregate RX command packet to minimize
              transmit time between DRV and FW.*/
        // Add a counter to prevent the lock in the loop from being held too long
-       while (total_length > 0 || exe_cnt++ >100)
+       while (total_length > 0 && exe_cnt++ < 100)
        {
                /* 2007/01/17 MH We support aggregation of different cmd in the same packet. */
                element_id = pcmd_buff[0];