virtio-vdpa: Fix unchecked call to NULL set_vq_affinity
PATCH 1/1 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.
--- drivers/virtio/virtio_vdpa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/virtio/virtio_vdpa.c +3 -1
@@ -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;
Signature · 6 lines
2.40.1 _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 18 lines · Dragos Tatulea
External email: Use caution opening links or attachments
The referenced patch calls
set_vq_affinitywithout checking if the op is valid. This patch adds the check.Fixes 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading mechanism")Reviewed-by Gal Pressman <[email protected]>Signed-off-by Dragos Tatulea <[email protected]>--- drivers/virtio/virtio_vdpa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/virtio/virtio_vdpa.c +0
-0
drivers/virtio/virtio_vdpa.c static int virtio_vdpa_find_vqs(struct virtio_device *vdev, unsigned int nvqs, · line 390
Quoted 7 lines
drivers/virtio/virtio_vdpa.c +3
-1@@ -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
Quoted 6 lines
drivers/virtio/virtio_vdpa.c +0
-1} cb.callback = virtio_vdpa_config_cb; --2.40.1
Quoted 17 lines · Feng Liu
Quoted 14 lines · Dragos Tatulea
External email: Use caution opening links or attachments
The referenced patch calls
set_vq_affinitywithout checking if the op is valid. This patch adds the check.Fixes 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreadingmechanism")
Reviewed-by Gal Pressman <[email protected]>Signed-off-by Dragos Tatulea <[email protected]>---
drivers/virtio/virtio_vdpa.c| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 16 lines
drivers/virtio/virtio_vdpa.c static int virtio_vdpa_find_vqs(struct virtio_device · line 391
Quoted 13 lines
drivers/virtio/virtio_vdpa.c +3
-1@@ -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_affinityis NULL, should give an error code to err, and return err
I don't think so: the set_vq_affinity is marked as optional.
Quoted 6 lines
Quoted 6 lines
drivers/virtio/virtio_vdpa.c +0
-0}cb.callback =
virtio_vdpa_config_cb;
--
2.40.1
Quoted 34 lines · Dragos Tatulea
Quoted 17 lines · Feng Liu
Quoted 14 lines · Dragos Tatulea
External email: Use caution opening links or attachments
The referenced patch calls
set_vq_affinitywithout checking if the op is valid. This patch adds the check.Fixes 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreadingmechanism")
Reviewed-by Gal Pressman <[email protected]>Signed-off-by Dragos Tatulea <[email protected]>--- drivers/virtio/virtio_vdpa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Quoted 16 lines
drivers/virtio/virtio_vdpa.c static int virtio_vdpa_find_vqs(struct virtio_device · line 391
Quoted 13 lines
drivers/virtio/virtio_vdpa.c +3
-1@@ -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_affinityis NULL, should give an error code to err, and return err
Quoted 2 lines
I don't think so: the
set_vq_affinityis marked as optional.
Yes, I see
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
drivers/virtio/virtio_vdpa.c +0
-0}cb.callback =
virtio_vdpa_config_cb;
--
2.40.1
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Michael S. Tsirkin
maintainerQuoted 16 lines · Feng Liu
Quoted 13 lines · Dragos Tatulea
External email: Use caution opening links or attachments
The referenced patch calls
set_vq_affinitywithout checking if the op is valid. This patch adds the check.Fixes 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading mechanism")Reviewed-by Gal Pressman <[email protected]>Signed-off-by Dragos Tatulea <[email protected]>--- drivers/virtio/virtio_vdpa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 14 lines
drivers/virtio/virtio_vdpa.c static int virtio_vdpa_find_vqs(struct virtio_device *vdev, unsigned int nvqs, · line 390
Quoted 12 lines
drivers/virtio/virtio_vdpa.c +3
-1@@ -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_affinityis NULL, should give an error code to err, and return err
Given we ignore return code, hardly seems like a critical thing to do. Is it really important? affinity is an optimization isn't it?
Quoted 6 lines
Quoted 6 lines
drivers/virtio/virtio_vdpa.c +0
-1} cb.callback = virtio_vdpa_config_cb; --2.40.1
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 35 lines · Michael S. Tsirkin
External email: Use caution opening links or attachments
Quoted 16 lines · Feng Liu
Quoted 13 lines · Dragos Tatulea
External email: Use caution opening links or attachments
The referenced patch calls
set_vq_affinitywithout checking if the op is valid. This patch adds the check.Fixes 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading mechanism")Reviewed-by Gal Pressman <[email protected]>Signed-off-by Dragos Tatulea <[email protected]>--- drivers/virtio/virtio_vdpa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Quoted 14 lines
drivers/virtio/virtio_vdpa.c static int virtio_vdpa_find_vqs(struct virtio_device *vdev, unsigned int nvqs, · line 390
Quoted 12 lines
drivers/virtio/virtio_vdpa.c +3
-1@@ -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_affinityis NULL, should give an error code to err, and return err
Quoted 3 lines
Given we ignore return code, hardly seems like a critical thing to do. Is it really important? affinity is an optimization isn't it?
Yes, it is an optimization, got it.
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
drivers/virtio/virtio_vdpa.c +0
-1} cb.callback = virtio_vdpa_config_cb; --2.40.1
Quoted 34 lines · Michael S. Tsirkin
Quoted 17 lines · Feng Liu
Quoted 14 lines · Dragos Tatulea
External email: Use caution opening links or attachments
The referenced patch calls
set_vq_affinitywithout checking if the op is valid. This patch adds the check.Fixes 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreadingmechanism")
Reviewed-by Gal Pressman <[email protected]>Signed-off-by Dragos Tatulea <[email protected]>---
drivers/virtio/virtio_vdpa.c| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)Quoted 15 lines
drivers/virtio/virtio_vdpa.c static int virtio_vdpa_find_vqs(struct virtio_device · line 391
Quoted 13 lines
drivers/virtio/virtio_vdpa.c +3
-1@@ -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_affinityis NULL, should give an error code to err, and return err
Quoted 4 lines
Given we ignore return code, hardly seems like a critical thing to do. Is it really important? affinity is an optimization isn't it?
Quoted 1 line
Quoted 1 line
set_vq_affinity is optional so it's not an error if the op is not implemented.
Is there anything else that needs to be done for this fix?
Thanks,
Dragos
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Michael S. Tsirkin
maintainerQuoted 39 lines · Dragos Tatulea
Quoted 34 lines · Michael S. Tsirkin
Quoted 17 lines · Feng Liu
Quoted 14 lines · Dragos Tatulea
External email: Use caution opening links or attachments
The referenced patch calls
set_vq_affinitywithout checking if the op is valid. This patch adds the check.Fixes 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreadingmechanism")
Reviewed-by Gal Pressman <[email protected]>Signed-off-by Dragos Tatulea <[email protected]>---
drivers/virtio/virtio_vdpa.c| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)Quoted 15 lines
drivers/virtio/virtio_vdpa.c static int virtio_vdpa_find_vqs(struct virtio_device · line 391
Quoted 13 lines
drivers/virtio/virtio_vdpa.c +3
-1@@ -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_affinityis NULL, should give an error code to err, and return errQuoted 4 lines
Given we ignore return code, hardly seems like a critical thing to do. Is it really important? affinity is an optimization isn't it?
Quoted 1 line
Quoted 1 line
Quoted 7 lines
set_vq_affinityis optional so it's not an error if the op is not implemented.Is there anything else that needs to be done for this fix?
Thanks,
Dragos
no, it's queued already.
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 43 lines · Michael S. Tsirkin
Quoted 41 lines · Dragos Tatulea
Quoted 34 lines · Michael S. Tsirkin
Quoted 17 lines · Feng Liu
Quoted 14 lines · Dragos Tatulea
External email: Use caution opening links or attachments
The referenced patch calls
set_vq_affinitywithout checking if the op is valid. This patch adds the check.Fixes 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreadingmechanism")
Reviewed-by Gal Pressman <[email protected]>Signed-off-by Dragos Tatulea <[email protected]>--- drivers/virtio/virtio_vdpa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Quoted 15 lines
drivers/virtio/virtio_vdpa.c static int virtio_vdpa_find_vqs(struct virtio_device · line 391
Quoted 13 lines
drivers/virtio/virtio_vdpa.c +3
-1@@ -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_affinityis NULL, should give an error code to err, and return errQuoted 4 lines
Given we ignore return code, hardly seems like a critical thing to do. Is it really important? affinity is an optimization isn't it?
Quoted 1 line
Quoted 1 line
set_vq_affinityis optional so it's not an error if the op is not implemented.
Quoted 7 lines
Quoted 5 lines
Is there anything else that needs to be done for this fix?
Thanks,
Dragosno, it's queued already.
Are these queued into a repo that is accessible? I haven't seen activity in the vhost.git where I would have expected it. After stumbling over and debugging this same problem, I was happy to see it fixed, and I'd like to pull from a repo that has the current updates.
Thanks,
sln
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 52 lines · Shannon Nelson
Quoted 43 lines · Michael S. Tsirkin
Quoted 41 lines · Dragos Tatulea
Quoted 34 lines · Michael S. Tsirkin
Quoted 17 lines · Feng Liu
Quoted 14 lines · Dragos Tatulea
External email: Use caution opening links or attachments
The referenced patch calls
set_vq_affinitywithout checking if the op is valid. This patch adds the check.Fixes 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreadingmechanism")
Reviewed-by Gal Pressman <[email protected]>Signed-off-by Dragos Tatulea <[email protected]>--- drivers/virtio/virtio_vdpa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Quoted 15 lines
drivers/virtio/virtio_vdpa.c static int virtio_vdpa_find_vqs(struct virtio_device · line 391
Quoted 13 lines
drivers/virtio/virtio_vdpa.c +3
-1@@ -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_affinityis NULL, should give an error code to err, and return errQuoted 4 lines
Given we ignore return code, hardly seems like a critical thing to do. Is it really important? affinity is an optimization isn't it?
Quoted 1 line
Quoted 1 line
set_vq_affinityis optional so it's not an error if the op is not implemented.Quoted 7 lines
Quoted 5 lines
Is there anything else that needs to be done for this fix?
Thanks,
Dragosno, it's queued already.
Quoted 7 lines
Are these queued into a repo that is accessible? I haven't seen activity in the vhost.git where I would have expected it. After stumbling over and debugging this same problem, I was happy to see it fixed, and I'd like to pull from a repo that has the current updates.
Thanks,
sln
Pushed to next now.
Signature · 6 lines
MST _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 10 lines · Dragos Tatulea
External email: Use caution opening links or attachments
The referenced patch calls
set_vq_affinitywithout checking if the op is valid. This patch adds the check.Fixes 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading mechanism")Reviewed-by Gal Pressman <[email protected]>Signed-off-by Dragos Tatulea <[email protected]>---
Quoted 19 lines
drivers/virtio/virtio_vdpa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/virtio/virtio_vdpa.c +3
-2@@ -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; --
Quoted 2 lines
2.40.1
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization