DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev]  [PATCH v3 4/5] net/tap: fix close a valid fd
@ 2020-04-07  4:23 wangyunjian
  2020-04-07 14:56 ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: wangyunjian @ 2020-04-07  4:23 UTC (permalink / raw)
  To: dev; +Cc: keith.wiles, jerry.lilijun, xudingke, Yunjian Wang, stable

From: Yunjian Wang <wangyunjian@huawei.com>

The internals is freed and setted NULL in the rte_eth_dev_release_port()
and zero is a valid fd. As a result, a valid fd is incorrectly closed.

Fixes: 3101191c63ab ("net/tap: fix device removal when no queue exist")
CC: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/net/tap/rte_eth_tap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 703fcceb9..88cd615e0 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -2468,12 +2468,12 @@ rte_pmd_tap_remove(struct rte_vdev_device *dev)
 	if (tap_devices_count == 1)
 		rte_mp_action_unregister(TAP_MP_KEY);
 	tap_devices_count--;
-	rte_eth_dev_release_port(eth_dev);
 
 	if (internals->ka_fd != -1) {
 		close(internals->ka_fd);
 		internals->ka_fd = -1;
 	}
+	rte_eth_dev_release_port(eth_dev);
 	return 0;
 }
 
-- 
2.19.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH v3 4/5] net/tap: fix close a valid fd
  2020-04-07  4:23 [dpdk-dev] [PATCH v3 4/5] net/tap: fix close a valid fd wangyunjian
@ 2020-04-07 14:56 ` Stephen Hemminger
  2020-04-08  1:24   ` wangyunjian
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2020-04-07 14:56 UTC (permalink / raw)
  To: wangyunjian; +Cc: dev, keith.wiles, jerry.lilijun, xudingke, stable

On Tue, 7 Apr 2020 12:23:26 +0800
wangyunjian <wangyunjian@huawei.com> wrote:

> The internals is freed and setted NULL in the rte_eth_dev_release_port()

The word "setted" is awkward in this phrase.
Better wording would be:

The internal structure is freed and set to NULL in rte_eth_dev_release_port()


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH v3 4/5] net/tap: fix close a valid fd
  2020-04-07 14:56 ` Stephen Hemminger
@ 2020-04-08  1:24   ` wangyunjian
  0 siblings, 0 replies; 3+ messages in thread
From: wangyunjian @ 2020-04-08  1:24 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, keith.wiles, Lilijun (Jerry), xudingke, stable

> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Tuesday, April 7, 2020 10:56 PM
> To: wangyunjian <wangyunjian@huawei.com>
> Cc: dev@dpdk.org; keith.wiles@intel.com; Lilijun (Jerry)
> <jerry.lilijun@huawei.com>; xudingke <xudingke@huawei.com>;
> stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 4/5] net/tap: fix close a valid fd
> 
> On Tue, 7 Apr 2020 12:23:26 +0800
> wangyunjian <wangyunjian@huawei.com> wrote:
> 
> > The internals is freed and setted NULL in the rte_eth_dev_release_port()
> 
> The word "setted" is awkward in this phrase.
> Better wording would be:
> 
> The internal structure is freed and set to NULL in rte_eth_dev_release_port()

OK, I will fix it in v4.

Thanks
Yunjian

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-08  1:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-07  4:23 [dpdk-dev] [PATCH v3 4/5] net/tap: fix close a valid fd wangyunjian
2020-04-07 14:56 ` Stephen Hemminger
2020-04-08  1:24   ` wangyunjian

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