[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH] Ensure Hash mapping has at least 1 entry when Toeplitz is selected.
From: Owen Smith <owen.smith@xxxxxxxxxx> Its possible to select Toeplitz hashing without specifiying the hash map. A divide-by-zero BSOD can occur when a packet is sent before the hash map is created. Also add an ASSERT to detect potential divide-by-zeros in checked builds. Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx> --- src/xenvif/frontend.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/xenvif/frontend.c b/src/xenvif/frontend.c index f6570e8..0b51fd1 100644 --- a/src/xenvif/frontend.c +++ b/src/xenvif/frontend.c @@ -1863,6 +1863,12 @@ __FrontendUpdateHash( break; case XENVIF_PACKET_HASH_ALGORITHM_TOEPLITZ: + if (Hash->Size == 0) { + // if Algorithm is set without setting a hash map, + // we need to ensure the hash map has 1 entry (0) + Hash->Size = 1; + Hash->Mapping[0] = 0; + } Size = Hash->Size; Mapping = Hash->Mapping; Flags = Hash->Flags; @@ -2151,6 +2157,7 @@ FrontendGetQueue( break; case XENVIF_PACKET_HASH_ALGORITHM_TOEPLITZ: + ASSERT3U(Frontend->Hash.Size, != , 0); Queue = Frontend->Hash.Mapping[Value % Frontend->Hash.Size]; break; -- 2.8.3 _______________________________________________ win-pv-devel mailing list win-pv-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |