Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp5802778rwn; Mon, 12 Sep 2022 14:47:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR4t8xxQLxAEGaWjbbv3dhn2v0px1JQfmwKlREzmlT39D46qEWH4Li4iI3yxtXe2QRfth93K X-Received: by 2002:a17:90a:ac01:b0:1fb:8956:7942 with SMTP id o1-20020a17090aac0100b001fb89567942mr425397pjq.107.1663019224549; Mon, 12 Sep 2022 14:47:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663019224; cv=none; d=google.com; s=arc-20160816; b=F695yNm4fHncf+Tn65Rt4ITVMEmKltJy8NnwCCJvY+hSaHmUD8SCQrzmRVQze3B/2w 9OmxdErR5J4dLlF2utbfNvCxOgpst1P2VfFkxEuSu/GIlk9A5vqMa0Ef502yUBE+NcVC DgbvSmULm0NJj1u2EUU1kWNWWchDUtDJ504JKhwlbvHN5YVnlJmvwVc5xFzNZOnOJWnl /tLksnb122nhivNF2s+6RBaSu7qRr+G5Yfm1/0kdpVI3VIsl0kghAos2GjAS7c2XMDB+ T8y8yfWWpEOKuGAdiKuiLTGxjyGGZEngZWBdxinkAjT3d7tSuC1NYrMftd5aeS3YZ35y tVtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=D0gGQfO3n93NHdjjAX94lSRbxVz2oHLGRDAcUgu8gcc=; b=iMtIrRhdFoQ/9DTbQaU5SVVMdh4SslXWMZMKwuLQHNqMTmwFVvP0XovLA74Ab5puX4 a7Ke8iquyigSebGuT3WHBvP6Axi88XogrJYHvAIqTomDuUv9C6bx14QFa2K+gYaRa/tg seGKOvk6Lij78InC6mHIfyXf0g5ZhNQb41jSskYdDqxcwYw7LSQB7R4d9q3LZ0ON/6Wy mZUhyrKq5BzmufmGgCOBTgx6NxEtH0Eed+2OYYlPlXilGQj9KRe+U8AYnMXasdZYXd8E dtO7xO6cFFxku33/ekqPyQ40WZofUMcq9y+xypnxjzRiDhDCE3J2ZwWOBOFIKPQUnDFR QoIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="l/rqiTFO"; 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 f20-20020a056a001ad400b00545c63d5387si759086pfv.21.2022.09.12.14.46.24; Mon, 12 Sep 2022 14:47:04 -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=20210112 header.b="l/rqiTFO"; 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 S229953AbiILVnC (ORCPT + 99 others); Mon, 12 Sep 2022 17:43:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229683AbiILVnB (ORCPT ); Mon, 12 Sep 2022 17:43:01 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C22524C61F for ; Mon, 12 Sep 2022 14:43:00 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id q9-20020a17090a178900b0020265d92ae3so13628456pja.5 for ; Mon, 12 Sep 2022 14:43:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date; bh=D0gGQfO3n93NHdjjAX94lSRbxVz2oHLGRDAcUgu8gcc=; b=l/rqiTFOAtREJKzNd3ppVvcuoXapuFD2sWI+2Cw5oX8Bs1wmb6nQ+tjqGHdq00HvFh TphbZlDQKeINxqBsTYC6y3dW3y6G0wsiXSn1SdKxxEBb9IxliFUQBTB7eGMKLY8LMkMb Aw0szI6ik2HCMqvM4sVp7JiB5pLIQ9LK2jDLTwjUc6GvMM8JMpuRzs8A8dt3jCsjVGAc jHXD4zQwWLqkIsaEzeW9ag6qDGYGCeCK99fmTCidfdLXNvjhQUHzJSeh3vDyrFSYslL3 pIkaEnroHgsmjmADvi+NRKFiSA+0hMVWWrRp/DqCORrF0kDftAOkhhh4+SlnKnxn5NAn 1Aow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date; bh=D0gGQfO3n93NHdjjAX94lSRbxVz2oHLGRDAcUgu8gcc=; b=Udo2wlRbJsbIo8AOcfxeehvwQkrnnokvz88WAVixTpbmDCLIQd8cV/ZT6OItI/lvhQ XG7w6b3PhhX2UjIlsFxQKe4EUYO0Jxmgkgc82UtElHupQ/sZX4hAAXqbzz/k35fwrdqk dSDNZzpPN6rENdYC/AmwvF8Sp00l5alQBWtGZJlRK7qKg9AHSTmQfuKWsj2nPOw1e5O2 NJ+SyY3+yadBeCQeSEHTpxzFFnkV2UgM70DYrARPHb8d9uLcTpm97QvXhiZnEZ5V9Dbu Inf7ITI77zAWc/kelC6MRai5ZnbkZC9P/+3fqRJxo451jGPArLtcGHSF7G2PstRHrIqT Vpig== X-Gm-Message-State: ACgBeo1LA9Fa7lBnAg+zx6kK1GuOq2M7rrFnzUAQie641AnC92tRY6BC qWYsD37YkTdrIKXSS6VqB3dDqO3hk68= X-Received: by 2002:a17:902:ab17:b0:177:e928:8cb2 with SMTP id ik23-20020a170902ab1700b00177e9288cb2mr24804292plb.62.1663018979669; Mon, 12 Sep 2022 14:42:59 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id s9-20020a170902ea0900b0015e8d4eb26esm6596372plg.184.2022.09.12.14.42.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 14:42:58 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ] shared/bap: Fix attempting to disable stream when it is idle Date: Mon, 12 Sep 2022 14:42:57 -0700 Message-Id: <20220912214257.173804-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 From: Luiz Augusto von Dentz If the stream is already in idle state do not attempt to disable it again. --- src/shared/bap.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index c5f1134d8d8a..7b23a33474bd 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -1050,13 +1050,15 @@ static void bap_stream_free(void *data) free(stream); } -static void bap_ep_detach(struct bt_bap_endpoint *ep) +static void bap_stream_detach(struct bt_bap_stream *stream) { - struct bt_bap_stream *stream = ep->stream; + struct bt_bap_endpoint *ep = stream->ep; - if (!stream) + if (!ep) return; + DBG(stream->bap, "stream %p ep %p", stream, ep); + queue_remove(stream->bap->streams, stream); bap_stream_clear_cfm(stream); @@ -1281,7 +1283,7 @@ static void bap_stream_state_changed(struct bt_bap_stream *stream) /* Post notification updates */ switch (stream->ep->state) { case BT_ASCS_ASE_STATE_IDLE: - bap_ep_detach(stream->ep); + bap_stream_detach(stream); break; case BT_ASCS_ASE_STATE_QOS: break; @@ -1838,7 +1840,8 @@ static uint8_t stream_disable(struct bt_bap_stream *stream, struct iovec *rsp) { DBG(stream->bap, "stream %p", stream); - if (!stream || stream->ep->state == BT_BAP_STREAM_STATE_QOS) + if (!stream || stream->ep->state == BT_BAP_STREAM_STATE_QOS || + stream->ep->state == BT_BAP_STREAM_STATE_IDLE) return 0; ascs_ase_rsp_success(rsp, stream->ep->id); -- 2.37.3