* [PATCH] virtio: fix crash if CQ is not negotiated
@ 2015-05-25 10:20 Damjan Marion
2015-05-26 14:59 ` Stephen Hemminger
0 siblings, 1 reply; 3+ messages in thread
From: Damjan Marion @ 2015-05-25 10:20 UTC (permalink / raw)
To: dev; +Cc: Damjan Marion
Fix NULL dereference if virtio control queue is not negotiated.
Signed-off-by: Damjan Marion <damarion@cisco.com>
---
drivers/net/virtio/virtio_ethdev.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index f74e413..3633fce 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -114,19 +114,20 @@ static int
virtio_send_command(struct virtqueue *vq, struct virtio_pmd_ctrl *ctrl,
int *dlen, int pkt_num)
{
- uint16_t head = vq->vq_desc_head_idx, i;
+ uint32_t head, i;
int k, sum = 0;
virtio_net_ctrl_ack status = ~0;
struct virtio_pmd_ctrl result;
ctrl->status = status;
- if (!vq->hw->cvq) {
+ if (!(vq && vq->hw->cvq)) {
PMD_INIT_LOG(ERR,
"%s(): Control queue is not supported.",
__func__);
return -1;
}
+ head = vq->vq_desc_head_idx;
PMD_INIT_LOG(DEBUG, "vq->vq_desc_head_idx = %d, status = %d, "
"vq->hw->cvq = %p vq = %p",
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-06-12 12:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-25 10:20 [PATCH] virtio: fix crash if CQ is not negotiated Damjan Marion
2015-05-26 14:59 ` Stephen Hemminger
2015-06-12 12:50 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).