aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2020-11-29 11:21:20 +0000
committerMichael Brown <mcb30@ipxe.org>2020-11-29 11:25:40 +0000
commit9ff61ab28df1a0d20e1819d387094d220c1580ad (patch)
tree4d290e88a261611ecc9f5f63b0b72042fba5cc2b
parent8d337ecdae3c6d555ea57996bc2280debd984a9c (diff)
downloadipxe-9ff61ab28df1a0d20e1819d387094d220c1580ad.zip
ipxe-9ff61ab28df1a0d20e1819d387094d220c1580ad.tar.gz
ipxe-9ff61ab28df1a0d20e1819d387094d220c1580ad.tar.bz2
[netdevice] Do not attempt to unmap a null I/O buffer
netdev_tx_err() may be called with a null I/O buffer (e.g. to record a transmit error with no associated buffer). Avoid a potential null pointer dereference in the DMA unmapping code path. Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/net/netdevice.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/net/netdevice.c b/src/net/netdevice.c
index f3feca2..754799c 100644
--- a/src/net/netdevice.c
+++ b/src/net/netdevice.c
@@ -392,7 +392,7 @@ void netdev_tx_err ( struct net_device *netdev,
}
/* Unmap I/O buffer, if required */
- if ( dma_mapped ( &iobuf->map ) )
+ if ( iobuf && dma_mapped ( &iobuf->map ) )
iob_unmap ( iobuf );
/* Discard packet */