mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-22 13:37:10 +00:00
dm: fix possible null pointer dereference in pci_gvt_deinit
will access null pointer if 'gvt' is null. Tracked-On: #1479 Signed-off-by: Yonghua Huang <yonghua.huang@intel.com> Reviewed-by: He, Min <min.he@intel.com>
This commit is contained in:
parent
7bcfebc55f
commit
49563b2a11
@ -262,7 +262,8 @@ pci_gvt_deinit(struct vmctx *ctx, struct pci_vdev *pi, char *opts)
|
||||
int ret;
|
||||
struct pci_gvt *gvt = pi->arg;
|
||||
|
||||
if (gvt && gvt->host_config) {
|
||||
if (gvt) {
|
||||
if (gvt->host_config) {
|
||||
/* Free the allocated host_config */
|
||||
free(gvt->host_config);
|
||||
gvt->host_config = NULL;
|
||||
@ -275,6 +276,7 @@ pci_gvt_deinit(struct vmctx *ctx, struct pci_vdev *pi, char *opts)
|
||||
free(gvt);
|
||||
pi->arg = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
struct pci_vdev_ops pci_ops_gvt = {
|
||||
.class_name = "pci-gvt",
|
||||
|
Loading…
Reference in New Issue
Block a user