Skip to contentSkip to conversation

virtio-vdpa: Fix cpumask memory leak in virtio_vdpa_find_vqs()

PATCH In review Dragos Tatulea 4 participants 4 messages Jul 26, 2023 – Jul 31, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-vdpa: Fix cpumask memory leak in virtio_vdpa_find_vqs()

From: Gal Pressman <[email protected]>

Free the cpumask allocated by create_affinity_masks() before returning from the function.

Fixes 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading mechanism")
---
 drivers/virtio/virtio_vdpa.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/virtio/virtio_vdpa.c +2 -0
index 989e2d7184ce..961161da5900 100644
@@ -393,11 +393,13 @@ static int virtio_vdpa_find_vqs(struct virtio_device *vdev, unsigned int nvqs,
 	cb.callback = virtio_vdpa_config_cb;
 	cb.private = vd_dev;
 	ops->set_config_cb(vdpa, &cb);
+	kfree(masks);
 
 	return 0;
 
 err_setup_vq:
 	virtio_vdpa_del_vqs(vdev);
+	kfree(masks);
 	return err;
 }
 
Signature · 1 line
2.41.0
#1 lore raw
FYI: kernel test robot notices the stable kernel rule is not satisfied.

Hi,

Thanks for your patch.

FYI: kernel test robot notices the stable kernel rule is not satisfied.

Rule: 'Cc: [email protected]' or 'commit <sha1> upstream.'
Subject: [PATCH] virtio-vdpa: Fix cpumask memory leak in virtio_vdpa_find_vqs()

The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Acked-by on v1 1/1
#2 lore raw
In reply to Dragos Tatulea
Quoted 9 lines · Dragos Tatulea

From: Gal Pressman <[email protected]>

Free the cpumask allocated by create_affinity_masks() before returning from the function.

Fixes 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading mechanism")

Thanks

Quoted 23 lines
---
 drivers/virtio/virtio_vdpa.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/virtio/virtio_vdpa.c +2 -1
index 989e2d7184ce..961161da5900 100644
@@ -393,11 +393,13 @@ static int virtio_vdpa_find_vqs(struct virtio_device *vdev, unsigned int nvqs,
        cb.callback = virtio_vdpa_config_cb;
        cb.private = vd_dev;
        ops->set_config_cb(vdpa, &cb);
+       kfree(masks);
 
        return 0;
 
 err_setup_vq:
        virtio_vdpa_del_vqs(vdev);
+       kfree(masks);
        return err;
 }
 
--
Quoted 2 lines

2.41.0

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization