vfio/mbochs: Fix missing error unwind of mbochs_used_mbytes
authorJason Gunthorpe <jgg@nvidia.com>
Fri, 6 Aug 2021 01:18:58 +0000 (22:18 -0300)
committerAlex Williamson <alex.williamson@redhat.com>
Wed, 11 Aug 2021 15:50:10 +0000 (09:50 -0600)
commitde5494af4815a4c9328536c72741229b7de88e7f
treed7af67843eedbccdcae8425e877d8a32024ec9ed
parente1706f0764f8bea42db8d33df5d7f9e754b89693
vfio/mbochs: Fix missing error unwind of mbochs_used_mbytes

Convert mbochs to use an atomic scheme for this like mtty was changed
into. The atomic fixes various race conditions with probing. Add the
missing error unwind. Also add the missing kfree of mdev_state->pages.

Fixes: 681c1615f891 ("vfio/mbochs: Convert to use vfio_register_group_dev()")
Reported-by: Cornelia Huck <cohuck@redhat.com>
Co-developed-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Link: https://lore.kernel.org/r/2-v4-9ea22c5e6afb+1adf-vfio_reflck_jgg@nvidia.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
samples/vfio-mdev/mbochs.c