dm: validate input of virtio_console_control_tx()

this patch validates input of virtio_console_control_tx()
 function to avoid potential progream crash with malicious
 input from guest.

Tracked-On: #6851
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
This commit is contained in:
Yonghua Huang 2021-11-15 04:30:39 +03:00 committed by wenlingz
parent a085b1eaaf
commit 0940b35340
1 changed files with 3 additions and 0 deletions

View File

@ -283,6 +283,9 @@ virtio_console_control_tx(struct virtio_console_port *port, void *arg,
console = port->console;
ctrl = (struct virtio_console_control *)iov->iov_base;
if ((console == NULL) || (ctrl == NULL))
return;
switch (ctrl->event) {
case VIRTIO_CONSOLE_DEVICE_READY:
console->ready = true;