public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v2] plugins/sixaxis: add NULL check in setup_device()
@ 2024-06-27 12:39 Roman Smirnov
  2024-06-27 14:18 ` [BlueZ,v2] " bluez.test.bot
  2024-06-27 18:40 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Roman Smirnov @ 2024-06-27 12:39 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Roman Smirnov

btd_adapter_get_device() may return NULL on the next call stack:

btd_adapter_get_device()
    adapter_create_device()
        device_create()
            device_new()
                g_try_malloc0()

It is necessary to prevent this to avoid dereferencing a null
pointer further.
---
 plugins/sixaxis.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c
index 544ab399a..3e69f1dd2 100644
--- a/plugins/sixaxis.c
+++ b/plugins/sixaxis.c
@@ -346,6 +346,11 @@ static bool setup_device(int fd, const char *sysfs_path,
 
 	device = btd_adapter_get_device(adapter, &device_bdaddr, BDADDR_BREDR);
 
+	if (!device) {
+		error("sixaxis: unable to set up a new device");
+		return false;
+	}
+
 	info("sixaxis: setting up new device");
 
 	btd_device_device_set_name(device, cp->name);
-- 
2.43.0


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

* RE: [BlueZ,v2] plugins/sixaxis: add NULL check in setup_device()
  2024-06-27 12:39 [PATCH BlueZ v2] plugins/sixaxis: add NULL check in setup_device() Roman Smirnov
@ 2024-06-27 14:18 ` bluez.test.bot
  2024-06-27 18:40 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2024-06-27 14:18 UTC (permalink / raw)
  To: linux-bluetooth, r.smirnov

[-- Attachment #1: Type: text/plain, Size: 949 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=866143

---Test result---

Test Summary:
CheckPatch                    PASS      0.44 seconds
GitLint                       PASS      0.31 seconds
BuildEll                      PASS      24.69 seconds
BluezMake                     PASS      1672.82 seconds
MakeCheck                     PASS      13.57 seconds
MakeDistcheck                 PASS      178.25 seconds
CheckValgrind                 PASS      253.30 seconds
CheckSmatch                   PASS      355.08 seconds
bluezmakeextell               PASS      120.44 seconds
IncrementalBuild              PASS      1448.99 seconds
ScanBuild                     PASS      1009.64 seconds



---
Regards,
Linux Bluetooth


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

* Re: [PATCH BlueZ v2] plugins/sixaxis: add NULL check in setup_device()
  2024-06-27 12:39 [PATCH BlueZ v2] plugins/sixaxis: add NULL check in setup_device() Roman Smirnov
  2024-06-27 14:18 ` [BlueZ,v2] " bluez.test.bot
@ 2024-06-27 18:40 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2024-06-27 18:40 UTC (permalink / raw)
  To: Roman Smirnov; +Cc: linux-bluetooth

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Thu, 27 Jun 2024 15:39:02 +0300 you wrote:
> btd_adapter_get_device() may return NULL on the next call stack:
> 
> btd_adapter_get_device()
>     adapter_create_device()
>         device_create()
>             device_new()
>                 g_try_malloc0()
> 
> [...]

Here is the summary with links:
  - [BlueZ,v2] plugins/sixaxis: add NULL check in setup_device()
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=e3616b776ae0

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:[~2024-06-27 18:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-27 12:39 [PATCH BlueZ v2] plugins/sixaxis: add NULL check in setup_device() Roman Smirnov
2024-06-27 14:18 ` [BlueZ,v2] " bluez.test.bot
2024-06-27 18:40 ` [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