net/tap: fix memory leak when unregister intr handler
authorYunjian Wang <wangyunjian@huawei.com>
Tue, 21 Jan 2020 02:12:43 +0000 (10:12 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 5 Feb 2020 08:51:19 +0000 (09:51 +0100)
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 <wangyunjian@huawei.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
drivers/net/tap/rte_eth_tap.c

index a13d8d5..05470a2 100644 (file)
@@ -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);