netpoll: don't require irqs disabled in rt kernels
authorWander Lairson Costa <wander@redhat.com>
Mon, 31 May 2021 15:23:23 +0000 (12:23 -0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 1 Jun 2021 22:15:11 +0000 (15:15 -0700)
write_msg(netconsole.c:836) calls netpoll_send_udp after a call to
spin_lock_irqsave, which normally disables interrupts; but in PREEMPT_RT
this call just locks an rt_mutex without disabling irqs. In this case,
netpoll_send_udp is called with interrupts enabled.

Signed-off-by: Wander Lairson Costa <wander@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/netpoll.c

index c310c7c1cef7f21538d248926aab6303cecf68b0..0a6b047145585bfc269cd63138f4c1e156639d5f 100644 (file)
@@ -36,6 +36,7 @@
 #include <net/ip6_checksum.h>
 #include <asm/unaligned.h>
 #include <trace/events/napi.h>
+#include <linux/kconfig.h>
 
 /*
  * We maintain a small pool of fully-sized skbs, to make sure the
@@ -389,7 +390,8 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
        static atomic_t ip_ident;
        struct ipv6hdr *ip6h;
 
-       WARN_ON_ONCE(!irqs_disabled());
+       if (!IS_ENABLED(CONFIG_PREEMPT_RT))
+               WARN_ON_ONCE(!irqs_disabled());
 
        udp_len = len + sizeof(*udph);
        if (np->ipv6)