dm: gvt: add bound check in gvt_init_config()
gvt_init_config() may perform out-of-range read on host_config, add bound check before accessing it. Tracked-On: #8382 Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com> Reviewed-by: Jian Jun Chen <jian.jun.chen@intel.com>
This commit is contained in:
parent
a41f600a3c
commit
6320977788
|
@ -256,7 +256,7 @@ gvt_init_config(struct pci_gvt *gvt)
|
||||||
/* capability */
|
/* capability */
|
||||||
pci_set_cfgdata8(gvt->gvt_pi, PCIR_CAP_PTR, gvt->host_config[0x34]);
|
pci_set_cfgdata8(gvt->gvt_pi, PCIR_CAP_PTR, gvt->host_config[0x34]);
|
||||||
cap_ptr = gvt->host_config[0x34];
|
cap_ptr = gvt->host_config[0x34];
|
||||||
while (cap_ptr != 0) {
|
while (cap_ptr != 0 && cap_ptr <= PCI_REGMAX - 15) {
|
||||||
pci_set_cfgdata32(gvt->gvt_pi, cap_ptr,
|
pci_set_cfgdata32(gvt->gvt_pi, cap_ptr,
|
||||||
gvt->host_config[cap_ptr]);
|
gvt->host_config[cap_ptr]);
|
||||||
pci_set_cfgdata32(gvt->gvt_pi, cap_ptr + 4,
|
pci_set_cfgdata32(gvt->gvt_pi, cap_ptr + 4,
|
||||||
|
|
Loading…
Reference in New Issue