Message ID | 20210518192133.59195-1-mgurtovoy@nvidia.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/3] vfio/platform: fix module_put call in error flow | expand |
On Tue, 18 May 2021 22:21:31 +0300 Max Gurtovoy <mgurtovoy@nvidia.com> wrote: > 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: 32a2d71c4e808 ("vfio: platform: introduce vfio-platform-base module") > > Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com> > --- > drivers/vfio/platform/vfio_platform_common.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c > index 361e5b57e369..470fcf7dac56 100644 > --- a/drivers/vfio/platform/vfio_platform_common.c > +++ b/drivers/vfio/platform/vfio_platform_common.c > @@ -291,7 +291,7 @@ static int vfio_platform_open(struct vfio_device *core_vdev) > vfio_platform_regions_cleanup(vdev); > err_reg: > mutex_unlock(&driver_lock); > - module_put(THIS_MODULE); > + module_put(vdev->parent_module); > return ret; > } > The series looks good to me. This one is an obvious fix, so I'll queue that for v5.13 and save the latter two for the v5.14 merge window. Please do make use of cover letters in the future. Thanks, Alex
On 5/24/2021 10:34 PM, Alex Williamson wrote: > On Tue, 18 May 2021 22:21:31 +0300 > Max Gurtovoy <mgurtovoy@nvidia.com> wrote: > >> 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: 32a2d71c4e808 ("vfio: platform: introduce vfio-platform-base module") >> >> Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com> >> --- >> drivers/vfio/platform/vfio_platform_common.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c >> index 361e5b57e369..470fcf7dac56 100644 >> --- a/drivers/vfio/platform/vfio_platform_common.c >> +++ b/drivers/vfio/platform/vfio_platform_common.c >> @@ -291,7 +291,7 @@ static int vfio_platform_open(struct vfio_device *core_vdev) >> vfio_platform_regions_cleanup(vdev); >> err_reg: >> mutex_unlock(&driver_lock); >> - module_put(THIS_MODULE); >> + module_put(vdev->parent_module); >> return ret; >> } >> > The series looks good to me. This one is an obvious fix, so I'll queue > that for v5.13 and save the latter two for the v5.14 merge window. > Please do make use of cover letters in the future. Thanks, Thanks Alex. I'll keep that in mind. > > Alex >
Hi Max, On 5/18/21 9:21 PM, Max Gurtovoy wrote: > 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: 32a2d71c4e808 ("vfio: platform: introduce vfio-platform-base module") > > Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com> Acked-by: Eric Auger <eric.auger@redhat.com> Thanks! Eric > --- > drivers/vfio/platform/vfio_platform_common.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c > index 361e5b57e369..470fcf7dac56 100644 > --- a/drivers/vfio/platform/vfio_platform_common.c > +++ b/drivers/vfio/platform/vfio_platform_common.c > @@ -291,7 +291,7 @@ static int vfio_platform_open(struct vfio_device *core_vdev) > vfio_platform_regions_cleanup(vdev); > err_reg: > mutex_unlock(&driver_lock); > - module_put(THIS_MODULE); > + module_put(vdev->parent_module); > return ret; > } > >
diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c index 361e5b57e369..470fcf7dac56 100644 --- a/drivers/vfio/platform/vfio_platform_common.c +++ b/drivers/vfio/platform/vfio_platform_common.c @@ -291,7 +291,7 @@ static int vfio_platform_open(struct vfio_device *core_vdev) vfio_platform_regions_cleanup(vdev); err_reg: mutex_unlock(&driver_lock); - module_put(THIS_MODULE); + module_put(vdev->parent_module); return ret; }
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: 32a2d71c4e808 ("vfio: platform: introduce vfio-platform-base module") Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com> --- drivers/vfio/platform/vfio_platform_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)