Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp133061ybj; Wed, 6 May 2020 13:21:14 -0700 (PDT) X-Google-Smtp-Source: APiQypKDBLfynE4LwRbNoyorklTNxgKwSNw2bThr+8a/udYUBc/tmWem6e8gBcUJzQrW/tfgASFC X-Received: by 2002:a17:906:d10b:: with SMTP id b11mr8758369ejz.62.1588796474274; Wed, 06 May 2020 13:21:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588796474; cv=none; d=google.com; s=arc-20160816; b=VtsjkSYbuywpCM1f+MFkweP5naheQEgeE+kVSvUKVs3drgppG04vKQHKB4AEpObM1P Fs8WrjNGFubLlvdaVPxlY1HjkyfrvUCtpbdv2knJhdRZO264c/EYuY5gBFgngitCwNwN ctb1jvz01hkj/rX6/Eq7/CUJ5EiQYBuOopJfY1vDkE5UJzL09WjYKolwu5k265R2kNBN E6+8VozQpV/yyswh8tgJSyeZSezHKOrl+uzazPYXRKGqNbbmx1eW8olplH7uNgNYRyzQ xyeXqHeyJeeAe33+HYfAg2WHG+DGRpFI+WWmDH9zGALhZps4rgAtEBtp7nR84iD7C0nC P9DQ== 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=FNrS4Y96E/KIKvbVV70tfWsX8/4iUb6oDqHOy8bVjYg=; b=iTL85X9DMfRy9jfsQz6j+ezsF2CWduF1LysiVMa6b48NTFFoEshMXGIR2W6Ht4IE3b HzpsrCUWN4zLtCjxkR5yLGF/Zw1GWLNuBsFnDCfixl/1q1dvOT1sPhb2pn+ecK6h+M1s CkQooThMK1RAU7bzKNw/JnlwTeO/CxCFCjOW0gPoTF1qviKznuD2r4FmNXuIF93JmA0F P/R9eLb+j7lmh7Mjpkdxc9SH0XODyjlqAnhsu8r2M/UVtJiYSaxdSKw/pDAOqxH9OPix Md31PZGTOgrHnSpRQZTfdRMI17+YRQNn/3khhEqlo69cBq3vNpgbLiwh0XbuR4pPgf0Y rkAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VBj6kQf8; 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 x2si1833145ejw.475.2020.05.06.13.20.48; Wed, 06 May 2020 13:21:14 -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=VBj6kQf8; 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 S1726218AbgEFT6F (ORCPT + 99 others); Wed, 6 May 2020 15:58:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725799AbgEFT6F (ORCPT ); Wed, 6 May 2020 15:58:05 -0400 Received: from mail-oi1-x242.google.com (mail-oi1-x242.google.com [IPv6:2607:f8b0:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEDBCC061A0F for ; Wed, 6 May 2020 12:58:03 -0700 (PDT) Received: by mail-oi1-x242.google.com with SMTP id o7so2922877oif.2 for ; Wed, 06 May 2020 12:58:03 -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=FNrS4Y96E/KIKvbVV70tfWsX8/4iUb6oDqHOy8bVjYg=; b=VBj6kQf8DlTv8GTdgyqET9n6ZOc55c+C1SmxQnlfzNNNgVXdpCfDxuCrEMsRTz4Pgv urJDTn7ZyR9jhZPasawxAHR9s7MJ6rPDiywazv3aZXLTNy67JPT3c/BS9g91w+P0jnZ1 dNB0Cq6gE5pqAw5LS2FUrCXXoxDr54kBpmy3o= 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=FNrS4Y96E/KIKvbVV70tfWsX8/4iUb6oDqHOy8bVjYg=; b=GxOeQyqVtHwtXbtuQ4fg2OZX3eCpXLv4cdC4wbONJcBBsoYvHePL5Abqfspk3Db8by suglvYsRl75CFpXe7Nh7ITdXTO2JGEhSTWboi1IoS8cZOLRKjazOq/cGz2I3GXj8nVFO DdXz5abjsI+ME59kYhBHs+dQIOws8R8eoWmAmQLis+MAfDwHdf9aHvvqcJZe7Nu7S9BE OCeEUf/sUmYnlPDcW2uRMmHBZ87i8g/EwEinKXDtt9e/IxVHkjxMWsanpbT6RtG0MpDK oZSNgDF5S9pXNY7PER0HlsgBpTXswHV4LwYtd6uLIkiT4Qe4n7pAW+4+DfNtXCRfoVgO Gdnw== X-Gm-Message-State: AGi0Pua829k+WFzCiQdVaGC0JzEup0HddNQuIbTMtkM30RlP2DBEq8Vo 6jBb7iO43JBWX5oOoU0BhFuch2pBGlZWltn3+jeTjQEO X-Received: by 2002:aca:c705:: with SMTP id x5mr4015752oif.136.1588795083278; Wed, 06 May 2020 12:58:03 -0700 (PDT) MIME-Version: 1.0 References: <20200428051151.14879-1-sonnysasaka@gmail.com> <89566A98-F0CE-4E70-A344-915E81FB0C14@holtmann.org> In-Reply-To: <89566A98-F0CE-4E70-A344-915E81FB0C14@holtmann.org> From: Sonny Sasaka Date: Wed, 6 May 2020 12:57:52 -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, 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 >