Skip to content
Permalink
Browse files Browse the repository at this point in the history
Fix vi_pci_read null vc_cfgread function pointer dereference (GHSL-20…
…21-054)

This is 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 cf1581b commit df0e46c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib/virtio.c
Expand Up @@ -559,7 +559,10 @@ vi_pci_read(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_cfgread)(DEV_SOFTC(vs), ((int) newoff), size, &value);
if (vc->vc_cfgread != NULL)
error = (*vc->vc_cfgread)(DEV_SOFTC(vs), ((int) newoff), size, &value);
else
error = 0;
if (!error)
goto done;
}
Expand Down

0 comments on commit df0e46c

Please sign in to comment.