Commit af6c8eed authored by Cornelia Huck's avatar Cornelia Huck Committed by Linus Torvalds

[PATCH] s390: remove ioctl32 from crypto driver

The ioctl32_conversion routines will be deprecated: Remove them from the
crypto driver.
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 4beb3709
...@@ -385,8 +385,8 @@ static int z90crypt_release(struct inode *, struct file *); ...@@ -385,8 +385,8 @@ static int z90crypt_release(struct inode *, struct file *);
static ssize_t z90crypt_read(struct file *, char __user *, size_t, loff_t *); static ssize_t z90crypt_read(struct file *, char __user *, size_t, loff_t *);
static ssize_t z90crypt_write(struct file *, const char __user *, static ssize_t z90crypt_write(struct file *, const char __user *,
size_t, loff_t *); size_t, loff_t *);
static int z90crypt_ioctl(struct inode *, struct file *, static long z90crypt_unlocked_ioctl(struct file *, unsigned int, unsigned long);
unsigned int, unsigned long); static long z90crypt_compat_ioctl(struct file *, unsigned int, unsigned long);
static void z90crypt_reader_task(unsigned long); static void z90crypt_reader_task(unsigned long);
static void z90crypt_schedule_reader_task(unsigned long); static void z90crypt_schedule_reader_task(unsigned long);
...@@ -436,7 +436,10 @@ static struct file_operations z90crypt_fops = { ...@@ -436,7 +436,10 @@ static struct file_operations z90crypt_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.read = z90crypt_read, .read = z90crypt_read,
.write = z90crypt_write, .write = z90crypt_write,
.ioctl = z90crypt_ioctl, .unlocked_ioctl = z90crypt_unlocked_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = z90crypt_compat_ioctl,
#endif
.open = z90crypt_open, .open = z90crypt_open,
.release = z90crypt_release .release = z90crypt_release
}; };
...@@ -474,14 +477,13 @@ struct ica_rsa_modexpo_32 { // For 32-bit callers ...@@ -474,14 +477,13 @@ struct ica_rsa_modexpo_32 { // For 32-bit callers
compat_uptr_t n_modulus; compat_uptr_t n_modulus;
}; };
static int static long
trans_modexpo32(unsigned int fd, unsigned int cmd, unsigned long arg, trans_modexpo32(struct file *filp, unsigned int cmd, unsigned long arg)
struct file *file)
{ {
struct ica_rsa_modexpo_32 __user *mex32u = compat_ptr(arg); struct ica_rsa_modexpo_32 __user *mex32u = compat_ptr(arg);
struct ica_rsa_modexpo_32 mex32k; struct ica_rsa_modexpo_32 mex32k;
struct ica_rsa_modexpo __user *mex64; struct ica_rsa_modexpo __user *mex64;
int ret = 0; long ret = 0;
unsigned int i; unsigned int i;
if (!access_ok(VERIFY_WRITE, mex32u, sizeof(struct ica_rsa_modexpo_32))) if (!access_ok(VERIFY_WRITE, mex32u, sizeof(struct ica_rsa_modexpo_32)))
...@@ -498,7 +500,7 @@ trans_modexpo32(unsigned int fd, unsigned int cmd, unsigned long arg, ...@@ -498,7 +500,7 @@ trans_modexpo32(unsigned int fd, unsigned int cmd, unsigned long arg,
__put_user(compat_ptr(mex32k.b_key), &mex64->b_key) || __put_user(compat_ptr(mex32k.b_key), &mex64->b_key) ||
__put_user(compat_ptr(mex32k.n_modulus), &mex64->n_modulus)) __put_user(compat_ptr(mex32k.n_modulus), &mex64->n_modulus))
return -EFAULT; return -EFAULT;
ret = sys_ioctl(fd, cmd, (unsigned long)mex64); ret = z90crypt_unlocked_ioctl(filp, cmd, (unsigned long)mex64);
if (!ret) if (!ret)
if (__get_user(i, &mex64->outputdatalength) || if (__get_user(i, &mex64->outputdatalength) ||
__put_user(i, &mex32u->outputdatalength)) __put_user(i, &mex32u->outputdatalength))
...@@ -518,14 +520,13 @@ struct ica_rsa_modexpo_crt_32 { // For 32-bit callers ...@@ -518,14 +520,13 @@ struct ica_rsa_modexpo_crt_32 { // For 32-bit callers
compat_uptr_t u_mult_inv; compat_uptr_t u_mult_inv;
}; };
static int static long
trans_modexpo_crt32(unsigned int fd, unsigned int cmd, unsigned long arg, trans_modexpo_crt32(struct file *filp, unsigned int cmd, unsigned long arg)
struct file *file)
{ {
struct ica_rsa_modexpo_crt_32 __user *crt32u = compat_ptr(arg); struct ica_rsa_modexpo_crt_32 __user *crt32u = compat_ptr(arg);
struct ica_rsa_modexpo_crt_32 crt32k; struct ica_rsa_modexpo_crt_32 crt32k;
struct ica_rsa_modexpo_crt __user *crt64; struct ica_rsa_modexpo_crt __user *crt64;
int ret = 0; long ret = 0;
unsigned int i; unsigned int i;
if (!access_ok(VERIFY_WRITE, crt32u, if (!access_ok(VERIFY_WRITE, crt32u,
...@@ -546,9 +547,8 @@ trans_modexpo_crt32(unsigned int fd, unsigned int cmd, unsigned long arg, ...@@ -546,9 +547,8 @@ trans_modexpo_crt32(unsigned int fd, unsigned int cmd, unsigned long arg,
__put_user(compat_ptr(crt32k.np_prime), &crt64->np_prime) || __put_user(compat_ptr(crt32k.np_prime), &crt64->np_prime) ||
__put_user(compat_ptr(crt32k.nq_prime), &crt64->nq_prime) || __put_user(compat_ptr(crt32k.nq_prime), &crt64->nq_prime) ||
__put_user(compat_ptr(crt32k.u_mult_inv), &crt64->u_mult_inv)) __put_user(compat_ptr(crt32k.u_mult_inv), &crt64->u_mult_inv))
ret = -EFAULT; return -EFAULT;
if (!ret) ret = z90crypt_unlocked_ioctl(filp, cmd, (unsigned long)crt64);
ret = sys_ioctl(fd, cmd, (unsigned long)crt64);
if (!ret) if (!ret)
if (__get_user(i, &crt64->outputdatalength) || if (__get_user(i, &crt64->outputdatalength) ||
__put_user(i, &crt32u->outputdatalength)) __put_user(i, &crt32u->outputdatalength))
...@@ -556,66 +556,34 @@ trans_modexpo_crt32(unsigned int fd, unsigned int cmd, unsigned long arg, ...@@ -556,66 +556,34 @@ trans_modexpo_crt32(unsigned int fd, unsigned int cmd, unsigned long arg,
return ret; return ret;
} }
static int compatible_ioctls[] = { static long
ICAZ90STATUS, Z90QUIESCE, Z90STAT_TOTALCOUNT, Z90STAT_PCICACOUNT, z90crypt_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
Z90STAT_PCICCCOUNT, Z90STAT_PCIXCCCOUNT, Z90STAT_PCIXCCMCL2COUNT,
Z90STAT_PCIXCCMCL3COUNT, Z90STAT_CEX2CCOUNT, Z90STAT_REQUESTQ_COUNT,
Z90STAT_PENDINGQ_COUNT, Z90STAT_TOTALOPEN_COUNT, Z90STAT_DOMAIN_INDEX,
Z90STAT_STATUS_MASK, Z90STAT_QDEPTH_MASK, Z90STAT_PERDEV_REQCNT,
};
static void z90_unregister_ioctl32s(void)
{
int i;
unregister_ioctl32_conversion(ICARSAMODEXPO);
unregister_ioctl32_conversion(ICARSACRT);
for(i = 0; i < ARRAY_SIZE(compatible_ioctls); i++)
unregister_ioctl32_conversion(compatible_ioctls[i]);
}
static int z90_register_ioctl32s(void)
{ {
int result, i; switch (cmd) {
case ICAZ90STATUS:
result = register_ioctl32_conversion(ICARSAMODEXPO, trans_modexpo32); case Z90QUIESCE:
if (result == -EBUSY) { case Z90STAT_TOTALCOUNT:
unregister_ioctl32_conversion(ICARSAMODEXPO); case Z90STAT_PCICACOUNT:
result = register_ioctl32_conversion(ICARSAMODEXPO, case Z90STAT_PCICCCOUNT:
trans_modexpo32); case Z90STAT_PCIXCCCOUNT:
} case Z90STAT_PCIXCCMCL2COUNT:
if (result) case Z90STAT_PCIXCCMCL3COUNT:
return result; case Z90STAT_CEX2CCOUNT:
result = register_ioctl32_conversion(ICARSACRT, trans_modexpo_crt32); case Z90STAT_REQUESTQ_COUNT:
if (result == -EBUSY) { case Z90STAT_PENDINGQ_COUNT:
unregister_ioctl32_conversion(ICARSACRT); case Z90STAT_TOTALOPEN_COUNT:
result = register_ioctl32_conversion(ICARSACRT, case Z90STAT_DOMAIN_INDEX:
trans_modexpo_crt32); case Z90STAT_STATUS_MASK:
} case Z90STAT_QDEPTH_MASK:
if (result) case Z90STAT_PERDEV_REQCNT:
return result; return z90crypt_unlocked_ioctl(filp, cmd, arg);
case ICARSAMODEXPO:
for(i = 0; i < ARRAY_SIZE(compatible_ioctls); i++) { return trans_modexpo32(filp, cmd, arg);
result = register_ioctl32_conversion(compatible_ioctls[i], 0); case ICARSACRT:
if (result == -EBUSY) { return trans_modexpo_crt32(filp, cmd, arg);
unregister_ioctl32_conversion(compatible_ioctls[i]); default:
result = register_ioctl32_conversion( return -ENOIOCTLCMD;
compatible_ioctls[i], 0);
}
if (result)
return result;
} }
return 0;
}
#else // !CONFIG_COMPAT
static inline void z90_unregister_ioctl32s(void)
{
}
static inline int z90_register_ioctl32s(void)
{
return 0;
} }
#endif #endif
...@@ -730,14 +698,9 @@ z90crypt_init_module(void) ...@@ -730,14 +698,9 @@ z90crypt_init_module(void)
reader_timer.expires = jiffies + (READERTIME * HZ / 1000); reader_timer.expires = jiffies + (READERTIME * HZ / 1000);
add_timer(&reader_timer); add_timer(&reader_timer);
if ((result = z90_register_ioctl32s()))
goto init_module_cleanup;
return 0; // success return 0; // success
init_module_cleanup: init_module_cleanup:
z90_unregister_ioctl32s();
#ifndef Z90CRYPT_USE_HOTPLUG #ifndef Z90CRYPT_USE_HOTPLUG
if ((nresult = misc_deregister(&z90crypt_misc_device))) if ((nresult = misc_deregister(&z90crypt_misc_device)))
PRINTK("misc_deregister failed with %d.\n", nresult); PRINTK("misc_deregister failed with %d.\n", nresult);
...@@ -763,8 +726,6 @@ z90crypt_cleanup_module(void) ...@@ -763,8 +726,6 @@ z90crypt_cleanup_module(void)
PDEBUG("PID %d\n", PID()); PDEBUG("PID %d\n", PID());
z90_unregister_ioctl32s();
remove_proc_entry("driver/z90crypt", 0); remove_proc_entry("driver/z90crypt", 0);
#ifndef Z90CRYPT_USE_HOTPLUG #ifndef Z90CRYPT_USE_HOTPLUG
...@@ -800,7 +761,7 @@ z90crypt_cleanup_module(void) ...@@ -800,7 +761,7 @@ z90crypt_cleanup_module(void)
* z90crypt_release * z90crypt_release
* z90crypt_read * z90crypt_read
* z90crypt_write * z90crypt_write
* z90crypt_ioctl * z90crypt_unlocked_ioctl
* z90crypt_status * z90crypt_status
* z90crypt_status_write * z90crypt_status_write
* disable_card * disable_card
...@@ -1804,9 +1765,8 @@ z90crypt_rsa(struct priv_data *private_data_p, pid_t pid, ...@@ -1804,9 +1765,8 @@ z90crypt_rsa(struct priv_data *private_data_p, pid_t pid,
* This function is a little long, but it's really just one large switch * This function is a little long, but it's really just one large switch
* statement. * statement.
*/ */
static int static long
z90crypt_ioctl(struct inode *inode, struct file *filp, z90crypt_unlocked_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
struct priv_data *private_data_p = filp->private_data; struct priv_data *private_data_p = filp->private_data;
unsigned char *status; unsigned char *status;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment