[dpdk-stable,v2] net/tap: fix memory leak when unregister intr handler
diff mbox series

Message ID 1579572763-17760-1-git-send-email-wangyunjian@huawei.com
State Accepted
Delegated to: Ferruh Yigit
Headers show
Series
  • [dpdk-stable,v2] net/tap: fix memory leak when unregister intr handler
Related show

Checks

Context Check Description
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-intel-Performance success Performance Testing PASS
ci/checkpatch warning coding style issues

Commit Message

Yunjian Wang Jan. 21, 2020, 2:12 a.m. UTC
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>
---
v2:
 * Modify according to Ferruh's suggestions
---
 drivers/net/tap/rte_eth_tap.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Ferruh Yigit Jan. 21, 2020, 4:14 p.m. UTC | #1
On 1/21/2020 2:12 AM, Yunjian Wang wrote:
> 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>
> ---
> v2:
>  * Modify according to Ferruh's suggestions

Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Ferruh Yigit Jan. 24, 2020, 4:48 p.m. UTC | #2
On 1/21/2020 4:14 PM, Ferruh Yigit wrote:
> On 1/21/2020 2:12 AM, Yunjian Wang wrote:
>> 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>
>> ---
>> v2:
>>  * Modify according to Ferruh's suggestions
> 
> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
> 

Applied to dpdk-next-net/master, thanks.

Patch
diff mbox series

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index a13d8d50d..05470a211 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);