linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] gatt: GAP and GATT services are mandatory
@ 2012-08-22 19:38 Claudio Takahasi
  2012-08-23 12:15 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Claudio Takahasi @ 2012-08-22 19:38 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

This patch fixes potential segmentation fault if the remote doesn't
support GAP and GATT services.
---
 profiles/gatt/manager.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/profiles/gatt/manager.c b/profiles/gatt/manager.c
index a1fa756..0702d26 100644
--- a/profiles/gatt/manager.c
+++ b/profiles/gatt/manager.c
@@ -30,6 +30,7 @@
 #include "gattrib.h"
 #include "gatt.h"
 #include "gas.h"
+#include "log.h"
 #include "manager.h"
 
 static gint primary_uuid_cmp(gconstpointer a, gconstpointer b)
@@ -55,8 +56,12 @@ static int gatt_driver_probe(struct btd_device *device, GSList *uuids)
 	if (l)
 		gatt = l->data;
 
-	return gas_register(device, gap ? &gap->range : NULL,
-				gatt ? &gatt->range : NULL);
+	if (gap == NULL || gatt == NULL) {
+		error("GAP and GATT are mandatory");
+		return -EINVAL;
+	}
+
+	return gas_register(device, &gap->range, &gatt->range);
 }
 
 static void gatt_driver_remove(struct btd_device *device)
-- 
1.7.12


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

* Re: [PATCH BlueZ] gatt: GAP and GATT services are mandatory
  2012-08-22 19:38 [PATCH BlueZ] gatt: GAP and GATT services are mandatory Claudio Takahasi
@ 2012-08-23 12:15 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2012-08-23 12:15 UTC (permalink / raw)
  To: Claudio Takahasi; +Cc: linux-bluetooth

Hi Claudio,

On Wed, Aug 22, 2012, Claudio Takahasi wrote:
> This patch fixes potential segmentation fault if the remote doesn't
> support GAP and GATT services.
> ---
>  profiles/gatt/manager.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)

Applied. Thanks.

Johan

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

end of thread, other threads:[~2012-08-23 12:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-22 19:38 [PATCH BlueZ] gatt: GAP and GATT services are mandatory Claudio Takahasi
2012-08-23 12:15 ` Johan Hedberg

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