* [PATCH] gatt: Fix crash with BR/EDR only adapter
@ 2018-04-04 7:32 Szymon Janc
2018-04-04 10:04 ` Szymon Janc
0 siblings, 1 reply; 2+ messages in thread
From: Szymon Janc @ 2018-04-04 7:32 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
adapter->database can be NULL if controller is BR/EDR only or LE was
disabled. Make btd_gatt_database_restore_svc_chng_ccc accept NULL
pointer and silently ignore it similiar to rest of btd_gatt_database
API.
---
src/gatt-database.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/gatt-database.c b/src/gatt-database.c
index 1cdc72e1b..0ac5b75b0 100644
--- a/src/gatt-database.c
+++ b/src/gatt-database.c
@@ -3330,6 +3330,9 @@ void btd_gatt_database_restore_svc_chng_ccc(struct btd_gatt_database *database)
uint8_t value[4];
uint16_t handle, ccc_handle;
+ if (!database)
+ return;
+
handle = gatt_db_attribute_get_handle(database->svc_chngd);
ccc_handle = gatt_db_attribute_get_handle(database->svc_chngd_ccc);
--
2.14.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] gatt: Fix crash with BR/EDR only adapter
2018-04-04 7:32 [PATCH] gatt: Fix crash with BR/EDR only adapter Szymon Janc
@ 2018-04-04 10:04 ` Szymon Janc
0 siblings, 0 replies; 2+ messages in thread
From: Szymon Janc @ 2018-04-04 10:04 UTC (permalink / raw)
To: Bluez mailing list; +Cc: Szymon Janc
On 4 April 2018 at 09:32, Szymon Janc <szymon.janc@codecoup.pl> wrote:
> adapter->database can be NULL if controller is BR/EDR only or LE was
> disabled. Make btd_gatt_database_restore_svc_chng_ccc accept NULL
> pointer and silently ignore it similiar to rest of btd_gatt_database
> API.
> ---
> src/gatt-database.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/src/gatt-database.c b/src/gatt-database.c
> index 1cdc72e1b..0ac5b75b0 100644
> --- a/src/gatt-database.c
> +++ b/src/gatt-database.c
> @@ -3330,6 +3330,9 @@ void btd_gatt_database_restore_svc_chng_ccc(struct btd_gatt_database *database)
> uint8_t value[4];
> uint16_t handle, ccc_handle;
>
> + if (!database)
> + return;
> +
> handle = gatt_db_attribute_get_handle(database->svc_chngd);
> ccc_handle = gatt_db_attribute_get_handle(database->svc_chngd_ccc);
>
> --
> 2.14.3
>
Applied.
--
pozdrawiam
Szymon K. Janc
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-04 10:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-04 7:32 [PATCH] gatt: Fix crash with BR/EDR only adapter Szymon Janc
2018-04-04 10:04 ` Szymon Janc
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).