Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F106157730
D22870.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D22870.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D22870: ixl: prevent non-privileged access to NVM update interface
Attached
Detach File
Event Timeline
Log In to Comment