public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Zhenyu Wang <zhenyuw@linux.intel.com>
To: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Cc: airlied@linux.ie, daniel@ffwll.ch, chenzhou10@huawei.com,
	intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org, zhenyuw@linux.intel.com,
	intel-gvt-dev@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/gvt: return error when failing to take the module reference
Date: Fri, 13 Nov 2020 12:01:57 +0800	[thread overview]
Message-ID: <20201113040157.GC1239@zhen-hp.sh.intel.com> (raw)
In-Reply-To: <1605187352-51761-1-git-send-email-wangxiongfeng2@huawei.com>

[-- Attachment #1: Type: text/plain, Size: 1273 bytes --]

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@huawei.com>
> Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.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@linux.intel.com>

-- 

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

      reply	other threads:[~2020-11-13  4:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12 13:22 [PATCH] drm/i915/gvt: return error when failing to take the module reference Xiongfeng Wang
2020-11-13  4:01 ` Zhenyu Wang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201113040157.GC1239@zhen-hp.sh.intel.com \
    --to=zhenyuw@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=chenzhou10@huawei.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-gvt-dev@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wangxiongfeng2@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox