diff options
author | Li Qiang <liq3ea@gmail.com> | 2018-09-25 22:01:27 +0300 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2018-09-25 22:01:27 +0300 |
commit | 30ea32ab1951c80c6113f300fce2c70cd12659e4 (patch) | |
tree | e0c09718dca442dc2ab3565cb7984bdd73608fa3 /drivers/vfio | |
parent | 6bf4ca7fbc85d80446ac01c0d1d77db4d91a6d84 (diff) | |
download | linux-30ea32ab1951c80c6113f300fce2c70cd12659e4.tar.xz |
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>
Diffstat (limited to 'drivers/vfio')
-rw-r--r-- | drivers/vfio/pci/vfio_pci_config.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c index 115a36f6f403..62023b4a373b 100644 --- a/drivers/vfio/pci/vfio_pci_config.c +++ b/drivers/vfio/pci/vfio_pci_config.c @@ -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; } |