Commit 1633407e authored by Li Qiang's avatar Li Qiang Committed by Kleber Sacilotto de Souza

vfio/pci: Fix potential memory leak in vfio_msi_cap_len

BugLink: https://bugs.launchpad.net/bugs/1853881

[ Upstream commit 30ea32ab ]

Free allocated vdev->msi_perm in error path.
Signed-off-by: default avatarLi Qiang <liq3ea@gmail.com>
Reviewed-by: default avatarEric Auger <eric.auger@redhat.com>
Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 04f732a5
......@@ -1137,8 +1137,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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment