提交 ffe3ce11 编写于 作者: D Donald Dutile 提交者: Anthony Liguori

pci-devfn: check that device/slot number is within range

Need to check that guest slot/device number is not > 31 or walk off
the devfn table when checking if a devfn is available or not in a guest.

before this fix, passing in an addr=abc  or addr=34,
can crash qemu, sometimes fail gracefully if data past end
of devfn table fails the availability test.

with this fix, get clean error:
Property 'pci-assign.addr' doesn't take value '34'

also tested when no addr= param passed for guest (pcicfg) address,
and that worked as well.
Signed-off-by: NDon Dutile <ddutile@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 c1d23eac
......@@ -524,6 +524,8 @@ static int parse_pci_devfn(DeviceState *dev, Property *prop, const char *str)
return -EINVAL;
if (fn > 7)
return -EINVAL;
if (slot > 31)
return -EINVAL;
*ptr = slot << 3 | fn;
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册