Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2968973ybk; Tue, 12 May 2020 12:35:50 -0700 (PDT) X-Google-Smtp-Source: APiQypIGxDDXlBi9ikLXSD2ROY3v1Nyw+qnGivti6Ch3fKpx/nT4xUEREKbnL9MESDT5+bmVI6zQ X-Received: by 2002:a50:c01a:: with SMTP id r26mr19565434edb.361.1589312150628; Tue, 12 May 2020 12:35:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589312150; cv=none; d=google.com; s=arc-20160816; b=VVfFiCpGmq3io3PfuouDmVgPwNofmfExcttuw35X9Ik8csTRJymUb4gpk0Jb0mNS0Y XdB6vIJenHU05FZmVGmifs/fSOH6EZS6FPNi9WiNpyq3xtTEhnRIrc6+XEhNVpjx4stz /+Zq8BmExtZsmK761MIRW3VzUcEWqYVpm8ZFLG53KUYuUrSttSJjQwl41A6FSnwmPDMh uoICnYh8hxnHKWSw7Wu1Jn/3MNdkolT7tEU0EpQWdMUiHqKiYwhtivJAbk7Nfivz0wAp rGSwbuOqPZwc5lxwr9elekqmxR6FnJBYzU66z/suIaAY5TfnQ+Af7Y5ncSYBA685E+2m Ihdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=2YGDI+yJeD00tU/1yDVwaMSidQu+F9oEjFDSx9vNfTE=; b=PxLkLeRsyAURbxiPhOJQWOBzTUrvSkiNZ3Yk3LZFKUoUWcHQVWbNtwqoHaEnzVP7vP q+G7o/O3qpwMI4Vw1O00IyzwXbuTPdp4as6qcKwAnAHzP06UuSP3MPdn4JZo9XZGiuVg wOMjvhlaA6RqW/OyvzE4phP/Dzq9B/21yfrmluX/mZfZFoQx7iBEJDkNNtPmHudeHH0I AwUjkqgWpBOGxWQo1pAg4Zvqe1tYAEi0cMlZPkgXSXGCdrmF8YtqZsHy99nV4mwJTIrp WCz0wxPWJ9OOCZwB1L7DtK0pTmi+urgaKa1tX0W0VFYK6PE7P0BJm7bKJtWMvvBPfV/z rjdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jx9mB9zj; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cy7si3686123edb.484.2020.05.12.12.35.09; Tue, 12 May 2020 12:35:50 -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; dkim=pass header.i=@chromium.org header.s=google header.b=jx9mB9zj; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725950AbgELTfD (ORCPT + 99 others); Tue, 12 May 2020 15:35:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725554AbgELTfD (ORCPT ); Tue, 12 May 2020 15:35:03 -0400 Received: from mail-oi1-x244.google.com (mail-oi1-x244.google.com [IPv6:2607:f8b0:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A870C061A0C for ; Tue, 12 May 2020 12:35:02 -0700 (PDT) Received: by mail-oi1-x244.google.com with SMTP id i13so19288525oie.9 for ; Tue, 12 May 2020 12:35:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2YGDI+yJeD00tU/1yDVwaMSidQu+F9oEjFDSx9vNfTE=; b=jx9mB9zjYgKNh/5R9uRCOM/VSSO7kShG8ymD1UvaJ/u0/VuvPpCVtXriExJmLP0Z0w mAOyBJtdoADQ0BwcOr86myJHuADBTOATkyrqQ180T9T2h2QHxHg1sBo/mWYmRBjWF8za FvvJRwlfyigczMa0UOX1M5z1Jao5wpBLWns1E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2YGDI+yJeD00tU/1yDVwaMSidQu+F9oEjFDSx9vNfTE=; b=ZYG+YsIFKxrHyjJFSCZpKKLMHtSVi36wMxOx09642ZtUoD/X0KR4v/yyWEyHqwSF/y xIgUs7l7uOl9FH41hi9dZ/ku1z3Y0KKdi5fURr9fgwhZRoxFAH+t4EEvwTnHKsqLhthe WCSlFXNBTGkpMRRt0U2MnHsE1yRuXA3f/AVbBIf/FZ7WPB1i6As41BLFBSZeiKMcO2m0 ZjM+oWU6i/47PMJ96t9ouiGiAkWb5Zb7Dqi7r6ea4+yO+7mGCeS1dDP8Q3QupWwWK6JI OaIOiZeB1pWbM7AS09zY2QBTM7DhU8uiJ/BlkolhRYplCN3fKs3L4nfjc4OZ5198vkJv L+FQ== X-Gm-Message-State: AGi0PuYkgR6/jTWHZba4HOOq9kUmKTECk3c84aO4znZur3VMtc1uAN1H k5aokhrBsIIbpPwyZJRk38Lfo27OFYrgkP4w8K7dh1VS X-Received: by 2002:aca:c705:: with SMTP id x5mr24940139oif.136.1589312101412; Tue, 12 May 2020 12:35:01 -0700 (PDT) MIME-Version: 1.0 References: <20200428051151.14879-1-sonnysasaka@gmail.com> <89566A98-F0CE-4E70-A344-915E81FB0C14@holtmann.org> In-Reply-To: From: Sonny Sasaka Date: Tue, 12 May 2020 12:34:49 -0700 Message-ID: Subject: Re: [PATCH] Bluetooth: Handle Inquiry Cancel error after Inquiry Complete To: Marcel Holtmann Cc: BlueZ Content-Type: text/plain; charset="UTF-8" Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Marcel, Could you take another look at my latest patch based on your feedback? Thanks. On Wed, May 6, 2020 at 12:57 PM Sonny Sasaka wrote: > > Hi Marcel, > > Please take a look at the modified patch based on your feedback. Thanks. > > On Tue, May 5, 2020 at 4:42 PM Marcel Holtmann wrote: > > > > 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 > >