From 78749542fc6d31ad41ecc350dea364e21362f985 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Sat, 10 Apr 2021 16:53:52 +0100 Subject: [netdevice] Ensure driver transmit() and poll() will not be re-entered When CONSOLE_SYSLOG is used, a DBG() from within a network device driver may cause its transmit() or poll() methods to be unexpectedly re-entered. Since these methods are not intended to be re-entrant, this can lead to undefined behaviour. Add an explicit re-entrancy guard to both methods. Note that this must operate at a per-netdevice level, since there are legitimate circumstances under which the netdev_tx() or netdev_poll() functions may be re-entered (e.g. when using VLAN devices). Signed-off-by: Michael Brown --- src/include/ipxe/netdevice.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/include/ipxe') diff --git a/src/include/ipxe/netdevice.h b/src/include/ipxe/netdevice.h index b9c651c71..294f7b367 100644 --- a/src/include/ipxe/netdevice.h +++ b/src/include/ipxe/netdevice.h @@ -451,6 +451,12 @@ struct net_device { */ #define NETDEV_IRQ_UNSUPPORTED 0x0008 +/** Network device transmission is in progress */ +#define NETDEV_TX_IN_PROGRESS 0x0010 + +/** Network device poll is in progress */ +#define NETDEV_POLL_IN_PROGRESS 0x0020 + /** Link-layer protocol table */ #define LL_PROTOCOLS __table ( struct ll_protocol, "ll_protocols" ) -- cgit v1.2.3-55-g7522