dm: validate inputs in vq_endchains

inputs shall be validated to avoid NULL pointer access.

Tracked-On: #6129
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
This commit is contained in:
Yonghua Huang 2021-06-01 10:25:27 +08:00 committed by wenlingz
parent 25c0e3817e
commit 154fe59531
1 changed files with 3 additions and 0 deletions

View File

@ -647,6 +647,9 @@ vq_endchains(struct virtio_vq_info *vq, int used_all_avail)
uint16_t event_idx, new_idx, old_idx;
int intr;
if (!vq || !vq->used)
return;
/*
* Interrupt generation: if we're using EVENT_IDX,
* interrupt if we've crossed the event threshold.