K 10 svn:author V 7 git2svn K 8 svn:date V 27 2022-11-11T01:25:32.877808Z K 7 svn:log V 1153 bhyve e1000: Sanitize transmit ring indices. When preparing to transmit pending packets, ensure that the head (TDH) and tail (TDT) indices are in bounds. Note that validating values when they are written is not sufficient along as the transmit length (TDLEN) could be changed turning a value that was valid when written into an out of bounds value. While here, add further restrictions to the head register (TDH). The manual states that writing to this value while transmit is enabled can cause unexpected behavior and that it should only be written after a reset. As such, ignore attempts to write while transmit is active, and also ignore writes of non-zero values. Later e1000 chipsets have this register as read-only. Also ignore any attempts to transmit packets if the transmit ring's size is zero. PR: 264567 Reported by: Robert Morris Reviewed by: emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D36269 (cherry picked from commit 7afe342dcb38b624488009bb6bdfa5337e628ffc) Git Hash: 93eafd4479da09eabbd447490a8661fb7616ba29 Git Author: jhb@FreeBSD.org END