Dragos Tatulea
2023-May-04 13:50 UTC
[PATCH] virtio-vdpa: Fix unchecked call to NULL set_vq_affinity
The referenced patch calls set_vq_affinity without checking if the op is valid. This patch adds the check. Fixes: 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading mechanism") Reviewed-by: Gal Pressman <gal at nvidia.com> Signed-off-by: Dragos Tatulea <dtatulea at nvidia.com> --- drivers/virtio/virtio_vdpa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c index eb6aee8c06b2..989e2d7184ce 100644 --- a/drivers/virtio/virtio_vdpa.c +++ b/drivers/virtio/virtio_vdpa.c @@ -385,7 +385,9 @@ static int virtio_vdpa_find_vqs(struct virtio_device *vdev, unsigned int nvqs, err = PTR_ERR(vqs[i]); goto err_setup_vq; } - ops->set_vq_affinity(vdpa, i, &masks[i]); + + if (ops->set_vq_affinity) + ops->set_vq_affinity(vdpa, i, &masks[i]); } cb.callback = virtio_vdpa_config_cb; -- 2.40.1
Feng Liu
2023-May-04 17:08 UTC
[PATCH] virtio-vdpa: Fix unchecked call to NULL set_vq_affinity
On 2023-05-04 a.m.9:50, Dragos Tatulea wrote:> External email: Use caution opening links or attachments > > > The referenced patch calls set_vq_affinity without checking if the op is > valid. This patch adds the check. > > Fixes: 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading mechanism") > Reviewed-by: Gal Pressman <gal at nvidia.com> > Signed-off-by: Dragos Tatulea <dtatulea at nvidia.com> > --- > drivers/virtio/virtio_vdpa.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c > index eb6aee8c06b2..989e2d7184ce 100644 > --- a/drivers/virtio/virtio_vdpa.c > +++ b/drivers/virtio/virtio_vdpa.c > @@ -385,7 +385,9 @@ static int virtio_vdpa_find_vqs(struct virtio_device *vdev, unsigned int nvqs, > err = PTR_ERR(vqs[i]); > goto err_setup_vq; > } > - ops->set_vq_affinity(vdpa, i, &masks[i]); > + > + if (ops->set_vq_affinity) > + ops->set_vq_affinity(vdpa, i, &masks[i]);if ops->set_vq_affinity is NULL, should give an error code to err, and return err> } > > cb.callback = virtio_vdpa_config_cb; > -- > 2.40.1 >
Feng Liu
2023-May-04 17:47 UTC
[PATCH] virtio-vdpa: Fix unchecked call to NULL set_vq_affinity
On 2023-05-04 a.m.9:50, Dragos Tatulea wrote:> External email: Use caution opening links or attachments > > > The referenced patch calls set_vq_affinity without checking if the op is > valid. This patch adds the check. > > Fixes: 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading mechanism") > Reviewed-by: Gal Pressman <gal at nvidia.com> > Signed-off-by: Dragos Tatulea <dtatulea at nvidia.com> > ---Reviewed-by: Feng Liu <feliu at nvidia.com>> drivers/virtio/virtio_vdpa.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c > index eb6aee8c06b2..989e2d7184ce 100644 > --- a/drivers/virtio/virtio_vdpa.c > +++ b/drivers/virtio/virtio_vdpa.c > @@ -385,7 +385,9 @@ static int virtio_vdpa_find_vqs(struct virtio_device *vdev, unsigned int nvqs, > err = PTR_ERR(vqs[i]); > goto err_setup_vq; > } > - ops->set_vq_affinity(vdpa, i, &masks[i]); > + > + if (ops->set_vq_affinity) > + ops->set_vq_affinity(vdpa, i, &masks[i]); > } > > cb.callback = virtio_vdpa_config_cb; > -- > 2.40.1 >
Reasonably Related Threads
- [PATCH] virtio-vdpa: Fix unchecked call to NULL set_vq_affinity
- [PATCH] virtio-vdpa: Fix unchecked call to NULL set_vq_affinity
- [PATCH] virtio-vdpa: Fix unchecked call to NULL set_vq_affinity
- [PATCH 0/2] vdpa/mlx5: Fixes for ASID handling
- [PATCH 0/2] vdpa/mlx5: Fixes for ASID handling