Skip to content

Commit

Permalink
PCI: hv: Add missing kfree(hbus) in hv_pci_probe()'s error handling path
Browse files Browse the repository at this point in the history
Now that we use kzalloc() to allocate the hbus buffer, we must call
kfree() in the error path as well to prevent memory leakage.

Fixes: 877b911 ("PCI: hv: Avoid a kmemleak false positive caused by the hbus buffer")
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
  • Loading branch information
Dexuan Cui authored and Lorenzo Pieralisi committed Feb 24, 2020
1 parent e658a4f commit 42c3d41
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/pci/controller/pci-hyperv.c
Original file line number Diff line number Diff line change
Expand Up @@ -3058,7 +3058,7 @@ static int hv_pci_probe(struct hv_device *hdev,
free_dom:
hv_put_dom_num(hbus->sysdata.domain);
free_bus:
free_page((unsigned long)hbus);
kfree(hbus);
return ret;
}

Expand Down

0 comments on commit 42c3d41

Please sign in to comment.