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

Subsystems: the rest, virtio host (vhost)

STALE1885d

2 messages, 2 authors, 2021-06-18 · open the first message on its own page

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

From: Cai Huoqing <hidden>
Date: 2021-06-18 06:53:23

"v->vqs" and "v" don't free when "cdev_device_add" returns error

Signed-off-by: Cai Huoqing <redacted>
---
 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);
        return r;
 }
 
-- 
2.22.0

Re: [PATCH] vhost-vdpa: fix bug-"v->vqs" and "v" don't free

From: Jason Wang <hidden>
Date: 2021-06-18 07:20:34

在 2021/6/18 下午2:53, Cai Huoqing 写道:
quoted hunk
"v->vqs" and "v" don't free when "cdev_device_add" returns error

Signed-off-by: Cai Huoqing <redacted>
---
  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;
  }
  

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help