From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796220966; b=BwMYxSZnsLqqvaCSHA2EkAybxoT1K/SkRplG/VlvJzqLONxZZgIOZxCNf/ygWceg04S+ dkzR/hHTje36p281j7aG5ARy9C1YwWnd5B9iHAonVs6qlukZhLLi6wk4P450c3GCG3LBg nuEDc+rhBLXVbtZ0+qR0yQIEFI8mLB7uoSTQcXFmBZ3cS/nBaPJbCQv1OW3rm0h6IKAVw q+TxVOBp4Sy73SucP58IBiNSglPGo6JXNP7/C8M/C3ZvjmF2LfjHaUZnPakfvS3/fQp5t wXSoznyijqW2/sR/n6+I4dXVolSXPyChVdJsFCDKTg7o2bDUbHov54lcd2v+pHvYaHw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796220966; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=Z5MJ7quKh4GGvBLpO9vX9/stawtdfXCk77nCHyfFZL8=; b=jEzYsurctZ6Vf4sCC0PIMzQdkLRqqp5u6SH7TdUXXrq37nyZcsFeYYFgNfg8axRvtk+9 DjmLndADmlCj8g2qf2XlNdfwWGYp+24RZRTv6vER3Q/LvTgRg065deYoQ43/6b8iIt+K3 UT7XAZUJjHm5cL+ckOVJAUjVmJOhK4ORih6KYttvm81LmJ2jI9Jiudoi8HET29WkzluOc pChn0lF731K5I0kHRHro1URKGLZRgU2ztR1dCjU9Po2yxmHCj7nD91yuOu+5JoyDyqkiv NCVUo6byxwTISBqDKNKVO/+F9CZW+pi1UY2fuM6gUW4dbrboLBTdKtdOkc7+Um5MH2g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Hj7s2nKs; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3AAB4606A322 for ; Wed, 2 Dec 2026 14:16:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Hj7s2nKs Received: by smtp.kernel.org (Postfix) with ESMTPSA id 281921F00926; Wed, 2 Dec 2026 14:16:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796220965; bh=Z5MJ7quKh4GGvBLpO9vX9/stawtdfXCk77nCHyfFZL8=; h=Subject:To:Cc:From:Date; b=Hj7s2nKsJjtAVU5lZdKJuOEtglBHBh/hvpPuuwZ0c0eVUSuGOG/vFTR0JClu1R/oI RQ9vrPjQ4IgxuyPmdkUgyLmv9/kckny3kZnbDahaKieubaN4qGQZGkI/uGoSyiXhGd rXvR0Ly6vHkyNLI5n6dCSJo0/nAhhNYBpoBxQIRk= Subject: FAILED: patch "[PATCH] Bluetooth: hci_serdev: serialize flush with transmit work" failed to apply to 6.18-stable tree To: enderaoelyther@gmail.com,luiz.von.dentz@intel.com Cc: From: Date: Wed, 02 Dec 2026 13:59:03 +0100 Message-ID: <2026120203-overreact-denatured-40ea@gregkh> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.18-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y git checkout FETCH_HEAD git cherry-pick -x ee43bade37c4578b52a76cf0cdb199d3c0019506 # git commit -s git send-email --to '' --in-reply-to '2026120203-overreact-denatured-40ea@gregkh' --subject-prefix 'PATCH 6.18.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From ee43bade37c4578b52a76cf0cdb199d3c0019506 Mon Sep 17 00:00:00 2001 From: Zhao Li Date: Mon, 16 Nov 2026 16:05:38 +0800 Subject: [PATCH] Bluetooth: hci_serdev: serialize flush with transmit work hci_uart_flush() runs on HCI close and reset and frees hu->tx_skb while write_work may still be sending the same partial frame. The worker can then resume with a freed skb, or both paths can free the frame. The tty flush has stopped write_work before freeing the partial frame since commit 1b0d946d6f08 ("Bluetooth: hci_uart: clear HCI_UART_SENDING when write_work is canceled"). Do the same in the serdev flush: disable and drain write_work before releasing the frame, and hold HCI_UART_SENDING meanwhile so that hci_uart_tx_wakeup() only records HCI_UART_TX_WAKEUP. Then re-enable the work, release SENDING and replay a wakeup that arrived in between. AI assistance was used. Fixes: 82f5169bf3d3 ("Bluetooth: hci_uart: add serdev driver support library") Cc: stable@vger.kernel.org # needs adjustments for <= 7.4 Signed-off-by: Zhao Li Signed-off-by: Luiz Augusto von Dentz diff --git a/drivers/bluetooth/hci_serdev.c b/drivers/bluetooth/hci_serdev.c index d2c48df34199..194f11251cc5 100644 --- a/drivers/bluetooth/hci_serdev.c +++ b/drivers/bluetooth/hci_serdev.c @@ -97,17 +97,26 @@ static int hci_uart_flush(struct hci_dev *hdev) BT_DBG("hdev %p serdev %p", hdev, hu->serdev); + /* Stop write_work and hold SENDING so wakeups only set TX_WAKEUP. */ + disable_work_sync(&hu->write_work); + set_bit(HCI_UART_SENDING, &hu->tx_state); + if (hu->tx_skb) { kfree_skb(hu->tx_skb); hu->tx_skb = NULL; } - if (!test_bit(HCI_UART_PROTO_READY, &hu->flags)) - return 0; + if (test_bit(HCI_UART_PROTO_READY, &hu->flags)) { + /* Flush any pending characters in the driver and discipline. */ + serdev_device_write_flush(hu->serdev); - /* Flush any pending characters in the driver and discipline. */ - serdev_device_write_flush(hu->serdev); + hu->proto->flush(hu); + } - hu->proto->flush(hu); + /* Resume TX and replay a wakeup recorded while it was stopped. */ + enable_work(&hu->write_work); + clear_bit(HCI_UART_SENDING, &hu->tx_state); + if (test_bit(HCI_UART_TX_WAKEUP, &hu->tx_state)) + hci_uart_tx_wakeup(hu); return 0; }