diff mbox series

[BlueZ,v2,1/3] audio: transport: Fix crash on A2DP suspend

Message ID 20240103205124.3839768-1-luiz.dentz@gmail.com
State Superseded
Headers show
Series [BlueZ,v2,1/3] audio: transport: Fix crash on A2DP suspend | expand

Commit Message

Luiz Augusto von Dentz Jan. 3, 2024, 8:51 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Commit 052534ae07b8 ("transport: Update transport release flow for
bcast src") introduced a crash where it assumes transport->data always
refers to struct bap_transport which causes a crash when the transport
is in fact A2DP.

Fixes: https://github.com/bluez/bluez/issues/701
---
 profiles/audio/transport.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

Comments

bluez.test.bot@gmail.com Jan. 3, 2024, 10:28 p.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=814200

---Test result---

Test Summary:
CheckPatch                    FAIL      1.95 seconds
GitLint                       PASS      0.99 seconds
BuildEll                      PASS      24.60 seconds
BluezMake                     PASS      718.81 seconds
MakeCheck                     PASS      11.85 seconds
MakeDistcheck                 PASS      164.64 seconds
CheckValgrind                 PASS      226.32 seconds
CheckSmatch                   PASS      332.96 seconds
bluezmakeextell               PASS      109.00 seconds
IncrementalBuild              PASS      2001.15 seconds
ScanBuild                     PASS      939.70 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,v2,1/3] audio: transport: Fix crash on A2DP suspend
WARNING:UNKNOWN_COMMIT_ID: Unknown commit id '052534ae07b8', maybe rebased or not pulled?
#76: 
Commit 052534ae07b8 ("transport: Update transport release flow for

/github/workspace/src/src/13510505.patch total: 0 errors, 1 warnings, 40 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13510505.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.


[BlueZ,v2,2/3] audio/transport: Refactor transport operations
WARNING:LINE_SPACING: Missing a blank line after declarations
#253: FILE: profiles/audio/transport.c:482:
+	struct a2dp_transport *a2dp = transport->data;
+	return a2dp->volume;

/github/workspace/src/src/13510507.patch total: 0 errors, 1 warnings, 726 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13510507.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.




---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org Jan. 4, 2024, 4:10 p.m. UTC | #2
Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Wed,  3 Jan 2024 15:51:22 -0500 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> Commit 052534ae07b8 ("transport: Update transport release flow for
> bcast src") introduced a crash where it assumes transport->data always
> refers to struct bap_transport which causes a crash when the transport
> is in fact A2DP.
> 
> [...]

Here is the summary with links:
  - [BlueZ,v2,1/3] audio: transport: Fix crash on A2DP suspend
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=36f057d7f66c
  - [BlueZ,v2,2/3] audio/transport: Refactor transport operations
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=e4764af76228
  - [BlueZ,v2,3/3] audio/transport: Fix runtime error
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=1c321baca781

You are awesome, thank you!
diff mbox series

Patch

diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index e2073451cc7a..0c60f06eef36 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -643,7 +643,6 @@  static DBusMessage *release(DBusConnection *conn, DBusMessage *msg,
 {
 	struct media_transport *transport = data;
 	struct media_owner *owner = transport->owner;
-	struct bap_transport *bap = transport->data;
 	const char *sender;
 	struct media_request *req;
 	guint id;
@@ -675,11 +674,6 @@  static DBusMessage *release(DBusConnection *conn, DBusMessage *msg,
 	req = media_request_create(msg, id);
 	media_owner_add(owner, req);
 
-	if (bt_bap_stream_get_type(bap->stream) ==
-			BT_BAP_STREAM_TYPE_BCAST) {
-		bap_disable_complete(bap->stream, 0x00, 0x00, owner);
-	}
-
 	return NULL;
 }
 
@@ -1416,6 +1410,7 @@  static guint suspend_bap(struct media_transport *transport,
 {
 	struct bap_transport *bap = transport->data;
 	bt_bap_stream_func_t func = NULL;
+	guint id;
 
 	if (!bap->stream)
 		return 0;
@@ -1427,7 +1422,14 @@  static guint suspend_bap(struct media_transport *transport,
 
 	bap_update_links(transport);
 
-	return bt_bap_stream_disable(bap->stream, bap->linked, func, owner);
+	id = bt_bap_stream_disable(bap->stream, bap->linked, func, owner);
+
+	if (bt_bap_stream_get_type(bap->stream) == BT_BAP_STREAM_TYPE_BCAST) {
+		bap_disable_complete(bap->stream, 0x00, 0x00, owner);
+		return 0;
+	}
+
+	return id;
 }
 
 static void cancel_bap(struct media_transport *transport, guint id)