public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Bastien Nocera <hadess@hadess.net>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH] Fix possible crash on startup
Date: Sun, 12 Oct 2008 00:03:22 +0100	[thread overview]
Message-ID: <1223766202.31961.868.camel@cookie.hadess.net> (raw)

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

I can provide the file that caused the crash, if needed.

Cheers

[-- Attachment #2: 0001-Fix-possible-crash-on-startup.patch --]
[-- Type: text/x-patch, Size: 2165 bytes --]

>From 8515a34842a0aee14d7d0c5725caf15d9d2d7308 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Sun, 12 Oct 2008 00:01:43 +0100
Subject: [PATCH] Fix possible crash on startup

0  0x0000000000a5cf71 in sdp_data_get (rec=0x0, attrId=0) at sdp.c:1444
1  0x000000008c704721 in hid_device_probe (device=0x7f1bed2a80b0, uuids=0x7f1bed29fa90) at manager.c:70
2  0x00007f1becb5bc33 in device_probe_drivers (device=0x7f1bed2a80b0, uuids=0x7f1bed2a2980) at device.c:647
3  0x00007f1becb58a23 in create_stored_device_from_profiles (key=0x7f1bed2a7360 "00:1E:45:AD:F1:96",
   value=0x7f1bed2a7aa0 "00000002-0000-1000-8000-0002ee000002 00001101-0000-1000-8000-00805f9b34fb 00001103-0000-1000-8000-00805f9b34fb 00001104-0000-1000-8000-00805f9b34fb 00001105-0000-1000-8000-00805f9b34fb 00001106-0000-1"..., user_data=0x7f1bed29edd0) at adapter.c:2296
4  0x00007f1becb61d12 in textfile_foreach (pathname=0x7ffff4b6f2a0 "/var/lib/bluetooth/00:13:EF:F1:42:B7/profiles", func=0x7f1becb58955 <create_stored_device_from_profiles>, data=0x7f1bed29edd0) at textfile.c:447
5  0x00007f1becb58b36 in load_devices (adapter=0x7f1bed29edd0) at adapter.c:2327
6  0x00007f1becb58fa0 in adapter_up (adapter=0x7f1bed29edd0, dd=18) at adapter.c:2462
7  0x00007f1becb59479 in adapter_start (adapter=0x7f1bed29edd0) at adapter.c:2569
8  0x00007f1becb5427f in manager_start_adapter (id=0) at manager.c:424
9  0x00007f1becb48e02 in device_devup_setup (dev_id=0) at main.c:481
10 0x00007f1becb48f35 in init_all_devices (ctl=7) at main.c:512
11 0x00007f1becb496d0 in main (argc=1, argv=0x7ffff4b70788) at main.c:748

The HID device's SDP record can be NULL, so don't crash when that happens
---
 input/manager.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/input/manager.c b/input/manager.c
index 51634e3..25b64e4 100644
--- a/input/manager.c
+++ b/input/manager.c
@@ -65,6 +65,9 @@ static int hid_device_probe(struct btd_device *device, GSList *uuids)
 
 	DBG("path %s", path);
 
+	if (!rec)
+		return -1;
+
 	adapter_get_address(adapter, &src);
 	device_get_address(device, &dst);
 	pdlist = sdp_data_get(rec, SDP_SERVER_RECORD_HANDLE);
-- 
1.5.5.2


             reply	other threads:[~2008-10-11 23:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-11 23:03 Bastien Nocera [this message]
2008-10-12 18:15 ` [PATCH] Fix possible crash on startup Johan Hedberg
2008-10-13 13:43   ` Luiz Augusto von Dentz
2008-10-13 14:16     ` Bastien Nocera
2008-10-14 18:47       ` Claudio Takahasi
2008-10-14 21:44         ` Claudio Takahasi
2008-10-14 22:51           ` Bastien Nocera

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=1223766202.31961.868.camel@cookie.hadess.net \
    --to=hadess@hadess.net \
    --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