Skip to content

Commit

Permalink
vhost: fix batch dequeue potential buffer overflow
Browse files Browse the repository at this point in the history
[ upstream commit af584d2 ]

Similar as single dequeue, the multiple accesses of descriptor length
will lead to potential risk. One-time access of descriptor length can
eliminate this risk.

Fixes: 75ed516 ("vhost: add packed ring batch dequeue")

Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
  • Loading branch information
MarvinLiu123 authored and steevenlee committed May 8, 2021
1 parent 358cba7 commit 429dd55
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/librte_vhost/virtio_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -2287,7 +2287,7 @@ vhost_reserve_avail_batch_packed(struct virtio_net *dev,
}

vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {
pkts[i]->pkt_len = descs[avail_idx + i].len - buf_offset;
pkts[i]->pkt_len = lens[i] - buf_offset;
pkts[i]->data_len = pkts[i]->pkt_len;
ids[i] = descs[avail_idx + i].id;
}
Expand Down

0 comments on commit 429dd55

Please sign in to comment.