Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1305613iog; Thu, 16 Jun 2022 03:39:49 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tAJnfg8794bAMv5WfLzB3t718A7giY23bszYMliCSuFltgF1Q/GO43pl+uaiMgpDfCHiH+ X-Received: by 2002:a63:89c1:0:b0:3fc:5fd2:54e4 with SMTP id v184-20020a6389c1000000b003fc5fd254e4mr3977599pgd.344.1655375989673; Thu, 16 Jun 2022 03:39:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655375989; cv=none; d=google.com; s=arc-20160816; b=FcyE0utB0bKKv0pXZUyjjLgAnFCZFOg+1ONOUGpZbPH5tW7/p9ZJF3bg7wes3OypbI en2qT7QY7GqrpzEoHh57c0WnXVYLi9ssu/e39ijjl+65UqmqNCJtm0vQPj0rQZ7svksW +YnILMdO68eomjK6taw2CpYhBr/caCx79+N1QhjQJWCi2FmSoZzV96G8Nhc3WQH6/LdT +CQg5DCXGdt/oC1Lu4Q/J3iX2CcwtHfV1SSWoCp8PRD3tVHnl+sxlnp93JDs7i9jGNFk BQcyitNdZ5er+QiKWiAWDoQnZuUVH05negScKyl5mn379ZRLynUjNThzZGqwCOHrtBAW iVUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-language:references:cc:to:subject:from:user-agent :mime-version:date:message-id; bh=bsKWxiclRuQY7QQTnyQHapOGdzBAztMXbsWd69tMpn8=; b=sLrKKIdiciN10zhOtmvdK/ndbb3d2E9hFgUOETdRSjuH9CgVqksgYENyLHupvTVWad AjXrWb/KQFOMtmoAM/fLOUJdBpGmSZ+UwmRC1gh4eilSprKoSJqWrHO55ote2ACYo2gI Xdhz/HjDpueGKlY1eJbkgdVG9RS958ywsPih+NM6DQruNOdC2MP3iL6Aa4vRxe6LLRLg 3dyE8QTKZtQlJeMSe8BR9ysWCC0rA6PahA2Jti/iiVgiJytrfK/eWA2wHciPZHrDfElb au18nSOwJBjtSkSPnrW/ApXju9ImkqqYpZNzQaIdLNPWueUOSBgDhDxF12cQuHFh6Rj3 vXAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v20-20020a17090abb9400b001df82539ad1si5075984pjr.54.2022.06.16.03.39.25; Thu, 16 Jun 2022 03:39:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359849AbiFPKig (ORCPT + 99 others); Thu, 16 Jun 2022 06:38:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359853AbiFPKi1 (ORCPT ); Thu, 16 Jun 2022 06:38:27 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A3E3193EB for ; Thu, 16 Jun 2022 03:38:25 -0700 (PDT) Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=[127.0.0.1]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1o1mtL-0006Uh-On; Thu, 16 Jun 2022 12:38:23 +0200 Message-ID: Date: Thu, 16 Jun 2022 12:38:21 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 From: Ahmad Fatoum Subject: Re: [BUG] BLE device unpairing triggers kernel panic To: Luiz Augusto von Dentz Cc: "linux-bluetooth@vger.kernel.org" , Marcel Holtmann , "regressions@lists.linux.dev" , Pengutronix Kernel Team References: <8d5c4724-d511-39b1-21d7-116c91cada45@pengutronix.de> Content-Language: en-US In-Reply-To: <8d5c4724-d511-39b1-21d7-116c91cada45@pengutronix.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: a.fatoum@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-bluetooth@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hello Luiz, On 16.05.22 18:37, Ahmad Fatoum wrote: >>>> - Commit a56a1138cbd8 ("Bluetooth: hci_sync: Fix not using conn_timeout") >>>> fixes, despite the title, what event is waited on. First Pairing works now, >>>> but the second pairing times out and crashes the kernel: >>>> >>>> [ 84.191684] Bluetooth: hci0: Opcode 0x200d failed: -110 >>>> [ 84.230478] Bluetooth: hci0: request failed to create LE connection: err -110 >>>> [ 84.237690] Unable to handle kernel read from unreadable memory at virtual address 0000000000000ca8 >> >> That said the error -110 mean -ETIMEDOUT > > Yes, this issue remains still. I feel better about my revert > knowing that the crash is fixed, but I'd like this regression > here fixed upstream as well. I'll try to collect some more > information and report back. I've now found time to revisit this and sprinkle around some extra logging. This is the initial pairing that works: Bluetooth: entered hci_le_create_conn_sync() Bluetooth: hci0: opcode 0x200d plen 25 Bluetooth: hci0: event 0x0f (sent = 0x0a) Bluetooth: hci0: BT: opcode 0x200d (sent: 0x0a) Bluetooth: hci0: event 0x3e (sent = 0x0a) Bluetooth: hci0: BT: subevent 0x0a (sent 0x0a) Bluetooth: entered hci_le_meta_evt(event=0x0a) completion clause I unpaired on device side and then retried pairing: Bluetooth: entered hci_le_create_conn_sync() Bluetooth: hci0: opcode 0x200d plen 25 Bluetooth: hci0: event 0x0f (sent = 0x0a) Bluetooth: hci0: BT: opcode 0x200d (sent: 0x0a) Bluetooth: entered hci_abort_conn() Bluetooth: hci0: opcode hci_req_add_ev 0x200e Bluetooth: hci0: event 0x0e (sent = 0x00) Bluetooth: hci0: event 0x3e (sent = 0x00) Bluetooth: hci0: BT: subevent 0x0a (sent 0x00) Bluetooth: __hci_cmd_sync_sk pending (event = 0x0a status=1, err=-110) Bluetooth: hci0: Opcode 0x200d failed: -110 Bluetooth: hci0: opcode 0x2006 plen 15 Bluetooth: hci0: event 0x0e (sent = 0x00) Bluetooth: hci0: opcode 0x200a plen 1 Bluetooth: hci0: event 0x0e (sent = 0x00) Bluetooth: hci0: request failed to create LE connection: err -110 But now it times out as reported. It looks like the intermittent hci_abort_conn() is at fault here. My theory is that replacing hci->sent_cmd is the problem here, as other events can't be matched anymore. We've been deploying the revert for a while now and I just posted it to the mailing list[1]. There have been other reports of this issue with different hardware too and fixing sent_cmd would likely be too complicated/time intensive for me. I am happy to test future patches that fix this properly though. [1]: https://lore.kernel.org/linux-bluetooth/20220616092418.738877-1-a.fatoum@pengutronix.de/T/#t Cheers, Ahmad > > Cheers, > Ahmad > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |