Module Name:    src
Committed By:   riastradh
Date:           Thu Aug 20 21:31:16 UTC 2020

Modified Files:
        src/sys/net: if_wg.c

Log Message:
Don't falsely assert cpu_softintr_p().

Will fail in the following stack trace:

wg_worker (kthread)
wg_receive_packets
wg_handle_packet
wg_handle_msg_data
KASSERT(cpu_softintr_p())

Instead, use kpreempt_disable/enable around softint_schedule.

XXX Not clear that softint is the right place to do this!


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/net/if_wg.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_wg.c
diff -u src/sys/net/if_wg.c:1.4 src/sys/net/if_wg.c:1.5
--- src/sys/net/if_wg.c:1.4	Thu Aug 20 21:31:06 2020
+++ src/sys/net/if_wg.c	Thu Aug 20 21:31:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wg.c,v 1.4 2020/08/20 21:31:06 riastradh Exp $	*/
+/*	$NetBSD: if_wg.c,v 1.5 2020/08/20 21:31:16 riastradh Exp $	*/
 
 /*
  * Copyright (C) Ryota Ozaki <ozaki.ry...@gmail.com>
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.4 2020/08/20 21:31:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.5 2020/08/20 21:31:16 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2351,8 +2351,9 @@ wg_handle_msg_data(struct wg_softc *wg, 
 		mutex_exit(wgs_prev->wgs_lock);
 
 		/* Anyway run a softint to flush pending packets */
-		KASSERT(cpu_softintr_p());
+		kpreempt_disable();
 		softint_schedule(wgp->wgp_si);
+		kpreempt_enable();
 	} else {
 		if (__predict_false(wg_need_to_send_init_message(wgs))) {
 			wg_schedule_peer_task(wgp, WGP_TASK_SEND_INIT_MESSAGE);

Reply via email to