lkml.org 
[lkml]   [2014]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.10 32/43] Bluetooth: Fix HCI H5 corrupted ack value
    Date
    3.10-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Loic Poulain <loic.poulain@intel.com>

    commit 4807b51895dce8aa650ebebc51fa4a795ed6b8b8 upstream.

    In this expression: seq = (seq - 1) % 8
    seq (u8) is implicitly converted to an int in the arithmetic operation.
    So if seq value is 0, operation is ((0 - 1) % 8) => (-1 % 8) => -1.
    The new seq value is 0xff which is an invalid ACK value, we expect 0x07.
    It leads to frequent dropped ACK and retransmission.
    Fix this by using '&' binary operator instead of '%'.

    Signed-off-by: Loic Poulain <loic.poulain@intel.com>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    drivers/bluetooth/hci_h5.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/drivers/bluetooth/hci_h5.c
    +++ b/drivers/bluetooth/hci_h5.c
    @@ -237,7 +237,7 @@ static void h5_pkt_cull(struct h5 *h5)
    break;

    to_remove--;
    - seq = (seq - 1) % 8;
    + seq = (seq - 1) & 0x07;
    }

    if (seq != h5->rx_ack)



    \
     
     \ /
      Last update: 2014-10-28 08:01    [W:8.010 / U:0.040 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site