hyperv/vmbus: Make sure that the allocated GPADL is not zero.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8631
This commit is contained in:
Sepherosa Ziehau 2016-11-28 06:53:00 +00:00
parent afd4971b7b
commit fa643a5d0a

View File

@ -325,7 +325,13 @@ vmbus_msghc_wakeup(struct vmbus_softc *sc, const struct vmbus_message *msg)
uint32_t
vmbus_gpadl_alloc(struct vmbus_softc *sc)
{
return atomic_fetchadd_int(&sc->vmbus_gpadl, 1);
uint32_t gpadl;
again:
gpadl = atomic_fetchadd_int(&sc->vmbus_gpadl, 1);
if (gpadl == 0)
goto again;
return (gpadl);
}
static int