Skip to contentSkip to conversation

profiles: Fix segfault when using headset controls

PATCH Applied Daniel Šimko 3 participants 3 messages Oct 10, 2020 – Oct 12, 2020 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 profiles: Fix segfault when using headset controls

This fixes a segmentation fault caused by controls trying to notify an unregistered player.

When an unregistered player is replaced by another valid player from the list, the session is not referenced in the sessions list of the player and when this player is unregistered, its reference is not removed from the session.

---
 profiles/audio/avrcp.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
profiles/audio/avrcp.c +13 -2
index ed436de3b..70f52efe8 100644
@@ -4441,8 +4441,19 @@ void avrcp_unregister_player(struct avrcp_player *player)
 		if (target == NULL)
 			continue;
 
-		if (target->player == player)
-			target->player = g_slist_nth_data(server->players, 0);
+		if (target->player == player) {
+			struct avrcp_player *next_player = g_slist_nth_data(
+								server->players,
+								0);
+
+			target->player = next_player;
+
+			if (next_player) {
+				next_player->sessions = g_slist_append(
+							next_player->sessions,
+							session);
+			}
+		}
 	}
 
 	avrcp_player_event(player,
Signature · 1 line
2.28.0
#1 lore raw

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=362639

---Test result---

##############################
Test: CheckPatch - PASS

##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuild - PASS

##############################
Test: MakeCheck - PASS

---
Regards,
Linux Bluetooth

maintainer Applied
#2 lore raw

Hi Daniel,

Quoted 20 lines · On Sun, Oct 11, 2020 at 12:32 PM <[email protected]> wrote:

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=362639

---Test result---

##############################
Test: CheckPatch - PASS

##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuild - PASS

Quoted 8 lines

##############################
Test: MakeCheck - PASS

---
Regards,
Linux Bluetooth

Applied, thanks. Note that I did some small cosmetic changes and also add a call to notify_addressed_player_changed since we are changing the addressed player in the process.

Signature · 1 line
Luiz Augusto von Dentz