Drivers: hv: vmbus: Fix synic per-cpu context initialization
authorMichael Kelley <mikelley@microsoft.com>
Fri, 10 Aug 2018 23:06:11 +0000 (23:06 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Nov 2019 16:59:56 +0000 (17:59 +0100)
commit57441e0615f155fe8b5002c68a79e61c576e2830
tree5921fe03e57bc6c8d9db92f12364ef60b696090e
parent9e50bed60686a27c31199f3f9c371c9670b60e6a
Drivers: hv: vmbus: Fix synic per-cpu context initialization

[ Upstream commit f25a7ece08bdb1f2b3c4bbeae942682fc3a99dde ]

If hv_synic_alloc() errors out, the state of the per-cpu context
for some CPUs is unknown since the zero'ing is done as each
CPU is iterated over.  In such case, hv_synic_cleanup() may try to
free memory based on uninitialized values.  Fix this by zero'ing
the per-cpu context for all CPUs before doing any memory
allocations that might fail.

Signed-off-by: Michael Kelley <mikelley@microsoft.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hv/hv.c