summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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 );