All of lore.kernel.org
 help / color / mirror / Atom feed
From: Haiyang Zhang <haiyangz@microsoft.com>
To: Yongzhi Liu <lyz_cs@pku.edu.cn>,
	KY Srinivasan <kys@microsoft.com>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	"wei.liu@kernel.org" <wei.liu@kernel.org>,
	Dexuan Cui <decui@microsoft.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"sashal@kernel.org" <sashal@kernel.org>
Cc: "linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"fuyq@stu.pku.edu.cn" <fuyq@stu.pku.edu.cn>
Subject: RE: [PATCH] hv_netvsc: Fix potential dereference of NULL pointer
Date: Thu, 19 May 2022 13:45:25 +0000	[thread overview]
Message-ID: <DM5PR21MB174975EE6EF554BB72C60C01CAD09@DM5PR21MB1749.namprd21.prod.outlook.com> (raw)
In-Reply-To: <1652962188-129281-1-git-send-email-lyz_cs@pku.edu.cn>



> -----Original Message-----
> From: Yongzhi Liu <lyz_cs@pku.edu.cn>
> Sent: Thursday, May 19, 2022 8:10 AM
> To: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang
> <haiyangz@microsoft.com>; Stephen Hemminger
> <sthemmin@microsoft.com>; wei.liu@kernel.org; Dexuan Cui
> <decui@microsoft.com>; davem@davemloft.net; kuba@kernel.org;
> pabeni@redhat.com; sashal@kernel.org
> Cc: linux-hyperv@vger.kernel.org; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org; fuyq@stu.pku.edu.cn; Yongzhi Liu
> <lyz_cs@pku.edu.cn>
> Subject: [PATCH] hv_netvsc: Fix potential dereference of NULL pointer
> 
> [Some people who received this message don't often get email from
> lyz_cs@pku.edu.cn. Learn why this is important at
> https://aka.ms/LearnAboutSenderIdentification.]
> 
> The return value of netvsc_devinfo_get()
> needs to be checked to avoid use of NULL
> pointer in case of an allocation failure.
> 
> Fixes: 0efeea5fb ("hv_netvsc: Add the support of hibernation")
> 
> Signed-off-by: Yongzhi Liu <lyz_cs@pku.edu.cn>
> ---
>  drivers/net/hyperv/netvsc_drv.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/hyperv/netvsc_drv.c
> b/drivers/net/hyperv/netvsc_drv.c
> index fde1c49..b1dece6 100644
> --- a/drivers/net/hyperv/netvsc_drv.c
> +++ b/drivers/net/hyperv/netvsc_drv.c
> @@ -2671,7 +2671,10 @@ static int netvsc_suspend(struct hv_device *dev)
> 
>         /* Save the current config info */
>         ndev_ctx->saved_netvsc_dev_info = netvsc_devinfo_get(nvdev);
> -
> +       if (!ndev_ctx->saved_netvsc_dev_info) {
> +               ret = -ENOMEM;
> +               goto out;
> +       }
>         ret = netvsc_detach(net, nvdev);
>  out:
>         rtnl_unlock();

Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Thank you!

  reply	other threads:[~2022-05-19 14:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-19 12:09 [PATCH] hv_netvsc: Fix potential dereference of NULL pointer Yongzhi Liu
2022-05-19 13:45 ` Haiyang Zhang [this message]
2022-05-21  1:00 ` patchwork-bot+netdevbpf
2022-05-20 17:13 [PATCH v2] iio: vadc: " Jonathan Cameron
2022-05-21  3:31 ` [PATCH] hv_netvsc: " Yongzhi Liu
2022-05-21  3:34   ` 刘永志
2022-05-23 15:21   ` Andy Shevchenko

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=DM5PR21MB174975EE6EF554BB72C60C01CAD09@DM5PR21MB1749.namprd21.prod.outlook.com \
    --to=haiyangz@microsoft.com \
    --cc=davem@davemloft.net \
    --cc=decui@microsoft.com \
    --cc=fuyq@stu.pku.edu.cn \
    --cc=kuba@kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lyz_cs@pku.edu.cn \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sashal@kernel.org \
    --cc=sthemmin@microsoft.com \
    --cc=wei.liu@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.