On Sun, Nov 11, 2018 at 10:55:06PM -0700, Theo de Raadt wrote:
> Philip Guenther <guent...@gmail.com> wrote:
> 
> > On Sun, Nov 11, 2018 at 9:45 PM David Gwynne <da...@gwynne.id.au> wrote:
> > 
> > > If you can trick someone into implementing 64bit device ids you can have
> > > more than your 16 millionth tap device.
> > >
> > 
> > Hhahahahahahahhahahahahah.
> > 
> > That would involve rolling six syscall numbers, not to mention handling the
> > 64bit padding in one of mknod() or mknodat().
> > 
> > As the guy who did the last type bump that invasive, Just Say No.
> 
> Right, it will never happen.  It serves no purpose.
> 
> The network driver can clamp itself at 24 bits, if it matters.

yes, i just realised what greg was actually asking.

so like this?

Index: if_tun.c
===================================================================
RCS file: /cvs/src/sys/net/if_tun.c,v
retrieving revision 1.181
diff -u -p -r1.181 if_tun.c
--- if_tun.c    24 Feb 2018 07:20:04 -0000      1.181
+++ if_tun.c    12 Nov 2018 06:02:51 -0000
@@ -193,6 +193,9 @@ tun_create(struct if_clone *ifc, int uni
        struct tun_softc        *tp;
        struct ifnet            *ifp;
 
+       if (unit > minor(~0U))
+               return (ENXIO);
+
        tp = malloc(sizeof(*tp), M_DEVBUF, M_WAITOK|M_ZERO);
        tp->tun_unit = unit;
        tp->tun_flags = TUN_INITED|TUN_STAYUP;

Reply via email to