dm: fix potential NULL pointer access in virtio_console.c

"port->cb" in 'virtio_console_notify_tx()'
 function maybe NULL when malicious inputs
 are injected from virtio frondend in guest.

Tracked-On: #6388
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
This commit is contained in:
Yonghua Huang 2021-08-12 05:15:54 +03:00 committed by wenlingz
parent 1f5a7e8b8d
commit d92c4bd840
1 changed files with 1 additions and 1 deletions

View File

@ -390,7 +390,7 @@ virtio_console_notify_tx(void *vdev, struct virtio_vq_info *vq)
while (vq_has_descs(vq)) {
vq_getchain(vq, &idx, iov, 1, flags);
if (port != NULL)
if ((port != NULL) && (port->cb != NULL))
port->cb(port, port->arg, iov, 1);
/*