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 5/8] gdbus/watch: Fix crash when disconnecting from D-Bus
Date: Mon,  9 Sep 2013 17:49:36 +0300	[thread overview]
Message-ID: <1378738179-21047-5-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1378738179-21047-1-git-send-email-luiz.dentz@gmail.com>

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

When disconnecting from D-Bus a message could be recieved with no sender:
Invalid read of size 1
   at 0x4A09EE1: strcmp (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x3B03C386B8: g_str_equal (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x4065D6: message_filter (watch.c:529)
   by 0x3B0700F9E5: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.7.4)
   by 0x4052E7: message_dispatch (mainloop.c:76)
   by 0x3B03C48962: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x3B03C47E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x3B03C48157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x3B03C48559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x4038C5: client_proxy_removed (test-gdbus-client.c:902)
   by 0x3B03C6B566: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x3B03C6B6E5: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
 Address 0x0 is not stack'd, malloc'd or (recently) free'd
---
 gdbus/watch.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gdbus/watch.c b/gdbus/watch.c
index a918535..1532795 100644
--- a/gdbus/watch.c
+++ b/gdbus/watch.c
@@ -519,6 +519,8 @@ static DBusHandlerResult message_filter(DBusConnection *connection,
 	dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &arg, DBUS_TYPE_INVALID);
 
 	/* Sender is always the owner */
+	if (sender == NULL)
+		return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
 	for (current = listeners; current != NULL; current = current->next) {
 		data = current->data;
-- 
1.8.3.1


  parent reply	other threads:[~2013-09-09 14:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-09 14:49 [PATCH BlueZ 1/8] unit: Add gdbus/client_proxy_removed Luiz Augusto von Dentz
2013-09-09 14:49 ` [PATCH BlueZ 2/8] unit: Add gdbus/client_force_disconnect Luiz Augusto von Dentz
2013-09-09 14:49 ` [PATCH BlueZ 3/8] gdbus/watch: Fix crash when g_dbus_remove_watch is called from connect callback Luiz Augusto von Dentz
2013-09-09 14:49 ` [PATCH BlueZ 4/8] gdbus/watch: Fix aborting when removing D-Bus filter Luiz Augusto von Dentz
2013-09-09 14:49 ` Luiz Augusto von Dentz [this message]
2013-09-09 14:49 ` [PATCH BlueZ 6/8] gdbus/client: Use g_dbus_add_service_watch to track services Luiz Augusto von Dentz
2013-09-09 14:49 ` [PATCH BlueZ 7/8] gdbus/client: Use g_dbus_add_signal_watch to track signals Luiz Augusto von Dentz
2013-09-09 14:49 ` [PATCH BlueZ 8/8] gdbus/client: Use g_dbus_add_properties_watch to track properties Luiz Augusto von Dentz
2013-09-12 11:01 ` [PATCH BlueZ 1/8] unit: Add gdbus/client_proxy_removed 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=1378738179-21047-5-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).