svn commit: r311366 - stable/11/sys/dev/hyperv/vmbus
Sepherosa Ziehau
sephe at FreeBSD.org
Thu Jan 5 05:41:34 UTC 2017
Author: sephe
Date: Thu Jan 5 05:41:33 2017
New Revision: 311366
URL: https://svnweb.freebsd.org/changeset/base/311366
Log:
MFC 309236,309237
309236
hyperv/vmbus: Make sure that the allocated GPADL is not zero.
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8631
309237
hyperv/vmbus: Stringent GPADL parameter assertion.
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8632
Modified:
stable/11/sys/dev/hyperv/vmbus/vmbus.c
stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/dev/hyperv/vmbus/vmbus.c
==============================================================================
--- stable/11/sys/dev/hyperv/vmbus/vmbus.c Thu Jan 5 05:29:51 2017 (r311365)
+++ stable/11/sys/dev/hyperv/vmbus/vmbus.c Thu Jan 5 05:41:33 2017 (r311366)
@@ -328,7 +328,13 @@ vmbus_msghc_wakeup(struct vmbus_softc *s
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
Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c
==============================================================================
--- stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Thu Jan 5 05:29:51 2017 (r311365)
+++ stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Thu Jan 5 05:41:33 2017 (r311366)
@@ -502,11 +502,7 @@ vmbus_chan_gpadl_connect(struct vmbus_ch
int page_count, range_len, i, cnt, error;
uint64_t page_id;
- /*
- * Reset GPADL, so that the result would consistent, if error
- * happened later on.
- */
- *gpadl0 = 0;
+ KASSERT(*gpadl0 == 0, ("GPADL is not zero"));
/*
* Preliminary checks.
@@ -652,6 +648,8 @@ vmbus_chan_gpadl_disconnect(struct vmbus
struct vmbus_chanmsg_gpadl_disconn *req;
int error;
+ KASSERT(gpadl != 0, ("GPADL is zero"));
+
mh = vmbus_msghc_get(sc, sizeof(*req));
if (mh == NULL) {
vmbus_chan_printf(chan,
More information about the svn-src-stable
mailing list