From: Michael Brown Date: Sun, 29 Nov 2020 11:21:20 +0000 (+0000) Subject: [netdevice] Do not attempt to unmap a null I/O buffer X-Git-Tag: v1.21.1~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ff61ab28df1a0d20e1819d387094d220c1580ad;p=thirdparty%2Fipxe.git [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 --- diff --git a/src/net/netdevice.c b/src/net/netdevice.c index f3feca26b..754799cd1 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 */