summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2009-05-21 10:56:11 -0700
committerBrian Behlendorf <[email protected]>2009-05-21 10:56:11 -0700
commite554dffa6031a2cf37537fc8451f757d5ae9e46f (patch)
tree0e2208716299f681ccaaa844c186809b8d8803c0 /module
parent9593ef76d9ab2290a4fee7f97651dfa1f57185e6 (diff)
SLES10 Fixes (part 9)
- Proper ioctl() 32/64-bit binary compatibility. We need to ensure the ioctl data itself is always packed the same for 32/64-bit binaries. Additionally, the correct thing to do is encode this size in bytes as part of the command using _IOC_SIZE(). - Minor formatting changes to respect the 80 character limit. - Move all SPLAT_SUBSYSTEM_* defines in to splat-ctl.h. - Increase SPLAT_SUBSYSTEM_UNKNOWN because we were getting close to accidentally using it for a real registered subsystem.
Diffstat (limited to 'module')
-rw-r--r--module/splat/splat-atomic.c1
-rw-r--r--module/splat/splat-condvar.c1
-rw-r--r--module/splat/splat-ctl.c23
-rw-r--r--module/splat/splat-generic.c1
-rw-r--r--module/splat/splat-kmem.c1
-rw-r--r--module/splat/splat-kobj.c1
-rw-r--r--module/splat/splat-list.c1
-rw-r--r--module/splat/splat-mutex.c1
-rw-r--r--module/splat/splat-random.c1
-rw-r--r--module/splat/splat-rwlock.c1
-rw-r--r--module/splat/splat-taskq.c1
-rw-r--r--module/splat/splat-thread.c1
-rw-r--r--module/splat/splat-time.c1
-rw-r--r--module/splat/splat-vnode.c1
14 files changed, 16 insertions, 20 deletions
diff --git a/module/splat/splat-atomic.c b/module/splat/splat-atomic.c
index cc947d095..3a651103e 100644
--- a/module/splat/splat-atomic.c
+++ b/module/splat/splat-atomic.c
@@ -26,7 +26,6 @@
#include "splat-internal.h"
-#define SPLAT_SUBSYSTEM_ATOMIC 0x0b00
#define SPLAT_ATOMIC_NAME "atomic"
#define SPLAT_ATOMIC_DESC "Kernel Atomic Tests"
diff --git a/module/splat/splat-condvar.c b/module/splat/splat-condvar.c
index 276798818..baef871c2 100644
--- a/module/splat/splat-condvar.c
+++ b/module/splat/splat-condvar.c
@@ -26,7 +26,6 @@
#include "splat-internal.h"
-#define SPLAT_SUBSYSTEM_CONDVAR 0x0500
#define SPLAT_CONDVAR_NAME "condvar"
#define SPLAT_CONDVAR_DESC "Kernel Condition Variable Tests"
diff --git a/module/splat/splat-ctl.c b/module/splat/splat-ctl.c
index c123f5bf9..c8925636a 100644
--- a/module/splat/splat-ctl.c
+++ b/module/splat/splat-ctl.c
@@ -326,11 +326,15 @@ splat_validate(struct file *file, splat_subsystem_t *sub, int cmd, void *arg)
}
static int
-splat_ioctl_cfg(struct file *file, unsigned long arg)
+splat_ioctl_cfg(struct file *file, unsigned int cmd, unsigned long arg)
{
splat_cfg_t kcfg;
int rc = 0;
+ /* User and kernel space agree about arg size */
+ if (_IOC_SIZE(cmd) != sizeof(kcfg))
+ return -EBADMSG;
+
if (copy_from_user(&kcfg, (splat_cfg_t *)arg, sizeof(kcfg)))
return -EFAULT;
@@ -362,7 +366,7 @@ splat_ioctl_cfg(struct file *file, unsigned long arg)
case SPLAT_CFG_SUBSYSTEM_LIST:
/* cfg_arg1 - Unused
* cfg_rc1 - Set to number of subsystems
- * cfg_data.splat_subsystems - Populated with subsystems
+ * cfg_data.splat_subsystems - Set with subsystems
*/
rc = splat_subsystem_list(&kcfg, arg);
break;
@@ -380,7 +384,8 @@ splat_ioctl_cfg(struct file *file, unsigned long arg)
rc = splat_test_list(&kcfg, arg);
break;
default:
- splat_print(file, "Bad config command %d\n", kcfg.cfg_cmd);
+ splat_print(file, "Bad config command %d\n",
+ kcfg.cfg_cmd);
rc = -EINVAL;
break;
}
@@ -389,13 +394,17 @@ splat_ioctl_cfg(struct file *file, unsigned long arg)
}
static int
-splat_ioctl_cmd(struct file *file, unsigned long arg)
+splat_ioctl_cmd(struct file *file, unsigned int cmd, unsigned long arg)
{
splat_subsystem_t *sub;
splat_cmd_t kcmd;
int rc = -EINVAL;
void *data = NULL;
+ /* User and kernel space agree about arg size */
+ if (_IOC_SIZE(cmd) != sizeof(kcmd))
+ return -EBADMSG;
+
if (copy_from_user(&kcmd, (splat_cfg_t *)arg, sizeof(kcmd)))
return -EFAULT;
@@ -432,7 +441,7 @@ splat_ioctl_cmd(struct file *file, unsigned long arg)
static int
splat_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg)
+ unsigned int cmd, unsigned long arg)
{
unsigned int minor = iminor(file->f_dentry->d_inode);
int rc = 0;
@@ -446,10 +455,10 @@ splat_ioctl(struct inode *inode, struct file *file,
switch (cmd) {
case SPLAT_CFG:
- rc = splat_ioctl_cfg(file, arg);
+ rc = splat_ioctl_cfg(file, cmd, arg);
break;
case SPLAT_CMD:
- rc = splat_ioctl_cmd(file, arg);
+ rc = splat_ioctl_cmd(file, cmd, arg);
break;
default:
splat_print(file, "Bad ioctl command %d\n", cmd);
diff --git a/module/splat/splat-generic.c b/module/splat/splat-generic.c
index 6da7473e0..d963e50f3 100644
--- a/module/splat/splat-generic.c
+++ b/module/splat/splat-generic.c
@@ -26,7 +26,6 @@
#include "splat-internal.h"
-#define SPLAT_SUBSYSTEM_GENERIC 0x0d00
#define SPLAT_GENERIC_NAME "generic"
#define SPLAT_GENERIC_DESC "Kernel Generic Tests"
diff --git a/module/splat/splat-kmem.c b/module/splat/splat-kmem.c
index f7ea58004..fdf02a917 100644
--- a/module/splat/splat-kmem.c
+++ b/module/splat/splat-kmem.c
@@ -26,7 +26,6 @@
#include "splat-internal.h"
-#define SPLAT_SUBSYSTEM_KMEM 0x0100
#define SPLAT_KMEM_NAME "kmem"
#define SPLAT_KMEM_DESC "Kernel Malloc/Slab Tests"
diff --git a/module/splat/splat-kobj.c b/module/splat/splat-kobj.c
index c646cce1b..cd73a98f3 100644
--- a/module/splat/splat-kobj.c
+++ b/module/splat/splat-kobj.c
@@ -26,7 +26,6 @@
#include "splat-internal.h"
-#define SPLAT_SUBSYSTEM_KOBJ 0x0a00
#define SPLAT_KOBJ_NAME "kobj"
#define SPLAT_KOBJ_DESC "Kernel Kobj Tests"
diff --git a/module/splat/splat-list.c b/module/splat/splat-list.c
index 224eaa63a..e68d4be33 100644
--- a/module/splat/splat-list.c
+++ b/module/splat/splat-list.c
@@ -26,7 +26,6 @@
#include "splat-internal.h"
-#define SPLAT_SUBSYSTEM_LIST 0x0c00
#define SPLAT_LIST_NAME "list"
#define SPLAT_LIST_DESC "Kernel List Tests"
diff --git a/module/splat/splat-mutex.c b/module/splat/splat-mutex.c
index 5c039236e..3d8f94213 100644
--- a/module/splat/splat-mutex.c
+++ b/module/splat/splat-mutex.c
@@ -26,7 +26,6 @@
#include "splat-internal.h"
-#define SPLAT_SUBSYSTEM_MUTEX 0x0400
#define SPLAT_MUTEX_NAME "mutex"
#define SPLAT_MUTEX_DESC "Kernel Mutex Tests"
diff --git a/module/splat/splat-random.c b/module/splat/splat-random.c
index c96dd480c..ed8f694c3 100644
--- a/module/splat/splat-random.c
+++ b/module/splat/splat-random.c
@@ -26,7 +26,6 @@
#include "splat-internal.h"
-#define SPLAT_SUBSYSTEM_KRNG 0x0300
#define SPLAT_KRNG_NAME "krng"
#define SPLAT_KRNG_DESC "Kernel Random Number Generator Tests"
diff --git a/module/splat/splat-rwlock.c b/module/splat/splat-rwlock.c
index 70c9dc3d0..7f19dfb32 100644
--- a/module/splat/splat-rwlock.c
+++ b/module/splat/splat-rwlock.c
@@ -26,7 +26,6 @@
#include "splat-internal.h"
-#define SPLAT_SUBSYSTEM_RWLOCK 0x0700
#define SPLAT_RWLOCK_NAME "rwlock"
#define SPLAT_RWLOCK_DESC "Kernel RW Lock Tests"
diff --git a/module/splat/splat-taskq.c b/module/splat/splat-taskq.c
index a9398f5a5..6ce398a0e 100644
--- a/module/splat/splat-taskq.c
+++ b/module/splat/splat-taskq.c
@@ -26,7 +26,6 @@
#include "splat-internal.h"
-#define SPLAT_SUBSYSTEM_TASKQ 0x0200
#define SPLAT_TASKQ_NAME "taskq"
#define SPLAT_TASKQ_DESC "Kernel Task Queue Tests"
diff --git a/module/splat/splat-thread.c b/module/splat/splat-thread.c
index ca6c46ac3..b88cecb83 100644
--- a/module/splat/splat-thread.c
+++ b/module/splat/splat-thread.c
@@ -26,7 +26,6 @@
#include "splat-internal.h"
-#define SPLAT_SUBSYSTEM_THREAD 0x0600
#define SPLAT_THREAD_NAME "thread"
#define SPLAT_THREAD_DESC "Kernel Thread Tests"
diff --git a/module/splat/splat-time.c b/module/splat/splat-time.c
index 1aa13e520..d9b62be8f 100644
--- a/module/splat/splat-time.c
+++ b/module/splat/splat-time.c
@@ -26,7 +26,6 @@
#include "splat-internal.h"
-#define SPLAT_SUBSYSTEM_TIME 0x0800
#define SPLAT_TIME_NAME "time"
#define SPLAT_TIME_DESC "Kernel Time Tests"
diff --git a/module/splat/splat-vnode.c b/module/splat/splat-vnode.c
index 413651dac..e545ce9f1 100644
--- a/module/splat/splat-vnode.c
+++ b/module/splat/splat-vnode.c
@@ -27,7 +27,6 @@
#include "splat-internal.h"
#include <linux/rcupdate.h>
-#define SPLAT_SUBSYSTEM_VNODE 0x0900
#define SPLAT_VNODE_NAME "vnode"
#define SPLAT_VNODE_DESC "Kernel Vnode Tests"