* [PATCH BlueZ v2] device: fix inverted NULL check in gatt_db clone
@ 2026-05-18 6:45 Zhao Dongdong
2026-05-18 9:48 ` [BlueZ,v2] " bluez.test.bot
2026-05-18 22:30 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth
0 siblings, 2 replies; 3+ messages in thread
From: Zhao Dongdong @ 2026-05-18 6:45 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Zhao Dongdong
From: Zhao Dongdong <zhaodongdong@kylinos.cn>
gatt_db_clone() returns NULL on failure so the condition was inverted.
With the old check a successful clone (non-NULL) would return false and
skip swapping the device's GATT database, while a failure (NULL) would
fall through and dereference a NULL pointer a few lines below.
Fix by negating the condition: only bail out early if the clone failed;
proceed with the swap when the clone actually succeeds.
Fixes: cbe4144dea6f ("set: Attempt to use existing set gatt-db")
Signed-off-by: Zhao Dongdong <zhaodongdong@kylinos.cn>
---
src/device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/device.c b/src/device.c
index 28515054c..bea893301 100644
--- a/src/device.c
+++ b/src/device.c
@@ -7896,7 +7896,7 @@ bool btd_device_set_gatt_db(struct btd_device *device, struct gatt_db *db)
return false;
clone = gatt_db_clone(db);
- if (clone)
+ if (!clone)
return false;
gatt_db_unregister(device->db, device->db_id);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* RE: [BlueZ,v2] device: fix inverted NULL check in gatt_db clone
2026-05-18 6:45 [PATCH BlueZ v2] device: fix inverted NULL check in gatt_db clone Zhao Dongdong
@ 2026-05-18 9:48 ` bluez.test.bot
2026-05-18 22:30 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2026-05-18 9:48 UTC (permalink / raw)
To: linux-bluetooth, winter91
[-- Attachment #1: Type: text/plain, Size: 825 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1096354
---Test result---
Test Summary:
CheckPatch PASS 0.48 seconds
GitLint PASS 0.65 seconds
BuildEll PASS 20.49 seconds
BluezMake PASS 638.98 seconds
CheckSmatch PASS 329.58 seconds
bluezmakeextell PASS 168.02 seconds
IncrementalBuild PASS 630.07 seconds
ScanBuild PASS 966.30 seconds
https://github.com/bluez/bluez/pull/2133
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH BlueZ v2] device: fix inverted NULL check in gatt_db clone
2026-05-18 6:45 [PATCH BlueZ v2] device: fix inverted NULL check in gatt_db clone Zhao Dongdong
2026-05-18 9:48 ` [BlueZ,v2] " bluez.test.bot
@ 2026-05-18 22:30 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2026-05-18 22:30 UTC (permalink / raw)
To: Zhao Dongdong; +Cc: linux-bluetooth, zhaodongdong
Hello:
This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Mon, 18 May 2026 14:45:32 +0800 you wrote:
> From: Zhao Dongdong <zhaodongdong@kylinos.cn>
>
> gatt_db_clone() returns NULL on failure so the condition was inverted.
> With the old check a successful clone (non-NULL) would return false and
> skip swapping the device's GATT database, while a failure (NULL) would
> fall through and dereference a NULL pointer a few lines below.
>
> [...]
Here is the summary with links:
- [BlueZ,v2] device: fix inverted NULL check in gatt_db clone
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=757cd98f4186
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-18 22:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-18 6:45 [PATCH BlueZ v2] device: fix inverted NULL check in gatt_db clone Zhao Dongdong
2026-05-18 9:48 ` [BlueZ,v2] " bluez.test.bot
2026-05-18 22:30 ` [PATCH BlueZ v2] " 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