From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.48 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796371251; b=k4w+CuAn4173683lT6PDVbpNpA/hiiDcZyWIL8DYx7E6G8lxSL+KpcejwEyEvh4kg9ai KEZ/zMsOGFTOYhyQf238jP3zIGJr/psqjKjUdHlZkZxAQbgNjmZFvcuwhI18KZnZNOtVd zg+yIfxj4xWevMyeenIpL6v9QhsYsZzQDMVibvjYACJad42tp+vHLuIow7wj+8dLmyx3a 0Jg502tgjuWiLchJxK7RqrtwGDtJXly1aKDoCYtFH0FvpM2fGu2gRTxRHLrMFM68YQUz8 We93mqW3QREF47VETbyU9zZikKMrCxfkaTg/19r5f6jKK8J2MjI37wDl1NjIG2uR5zw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796371251; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=x+ew2XEaipMjJdcEmqNp++1OVjG14iD5dkCC+Yv5uAc=; b=lOdRJUnVdPRzkjOeGTh4Bctfjz75hnAq9HEFeYdtBbdDuzvgHPsA7FfDpimE1zDgcKJq /OKzM5iDsNTO/3IMi4AdUMUqOqx+FhXgpJhZOHPjEBaOSdPKZPyKkwBH4OJ67MoS7WxdI LX7kefLudCCHL9BD5wsP1nJMellkPuB7kfVP9iuIDryO5Tyg0HXx1XHLaH0VQKhZ2GjAx SFN3gSybYGEwqtrc9M3BAw6zBW3NbvCKLBdHZTiQuDCXHgkk+xweu8cqITU8qUxpzDkRc FcYCnuUMimqxAFrfWxwZGCKYmvL4Lh67hMyiOR0Goo7tbUg0idU1z0ZyuRLvVL/+L0A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=ZUUjGzvA; arc=none smtp.remote-ip=209.85.218.48 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D546E606A32C for ; Fri, 4 Dec 2026 08:00:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D546E606A32C 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=ZUUjGzvA Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-c51d158acc6so139573866b.0 for ; Fri, 04 Dec 2026 00:00:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796371249; x=1796976049; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=x+ew2XEaipMjJdcEmqNp++1OVjG14iD5dkCC+Yv5uAc=; b=ZUUjGzvAaqhwj9WGgoNQLlMC+EBhUZyYas6NXNs0y0ZUmlB9lrN6N41s0PYaUzzhSk P0pPEpMipBCiEGth6QfIZSAuNbmMO03KD/Pc85u9oADqRE9/2pmTk/+3ojfJrhMoN6zG BGLB9klfgACAt6uafgMD8BwUEAGyFfk7AlkjE+XzvHhe+uCw5tXhO4U9h6/kWwCExQLE xgqoOzyMiIMblrVYxVdD8qmmqPcXxUHBXN1bAHCfPGHnxgVJzd161V0B9VnTxtGG5uWP OKavWG1N6306oeJutVSiAQKlsWQ9F0dxAhtiaokNFQvCnkTIFs7i+zuIFRchDnpJlvCt qVGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796371249; x=1796976049; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=x+ew2XEaipMjJdcEmqNp++1OVjG14iD5dkCC+Yv5uAc=; b=WRqXoVDCHPhzzG57h+kpcQekKrSbs9YmlmK85yoCAQWdyZB3I/CC+PeF7c8UMvJJyG SFjNDhV+EXOvCMyHPfJbSbnpE1UhEYX8r5fRfh009IP3T8L6rri0RFzafL0bnHuQDn6i MHhKWPUe65Q5MAio1+zi8EAuYet0cvYeu3uQ1yX5Hcyi0WlKFyowdunQ5efoTdD1VQSt ynsYL6r6gxsBrirbaXxFZLen2+eehHkvaT79YUtqg+p5eXYortI0En6SlSqpAjPqRT7Q uV/EBzEkSaJdoMlncnDy+udkGc2JY9n5pf9Y5eLhzgxeBvD3Wv+Vtj0g6f8V76mg0dSD vwYg== X-Gm-Message-State: APuU4Z9aTsUn9eGJMIcAdyER8t8DGsXUlcYutyIURzYlMK4L4gr7jrxK zD5xWY+SclBRbWhWM1J7+7ZJCBrOUhnSZzJQswHSuKVFMHKz8dzXwJ0hbXHJCYUY X-Gm-Gg: AZFdTZdsDuQs1AqURxtk/U5ttK+wII8xHxGegzqOX6fT8Q5/UiWk7t6NHVpL9vDZffL fIW1BU2yw+PH0kR54iX+Kj/cKNwWsgQPY9wEerOAgnwDsmUyikuPPe2PHcdkr2jYqIx0FusbXZ/ iBoK6himoB96ZKranlD+Y5TROAkgrgoQnmC1zCxOt7fzh8O2xs+xLIQhsFaHPKN5wt+BcrQtvgX siDjli5wWNxFx9Hq/eb6nOlJ2CF6NBo1Izv4vtUQsu7BKYRqytI7ps5bY5vxyqdRbKGgbmeCck+ c/HXMN7NlS6oPE5xzijX6ZQPGZR9lzvsTOS8Pg3qhWxcsjwovMw2zEPukUry7sxrZbXsxeBD6Ms y9k5yE0Y3PRSFixopoWEugQ+y/7G4JpAqwIGcCg1mYXnbFwGF0Lskyr6VmtnxtNd9+m66rA5ehZ UtyQy+Ovx1cZmq6R8Xk40hljZsLjHhDL8w8WvEjmWjxCpqT+093kCgpm1JxjVK5SVGL/ieYgIKS f+ru77iWCrxm2a+NH/AfvmAQduM5NCmvQSNT1z+AfmbEW/9BEgIMk+bOJcpcsKe+AroTAwAccVj 1GhcUy6IM8ewTfmJKfQz3qppRqUio7mRqV9JrbG/dOLxWsCMXqMFrJuBKwYUihnIPfvIU1REfe5 DROnuAyJEs+3HEJMU6x9205vdsbIPLwBYWZOieHqXjscGz+BCbXk= X-Received: by 2002:a17:907:73c7:b0:c51:558c:7654 with SMTP id a640c23a62f3a-c5261a02c4cmr79952066b.7.1796371248887; Fri, 04 Dec 2026 00:00:48 -0800 (PST) Received: from amd.seeq.cloud ([209.131.115.66]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c525b3bd6c1sm82596166b.45.2026.12.04.00.00.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 00:00:48 -0800 (PST) From: Jakob Stender Guldberg To: linux-bluetooth@vger.kernel.org Cc: Jakob Stender Guldberg Subject: [PATCH BlueZ] avdtp: Fix rejected Close dropping A2DP Date: Fri, 4 Dec 2026 09:00:44 +0100 Message-ID: <20261204080044.4151850-1-jakob1379@gmail.com> X-Mailer: git-send-email 2.56.1 X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit A Close Reject carries only the Error Code, but avdtp_parse_rej() parsed it with stream_rej_to_err(), which wants an ACP SEID before it. The 1 byte reject failed the size check and session_cb() dropped the whole session. OnePlus Buds Pro 4 often reject Close with BAD_ACP_SEID, so changing the codec left the headset without A2DP: < 80 08 08 > 83 08 12 stream_rej_to_err() Too small packet for stream_rej session_cb() Unable to parse reject response Parse the Error Code alone and release the stream as if the Close had been accepted. Fixes: 6763ebb3c231 ("Integrate A2DP work from Johan's and Luiz's GIT trees") Assisted-by: Claude:claude-opus-5-5 --- Tests: - A test program runs a2dp.c and avdtp.c against simulated buds that reject Close. The codec change fails on master and works with this patch. The test program is not in the tree. - On real OnePlus Buds Pro 4 with BlueZ 5.87, the codec changed from AAC to SBC and back. The buds rejected both Close commands. That build also contained a change to a2dp.c that is not in this patch. - make check gives the same result with and without this patch. The BlueZ tree has no test for this case. The functional tests have no remote device that rejects Close. profiles/audio/avdtp.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c index c49ac9c0e..191ae12b5 100644 --- a/profiles/audio/avdtp.c +++ b/profiles/audio/avdtp.c @@ -3192,15 +3192,12 @@ static gboolean avdtp_parse_rej(struct avdtp *session, sep->user_data); return TRUE; case AVDTP_CLOSE: - if (!stream_rej_to_err(buf, size, &err, &acp_seid)) + if (!seid_rej_to_err(buf, size, &err)) return FALSE; error("CLOSE request rejected: %s (%d)", avdtp_strerror(&err), err.err.error_code); - if (sep && sep->cfm && sep->cfm->close) { - sep->cfm->close(session, sep, stream, &err, - sep->user_data); - stream->close_int = FALSE; - } + if (stream) + return avdtp_close_resp(session, stream, buf, size); return TRUE; case AVDTP_ABORT: if (!stream_rej_to_err(buf, size, &err, &acp_seid)) base-commit: 71f224fd62317779ec6de23098b4dd96ea83ae5e -- 2.56.1