Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Dec 2019 23:43:50 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r356047 - head/sys/dev/oce
Message-ID:  <201912232343.xBNNhoBL047623@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <ivansprundel@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>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912232343.xBNNhoBL047623>