aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/netmap
diff options
context:
space:
mode:
authorVincenzo Maffione <vmaffione@FreeBSD.org>2019-01-24 22:09:26 +0000
committerVincenzo Maffione <vmaffione@FreeBSD.org>2019-01-24 22:09:26 +0000
commitaa4dd64dfec15d8bc6118db6f26ca88f9dbec84e (patch)
tree29fc706feacba6dca456bbde5a3698dd3867b734 /sys/dev/netmap
parentb882e02bc4f3f4f74c6a5b428dc916ec92ad4198 (diff)
downloadsrc-aa4dd64dfec15d8bc6118db6f26ca88f9dbec84e.tar.gz
src-aa4dd64dfec15d8bc6118db6f26ca88f9dbec84e.zip
netmap: fix crash with monitors and VALE ports
Crash report described here: https://github.com/luigirizzo/netmap/issues/583 Fixed by providing dummy sync callback in case it is missing.
Notes
Notes: svn path=/head/; revision=343413
Diffstat (limited to 'sys/dev/netmap')
-rw-r--r--sys/dev/netmap/netmap_monitor.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/dev/netmap/netmap_monitor.c b/sys/dev/netmap/netmap_monitor.c
index 7e88ae02f9ba..5297c0cb9123 100644
--- a/sys/dev/netmap/netmap_monitor.c
+++ b/sys/dev/netmap/netmap_monitor.c
@@ -259,11 +259,20 @@ static int netmap_monitor_parent_txsync(struct netmap_kring *, int);
static int netmap_monitor_parent_rxsync(struct netmap_kring *, int);
static int netmap_monitor_parent_notify(struct netmap_kring *, int);
+static int
+nm_monitor_dummycb(struct netmap_kring *kring, int flags)
+{
+ (void)kring;
+ (void)flags;
+ return 0;
+}
+
static void
nm_monitor_intercept_callbacks(struct netmap_kring *kring)
{
ND("intercept callbacks on %s", kring->name);
- kring->mon_sync = kring->nm_sync;
+ kring->mon_sync = kring->nm_sync != NULL ?
+ kring->nm_sync : nm_monitor_dummycb;
kring->mon_notify = kring->nm_notify;
if (kring->tx == NR_TX) {
kring->nm_sync = netmap_monitor_parent_txsync;