Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp16636101rwd; Mon, 26 Jun 2023 12:51:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4R5FoAyodWfYhG/awDF465c3LCfC70TpD475xeh931jCzcadSivg6M90tum28z4m6Mgrzd X-Received: by 2002:a17:907:86a0:b0:991:edf7:48e9 with SMTP id qa32-20020a17090786a000b00991edf748e9mr1868668ejc.7.1687809113129; Mon, 26 Jun 2023 12:51:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687809113; cv=none; d=google.com; s=arc-20160816; b=KVS33H1sTAy1A2SpqXebSzkPzlGQAr8kU3ndTKUvFjuDjouXMZqgX6RuTsU+Q/JcbO pyvS7qWU6gG9enJMP1Fqs2bfAnB4o4Syj21ymw//HmOrS96V537AhfKPKf4fRdrodfRC 7j6ifjkPSZBrGbAWo4D3YQC2qzmD5PysJKJ3DrxuIRNnGgYQpeAiXJLPEz6nhUHI5CQ0 x/jMw95+VR5bZwPGpgQQSpuYNFJT8L2wqCUyjcxalMMMGTH5YppzZfSnXBDc/TpzIkXT EwMSeNw6x5ry5WNxzwZkFnZrwvZ4LdX7X3ywPIRlkzKsr4QtVzU+8q9lqO8k13vEysiG NO7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=9NFypNUympay54cWESrUztMRbmrTa5aoLaDv8wRaHyk=; fh=sFdEcN8r6/RLIKE84DFckd8GgNKhUuNwDW53pZP4Asw=; b=NBDs30xEKrmxZiEOPTgjm+/B158FKJ+j7GVjaLExP4syi9GPYycgNAUWEyr9mXUH4T bmeSNuplWoAiIXa37pbxQssvkBP8PkJpDRLWZir4yias2YdnWZDCsqTvV6at2CJYjG33 yQfjGu4RYYFDJz8KrNqLeLesso/XxACSoktyr0jyWIYHeQM1jRG5SsyCox7w/2+E+jF9 jxFice1w8eCu6gftAvTZnWAvo5FjjS5PcfPrLMEbYuwctzYuj4xgu2xAS2nYmD3jLn6S HN9tbX6T29xq8M326bVzwufh3OKShScVPclp//zJYQT5KVaQltmLeK/+yhS5HEhhcFzQ 6VXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=LnHIUwEI; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k8-20020a170906054800b00986539d1693si3057701eja.924.2023.06.26.12.51.17; Mon, 26 Jun 2023 12:51:53 -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; dkim=pass header.i=@gmail.com header.s=20221208 header.b=LnHIUwEI; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229629AbjFZTZa (ORCPT + 99 others); Mon, 26 Jun 2023 15:25:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230158AbjFZTZ2 (ORCPT ); Mon, 26 Jun 2023 15:25:28 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4177A1700; Mon, 26 Jun 2023 12:25:26 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2b5c2433134so30032651fa.0; Mon, 26 Jun 2023 12:25:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687807524; x=1690399524; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=9NFypNUympay54cWESrUztMRbmrTa5aoLaDv8wRaHyk=; b=LnHIUwEIcP2pbXYaPoaAF/4xSheQVBu061Iu2+/UOzv5F5HeQk9tVn3M+KeSXKcgn5 bH/gjVAeB+ISb5Dt9HYF773Wv3RyiXBXEBjjkF1NKcUtjA0Z9QQ/j+gDOWBAFH3r3ute wNyyiLmezGAH2Q/bfZJ8rkWwBAySe8cNp4MB7J9fqJtmoqLbXIljLZNVkj0hLV9TeJhZ My50++zYAkbgOEEZ9OEZgjdVFaCFPhzmL0KiXcAYe4/F4ythLq8wWNqJgxb0dbZHKVzU 0u0uibLstNJ1ggzsHso8yXTR3nPdHQVK/aPeSDHY5WGYvUIqDRA/N3o6MM70q0et/T6h 4bvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687807524; x=1690399524; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9NFypNUympay54cWESrUztMRbmrTa5aoLaDv8wRaHyk=; b=d74MmAwB+fFC8uKLLyjOwTF0t5C+5vwo8Z/IboTRF8QQYfRI+VgKR/rZYXxDLiwysS 3yvF6sBH/ozi2TGdaA5gXm2mvomQz5j8m13y6VjnJKg/CZMmAUaBLwtlbFUzyjU0/SEY McSQImaZwQR6YtITZc91sfq75e4UViISe9JSknL3lyXpGOjsQas4R8RZU73OVRaj6hG2 GwKaYuh9sohn/6fql74mmqL6rBi+uh048Ns84JSy7rlTYOtsF1T4rob+QCLBj1cVg7Ya eIhtfZDDvTr+qLw6eky0s0ayuTzzypbh4zYjigKZE1DerYbS5saPc2yyoKeG2bzQU1qx XpqA== X-Gm-Message-State: AC+VfDx2HcO+tcyG1vbI5HyszLijL05dEDF8HftTdRUwmtE3ZSLYmzFb cJt2OAgxvDjbiW1KvdO15P7wywyynquFhXhgHwY= X-Received: by 2002:a2e:a268:0:b0:2b4:7763:c1fb with SMTP id k8-20020a2ea268000000b002b47763c1fbmr9829487ljm.13.1687807524076; Mon, 26 Jun 2023 12:25:24 -0700 (PDT) MIME-Version: 1.0 References: <259e755c.4eaad.188f817a0f3.Coremail.lxybhu@buaa.edu.cn> In-Reply-To: <259e755c.4eaad.188f817a0f3.Coremail.lxybhu@buaa.edu.cn> From: Luiz Augusto von Dentz Date: Mon, 26 Jun 2023 12:25:12 -0700 Message-ID: Subject: Re: [BUG]Bluetooth: HCI_Command_Status: possible semantic bug when Num_HCI_Command_Packets set to zero To: =?UTF-8?B?5YiY5paw5a6H?= Cc: marcel@holtmann.org, johan.hedberg@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, baijiaju1990@gmail.com, sy2239101@buaa.edu.cn, linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 Hi, On Mon, Jun 26, 2023 at 7:25=E2=80=AFAM =E5=88=98=E6=96=B0=E5=AE=87 wrote: > > Hello, > > Our fuzzing tool finds a possible semantic bug in the Bluetooth system in= Linux 5.18: > > During the connection process, the host server needs to receive the HCI_C= ommand_Status packet from the hardware controller. In normal cases, the Num= _HCI_Command_Packets field of this packet is not zero, and the host server = can normally handle this packet. However, in our testing, when the Num_HCI_= Command_Packets field is set to zero, the Bluetooth functionality is totall= y stopped until it is manually reopened. > > In the Bluetooth Core Specification 5.4, the section 7.7.15 "Command Stat= us event" says that: > > "The Num_HCI_Command_Packets event parameter allows the Controller to ind= icate the number of HCI command packets the Host can send to the Controller= . If the Controller requires the Host to stop sending commands, the Num_HCI= _Command_Packets event parameter will be set to zero." > > This section does not mean that the Bluetooth functionality needs to be t= otally stopped when Num_HCI_Command_Packets is zero. Maybe in this case, th= e Bluetooth functionality could be still available, but the host server cou= ld reject any packet until Num_HCI_Command_Packets is not zero. Well it says, If the Controller requires the Host to stop sending commands, so if your tool is sending 0 then it is requesting he host to stop sending more commands, if you want it to continue just send another Num_HCI_Command_Packets, or are you saying some other functionality that doesn't require sending commands shall still work? > We are not sure whether this is a semantic bug or implementation feature = in the Linux kernel. Any feedback would be appreciated, thanks! > > > Best wishes, > Xin-Yu Liu --=20 Luiz Augusto von Dentz