vfio-pci/zdev: fix possible segmentation fault issue
authorMax Gurtovoy <mgurtovoy@nvidia.com>
Mon, 1 Feb 2021 16:28:25 +0000 (16:28 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Mar 2021 10:38:13 +0000 (11:38 +0100)
commit9eb145398e6fd31f1224a70a69db5ee0882210ec
tree0d68f6e7a54115b1e4b762268d871229086ccf14
parentc0e73c1d6d9186ab861e3d461a77836071cff990
vfio-pci/zdev: fix possible segmentation fault issue

[ Upstream commit 7e31d6dc2c78b2a0ba0039ca97ca98a581e8db82 ]

In case allocation fails, we must behave correctly and exit with error.

Fixes: e6b817d4b821 ("vfio-pci/zdev: Add zPCI capabilities to VFIO_DEVICE_GET_INFO")
Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/vfio/pci/vfio_pci_zdev.c