hv_netvsc: Add check for kvmalloc_array
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Mon, 14 Mar 2022 02:01:25 +0000 (10:01 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Mar 2022 08:16:42 +0000 (09:16 +0100)
commitab0ab176183191cffc69fe9dd8ac6c8db23f60d3
treed41c18c16de951699e60057a721c39f61d896409
parent735f918cc2c8510583af8f0e4ded48ba6f19c9a4
hv_netvsc: Add check for kvmalloc_array

[ Upstream commit 886e44c9298a6b428ae046e2fa092ca52e822e6a ]

As the potential failure of the kvmalloc_array(),
it should be better to check and restore the 'data'
if fails in order to avoid the dereference of the
NULL pointer.

Fixes: 6ae746711263 ("hv_netvsc: Add per-cpu ethtool stats for netvsc")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220314020125.2365084-1-jiasheng@iscas.ac.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/hyperv/netvsc_drv.c