summaryrefslogtreecommitdiff
path: root/sys/net/if_tun.c
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2018-01-09 15:24:25 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2018-01-09 15:24:25 +0000
commit630ce3acafb6c26deb5d91610e9d8875a6b6bc61 (patch)
treef8c88944a39775dc96058c94e316bc99c8dca96d /sys/net/if_tun.c
parentb6ab100d040502e7a25daea02f44fa22cc465cbe (diff)
Creating a cloned interface could return ENOMEM due to temporary
memory shortage. As it is invoked from a system call, it should not fail and wait instead. OK visa@ mpi@
Diffstat (limited to 'sys/net/if_tun.c')
-rw-r--r--sys/net/if_tun.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index 3a7fd26d0b1..81dd0148a3f 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tun.c,v 1.179 2017/12/30 23:08:29 guenther Exp $ */
+/* $OpenBSD: if_tun.c,v 1.180 2018/01/09 15:24:24 bluhm Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
@@ -193,10 +193,7 @@ tun_create(struct if_clone *ifc, int unit, int flags)
struct tun_softc *tp;
struct ifnet *ifp;
- tp = malloc(sizeof(*tp), M_DEVBUF, M_NOWAIT|M_ZERO);
- if (tp == NULL)
- return (ENOMEM);
-
+ tp = malloc(sizeof(*tp), M_DEVBUF, M_WAITOK|M_ZERO);
tp->tun_unit = unit;
tp->tun_flags = TUN_INITED|TUN_STAYUP;