linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Inga Stotland <inga.stotland@intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: brian.gix@intel.com, Inga Stotland <inga.stotland@intel.com>
Subject: [PATCH BlueZ] tools/mesh-cfgclient: Fix segfault on remote node reset
Date: Mon, 20 Jul 2020 13:42:06 -0700	[thread overview]
Message-ID: <20200720204206.226761-1-inga.stotland@intel.com> (raw)

This fixes a segfault that is caused by freeeing non-allocated memory.
Happens upon the removal of a remote node when remote's net key and/or
app key queues are destroyed.

__GI___libc_free (mem=0x1) at malloc.c:3102
    destroy=destroy@entry=0x55761f63a3b0 <l_free>) at ell/queue.c:107
    destroy=destroy@entry=0x55761f63a3b0 <l_free>) at ell/queue.c:82
    at tools/mesh/remote.c:140
    at tools/mesh/cfgcli.c:764
    at tools/mesh/cfgcli.c:764
    msg=0x5576213aa6f0, user_data=<optimized out>)
    at tools/mesh-cfgclient.c:1522
    dbus=dbus@entry=0x55762132f860, message=message@entry=0x5576213aa6f0)
    at ell/dbus-service.c:1793
    user_data=0x55762132f860) at ell/dbus.c:285
    user_data=0x55762132f940) at ell/io.c:126
---
 tools/mesh/remote.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/mesh/remote.c b/tools/mesh/remote.c
index 2a8f747d6..c74f0bec1 100644
--- a/tools/mesh/remote.c
+++ b/tools/mesh/remote.c
@@ -134,10 +134,11 @@ uint8_t remote_del_node(uint16_t unicast)
 		l_queue_destroy(rmt->els[i], NULL);
 		remote_add_blacklisted_address(unicast + i, iv_index, true);
 	}
+
 	l_free(rmt->els);
 
-	l_queue_destroy(rmt->net_keys, l_free);
-	l_queue_destroy(rmt->app_keys, l_free);
+	l_queue_destroy(rmt->net_keys, NULL);
+	l_queue_destroy(rmt->app_keys, NULL);
 	l_free(rmt);
 
 	mesh_db_del_node(unicast);
-- 
2.26.2


             reply	other threads:[~2020-07-20 20:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-20 20:42 Inga Stotland [this message]
2020-07-21 16:01 ` [PATCH BlueZ] tools/mesh-cfgclient: Fix segfault on remote node reset Gix, Brian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200720204206.226761-1-inga.stotland@intel.com \
    --to=inga.stotland@intel.com \
    --cc=brian.gix@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).