summaryrefslogtreecommitdiffstats
path: root/src/drivers/net
diff options
context:
space:
mode:
authorMichael Brown2010-09-05 19:52:57 +0200
committerMichael Brown2010-09-05 19:58:10 +0200
commite9efbcd84ca910b416cb5869a9b92f0e2e73e72c (patch)
treef3ac143e7853669f36bace53afb926b5ccff2b30 /src/drivers/net
parent[xfer] Add xfer_window_changed() (diff)
downloadipxe-e9efbcd84ca910b416cb5869a9b92f0e2e73e72c.tar.gz
ipxe-e9efbcd84ca910b416cb5869a9b92f0e2e73e72c.tar.xz
ipxe-e9efbcd84ca910b416cb5869a9b92f0e2e73e72c.zip
[rtl8139] Check for oversized packets when transmitting
An attempt to transmit a packet of 8192 bytes or larger will collide with the status bits in the TX descriptor. This gives the appearance of the network card's transmit data path having just suddenly stopped responding; iPXE is waiting for the card to report a TX completion but, because of the status bit collision, the card thinks that the descriptor has not yet been written. Fix by explicitly checking for oversized packets in rtl_transmit(). Discovered during Fibre Channel over Ethernet testing, and debugged by using gdb to examine the state of the emulated rtl8139 card in qemu. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/net')
-rw-r--r--src/drivers/net/rtl8139.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/drivers/net/rtl8139.c b/src/drivers/net/rtl8139.c
index dd3f80e57..4ed43c02e 100644
--- a/src/drivers/net/rtl8139.c
+++ b/src/drivers/net/rtl8139.c
@@ -86,6 +86,7 @@ FILE_LICENCE ( GPL_ANY );
#include <ipxe/nvo.h>
#define TX_RING_SIZE 4
+#define TX_MAX_LEN 8192
struct rtl8139_tx {
unsigned int next;
@@ -383,6 +384,13 @@ static int rtl_transmit ( struct net_device *netdev,
return -ENOBUFS;
}
+ /* Check for oversized packets */
+ if ( iob_len ( iobuf ) >= TX_MAX_LEN ) {
+ DBGC ( rtl, "rtl8139 %p TX too large (%zd bytes)\n",
+ rtl, iob_len ( iobuf ) );
+ return -ERANGE;
+ }
+
/* Pad and align packet */
iob_pad ( iobuf, ETH_ZLEN );