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 e00c4176e1
commit eeffdb4833

View File

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