Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3822967pxf; Mon, 15 Mar 2021 21:14:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLPIW0ryeowUuA9x8v/CPvh8ViTNZsXm5HA4KTjN9iNxDqhe57KHyhsmyP8oPc6SDBwjCC X-Received: by 2002:aa7:cb97:: with SMTP id r23mr11309826edt.106.1615868060224; Mon, 15 Mar 2021 21:14:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615868060; cv=none; d=google.com; s=arc-20160816; b=jKmLxTR71ot7QMyLvWh9pIJ5mtx7eBqLvbZ/XxQLTMQctCBPj6NGrFLiuoc56P1gej /JHTCP3ejmYJ6uEtlZ1+ls1y+W/gdh6hmrQwtgUPhlHicl0WGaDAjf9d0VfBuEdBhWHH w3Vfo010fI4w4ylLqxG6TU4gHF93s6fzer1PTu/9ggk4W7w9eWtLoRUwTKlXKNyQXCAx SoTulNVfcx2fvvA2ZRWdpTne91DjZO5B9Yp9i2CBhBm8IxE2AUbcDHdIVhpF3vLvivlo TcIqYjuNuAaYYb5Le1MFvK2QoHXjN2YSm6lLQTNqVWcTMwv3lCqEhv13oV4hYXAnTVOD gkTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=+9o+mRo1PtsPEq3YfOYLYhV1RlW0xg0vnV4ig+lyaUE=; b=pKGt1OiI+EnxwyAtlSD4CYCk3W+rG2ozqM1oaoHaqLD7PmiaAL5Cyy7o0g8LjOmSIV l79WpI3QzuZMMlpYLpn52h16pWrrIVRvwytMpo4BAAm8dpnV+IbRlJgtkbxHQRGll+Wx VlsatOCA2YLZ8HCZQErRTm88DO2e5Cs+hhPCCwPeCc3VdZJZudTyZxD8jVPzMB7aCul9 x9a7bC5J2a+I77ivFJ1a/LhBMxLYbhyTs/kddCFw6QOP/lRBd13QDf1nQF73HMvY7rlB IrQSviIKoWIfSva8XTMOPSfh+714DQIDUnc+8p7RHvT8TdSOhrTrVVC9iHdvhtOT1lyD Ib+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q27si14128274edi.328.2021.03.15.21.13.40; Mon, 15 Mar 2021 21:14:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229808AbhCOUHx (ORCPT + 99 others); Mon, 15 Mar 2021 16:07:53 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:33037 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231741AbhCOUHh (ORCPT ); Mon, 15 Mar 2021 16:07:37 -0400 Received: from marcel-macbook.holtmann.net (p4fefc126.dip0.t-ipconnect.de [79.239.193.38]) by mail.holtmann.org (Postfix) with ESMTPSA id 95B01CECE5; Mon, 15 Mar 2021 21:15:12 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: [PATCH v2] Bluetooth: Cancel le_scan_restart work when stopping discovery From: Marcel Holtmann In-Reply-To: <20210315173059.74030-1-sonnysasaka@chromium.org> Date: Mon, 15 Mar 2021 21:07:35 +0100 Cc: Bluetooth Kernel Mailing List , Abhishek Pandit-Subedi Content-Transfer-Encoding: 7bit Message-Id: <43E0F57D-321D-4963-B0D1-6A1C078BDC7B@holtmann.org> References: <20210315173059.74030-1-sonnysasaka@chromium.org> To: Sonny Sasaka X-Mailer: Apple Mail (2.3654.60.0.2.21) Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Sonny, > Not cancelling it has caused a bug where passive background scanning is > disabled out of the blue, preventing BLE keyboards/mice to reconnect. > Here is how it happens: > After hci_req_stop_discovery, there is still le_scan_restart_work > scheduled. Invocation of le_scan_restart_work causes a harmful > le_scan_disable_work to be scheduled. This le_scan_disable_work will > eventually disable passive scanning when the timer fires. > > Sample btmon trace: > > < HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7 > Type: Passive (0x00) > Interval: 367.500 msec (0x024c) > Window: 37.500 msec (0x003c) > Own address type: Public (0x00) > Filter policy: Accept all advertisement (0x00) >> HCI Event: Command Complete (0x0e) plen 4 > LE Set Scan Parameters (0x08|0x000b) ncmd 1 > Status: Success (0x00) > < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2 > Scanning: Enabled (0x01) > Filter duplicates: Disabled (0x00) >> HCI Event: Command Complete (0x0e) plen 4 > LE Set Scan Enable (0x08|0x000c) ncmd 2 > Status: Success (0x00) > ... > < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2 > Scanning: Disabled (0x00) > Filter duplicates: Disabled (0x00) >> HCI Event: Command Complete (0x0e) plen 4 > LE Set Scan Enable (0x08|0x000c) ncmd 2 > Status: Success (0x00) > // Background scanning is not working here onwards. > > Reviewed-by: Abhishek Pandit-Subedi > Signed-off-by: Sonny Sasaka > > --- > net/bluetooth/hci_request.c | 1 + > 1 file changed, 1 insertion(+) patch has been applied to bluetooth-next tree. Regards Marcel