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 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html