DPDK patches and discussions
 help / color / mirror / Atom feed
From: Raslan Darawsheh <rasland@mellanox.com>
To: Michael Baum <michaelba@mellanox.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: Matan Azrad <matan@mellanox.com>,
	Slava Ovsiienko <viacheslavo@mellanox.com>,
	"stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 1/6] net/mlx5: fix hairpin Tx queue creation	error flow
Date: Sun, 31 May 2020 11:26:32 +0000	[thread overview]
Message-ID: <AM0PR05MB670745339E2B0635DAB7F96BC28D0@AM0PR05MB6707.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <1590568677-11662-1-git-send-email-michaelba@mellanox.com>


> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Michael Baum
> Sent: Wednesday, May 27, 2020 11:38 AM
> To: dev@dpdk.org
> Cc: Matan Azrad <matan@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH 1/6] net/mlx5: fix hairpin Tx queue creation
> error flow
> The mlx5_txq_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_sq 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, and another variable that has never been allocated.
> 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: ae18a1ae9692 ("net/mlx5: support Tx hairpin queues")
> Cc: stable@dpdk.org
> Signed-off-by: Michael Baum <michaelba@mellanox.com>
> Acked-by: Matan Azrad <matan@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_txq.c | 15 ++++-----------
>  1 file changed, 4 insertions(+), 11 deletions(-)

Series applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

      parent reply	other threads:[~2020-05-31 11:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-27  8:37 Michael Baum
2020-05-27  8:37 ` [dpdk-dev] [PATCH 2/6] net/mlx5: fix hairpin Rx " Michael Baum
2020-05-27  8:37 ` [dpdk-dev] [PATCH 3/6] net/mlx5: fix unnecessary init in socket handle Michael Baum
2020-05-27  8:37 ` [dpdk-dev] [PATCH 4/6] net/mlx5: fix socket handle closing Michael Baum
2020-05-27  8:37 ` [dpdk-dev] [PATCH 5/6] net/mlx5: fix needless txq initialization check Michael Baum
2020-05-27  8:37 ` [dpdk-dev] [PATCH 6/6] net/mlx5: fix compiler code arrangement in MPLS support Michael Baum
2020-05-31 11:26 ` Raslan Darawsheh [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:

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

  git send-email \
    --in-reply-to=AM0PR05MB670745339E2B0635DAB7F96BC28D0@AM0PR05MB6707.eurprd05.prod.outlook.com \
    --to=rasland@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=matan@mellanox.com \
    --cc=michaelba@mellanox.com \
    --cc=stable@dpdk.org \
    --cc=viacheslavo@mellanox.com \


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