Patch "Bluetooth: btnxpuart: fix recv_buf() return value" has been added to the 6.7-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    Bluetooth: btnxpuart: fix recv_buf() return value

to the 6.7-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     bluetooth-btnxpuart-fix-recv_buf-return-value.patch
and it can be found in the queue-6.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit bad56bf7bf5677c63cb9182e5370ab3c54f0779e
Author: Francesco Dolcini <francesco.dolcini@xxxxxxxxxxx>
Date:   Mon Dec 11 17:40:18 2023 +0100

    Bluetooth: btnxpuart: fix recv_buf() return value
    
    [ Upstream commit 94d05394254401e503867c16aff561d3e687dfdc ]
    
    Serdev recv_buf() callback is supposed to return the amount of bytes
    consumed, therefore an int in between 0 and count.
    
    Do not return a negative number in case of issue, just print an error
    and return count. Before this change, in case of error, the returned
    negative number was internally converted to 0 in ttyport_receive_buf,
    now when the receive buffer is corrupted we return the size of the whole
    received data (`count`). This should allow for better recovery in case
    receiver/transmitter get out of sync if some data is lost.
    
    This fixes a WARN in ttyport_receive_buf().
    
      Bluetooth: hci0: Frame reassembly failed (-84)
      ------------[ cut here ]------------
      serial serial0: receive_buf returns -84 (count = 6)
      WARNING: CPU: 0 PID: 37 at drivers/tty/serdev/serdev-ttyport.c:37 ttyport_receive_buf+0xd8/0xf8
      Modules linked in: mwifiex_sdio(+) ...
      CPU: 0 PID: 37 Comm: kworker/u4:2 Not tainted 6.7.0-rc2-00147-gf1a09972a45a #1
      Hardware name: Toradex Verdin AM62 WB on Verdin Development Board (DT)
      Workqueue: events_unbound flush_to_ldisc
      pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      pc : ttyport_receive_buf+0xd8/0xf8
      lr : ttyport_receive_buf+0xd8/0xf8
    ...
      Call trace:
       ttyport_receive_buf+0xd8/0xf8
       flush_to_ldisc+0xbc/0x1a4
       process_scheduled_works+0x16c/0x28c
    
    Closes: https://lore.kernel.org/all/ZWEIhcUXfutb5SY6@xxxxxxxxxxxxxxxxxxxxxxxxxxxx/
    Fixes: 689ca16e5232 ("Bluetooth: NXP: Add protocol support for NXP Bluetooth chipsets")
    Signed-off-by: Francesco Dolcini <francesco.dolcini@xxxxxxxxxxx>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c
index b7e66b7ac570..951fe3014a3f 100644
--- a/drivers/bluetooth/btnxpuart.c
+++ b/drivers/bluetooth/btnxpuart.c
@@ -1276,11 +1276,10 @@ static int btnxpuart_receive_buf(struct serdev_device *serdev, const u8 *data,
 	if (IS_ERR(nxpdev->rx_skb)) {
 		int err = PTR_ERR(nxpdev->rx_skb);
 		/* Safe to ignore out-of-sync bootloader signatures */
-		if (is_fw_downloading(nxpdev))
-			return count;
-		bt_dev_err(nxpdev->hdev, "Frame reassembly failed (%d)", err);
+		if (!is_fw_downloading(nxpdev))
+			bt_dev_err(nxpdev->hdev, "Frame reassembly failed (%d)", err);
 		nxpdev->rx_skb = NULL;
-		return err;
+		return count;
 	}
 	if (!is_fw_downloading(nxpdev))
 		nxpdev->hdev->stat.byte_rx += count;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux