audio: transport: Fix crash on A2DP suspend
Luiz Augusto von Dentz
maintainerPATCH 1/1 audio: transport: Fix crash on A2DP suspend
From: Luiz Augusto von Dentz <[email protected]>
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.
--- profiles/audio/transport.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
profiles/audio/transport.c +9 -7
@@ -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)
Signature · 1 line
2.43.0
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=813893
---Test result---
Test Summary:
CheckPatch FAIL 0.72 seconds GitLint PASS 0.50 seconds BuildEll PASS 24.00 seconds BluezMake PASS 722.25 seconds MakeCheck PASS 11.83 seconds MakeDistcheck PASS 160.48 seconds CheckValgrind PASS 221.84 seconds CheckSmatch PASS 327.10 seconds bluezmakeextell PASS 106.56 seconds IncrementalBuild PASS 665.20 seconds ScanBuild WARNING 948.25 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,v1] 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/13509235.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/13509235.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.
##############################
Test: ScanBuild - WARNING
Desc: Run Scan Build
Output:profiles/audio/transport.c:620:30: warning: Access to field 'pending' results in a dereference of a null pointer (loaded from variable 'owner')
struct media_request *req = owner->pending;
^~~~~~~~~~~~~~1 warning generated.
---
Regards,
Linux Bluetooth