linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anderson Lizardo <anderson.lizardo@openbossa.org>
To: linux-bluetooth@vger.kernel.org
Cc: Anderson Lizardo <anderson.lizardo@openbossa.org>
Subject: [PATCH BlueZ 1/4] device: Fix NULL pointer dereference during GATT service discovery
Date: Tue, 14 Feb 2012 12:06:01 -0400	[thread overview]
Message-ID: <1329235564-12471-2-git-send-email-anderson.lizardo@openbossa.org> (raw)
In-Reply-To: <1329235564-12471-1-git-send-email-anderson.lizardo@openbossa.org>

If reverse service discovery for GATT is triggered,
device_browse_primary() is called with a NULL "conn" parameter. This fix
is based on similar code found in device_browse_sdp().

This fixes errors like:

process 871: arguments to dbus_connection_ref() were incorrect,
assertion "connection != NULL" failed in file dbus-connection.c line
2549.
This is normally a bug in some application using the D-Bus library.
process 871: arguments to dbus_connection_get_object_path_data() were
incorrect, assertion "connection != NULL" failed in file
dbus-connection.c line 5639.
This is normally a bug in some application using the D-Bus library.
process 871: arguments to dbus_connection_register_object_path() were
incorrect, assertion "connection != NULL" failed in file
dbus-connection.c line 5461.
This is normally a bug in some application using the D-Bus library.
---
 src/device.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/device.c b/src/device.c
index ca7b15b..50ab339 100644
--- a/src/device.c
+++ b/src/device.c
@@ -2011,8 +2011,10 @@ int device_browse_primary(struct btd_device *device, DBusConnection *conn,
 	}
 
 done:
-	if (conn)
-		req->conn = dbus_connection_ref(conn);
+	if (conn == NULL)
+		conn = get_dbus_connection();
+
+	req->conn = dbus_connection_ref(conn);
 
 	if (msg) {
 		const char *sender = dbus_message_get_sender(msg);
-- 
1.7.5.4


  reply	other threads:[~2012-02-14 16:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-14 16:06 [PATCH BlueZ 0/4] GATT over LE reverse service discovery fixes Anderson Lizardo
2012-02-14 16:06 ` Anderson Lizardo [this message]
2012-02-14 16:06 ` [PATCH BlueZ 2/4] device: Fix invalid memory read during GATT discovery Anderson Lizardo
2012-02-14 16:06 ` [PATCH BlueZ 3/4] device: Fix invalid D-Bus calls during Reverse GATT Discovery Anderson Lizardo
2012-02-14 16:06 ` [PATCH BlueZ 4/4] device: Fix memory leak during GATT service update Anderson Lizardo
2012-02-16 13:10 ` [PATCH BlueZ 0/4] GATT over LE reverse service discovery fixes Johan Hedberg

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=1329235564-12471-2-git-send-email-anderson.lizardo@openbossa.org \
    --to=anderson.lizardo@openbossa.org \
    --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).