linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 04/11] AVRCP: Fix not adding session to player's list of sessions
Date: Thu, 25 Oct 2012 16:59:07 +0300	[thread overview]
Message-ID: <1351173554-28039-4-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1351173554-28039-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

If the session is not added in the list if the player gets
unregistered it will not be cleared from the session which might cause a
crash if the tries to access it.
---
 audio/avrcp.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/audio/avrcp.c b/audio/avrcp.c
index a14833a..88ba3aa 100644
--- a/audio/avrcp.c
+++ b/audio/avrcp.c
@@ -1442,10 +1442,16 @@ static struct avrcp *find_session(GSList *list, struct audio_device *dev)
 static void session_tg_init(struct avrcp *session)
 {
 	struct avrcp_server *server = session->server;
+	struct avrcp_player *player;
 
 	DBG("%p version 0x%04x", session, session->version);
 
-	session->player = g_slist_nth_data(server->players, 0);
+	player = g_slist_nth_data(server->players, 0);
+	if (player != NULL) {
+		session->player = player;
+		player->sessions = g_slist_prepend(player->sessions, session);
+	}
+
 	session->control_handlers = tg_control_handlers;
 
 	if (session->version >= 0x0104) {
-- 
1.7.11.7


  parent reply	other threads:[~2012-10-25 13:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-25 13:59 [PATCH BlueZ 01/11] control: Fix Control.Disconnect not generating any reply Luiz Augusto von Dentz
2012-10-25 13:59 ` [PATCH BlueZ 02/11] AVRCP: Fix using void * for metadata values Luiz Augusto von Dentz
2012-10-25 13:59 ` [PATCH BlueZ 03/11] AVRCP: Don't respond with errors when no player is registered Luiz Augusto von Dentz
2012-10-25 13:59 ` Luiz Augusto von Dentz [this message]
2012-10-25 13:59 ` [PATCH BlueZ 05/11] AVCTP: Reduce verbosity of PDU parsing Luiz Augusto von Dentz
2012-10-25 13:59 ` [PATCH BlueZ 06/11] AVRCP: Add support for settings changed event Luiz Augusto von Dentz
2012-10-25 13:59 ` [PATCH BlueZ 07/11] AVRCP: Add initial support for controller player Luiz Augusto von Dentz
2012-10-26  7:44   ` Johan Hedberg
2012-10-25 13:59 ` [PATCH BlueZ 08/11] AVRCP: Remove conversions inside media.c Luiz Augusto von Dentz
2012-10-25 13:59 ` [PATCH BlueZ 09/11] test: Fix using Number instead of Track in simple-player Luiz Augusto von Dentz
2012-10-25 13:59 ` [PATCH BlueZ 10/11] test: Fix using Number instead of Track in mpris-player Luiz Augusto von Dentz
2012-10-25 13:59 ` [PATCH BlueZ 11/11] test: Add support for using external player Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1351173554-28039-4-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).