diff options
Diffstat (limited to 'drivers/s390/char/fs3270.c')
-rw-r--r-- | drivers/s390/char/fs3270.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c index 247b2b934728..31c59b0d6df0 100644 --- a/drivers/s390/char/fs3270.c +++ b/drivers/s390/char/fs3270.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
16 | #include <linux/smp_lock.h> | 16 | #include <linux/smp_lock.h> |
17 | 17 | ||
18 | #include <asm/compat.h> | ||
18 | #include <asm/ccwdev.h> | 19 | #include <asm/ccwdev.h> |
19 | #include <asm/cio.h> | 20 | #include <asm/cio.h> |
20 | #include <asm/ebcdic.h> | 21 | #include <asm/ebcdic.h> |
@@ -322,6 +323,7 @@ fs3270_write(struct file *filp, const char __user *data, size_t count, loff_t *o | |||
322 | static long | 323 | static long |
323 | fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 324 | fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
324 | { | 325 | { |
326 | char __user *argp; | ||
325 | struct fs3270 *fp; | 327 | struct fs3270 *fp; |
326 | struct raw3270_iocb iocb; | 328 | struct raw3270_iocb iocb; |
327 | int rc; | 329 | int rc; |
@@ -329,6 +331,10 @@ fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
329 | fp = filp->private_data; | 331 | fp = filp->private_data; |
330 | if (!fp) | 332 | if (!fp) |
331 | return -ENODEV; | 333 | return -ENODEV; |
334 | if (is_compat_task()) | ||
335 | argp = compat_ptr(arg); | ||
336 | else | ||
337 | argp = (char __user *)arg; | ||
332 | rc = 0; | 338 | rc = 0; |
333 | mutex_lock(&fs3270_mutex); | 339 | mutex_lock(&fs3270_mutex); |
334 | switch (cmd) { | 340 | switch (cmd) { |
@@ -339,10 +345,10 @@ fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
339 | fp->write_command = arg; | 345 | fp->write_command = arg; |
340 | break; | 346 | break; |
341 | case TUBGETI: | 347 | case TUBGETI: |
342 | rc = put_user(fp->read_command, (char __user *) arg); | 348 | rc = put_user(fp->read_command, argp); |
343 | break; | 349 | break; |
344 | case TUBGETO: | 350 | case TUBGETO: |
345 | rc = put_user(fp->write_command,(char __user *) arg); | 351 | rc = put_user(fp->write_command, argp); |
346 | break; | 352 | break; |
347 | case TUBGETMOD: | 353 | case TUBGETMOD: |
348 | iocb.model = fp->view.model; | 354 | iocb.model = fp->view.model; |
@@ -351,8 +357,7 @@ fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
351 | iocb.pf_cnt = 24; | 357 | iocb.pf_cnt = 24; |
352 | iocb.re_cnt = 20; | 358 | iocb.re_cnt = 20; |
353 | iocb.map = 0; | 359 | iocb.map = 0; |
354 | if (copy_to_user((char __user *) arg, &iocb, | 360 | if (copy_to_user(argp, &iocb, sizeof(struct raw3270_iocb))) |
355 | sizeof(struct raw3270_iocb))) | ||
356 | rc = -EFAULT; | 361 | rc = -EFAULT; |
357 | break; | 362 | break; |
358 | } | 363 | } |
@@ -511,8 +516,8 @@ static const struct file_operations fs3270_fops = { | |||
511 | .write = fs3270_write, /* write */ | 516 | .write = fs3270_write, /* write */ |
512 | .unlocked_ioctl = fs3270_ioctl, /* ioctl */ | 517 | .unlocked_ioctl = fs3270_ioctl, /* ioctl */ |
513 | .compat_ioctl = fs3270_ioctl, /* ioctl */ | 518 | .compat_ioctl = fs3270_ioctl, /* ioctl */ |
514 | .open = fs3270_open, /* open */ | 519 | .open = fs3270_open, /* open */ |
515 | .release = fs3270_close, /* release */ | 520 | .release = fs3270_close, /* release */ |
516 | }; | 521 | }; |
517 | 522 | ||
518 | /* | 523 | /* |