Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH v1] obexd: fix PBAP PullPhoneBook failure with ebook backend
@ 2026-05-22  6:03 Zhiyuan Sheng
  2026-05-22  8:51 ` [v1] " bluez.test.bot
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Zhiyuan Sheng @ 2026-05-22  6:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: cheng.jiang, shuai.zhang

phonebook_pull() in phonebook-ebook.c does not set *err = 0 on the
success path, unlike phonebook-tracker.c and phonebook-dummy.c. The
caller vobject_pull_open() in pbap.c declares 'ret' without
initialization and passes &ret to phonebook_pull(), so 'ret' retains
an indeterminate stack value when the ebook backend is in use. The
subsequent 'if (ret < 0)' check then incorrectly triggers and rejects
the request with Internal Server Error.

Fix this by setting *err = 0 on success in phonebook-ebook.c, and
initialize 'ret' to 0 in vobject_pull_open() as a defensive measure
to guard against any backend that omits this assignment.

Signed-off-by: Zhiyuan Sheng <zhiyuan.sheng@oss.qualcomm.com>
---
 obexd/plugins/pbap.c            | 2 +-
 obexd/plugins/phonebook-ebook.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/obexd/plugins/pbap.c b/obexd/plugins/pbap.c
index 74976890d..9f8684863 100644
--- a/obexd/plugins/pbap.c
+++ b/obexd/plugins/pbap.c
@@ -661,7 +661,7 @@ static void *vobject_pull_open(const char *name, int oflag, mode_t mode,
 {
 	struct pbap_session *pbap = context;
 	phonebook_cb cb;
-	int ret;
+	int ret = 0;
 	void *request;
 
 	DBG("name %s context %p maxlistcount %d", name, context,
diff --git a/obexd/plugins/phonebook-ebook.c b/obexd/plugins/phonebook-ebook.c
index d772edca0..5fc0498c1 100644
--- a/obexd/plugins/phonebook-ebook.c
+++ b/obexd/plugins/phonebook-ebook.c
@@ -262,6 +262,9 @@ void *phonebook_pull(const char *name, const struct apparam_field *params,
 	data->query = e_book_query_to_string(query);
 	e_book_query_unref(query);
 
+	if (err)
+		*err = 0;
+
 	return data;
 }
 
-- 
2.34.1


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

end of thread, other threads:[~2026-06-05 16:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-22  6:03 [PATCH v1] obexd: fix PBAP PullPhoneBook failure with ebook backend Zhiyuan Sheng
2026-05-22  8:51 ` [v1] " bluez.test.bot
2026-06-05  9:39 ` [PATCH v1] " Bastien Nocera
2026-06-05 16:30 ` patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox