diff mbox series

vhost-vdpa: fix bug-"v->vqs" and "v" don't free

Message ID 20210618065307.183-1-caihuoqing@baidu.com (mailing list archive)
State Not Applicable
Delegated to: Netdev Maintainers
Headers show
Series vhost-vdpa: fix bug-"v->vqs" and "v" don't free | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Cai,Huoqing June 18, 2021, 6:53 a.m. UTC
"v->vqs" and "v" don't free when "cdev_device_add" returns error

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/vhost/vdpa.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jason Wang June 18, 2021, 7:20 a.m. UTC | #1
在 2021/6/18 下午2:53, Cai Huoqing 写道:
> "v->vqs" and "v" don't free when "cdev_device_add" returns error
>
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
> ---
>   drivers/vhost/vdpa.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
> index fb41db3da611..6e5d5df5ee70 100644
> --- a/drivers/vhost/vdpa.c
> +++ b/drivers/vhost/vdpa.c
> @@ -1065,6 +1065,8 @@ static int vhost_vdpa_probe(struct vdpa_device *vdpa)
>   
>   err:
>          put_device(&v->dev);
> +       kfree(v->vqs);
> +       kfree(v);


Isn't this the charge of vhost_vdpa_release_dev()?

Thanks


>          return r;
>   }
>
diff mbox series

Patch

diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index fb41db3da611..6e5d5df5ee70 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -1065,6 +1065,8 @@  static int vhost_vdpa_probe(struct vdpa_device *vdpa)
 
 err:
        put_device(&v->dev);
+       kfree(v->vqs);
+       kfree(v);
        return r;
 }