From nobody Tue Apr 7 07:09:30 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BC55ECAAD5 for ; Tue, 30 Aug 2022 02:58:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230004AbiH3C6g (ORCPT ); Mon, 29 Aug 2022 22:58:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229689AbiH3C6e (ORCPT ); Mon, 29 Aug 2022 22:58:34 -0400 Received: from mail-pl1-x649.google.com (mail-pl1-x649.google.com [IPv6:2607:f8b0:4864:20::649]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C1AB9FABD for ; Mon, 29 Aug 2022 19:58:33 -0700 (PDT) Received: by mail-pl1-x649.google.com with SMTP id b9-20020a170903228900b001730a0e11e5so7216911plh.19 for ; Mon, 29 Aug 2022 19:58:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc; bh=mXODdFJOi47qFxuaBDFzWIBYSAQ55JCqgGs7Fum9gUw=; b=oXx1RFmFoaFpGoHeVLvUsAH/QO5H28u8zUgFjw5oflI5sieX1P5U3/Z7TXqAFe86GO clzJ4uCylokNoe46G/ldRWnVm5FQWxyZAb6g3Drk6G2HncBy0aq/ZiYBPw3tXZCcgNJy OLsVTH+rbA095vRPvrDH0IPRUnFUShEeEknHPwFBPCXSp01miFtUtxHrRRs1hPLWd2sV EfgpBLla/mP4qdmFmB+yFLWJzbc6I2c8oom4mv0o60Qu3PFpKkuWGH9htbfs9lYlxFwy Hp1CoE26ziYkh7cGeYjp8Fl31BKFNJNqMJYCtEGzZ1EEvEANHlEzDwPj7Av71FetwD7W RObg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc; bh=mXODdFJOi47qFxuaBDFzWIBYSAQ55JCqgGs7Fum9gUw=; b=iGYxIlqHYncO4uiG2FiuzZEI6UumLpWH3z4sQ7fd4XgpmcxyOmcZ/1dX4FszdlqW73 5jQs/LaJTvNCM5KPtaMCLnZVi8XttXgFHDdJoZIJ2ajHsKZ2hPUiRYlXY8yFXGA3kIad lIfthlx6NaBy7c8vStVVIKhdzzzKPwM6BFcdrrywAvuvI+TfxKZTPGrUWxJDvAlKrUfC l9ZZmTOPNP9Ysg0veneK1sAgMFuVwhcVErrwzsgfhrL92K/cgFaoyhHFG/MrO91aRMpp jcE1yWSZ/4gCqTWvGx/olJswtRMLiXmjekUtEzI+dqOyVWHpBsSYkuVuPAKu4j6+zK9X UaKA== X-Gm-Message-State: ACgBeo1Runz0O3rmjs9tSDtgzRVPev05QQBlm9+FKyCNJlDrSq/fkb4y 600+Yse1fw9e89GrPTu6R3y2K4WU+EQXvN6pXdmccg== X-Google-Smtp-Source: AA6agR6NZUm4QwSTu5Mo0zFw2JMhgTEkHooh30Xuym1xPQd7iaesgJ1yJQcjk+QRHUx17Y2Fbclio8SH5AxJYBUx/Yd7bQ== X-Received: from abps.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:9b4]) (user=abhishekpandit job=sendgmr) by 2002:a63:145:0:b0:42c:1f56:2799 with SMTP id 66-20020a630145000000b0042c1f562799mr6647738pgb.154.1661828312961; Mon, 29 Aug 2022 19:58:32 -0700 (PDT) Date: Mon, 29 Aug 2022 19:58:26 -0700 Mime-Version: 1.0 X-Mailer: git-send-email 2.37.2.672.g94769d06f0-goog Message-ID: <20220829195805.1.Ic8eabc8ed89a07c3d52726dd017539069faac6c4@changeid> Subject: [PATCH] Bluetooth: Call shutdown for HCI_USER_CHANNEL From: Abhishek Pandit-Subedi To: linux-bluetooth@vger.kernel.org Cc: Abhishek Pandit-Subedi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Johan Hedberg , Luiz Augusto von Dentz , Marcel Holtmann , Paolo Abeni , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Abhishek Pandit-Subedi Some drivers depend on shutdown being called for proper operation. There's no reason to restrict this from being called when using HCI_USER_CHANNEL. Signed-off-by: Abhishek Pandit-Subedi --- This is easy to reproduce on QCA6174-A, which uses the hci_qca driver. Simply open the socket, bind as userchannel and close again. It will succeed the first time and fail the second time (because shutdown wasn't called). A similar bug also occurs with btmtksdio (using MT7921). Question for maintainers: What is a driver supposed to be doing during shutdown? We should add some documentation to `struct hci_dev` to clarify. net/bluetooth/hci_sync.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index e08c0503027d..be78fd708f16 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -4680,7 +4680,6 @@ int hci_dev_close_sync(struct hci_dev *hdev) } =20 if (!hci_dev_test_flag(hdev, HCI_UNREGISTER) && - !hci_dev_test_flag(hdev, HCI_USER_CHANNEL) && test_bit(HCI_UP, &hdev->flags)) { /* Execute vendor specific shutdown routine */ if (hdev->shutdown) --=20 2.37.2.672.g94769d06f0-goog