[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20201113040157.GC1239@zhen-hp.sh.intel.com>
Date: Fri, 13 Nov 2020 12:01:57 +0800
From: Zhenyu Wang <zhenyuw@...ux.intel.com>
To: Xiongfeng Wang <wangxiongfeng2@...wei.com>
Cc: airlied@...ux.ie, daniel@...ll.ch, chenzhou10@...wei.com,
intel-gfx@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org, zhenyuw@...ux.intel.com,
intel-gvt-dev@...ts.freedesktop.org
Subject: Re: [PATCH] drm/i915/gvt: return error when failing to take the
module reference
On 2020.11.12 21:22:32 +0800, Xiongfeng Wang wrote:
> When we fail to take the module reference, we go to the 'undo*' branch and
> return. But the returned variable 'ret' has been set as zero by the
> above code. Change 'ret' to '-ENODEV' in this situation.
>
> Fixes: 9bdb073464d6 ("drm/i915/gvt: Change KVMGT as self load module")
> Reported-by: Hulk Robot <hulkci@...wei.com>
> Signed-off-by: Xiongfeng Wang <wangxiongfeng2@...wei.com>
> ---
> drivers/gpu/drm/i915/gvt/kvmgt.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
> index ad8a9df..778eb8c 100644
> --- a/drivers/gpu/drm/i915/gvt/kvmgt.c
> +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
> @@ -829,8 +829,10 @@ static int intel_vgpu_open(struct mdev_device *mdev)
> /* Take a module reference as mdev core doesn't take
> * a reference for vendor driver.
> */
> - if (!try_module_get(THIS_MODULE))
> + if (!try_module_get(THIS_MODULE)) {
> + ret = -ENODEV;
> goto undo_group;
> + }
>
> ret = kvmgt_guest_init(mdev);
> if (ret)
> --
Thanks for the fix!
Reviewed-by: Zhenyu Wang <zhenyuw@...ux.intel.com>
--
$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists