Commit eb4c0788 authored by Yongzhi Liu's avatar Yongzhi Liu Committed by Jakub Kicinski

hv_netvsc: Fix potential dereference of NULL pointer

The return value of netvsc_devinfo_get()
needs to be checked to avoid use of NULL
pointer in case of an allocation failure.

Fixes: 0efeea5f ("hv_netvsc: Add the support of hibernation")
Signed-off-by: default avatarYongzhi Liu <lyz_cs@pku.edu.cn>
Reviewed-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
Link: https://lore.kernel.org/r/1652962188-129281-1-git-send-email-lyz_cs@pku.edu.cnSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent ed46b3e1
......@@ -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();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment