lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Mon, 26 Mar 2007 21:49:57 -0800
From:	akpm@...ux-foundation.org
To:	davem@...emloft.net
Cc:	netdev@...r.kernel.org, akpm@...ux-foundation.org,
	anemo@....ocn.ne.jp, jeff@...zik.org, romieu@...zoreil.com
Subject: [patch 1/7] fix irq problem with NAPI + NETPOLL

From: Atsushi Nemoto <anemo@....ocn.ne.jp>

This patch is to make netif_receive_skb() robust on NAPI+NETPOLL case.

1. netpoll_send_skb() calls netpoll_poll() with interrupt disabled.
2. netpoll_poll() calls poll_napi().
3. poll_napi() calls dev->poll().
4. dev->poll() (for example rtl8139_poll()) calls rtl8139_rx().
5. rtl8139_rx() calls netif_receive_skb().
6. netif_receive_skb() calls netpoll_rx().

If netpoll_rx() returned 1, no problem.  If netpoll_rx() returned 0,
netif_receive_skb() continues to processing the skb with interrupt
disabled.  It might cause some problems, for example,

netif_receive_skb() -> deliver_skb() -> arp_rcv() -> arp_process() ->
neigh_lookup() -> read_unlock_bh() -> local_bh_enable() ->
WARN_ON_ONCE(irqs_disabled()).

The patch tries to avoid this by redirecting skb to netif_rx() if
netif_receive_skb() was called from irq context or irq disabled.

Signed-off-by: Atsushi Nemoto <anemo@....ocn.ne.jp>
Cc: Jeff Garzik <jeff@...zik.org>
Cc: Francois Romieu <romieu@...zoreil.com>
Cc: "David S. Miller" <davem@...emloft.net>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
---

 net/core/dev.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff -puN net/core/dev.c~fix-irq-problem-with-napi-netpoll net/core/dev.c
--- a/net/core/dev.c~fix-irq-problem-with-napi-netpoll
+++ a/net/core/dev.c
@@ -1769,8 +1769,15 @@ int netif_receive_skb(struct sk_buff *sk
 	__be16 type;
 
 	/* if we've gotten here through NAPI, check netpoll */
-	if (skb->dev->poll && netpoll_rx(skb))
-		return NET_RX_DROP;
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	if (skb->dev->poll && skb->dev->poll_controller) {
+		/* NAPI poll might be called in irq context on NETPOLL */
+		if (in_irq() || irqs_disabled())
+			return netif_rx(skb);
+		if (netpoll_rx(skb))
+			return NET_RX_DROP;
+	}
+#endif
 
 	if (!skb->tstamp.off_sec)
 		net_timestamp(skb);
_
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ