hv_netvsc: Fix potential dereference of NULL pointer
[ Upstream commit eb4c0788964730d12e8dd520bd8f5217ca48321c ]
The return value of netvsc_devinfo_get()
needs to be checked to avoid use of NULL
pointer in case of an allocation failure.
Fixes: 0efeea5fb1
("hv_netvsc: Add the support of hibernation")
Signed-off-by: Yongzhi Liu <lyz_cs@pku.edu.cn>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Link: https://lore.kernel.org/r/1652962188-129281-1-git-send-email-lyz_cs@pku.edu.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
deb16df525
commit
541224201e
@@ -2629,7 +2629,10 @@ static int netvsc_suspend(struct hv_device *dev)
|
|||||||
|
|
||||||
/* Save the current config info */
|
/* Save the current config info */
|
||||||
ndev_ctx->saved_netvsc_dev_info = netvsc_devinfo_get(nvdev);
|
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);
|
ret = netvsc_detach(net, nvdev);
|
||||||
out:
|
out:
|
||||||
rtnl_unlock();
|
rtnl_unlock();
|
||||||
|
Reference in New Issue
Block a user