DPDK patches and discussions
 help / color / mirror / Atom feed
From: Raslan Darawsheh <rasland@mellanox.com>
To: shahafs@mellanox.com
Cc: dev@dpdk.org, thomas@monjalon.net, ophirmu@mellanox.com,
	rasland@mellanox.com, yskoh@mellanox.com, stable@dpdk.org
Subject: [dpdk-dev] [PATCH v3 2/2] net/mlx5: fix resource leak in case of error
Date: Tue,  8 May 2018 12:11:27 +0300	[thread overview]
Message-ID: <1525770687-22980-2-git-send-email-rasland@mellanox.com> (raw)
In-Reply-To: <1525770687-22980-1-git-send-email-rasland@mellanox.com>

If something went wrong in mlx5 pci prop the allocated eth dev
will cause a memory leak.

This commit release the eth dev that was previously allocated.

Fixes: 771fa900b73a ("mlx5: introduce new driver for Mellanox ConnectX-4 adapters")
Cc: stable@dpdk.org

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>

---
v2 changes:
 Reword the commit log.

v3 changes:
 Reword the commit log.
 change the release to be only in primary process.
---
---
 drivers/net/mlx5/mlx5.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 3831e3d..c4ab166 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1063,6 +1063,8 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 			claim_zero(mlx5_glue->dealloc_pd(pd));
 		if (ctx)
 			claim_zero(mlx5_glue->close_device(ctx));
+		if (eth_dev && rte_eal_process_type() == RTE_PROC_PRIMARY)
+			rte_eth_dev_release_port(eth_dev);
 		break;
 	}
 	/*
-- 
2.7.4

  reply	other threads:[~2018-05-08  9:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-08  9:11 [dpdk-dev] [PATCH v3 1/2] net/mlx5: fix double free on error handling Raslan Darawsheh
2018-05-08  9:11 ` Raslan Darawsheh [this message]
2018-05-08 19:19   ` [dpdk-dev] [PATCH v3 2/2] net/mlx5: fix resource leak in case of error Yongseok Koh
2018-05-09  9:50     ` Shahaf Shuler
2018-05-08 19:08 ` [dpdk-dev] [PATCH v3 1/2] net/mlx5: fix double free on error handling Yongseok Koh
2018-05-09  9:51   ` Shahaf Shuler

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=1525770687-22980-2-git-send-email-rasland@mellanox.com \
    --to=rasland@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=ophirmu@mellanox.com \
    --cc=shahafs@mellanox.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    --cc=yskoh@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).