All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bluez PATCH v1] plugin/admin: fix set empty allowlist no persistence issue
@ 2021-08-31  5:39 Howard Chung
  2021-08-31  6:40 ` [Bluez,v1] " bluez.test.bot
  0 siblings, 1 reply; 3+ messages in thread
From: Howard Chung @ 2021-08-31  5:39 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz; +Cc: Yun-Hao Chung, Miao-chen Chou

From: Yun-Hao Chung <howardchung@chromium.org>

This patch fixes a bug when setting empty service allowlist, the
allowlist sets successfully but it fails to be stored in the file.

Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
---
Test procedure:
1. set empty service allowlist via bluetoothctl
2. cat /var/lib/bluetooth/admin_policy_settings
3. restart bluetoothd
4. get service allowlist via bluetoothctl

 plugins/admin.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/plugins/admin.c b/plugins/admin.c
index aea33cb71ac2..02fec04568ba 100644
--- a/plugins/admin.c
+++ b/plugins/admin.c
@@ -196,12 +196,17 @@ static char **new_uuid_strings(struct queue *allowlist, gsize *num)
 	char **uuid_strs = NULL;
 	gsize i = 0, allowlist_num;
 
+	allowlist_num = queue_length(allowlist);
+	if (!allowlist_num) {
+		*num = 0;
+		return NULL;
+	}
+
 	/* Set num to a non-zero number so that whoever call this could know if
 	 * this function success or not
 	 */
 	*num = 1;
 
-	allowlist_num = queue_length(allowlist);
 	uuid_strs = g_try_malloc_n(allowlist_num, sizeof(char *));
 	if (!uuid_strs)
 		return NULL;
-- 
2.33.0.259.gc128427fd7-goog


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

end of thread, other threads:[~2021-09-01  0:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-31  5:39 [Bluez PATCH v1] plugin/admin: fix set empty allowlist no persistence issue Howard Chung
2021-08-31  6:40 ` [Bluez,v1] " bluez.test.bot
2021-09-01  0:57   ` Luiz Augusto von Dentz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.