Skip to content
Permalink
Browse files Browse the repository at this point in the history
Fix vi_pci_write null vc_cfgwrite function pointer dereference (GHSL-…
…2021-055)

This is a backport of what is done in bhyve.

Signed-off-by: Frederic Dalleau <frederic.dalleau@docker.com>
  • Loading branch information
fredericdalleau committed Jun 24, 2021
1 parent df0e46c commit 451558f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/virtio.c
Expand Up @@ -681,8 +681,11 @@ vi_pci_write(UNUSED int vcpu, struct pci_devinst *pi, int baridx,
max = vc->vc_cfgsize ? vc->vc_cfgsize : 0x100000000;
if ((newoff + ((unsigned) size)) > max)
goto bad;
error = (*vc->vc_cfgwrite)(DEV_SOFTC(vs), ((int) newoff), size,
((uint32_t) value));
if (vc->vc_cfgwrite != NULL)
error = (*vc->vc_cfgwrite)(DEV_SOFTC(vs), ((int) newoff), size,
((uint32_t) value));
else
error = 0;
if (!error)
goto done;
}
Expand Down

0 comments on commit 451558f

Please sign in to comment.