[dpdk-dev] [PATCH] net/virtio: fix memory leak in dev close

刘高翔 clgx0086 at 163.com
Mon Jul 26 13:38:25 CEST 2021



>Hi, chen bo
>>And I think the fix commit id is not correct. Fix commit id should be the
>>first commit that introduces the bug. I think it's:
>>3d4fb6fd2505 ("net/virtio-user: support Rx interrupt")
> Yes, it should be the commit id. And I will fix other issues right now.
> Thanks.




At 2021-07-26 16:42:57, "Xia, Chenbo" <chenbo.xia at intel.com> wrote:
>Hi Gaoxiang,
>
>> -----Original Message-----
>> From: Gaoxiang Liu <clgx0086 at 163.com>
>> Sent: Sunday, July 25, 2021 10:03 AM
>> To: Maxime Coquelin <maxime.coquelin at redhat.com>; Xia, Chenbo
>> <chenbo.xia at intel.com>
>> Cc: dev at dpdk.org; liugaoxiang at huawei.com; Gaoxiang Liu <clgx0086 at 163.com>
>> Subject: [PATCH] net/virtio: fix memory leak in dev close
>
>I suggest the title: fix memory leak of interrupt handle
>
>> 
>> Free the "intr_handle" memory in virtio_user_dev_uninit() to
>> avoid memory leak.
>> when virtio user dev closes, the "intr_handle" memory is not freeed
>> that is alloced in virtio_user_fill_intr_handle().
>
>I suggest to replace 'intr_handle memory' with 'memory of interrupt handle'
>
>freeed -> freed
>
>alloced -> allocated
>
>> 
>> Fixes: 7f468b2ebfad ("net/virtio: release port upon close")
>
>Please add cc stable tag under fixes line:
>Cc: stable at dpdk.org
>
>And I think the fix commit id is not correct. Fix commit id should be the
>first commit that introduces the bug. I think it's:
>
>3d4fb6fd2505 ("net/virtio-user: support Rx interrupt")
>
>Please help me double confirm.
>
>> 
>> Signed-off-by: Gaoxiang Liu <liugaoxiang at huawei.com>
>
>I suggest to send patch using this email too.
>
>The patch content looks good to me.
>Thanks,
>Chenbo
>
>> ---
>>  drivers/net/virtio/virtio_user/virtio_user_dev.c | 7 +++++++
>>  1 file changed, 7 insertions(+)
>> 
>> diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c
>> b/drivers/net/virtio/virtio_user/virtio_user_dev.c
>> index 1cd1e95f4..16c58710d 100644
>> --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
>> +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
>> @@ -654,6 +654,13 @@ virtio_user_dev_init(struct virtio_user_dev *dev,
>> char *path, int queues,
>>  void
>>  virtio_user_dev_uninit(struct virtio_user_dev *dev)
>>  {
>> +	struct rte_eth_dev *eth_dev = &rte_eth_devices[dev->hw.port_id];
>> +
>> +	if (eth_dev->intr_handle) {
>> +		free(eth_dev->intr_handle);
>> +		eth_dev->intr_handle = NULL;
>> +	}
>> +
>>  	virtio_user_stop_device(dev);
>> 
>>  	rte_mem_event_callback_unregister(VIRTIO_USER_MEM_EVENT_CLB_NAME,
>> dev);
>> --
>> 2.32.0


More information about the dev mailing list