Hi,

according to the NCM spec, the list of datagram pointer entries has to
be terminated with an entry where wDatagramIndex and wDatagramLen are
zero. Not all implementations seem to follow that rule: otto@ had one
that only sets the index to zero while using an arbitrary length value.

The patch below fixes the parsing to stop if any of those values is
zero. It was successfully tested by otto@

Gerhard


Index: if_umb.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_umb.c,v
retrieving revision 1.5
diff -u -p -u -p -r1.5 if_umb.c
--- if_umb.c    10 Nov 2016 14:45:43 -0000      1.5
+++ if_umb.c    14 Nov 2016 09:34:29 -0000
@@ -1815,7 +1815,7 @@ umb_decap(struct umb_softc *sc, struct u
                }
 
                /* Terminating zero entry */
-               if (dlen == 0 && doff == 0)
+               if (dlen == 0 || doff == 0)
                        break;
                if (len < dlen + doff) {
                        /* Skip giant datagram but continue processing */

Reply via email to