From c5f9911d34650768355573bc53e0b621760c4124 Mon Sep 17 00:00:00 2001 From: Yunjian Wang Date: Tue, 21 Jan 2020 10:12:43 +0800 Subject: [PATCH] net/tap: fix memory leak when unregister intr handler The return check of function tap_lsc_intr_handle_set() is wrong, it should be 0 or a positive number if success. So the intr_handle->intr_vec was not been freed when tap_lsc_intr_handle_set() returned a positive number. Fixes: 4870a8cdd968 ("net/tap: support Rx interrupt") Cc: stable@dpdk.org Signed-off-by: Yunjian Wang Acked-by: Ferruh Yigit --- drivers/net/tap/rte_eth_tap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index a13d8d50d7..05470a2115 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -1591,8 +1591,11 @@ tap_intr_handle_set(struct rte_eth_dev *dev, int set) int err; err = tap_lsc_intr_handle_set(dev, set); - if (err) + if (err < 0) { + if (!set) + tap_rx_intr_vec_set(dev, 0); return err; + } err = tap_rx_intr_vec_set(dev, set); if (err && set) tap_lsc_intr_handle_set(dev, 0); -- 2.20.1