Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1952766pxf; Sat, 13 Mar 2021 03:03:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJznk6qajv39xW249lFEi3xb63sycSgfT/PFgh6TvbsDNbEZvOmmltcm2/j/r6Cpx6cc3UlS X-Received: by 2002:a17:906:3388:: with SMTP id v8mr13614835eja.278.1615633434258; Sat, 13 Mar 2021 03:03:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615633434; cv=none; d=google.com; s=arc-20160816; b=wA2RUVxVN6hZxkc/6wPfqw65o8IBnPVSdCysCjZjwyE2iE/FsB+Flper20xPIrwL6r clAjVKkFN1LsAJjK7qEcwfDGdsOwp4Pq8GMlEjqIbWjgexVIKiLKHSydZNIdSvuPax5M V4vplOY+ajHaMrcujUTRzjbIZBUn/SfiKd2ZzFDCA/tvJwgfGOm6SJhQTK8CxE38aF6/ po8lAvR3/t9lz6Pv9Pb5YC0IVtX1X+1yMYluJ6INLzqFsL80ju2Fj3FCUWVqzmL6CB2B wnHd/XJ9tjRvuooi4yBWNyRrn1+UIwgJYcCmg23rVtKVab/Q5qAcOBT4MO4nHtLlpVDL qovg== 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=feAnVFWNv0Pl2hdmtqj3l6Oe/3Cbgyc9qurO+5PCqEQ=; b=C1goayRGa6mDZ8K7pod6ExrpBs55nnlXW955ImTLCGmoHfkNYGBIzN6p1Wrcr1jpDZ OnC/21mUqoIwR5jNw0RH3yGV/9/WjsaAlSUcqbOouu2GK1K9zRLFz4x9vnUeDmJ9ssao 213ahNR97NWWqlKj/tXCQ+xbFDMOihfpm99gFfSzr0r6apZD2ZwnT35h6jTS0JNYw9k+ eCy805AZsOFM1z3/lyoE5JnMa8eB01Hu6diTgV2YJKjniaQwaYYEpgXJPtqvDeb/oo3U lYIGHpRNwTiLNvF0vmf794WCjLPiOzup3p5/hgpuhfHdfI+zNDwK6eFUaBFOrxEaaF1u 1Czw== 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 de13si6078285edb.525.2021.03.13.03.03.11; Sat, 13 Mar 2021 03:03:54 -0800 (PST) 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 S231597AbhCMLAi convert rfc822-to-8bit (ORCPT + 99 others); Sat, 13 Mar 2021 06:00:38 -0500 Received: from coyote.holtmann.net ([212.227.132.17]:48167 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231134AbhCMLAP (ORCPT ); Sat, 13 Mar 2021 06:00:15 -0500 Received: from marcel-macbook.holtmann.net (p4fefc126.dip0.t-ipconnect.de [79.239.193.38]) by mail.holtmann.org (Postfix) with ESMTPSA id 3E61FCED1B; Sat, 13 Mar 2021 12:07:50 +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] Bluetooth: Cancel le_scan_restart work when stopping discovery From: Marcel Holtmann In-Reply-To: <20210313004435.73331-1-sonnysasaka@chromium.org> Date: Sat, 13 Mar 2021 12:00:13 +0100 Cc: linux-bluetooth@vger.kernel.org, Abhishek Pandit-Subedi Content-Transfer-Encoding: 8BIT Message-Id: <86C70A5F-A214-4CA7-A801-82405C17AC78@holtmann.org> References: <20210313004435.73331-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(+) I can apply this cleanly to bluetooth-next tree. Please double-check and rebase if it is still needed. Regards Marcel