From: "Gix, Brian" <brian.gix@intel.com>
To: "linux-bluetooth@vger.kernel.org"
<linux-bluetooth@vger.kernel.org>,
"Stotland, Inga" <inga.stotland@intel.com>
Subject: Re: [PATCH BlueZ] mesh: Fix double free of a pointer in mesh-io-generic
Date: Thu, 8 Aug 2019 18:57:48 +0000 [thread overview]
Message-ID: <da2be8478867a386cab75fec400896bb9c006828.camel@intel.com> (raw)
In-Reply-To: <20190807200636.19614-1-inga.stotland@intel.com>
Applied
On Wed, 2019-08-07 at 13:06 -0700, Inga Stotland wrote:
> This fixes a crash in bluetooth-meshd due to freeing the same pointer
> twice. The fix is to initialize the address of freed TX buffer to NULL.
> ---
> mesh/mesh-io-generic.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/mesh/mesh-io-generic.c b/mesh/mesh-io-generic.c
> index 576c5df1b..cc91f494e 100644
> --- a/mesh/mesh-io-generic.c
> +++ b/mesh/mesh-io-generic.c
> @@ -654,8 +654,12 @@ static bool tx_cancel(struct mesh_io *io, const uint8_t *data, uint8_t len)
> tx = l_queue_remove_if(pvt->tx_pkts, find_by_ad_type,
> L_UINT_TO_PTR(data[0]));
> l_free(tx);
> +
> + if (tx == pvt->tx)
> + pvt->tx = NULL;
> +
> } while (tx);
> - } else {
> + } else {
> struct tx_pattern pattern = {
> .data = data,
> .len = len
> @@ -665,6 +669,10 @@ static bool tx_cancel(struct mesh_io *io, const uint8_t *data, uint8_t len)
> tx = l_queue_remove_if(pvt->tx_pkts, find_by_pattern,
> &pattern);
> l_free(tx);
> +
> + if (tx == pvt->tx)
> + pvt->tx = NULL;
> +
> } while (tx);
> }
>
prev parent reply other threads:[~2019-08-08 18:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-07 20:06 [PATCH BlueZ] mesh: Fix double free of a pointer in mesh-io-generic Inga Stotland
2019-08-08 18:57 ` Gix, Brian [this message]
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=da2be8478867a386cab75fec400896bb9c006828.camel@intel.com \
--to=brian.gix@intel.com \
--cc=inga.stotland@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).