[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>
pull/181/head
Michael Brown 2020-11-29 11:21:20 +00:00
parent 8d337ecdae
commit 9ff61ab28d
1 changed files with 1 additions and 1 deletions

View File

@ -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 */