Page MenuHomeFreeBSD

D22870.diff
No OneTemporary

D22870.diff

Index: head/sys/dev/ixl/if_ixl.c
===================================================================
--- head/sys/dev/ixl/if_ixl.c
+++ head/sys/dev/ixl/if_ixl.c
@@ -1624,11 +1624,29 @@
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);
}
Index: head/sys/dev/ixl/ixl.h
===================================================================
--- head/sys/dev/ixl/ixl.h
+++ head/sys/dev/ixl/ixl.h
@@ -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>

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 27, 8:26 AM (10 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15612576
Default Alt Text
D22870.diff (1 KB)

Event Timeline