From: Gal Pressman gal@nvidia.com
Free the cpumask allocated by create_affinity_masks() before returning from the function.
Fixes: 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading mechanism") Signed-off-by: Gal Pressman gal@nvidia.com Reviewed-by: Dragos Tatulea dtatulea@nvidia.com --- drivers/virtio/virtio_vdpa.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c index 989e2d7184ce..961161da5900 100644 --- a/drivers/virtio/virtio_vdpa.c +++ b/drivers/virtio/virtio_vdpa.c @@ -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; }
Hi,
Thanks for your patch.
FYI: kernel test robot notices the stable kernel rule is not satisfied.
Rule: 'Cc: stable@vger.kernel.org' or 'commit <sha1> upstream.' Subject: [PATCH] virtio-vdpa: Fix cpumask memory leak in virtio_vdpa_find_vqs() Link: https://lore.kernel.org/stable/20230726191036.14324-1-dtatulea%40nvidia.com
The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
On Thu, Jul 27, 2023 at 3:11 AM Dragos Tatulea dtatulea@nvidia.com wrote:
From: Gal Pressman gal@nvidia.com
Free the cpumask allocated by create_affinity_masks() before returning from the function.
Fixes: 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading mechanism") Signed-off-by: Gal Pressman gal@nvidia.com Reviewed-by: Dragos Tatulea dtatulea@nvidia.com
Acked-by: Jason Wang jasowang@redhat.com
Thanks
drivers/virtio/virtio_vdpa.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c index 989e2d7184ce..961161da5900 100644 --- a/drivers/virtio/virtio_vdpa.c +++ b/drivers/virtio/virtio_vdpa.c @@ -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;
}
-- 2.41.0
On Thu, Jul 27, 2023 at 3:11 AM Dragos Tatulea dtatulea@nvidia.com wrote:
From: Gal Pressman gal@nvidia.com
Free the cpumask allocated by create_affinity_masks() before returning from the function.
Fixes: 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading mechanism") Signed-off-by: Gal Pressman gal@nvidia.com Reviewed-by: Dragos Tatulea dtatulea@nvidia.com
Reviewed-by: Xie Yongji xieyongji@bytedance.com
Thanks, Yongji
linux-stable-mirror@lists.linaro.org