All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] profiles: Fix segfault when using headset controls
@ 2020-10-10 22:27 Daniel Šimko
  2020-10-10 23:33 ` [BlueZ] " bluez.test.bot
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Šimko @ 2020-10-10 22:27 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Daniel Šimko

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(-)

diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index ed436de3b..70f52efe8 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -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,
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [BlueZ] profiles: Fix segfault when using headset controls
  2020-10-10 22:27 [PATCH BlueZ] profiles: Fix segfault when using headset controls Daniel Šimko
@ 2020-10-10 23:33 ` bluez.test.bot
  2020-10-12 17:26   ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 3+ messages in thread
From: bluez.test.bot @ 2020-10-10 23:33 UTC (permalink / raw)
  To: linux-bluetooth, daniel

[-- Attachment #1: Type: text/plain, Size: 557 bytes --]

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BlueZ] profiles: Fix segfault when using headset controls
  2020-10-10 23:33 ` [BlueZ] " bluez.test.bot
@ 2020-10-12 17:26   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2020-10-12 17:26 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: daniel

Hi Daniel,

On Sun, Oct 11, 2020 at 12:32 PM <bluez.test.bot@gmail.com> 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
>
> ##############################
> 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.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-12 17:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-10 22:27 [PATCH BlueZ] profiles: Fix segfault when using headset controls Daniel Šimko
2020-10-10 23:33 ` [BlueZ] " bluez.test.bot
2020-10-12 17:26   ` Luiz Augusto von Dentz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.