svn commit: r359140 - releng/12.1/sys/dev/ixl
Gordon Tetlow
gordon at FreeBSD.org
Thu Mar 19 16:49:34 UTC 2020
Author: gordon
Date: Thu Mar 19 16:49:32 2020
New Revision: 359140
URL: https://svnweb.freebsd.org/changeset/base/359140
Log:
Fix insufficient ixl(4) ioctl(2) privilege checking.
Approved by: so
Security: FreeBSD-SA-20:06.if_ixl_ioctl
Security: CVE-2019-15877
Modified:
releng/12.1/sys/dev/ixl/if_ixl.c
releng/12.1/sys/dev/ixl/ixl.h
Modified: releng/12.1/sys/dev/ixl/if_ixl.c
==============================================================================
--- releng/12.1/sys/dev/ixl/if_ixl.c Thu Mar 19 16:48:29 2020 (r359139)
+++ releng/12.1/sys/dev/ixl/if_ixl.c Thu Mar 19 16:49:32 2020 (r359140)
@@ -1625,11 +1625,29 @@ ixl_if_priv_ioctl(if_ctx_t ctx, u_long command, caddr_
struct ifdrv *ifd = (struct ifdrv *)data;
int error = 0;
- /* NVM update command */
- if (ifd->ifd_cmd == I40E_NVM_ACCESS)
- error = ixl_handle_nvmupd_cmd(pf, ifd);
- else
- error = EINVAL;
+ /*
+ * The iflib_if_ioctl forwards SIOCxDRVSPEC and SIOGPRIVATE_0 without
+ * performing privilege checks. It is important that this function
+ * perform the necessary checks for commands which should only be
+ * executed by privileged threads.
+ */
+
+ switch(command) {
+ case SIOCGDRVSPEC:
+ case SIOCSDRVSPEC:
+ /* NVM update command */
+ if (ifd->ifd_cmd == I40E_NVM_ACCESS) {
+ error = priv_check(curthread, PRIV_DRIVER);
+ if (error)
+ break;
+ error = ixl_handle_nvmupd_cmd(pf, ifd);
+ } else {
+ error = EINVAL;
+ }
+ break;
+ default:
+ error = EOPNOTSUPP;
+ }
return (error);
}
Modified: releng/12.1/sys/dev/ixl/ixl.h
==============================================================================
--- releng/12.1/sys/dev/ixl/ixl.h Thu Mar 19 16:48:29 2020 (r359139)
+++ releng/12.1/sys/dev/ixl/ixl.h Thu Mar 19 16:49:32 2020 (r359140)
@@ -52,6 +52,7 @@
#include <sys/sockio.h>
#include <sys/eventhandler.h>
#include <sys/syslog.h>
+#include <sys/priv.h>
#include <net/if.h>
#include <net/if_var.h>
More information about the svn-src-all
mailing list