Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp3333027rdb; Tue, 6 Feb 2024 14:35:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVVJ17MXOqCaqsNJxMrIvhEa4M5xUDQNdysyBtA2atMEHHRnygmGB5yrTG63iZDBkHliplkJKsupJbWcVr2m89x2hZcnfvfD9QP69GfwQ== X-Google-Smtp-Source: AGHT+IHkHGiqVBiT9iMToegZ0JuqgHP/FoUPCvYWB6FW5DbX+0XVhO5sUXRLbeKjV9Wvu1alPkGt X-Received: by 2002:a05:6a21:3489:b0:19e:4e58:4fea with SMTP id yo9-20020a056a21348900b0019e4e584feamr2971816pzb.0.1707258935010; Tue, 06 Feb 2024 14:35:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707258934; cv=pass; d=google.com; s=arc-20160816; b=IYp3hTaJuCDWgGjFlqk+Dm4v+5R9yHJj760P1IGsISfZ5Hit6QwEg5gX5bOxQivsHu yBZsA0dQ5AeBN/tUmqHzvaUXoSiHednqSobVtQ9wDuhU3q9r3WRqmzKT8xtS7ZdAqo1g 5GCFkwQczp7EQ4ADIjOVWxSnwSz44CLKbF3B/Ele5X6sT22EssOZ7XtryGRxMTsnSc1/ ri5Of8v6+BVyY5bT6NhVuOoMQcChJ7Kc6+T0JRjkYXNgyYqkpnbivxntCYOmMr7xjx9D LEvbc5LXLArcJH5f3LRY1gwes8kKOX2nSYqJC0zcIyHCvRltBS6jMKq74g3zwL+fA+bW BGnQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=vdbWku3dFjLXvK8sQDBJRr6eWjve+Kmhmgss6oqKgwA=; fh=hzc0lXV7RUx8rgwP2g83G0j8h5BnCnvi6npKmrhYR3s=; b=W0K5z9DAXDqN24WOj+b6w349tVtyNQSfMVshYIXSrkirwN3X7dtIcecCb8zVdpvnzM MgFBtQFYkXVGxjZ/CaQst7lei//Jye8y+mNWjV5OsV0BheX6VmT53GVQ9e6l3ACkTbWH RQOdjAggAPOlVbSjCLPaswSoLGyaH+xYu2opw5xsn+wq4gZ9691Nw8inZXvpN2Ym5DWZ 1m7LSQ7mivE49sr7E+STyHYFAQlVdNr18FvsUhe0C5ylhUXASWO5sL7EFZCUdyMYaFaC aUiJIA5N9yWj/et4lEQN4rOIddCFg2dKlBfKUHx7gmOXw819qtj5iO34jGpMv8wlWv8Y hR2Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jHITtSbg; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-1650-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1650-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=1; AJvYcCWxGBnQAiJa0ovYwDyR1oZ0sOy4RCIZpn0fUL6KIjAAjoAhoh4DqlBCRVOZ2wuPrWskdyOlpnUEm0cl5A6D7avv7i9qA5NpPJFllCTJkA== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id z15-20020a63330f000000b005dc10248136si2322487pgz.314.2024.02.06.14.35.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 14:35:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-1650-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jHITtSbg; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-1650-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1650-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 95C1C2854A8 for ; Tue, 6 Feb 2024 22:35:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 605BC1C68A; Tue, 6 Feb 2024 22:35:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jHITtSbg" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail-ua1-f42.google.com (mail-ua1-f42.google.com [209.85.222.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 680AA1C283 for ; Tue, 6 Feb 2024 22:35:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707258923; cv=none; b=fg07zYyp2Txeegh05cH1z9bACAGjwBLVNHeBaWDJhtdJ1sjR4hPWFAPZfSuKRbkxTFslIfo2Y5bi9uMBmDSloxtCXHiHwzPI1oqSLz7AY4sn8TBzHjBTi+yPswnaY7YGYwON622OIDO5fiTz22HHdjbOqlX09l4SeX8znFiQ8Fk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707258923; c=relaxed/simple; bh=2gD+UeIhNC74u8XXxHunkeiz09ZImZJ+lnK6iKxCPb8=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WRs60tpIx3/QQrKbahRlPCwVmawAX7JUcioxBEPbWJ0vYWw2EBRtTKPdxrp8C++Esz3i8GdnaBTQzIa5nAC6uUEo1YVytQw9Gv/ELqZRwVjbjCt4Ek8UFECuBEAGtLaGGRpIuPf92uv/ltMfH0bmKSaAuC4B7b/su8ksAvm4bfE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jHITtSbg; arc=none smtp.client-ip=209.85.222.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ua1-f42.google.com with SMTP id a1e0cc1a2514c-7d2e15193bbso3041489241.0 for ; Tue, 06 Feb 2024 14:35:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707258920; x=1707863720; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=vdbWku3dFjLXvK8sQDBJRr6eWjve+Kmhmgss6oqKgwA=; b=jHITtSbgpQPQrgtZevm1SDttSL1eQgS00xQn7OdcLvOYLSVRaggXwKc6q4L2VjgyCo 98GC4kuhQR04/uZOaWlNLlZToMAb4dHWjGD/Ms4LmCdxQoV0zewJKE0xvsNBNDTpwCq/ 62snX7n3yMt8qUsGz9u8i9+Oy+ORVH2TDV/Xx9vcWUoFEMdiPco5Mbjufyvjrzqwh8E2 BwcjdEMHPBu4OrGXht/bxwn49JUAL2YKlb9QTRaM/VlwILD9W+k/bzZaYWVANoZW/1fH 7hyUP25iwXI+0wuR8ZnHyUsgjecM6LGcvXb+wHHpgRtm568vu/cFK1/1lI4DRqrwXVsy dPLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707258920; x=1707863720; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vdbWku3dFjLXvK8sQDBJRr6eWjve+Kmhmgss6oqKgwA=; b=oeQz+rivK8SgHzpvq+a4eGtNqIsT0j6WsJGBGI4vFy4pkEcGNcFah/WeYZp37cd6cb A510ICFFOpdgeD5ne5OrZA0ZK9GsO4YjzZjEt5++wNf/gECKKwZsgpLWV4DVdPFrfDfh BtiL0yyXDgyGAqeCsWhkTz5bt3rSi4RjXNhLC27diTstbfe+SjH+KHPzYELSgIulkugP RKvs+73vcWl6kyiCywMfPvmpKz6mPDU7x2oJ65OezI4OGZ2rkZ0y+nmCsJQrzhvz6a6x MRbSXqP/hOsezSGJZV5dASM+pC1wUgzX1d0PXpIel0pQxBxKsa7hHGVYKFgBeIRZ3vwE 2xjw== X-Gm-Message-State: AOJu0Yxb6eWlxtaQnxoWViJBvWku8vj5dAs+oc32dfMt6Qsk9mgbtCq6 uMvHujMTSnpDIR6LVve0vjSZWti7GJXezk2SKPQappxYENodL788+pazFPMt X-Received: by 2002:a05:6102:3592:b0:46d:3368:971e with SMTP id h18-20020a056102359200b0046d3368971emr1088622vsu.33.1707258919750; Tue, 06 Feb 2024 14:35:19 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id l7-20020a056102316700b0046d35339f2bsm322432vsm.3.2024.02.06.14.35.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 14:35:16 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v3 3/3] shared/bap: Make bt_bap_ref_safe check if the instance is attached Date: Tue, 6 Feb 2024 17:35:13 -0500 Message-ID: <20240206223513.2783330-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206223513.2783330-1-luiz.dentz@gmail.com> References: <20240206223513.2783330-1-luiz.dentz@gmail.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Luiz Augusto von Dentz This makes bt_bap_ref_safe check that bap instance is part of sessions list which means it is attached/valid. --- src/shared/bap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 4722ed1a1b27..804352db9c41 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -1033,7 +1033,7 @@ static void stream_notify_metadata(struct bt_bap_stream *stream) static struct bt_bap *bt_bap_ref_safe(struct bt_bap *bap) { - if (!bap || !bap->ref_count) + if (!bap || !bap->ref_count || !queue_find(sessions, NULL, bap)) return NULL; return bt_bap_ref(bap); -- 2.43.0