Skip to content

Commit

Permalink
Removing desc len sanity check.
Browse files Browse the repository at this point in the history
  • Loading branch information
KennyMacheka committed May 17, 2021
1 parent 03cc9d0 commit 24366a4
Showing 1 changed file with 1 addition and 33 deletions.
34 changes: 1 addition & 33 deletions src/lkl/virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,39 +521,7 @@ void lkl_virtio_deliver_irq(uint8_t dev_id)
{
struct virtio_dev *dev_host = dev_hosts[dev_id];
int num_queues = device_num_queues(dev_host->device_id);

//Verify descriptor len doesn't exceed bounds
for (int i = 0; i < num_queues; i++)
{
if (packed_ring)
{
struct virtq_packed* packed_q = &dev_host->packed.queue[i];
for (int j = 0; j < packed_q->num; j++)
{
if (packed_q->desc[j].len >
sgxlkl_enclave_state.shared_memory.virtio_swiotlb_size)
{
sgxlkl_error("Virtio desc memory size larger than allocated bounce buffer\n");
return;
}
}
}

else
{
struct virtq* split_q = &dev_host->split.queue[i];
for (int j = 0; j < split_q->used->idx; j++)
{
if (split_q->used->ring[j].len >
sgxlkl_enclave_state.shared_memory.virtio_swiotlb_size)
{
sgxlkl_error("Virtio used memory size larger than allocated bounce buffer\n");
return;
}
}
}
}


// Get sgxlkl_enclave_state
if (virtio_deliver_irq[dev_id])
virtio_deliver_irq[dev_id](dev_id);
Expand Down

0 comments on commit 24366a4

Please sign in to comment.