aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ncpfs/ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ncpfs/ioctl.c')
-rw-r--r--fs/ncpfs/ioctl.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c
index d6e0c089e1b1..eb3813ad136f 100644
--- a/fs/ncpfs/ioctl.c
+++ b/fs/ncpfs/ioctl.c
@@ -518,10 +518,11 @@ outrel:
518 if (user.object_name_len > NCP_OBJECT_NAME_MAX_LEN) 518 if (user.object_name_len > NCP_OBJECT_NAME_MAX_LEN)
519 return -ENOMEM; 519 return -ENOMEM;
520 if (user.object_name_len) { 520 if (user.object_name_len) {
521 newname = ncp_kmalloc(user.object_name_len, GFP_USER); 521 newname = kmalloc(user.object_name_len, GFP_USER);
522 if (!newname) return -ENOMEM; 522 if (!newname)
523 return -ENOMEM;
523 if (copy_from_user(newname, user.object_name, user.object_name_len)) { 524 if (copy_from_user(newname, user.object_name, user.object_name_len)) {
524 ncp_kfree_s(newname, user.object_name_len); 525 kfree(newname);
525 return -EFAULT; 526 return -EFAULT;
526 } 527 }
527 } else { 528 } else {
@@ -540,8 +541,8 @@ outrel:
540 server->priv.len = 0; 541 server->priv.len = 0;
541 server->priv.data = NULL; 542 server->priv.data = NULL;
542 /* leave critical section */ 543 /* leave critical section */
543 if (oldprivate) ncp_kfree_s(oldprivate, oldprivatelen); 544 kfree(oldprivate);
544 if (oldname) ncp_kfree_s(oldname, oldnamelen); 545 kfree(oldname);
545 return 0; 546 return 0;
546 } 547 }
547 case NCP_IOC_GETPRIVATEDATA: 548 case NCP_IOC_GETPRIVATEDATA:
@@ -581,10 +582,11 @@ outrel:
581 if (user.len > NCP_PRIVATE_DATA_MAX_LEN) 582 if (user.len > NCP_PRIVATE_DATA_MAX_LEN)
582 return -ENOMEM; 583 return -ENOMEM;
583 if (user.len) { 584 if (user.len) {
584 new = ncp_kmalloc(user.len, GFP_USER); 585 new = kmalloc(user.len, GFP_USER);
585 if (!new) return -ENOMEM; 586 if (!new)
587 return -ENOMEM;
586 if (copy_from_user(new, user.data, user.len)) { 588 if (copy_from_user(new, user.data, user.len)) {
587 ncp_kfree_s(new, user.len); 589 kfree(new);
588 return -EFAULT; 590 return -EFAULT;
589 } 591 }
590 } else { 592 } else {
@@ -596,7 +598,7 @@ outrel:
596 server->priv.len = user.len; 598 server->priv.len = user.len;
597 server->priv.data = new; 599 server->priv.data = new;
598 /* leave critical section */ 600 /* leave critical section */
599 if (old) ncp_kfree_s(old, oldlen); 601 kfree(old);
600 return 0; 602 return 0;
601 } 603 }
602 604