mirror of https://gitee.com/openkylin/linux.git
vfio/pci: Fix potential memory leak in vfio_msi_cap_len
Free allocated vdev->msi_perm in error path. Signed-off-by: Li Qiang <liq3ea@gmail.com> Reviewed-by: Eric Auger <eric.auger@redhat.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This commit is contained in:
parent
6bf4ca7fbc
commit
30ea32ab19
|
@ -1180,8 +1180,10 @@ static int vfio_msi_cap_len(struct vfio_pci_device *vdev, u8 pos)
|
|||
return -ENOMEM;
|
||||
|
||||
ret = init_pci_cap_msi_perm(vdev->msi_perm, len, flags);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
kfree(vdev->msi_perm);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue