Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1264421ybj; Tue, 5 May 2020 16:43:06 -0700 (PDT) X-Google-Smtp-Source: APiQypJjd9Hs1Z9CT4vlLVq0NN11L8WbOywqbjowVERcBf5Nv1b2jSHOQj5PUv7/O1LtpTgarZkL X-Received: by 2002:a17:906:5e50:: with SMTP id b16mr5196586eju.331.1588722186842; Tue, 05 May 2020 16:43:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588722186; cv=none; d=google.com; s=arc-20160816; b=Lv2ea6gP5hLeQntGnq4C18gIzvpY/c6cBywJjRy4LXBwI5I3IrwYId37ZzsKUrLpnS 2nBfunv2gE5LHlP7MCJcA2kDwVaRZZWq+SGr2xM8TqQVckfoAtub633Q9ZFnegA5G+R3 ohiEgFZTj1JmlVslqYX4s7THLbIDoFlSPMW25gQtS9jCE8zg8Q4BpHe5zPxJAoFQlAog uUrTDpGBHggmtnnuwQCOoliZBETztCJLdOI/UugtMYsp0uhcefw6haLr5PDGkC1JI5ny hTm5i/UTXGMfw8SJEdKm2mzCCT0SusC9gMEupuT7bmZimvxbOToOkxnOHBteNTb4XK3j 869A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=SgcMnuSAlnE1aI53buWpO2bY6bxwUNZyCAJW7Df1ekw=; b=e1J7+oVwpjkaGN+sHYMg/x84AIOk2XV7a2cwYlIi4FLIuzVJXzy5rp61/oCYgRniNt Ii2xWw7tbG/+vEvVmil0BuTSUSQCh/2P9DvP4fZ+Lz81vJUyEX1LezS8sCG79sWnA8ye iinJBQcltN7PcRaAA8usrnsGAniHq0g5T2w0ukxJGd+HYqC/VEn7tj0TckIzdl1BJeRw nKRPnNXNzb99Ii1X8UT8VtgdKcbE/wsegVxs3oFb55Dn5TN8hw13KSfAk3L7MjrSME6F BVQNEYn6nVAbCZoCIwc/yWtBPfK0/BhlShJWZLL8semviD2alk0RygGMk0v45m4fM4dX NLWg== 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 c11si119323ejs.396.2020.05.05.16.42.40; Tue, 05 May 2020 16:43:06 -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 S1728717AbgEEXmP convert rfc822-to-8bit (ORCPT + 99 others); Tue, 5 May 2020 19:42:15 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:54131 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727895AbgEEXmO (ORCPT ); Tue, 5 May 2020 19:42:14 -0400 Received: from marcel-macbook.fritz.box (p4FEFC5A7.dip0.t-ipconnect.de [79.239.197.167]) by mail.holtmann.org (Postfix) with ESMTPSA id 23908CECFC; Wed, 6 May 2020 01:51:53 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: [PATCH] Bluetooth: Handle Inquiry Cancel error after Inquiry Complete From: Marcel Holtmann In-Reply-To: Date: Wed, 6 May 2020 01:42:11 +0200 Cc: BlueZ Content-Transfer-Encoding: 8BIT Message-Id: <89566A98-F0CE-4E70-A344-915E81FB0C14@holtmann.org> References: <20200428051151.14879-1-sonnysasaka@gmail.com> To: Sonny Sasaka X-Mailer: Apple Mail (2.3608.80.23.2.2) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Sonny, > Could you take another look at my last proposal based on your > suggestion? If we are to move the logic inside hci_cc_inquiry_cancel, > we will need a way to update the status to the caller, for example by > having hci_cc_inquiry_cancel return a value, or accept a pointer for > the updated status value. Let me know which way you prefer. maybe something like this (missing comment of course): --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -42,14 +42,20 @@ /* Handle HCI Event packets */ -static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb) +static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb, + u8 *new_status) { __u8 status = *((__u8 *) skb->data); BT_DBG("%s status 0x%2.2x", hdev->name, status); - if (status) + if (status) { + if (!test_bit(HCI_INQUIRY, &hdev->flags) && status == 0x0c) { + BT_DBG("Ignoring error of HCI Inquiry Cancel command"); + *new_status = 0x00; + } return; + } clear_bit(HCI_INQUIRY, &hdev->flags); smp_mb__after_atomic(); /* wake_up_bit advises about this barrier */ @@ -3233,7 +3239,7 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb, switch (*opcode) { case HCI_OP_INQUIRY_CANCEL: - hci_cc_inquiry_cancel(hdev, skb); + hci_cc_inquiry_cancel(hdev, skb, status); break; case HCI_OP_PERIODIC_INQ: Regards Marcel