vfio/platform: fix module_put call in error flow
authorMax Gurtovoy <mgurtovoy@nvidia.com>
Tue, 18 May 2021 19:21:31 +0000 (22:21 +0300)
committerAlex Williamson <alex.williamson@redhat.com>
Mon, 24 May 2021 19:40:13 +0000 (13:40 -0600)
The ->parent_module is the one that use in try_module_get. It should
also be the one the we use in module_put during vfio_platform_open().

Fixes: 32a2d71c4e80 ("vfio: platform: introduce vfio-platform-base module")
Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Message-Id: <20210518192133.59195-1-mgurtovoy@nvidia.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/platform/vfio_platform_common.c

index 361e5b57e369327e4143717025d7aaad75765d7a..470fcf7dac564cece9a6fdc867b9e646649d6df6 100644 (file)
@@ -291,7 +291,7 @@ err_irq:
        vfio_platform_regions_cleanup(vdev);
 err_reg:
        mutex_unlock(&driver_lock);
-       module_put(THIS_MODULE);
+       module_put(vdev->parent_module);
        return ret;
 }