From f3fa3fa7db781ee1847ca070517843bddc648cf6 Mon Sep 17 00:00:00 2001 From: martin Date: Tue, 17 Dec 2019 16:12:53 +0000 Subject: Pull up following revision(s) (requested by christos in ticket #569): sys/dev/usb/if_umb.c: revision 1.10 sys/net/if.c: revision 1.466 sys/dev/ic/ath.c: revision 1.129 Protect network ioctls from non-authorized users. (Ilja Van Sprundel) --- sys/dev/ic/ath.c | 11 +++++++++-- sys/dev/usb/if_umb.c | 10 ++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/ic/ath.c b/sys/dev/ic/ath.c index 618562c8dac..90d18913887 100644 --- a/sys/dev/ic/ath.c +++ b/sys/dev/ic/ath.c @@ -1,4 +1,4 @@ -/* $NetBSD: ath.c,v 1.127 2019/05/28 07:41:48 msaitoh Exp $ */ +/* $NetBSD: ath.c,v 1.127.2.1 2019/12/17 16:12:54 martin Exp $ */ /*- * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.104 2005/09/16 10:09:23 ru Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.127 2019/05/28 07:41:48 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.127.2.1 2019/12/17 16:12:54 martin Exp $"); #endif /* @@ -69,6 +69,7 @@ __KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.127 2019/05/28 07:41:48 msaitoh Exp $"); #include #include #include +#include #include #include @@ -5441,6 +5442,12 @@ ath_ioctl(struct ifnet *ifp, u_long cmd, void *data) return copyout(&sc->sc_stats, ifr->ifr_data, sizeof (sc->sc_stats)); case SIOCGATHDIAG: + error = kauth_authorize_network(curlwp->l_cred, + KAUTH_NETWORK_INTERFACE, + KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, KAUTH_ARG(cmd), + NULL); + if (error) + break; error = ath_ioctl_diag(sc, (struct ath_diag *) ifr); break; default: diff --git a/sys/dev/usb/if_umb.c b/sys/dev/usb/if_umb.c index 54c57ccd6bd..9077d053c0e 100644 --- a/sys/dev/usb/if_umb.c +++ b/sys/dev/usb/if_umb.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_umb.c,v 1.9 2019/06/26 22:58:58 khorben Exp $ */ +/* $NetBSD: if_umb.c,v 1.9.2.1 2019/12/17 16:12:53 martin Exp $ */ /* $OpenBSD: if_umb.c,v 1.20 2018/09/10 17:00:45 gerhard Exp $ */ /* @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.9 2019/06/26 22:58:58 khorben Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.9.2.1 2019/12/17 16:12:53 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -779,6 +779,12 @@ umb_ioctl(struct ifnet *ifp, u_long cmd, void *data) usb_add_task(sc->sc_udev, &sc->sc_umb_task, USB_TASKQ_DRIVER); break; case SIOCGUMBINFO: + error = kauth_authorize_network(curlwp->l_cred, + KAUTH_NETWORK_INTERFACE, + KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, KAUTH_ARG(cmd), + NULL); + if (error) + break; error = copyout(&sc->sc_info, ifr->ifr_data, sizeof(sc->sc_info)); break; -- cgit