patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Luca Boccassi <bluca@debian.org>
To: Michael Baum <michaelba@mellanox.com>, stable@dpdk.org
Cc: Matan Azrad <matan@nvidia.com>,
	Raslan Darawsheh <rasland@nvidia.com>,
	 Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Subject: Re: [dpdk-stable] [PATCH 19.11 2/2] net/mlx5: fix hairpin Rx queue creation error flow
Date: Mon, 17 Aug 2020 10:42:20 +0100	[thread overview]
Message-ID: <e14f8075309e041b03053240990bf01c800425b3.camel@debian.org> (raw)
In-Reply-To: <1597579615-8044-2-git-send-email-michaelba@mellanox.com>

On Sun, 2020-08-16 at 12:06 +0000, Michael Baum wrote:
> [ upstream commit ebed623f621bbe9cf050a9eb7725f4d81cb95d4f ]
> 
> The mlx5_rxq_obj_hairpin_new function defines a pointer named tmpl and
> allocates memory for it using the rte_zmalloc_socket function.
> Later, this function allocates memory to a variable inside tmpl using
> the mlx5_devx_cmd_create_rq function.
> 
> In both cases, if the allocation fails, the code jumps to the error
> label and frees allocated resources. However, in the first jump there
> are still no resources to free and the jump only for the line return
> NULL is unnecessary. Even worse, when it jumps to error label with
> invalid tmpl it actually does dereference to a null pointer.
> In contrast, the second jump needs to free the tmpl variable but the
> function instead of freeing, tries to free the variable that it just
> failed to allocate.
> In addition, for another error, the function returns NULL without
> freeing the tmpl variable before, causing a memory leak.
> 
> Delete the error label and replace each jump with local return NULL and
> free tmpl variable if needed.
> 
> Fixes: e79c9be91515 ("net/mlx5: support Rx hairpin queues")
> 
> Signed-off-by: Michael Baum <michaelba@mellanox.com>
> Acked-by: Matan Azrad <matan@mellanox.com>

Thanks, applied and pushed both.

-- 
Kind regards,
Luca Boccassi

      reply	other threads:[~2020-08-17  9:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-16 12:06 [dpdk-stable] [PATCH 19.11 1/2] net/mlx5: fix hairpin Tx " Michael Baum
2020-08-16 12:06 ` [dpdk-stable] [PATCH 19.11 2/2] net/mlx5: fix hairpin Rx " Michael Baum
2020-08-17  9:42   ` Luca Boccassi [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=e14f8075309e041b03053240990bf01c800425b3.camel@debian.org \
    --to=bluca@debian.org \
    --cc=matan@nvidia.com \
    --cc=michaelba@mellanox.com \
    --cc=rasland@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=viacheslavo@mellanox.com \
    /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).