linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] tools/mesh-cfg-client: Fix NULL pointer dereferencing
@ 2021-10-08 18:48 Inga Stotland
  2021-10-08 19:30 ` [BlueZ] " bluez.test.bot
  2021-10-08 22:40 ` [PATCH BlueZ] " Gix, Brian
  0 siblings, 2 replies; 3+ messages in thread
From: Inga Stotland @ 2021-10-08 18:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: brian.gix, Inga Stotland

This patch fixes a number of potential NULL pointer dereferencing
cases.
---
 tools/mesh/cfgcli.c  | 2 --
 tools/mesh/mesh-db.c | 3 ++-
 tools/mesh/remote.c  | 6 ++++++
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/tools/mesh/cfgcli.c b/tools/mesh/cfgcli.c
index 2bf1a1503..f815c513c 100644
--- a/tools/mesh/cfgcli.c
+++ b/tools/mesh/cfgcli.c
@@ -668,8 +668,6 @@ static bool msg_recvd(uint16_t src, uint16_t idx, uint8_t *data,
 			break;
 		}
 
-		bt_shell_printf("Period\t\t%d ms\n", pub.period);
-
 		pub.rtx_cnt = data[9] & 0x7;
 		pub.rtx_interval = ((data[9] >> 3) + 1) * 50;
 		bt_shell_printf("Rexmit count\t%d\n", pub.rtx_cnt);
diff --git a/tools/mesh/mesh-db.c b/tools/mesh/mesh-db.c
index 12055c1a9..1a1ba380b 100644
--- a/tools/mesh/mesh-db.c
+++ b/tools/mesh/mesh-db.c
@@ -2508,7 +2508,8 @@ void *mesh_db_prepare_export(void)
 	jarray = json_object_new_array();
 	json_object_object_add(export, "scenes", jarray);
 
-	write_bool(export, "partial", false);
+	if (!write_bool(export, "partial", false))
+		l_warn("Failed to write\"partial\" property");
 
 	return export;
 }
diff --git a/tools/mesh/remote.c b/tools/mesh/remote.c
index 054da5300..6ec220a6f 100644
--- a/tools/mesh/remote.c
+++ b/tools/mesh/remote.c
@@ -281,6 +281,9 @@ bool remote_update_net_key(uint16_t addr, uint16_t net_idx, bool update,
 
 	key = l_queue_find(rmt->net_keys, match_key,
 						L_UINT_TO_PTR(net_idx));
+	if (!key)
+		return false;
+
 	key->updated = update;
 
 	if (save)
@@ -343,6 +346,9 @@ bool remote_update_app_key(uint16_t addr, uint16_t app_idx, bool update,
 
 	key = l_queue_find(rmt->app_keys, match_key,
 						L_UINT_TO_PTR(app_idx));
+	if (!key)
+		return false;
+
 	key->updated = update;
 
 	if (save)
-- 
2.31.1


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

* RE: [BlueZ] tools/mesh-cfg-client: Fix NULL pointer dereferencing
  2021-10-08 18:48 [PATCH BlueZ] tools/mesh-cfg-client: Fix NULL pointer dereferencing Inga Stotland
@ 2021-10-08 19:30 ` bluez.test.bot
  2021-10-08 22:40 ` [PATCH BlueZ] " Gix, Brian
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2021-10-08 19:30 UTC (permalink / raw)
  To: linux-bluetooth, inga.stotland

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

---Test result---

Test Summary:
CheckPatch                    PASS      1.47 seconds
GitLint                       PASS      0.91 seconds
Prep - Setup ELL              PASS      42.04 seconds
Build - Prep                  PASS      0.47 seconds
Build - Configure             PASS      7.84 seconds
Build - Make                  PASS      178.80 seconds
Make Check                    PASS      8.90 seconds
Make Distcheck                PASS      214.84 seconds
Build w/ext ELL - Configure   PASS      7.99 seconds
Build w/ext ELL - Make        PASS      171.15 seconds



---
Regards,
Linux Bluetooth


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

* Re: [PATCH BlueZ] tools/mesh-cfg-client: Fix NULL pointer dereferencing
  2021-10-08 18:48 [PATCH BlueZ] tools/mesh-cfg-client: Fix NULL pointer dereferencing Inga Stotland
  2021-10-08 19:30 ` [BlueZ] " bluez.test.bot
@ 2021-10-08 22:40 ` Gix, Brian
  1 sibling, 0 replies; 3+ messages in thread
From: Gix, Brian @ 2021-10-08 22:40 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org, Stotland, Inga

Patch Applied

On Fri, 2021-10-08 at 11:48 -0700, Inga Stotland wrote:
> This patch fixes a number of potential NULL pointer dereferencing
> cases.
> ---
>  tools/mesh/cfgcli.c  | 2 --
>  tools/mesh/mesh-db.c | 3 ++-
>  tools/mesh/remote.c  | 6 ++++++
>  3 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/mesh/cfgcli.c b/tools/mesh/cfgcli.c
> index 2bf1a1503..f815c513c 100644
> --- a/tools/mesh/cfgcli.c
> +++ b/tools/mesh/cfgcli.c
> @@ -668,8 +668,6 @@ static bool msg_recvd(uint16_t src, uint16_t idx, uint8_t *data,
>                         break;
>                 }
>  
> -               bt_shell_printf("Period\t\t%d ms\n", pub.period);
> -
>                 pub.rtx_cnt = data[9] & 0x7;
>                 pub.rtx_interval = ((data[9] >> 3) + 1) * 50;
>                 bt_shell_printf("Rexmit count\t%d\n", pub.rtx_cnt);
> diff --git a/tools/mesh/mesh-db.c b/tools/mesh/mesh-db.c
> index 12055c1a9..1a1ba380b 100644
> --- a/tools/mesh/mesh-db.c
> +++ b/tools/mesh/mesh-db.c
> @@ -2508,7 +2508,8 @@ void *mesh_db_prepare_export(void)
>         jarray = json_object_new_array();
>         json_object_object_add(export, "scenes", jarray);
>  
> -       write_bool(export, "partial", false);
> +       if (!write_bool(export, "partial", false))
> +               l_warn("Failed to write\"partial\" property");
>  
>         return export;
>  }
> diff --git a/tools/mesh/remote.c b/tools/mesh/remote.c
> index 054da5300..6ec220a6f 100644
> --- a/tools/mesh/remote.c
> +++ b/tools/mesh/remote.c
> @@ -281,6 +281,9 @@ bool remote_update_net_key(uint16_t addr, uint16_t net_idx, bool update,
>  
>         key = l_queue_find(rmt->net_keys, match_key,
>                                                 L_UINT_TO_PTR(net_idx));
> +       if (!key)
> +               return false;
> +
>         key->updated = update;
>  
>         if (save)
> @@ -343,6 +346,9 @@ bool remote_update_app_key(uint16_t addr, uint16_t app_idx, bool update,
>  
>         key = l_queue_find(rmt->app_keys, match_key,
>                                                 L_UINT_TO_PTR(app_idx));
> +       if (!key)
> +               return false;
> +
>         key->updated = update;
>  
>         if (save)


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

end of thread, other threads:[~2021-10-08 22:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-08 18:48 [PATCH BlueZ] tools/mesh-cfg-client: Fix NULL pointer dereferencing Inga Stotland
2021-10-08 19:30 ` [BlueZ] " bluez.test.bot
2021-10-08 22:40 ` [PATCH BlueZ] " Gix, Brian

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).