Author: markj
Date: Mon Dec 23 23:43:50 2019
New Revision: 356047
URL: https://svnweb.freebsd.org/changeset/base/356047

Log:
  oce: Disallow the passthrough ioctl for unprivileged users.
  
  A missing check meant that unprivileged users could send passthrough
  commands to the device firmware.
  
  Reported by:  Ilja Van Sprundel <ivansprun...@ioactive.com>
  MFC after:    3 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/oce/oce_if.c
  head/sys/dev/oce/oce_if.h

Modified: head/sys/dev/oce/oce_if.c
==============================================================================
--- head/sys/dev/oce/oce_if.c   Mon Dec 23 21:57:11 2019        (r356046)
+++ head/sys/dev/oce/oce_if.c   Mon Dec 23 23:43:50 2019        (r356047)
@@ -620,6 +620,9 @@ oce_ioctl(struct ifnet *ifp, u_long command, caddr_t d
                break;
 
        case SIOCGPRIVATE_0:
+               rc = priv_check(curthread, PRIV_DRIVER);
+               if (rc != 0)
+                       break;
                rc = oce_handle_passthrough(ifp, data);
                break;
        default:

Modified: head/sys/dev/oce/oce_if.h
==============================================================================
--- head/sys/dev/oce/oce_if.h   Mon Dec 23 21:57:11 2019        (r356046)
+++ head/sys/dev/oce/oce_if.h   Mon Dec 23 23:43:50 2019        (r356047)
@@ -48,6 +48,7 @@
 #include <sys/kernel.h>
 #include <sys/bus.h>
 #include <sys/mbuf.h>
+#include <sys/priv.h>
 #include <sys/rman.h>
 #include <sys/socket.h>
 #include <sys/sockio.h>
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to