diff options
-rw-r--r-- | drivers/bluetooth/btnxpuart.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c index a2335fe3e264..93f3afc0c0c8 100644 --- a/drivers/bluetooth/btnxpuart.c +++ b/drivers/bluetooth/btnxpuart.c @@ -1199,33 +1199,20 @@ static const struct h4_recv_pkt nxp_recv_pkts[] = { { NXP_RECV_FW_REQ_V3, .recv = nxp_recv_fw_req_v3 }, }; -static bool is_valid_bootloader_signature(const u8 *data, size_t count) -{ - if ((*data == NXP_V1_FW_REQ_PKT && count == sizeof(struct v1_data_req) + 1) || - (*data == NXP_V3_FW_REQ_PKT && count == sizeof(struct v3_data_req) + 1) || - (*data == NXP_V3_CHIP_VER_PKT && count == sizeof(struct v3_start_ind) + 1)) - return true; - else - return false; -} - static int btnxpuart_receive_buf(struct serdev_device *serdev, const u8 *data, size_t count) { struct btnxpuart_dev *nxpdev = serdev_device_get_drvdata(serdev); - if (is_fw_downloading(nxpdev) && !is_valid_bootloader_signature(data, count)) { - /* Unknown bootloader signature, skip without returning error */ - return count; - } - ps_start_timer(nxpdev); nxpdev->rx_skb = h4_recv_buf(nxpdev->hdev, nxpdev->rx_skb, data, count, nxp_recv_pkts, ARRAY_SIZE(nxp_recv_pkts)); 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); nxpdev->rx_skb = NULL; return err; |