Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 219779
b: refs/heads/master
c: 7b1f6bf
h: refs/heads/master
i:
  219777: aa883e0
  219775: 9137fd0
v: v3
  • Loading branch information
Vasiliy Kulikov authored and Greg Kroah-Hartman committed Sep 5, 2010
1 parent bc04604 commit 366e2c8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ec53d6123bea9f69887f194b5d4294a43292120d
refs/heads/master: 7b1f6bfb03cca84af40aa9142ddf99ace9894f6e
10 changes: 9 additions & 1 deletion trunk/drivers/staging/westbridge/astoria/gadget/cyasgadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,8 @@ static int cyasgadget_ioctl(

/* better use fixed size buff*/
alloc_filename = kmalloc(k_d.name_length + 1, GFP_KERNEL);
if (alloc_filename == NULL)
return -ENOMEM;

/* get the filename */
if (copy_from_user(alloc_filename, k_d.file_name,
Expand All @@ -1132,12 +1134,13 @@ static int cyasgadget_ioctl(
"copy file name from user space failed\n",
__func__);
#endif
kfree(alloc_filename);
return -EFAULT;
}

file_to_allocate = filp_open(alloc_filename, O_RDWR, 0);

if ((int)file_to_allocate != 0xfffffffe) {
if (!IS_ERR(file_to_allocate)) {

struct address_space *mapping =
file_to_allocate->f_mapping;
Expand Down Expand Up @@ -1379,6 +1382,7 @@ static int cyasgadget_ioctl(
__func__, alloc_filename);
} /* end if (file_to_allocate)*/
#endif
kfree(alloc_filename);
initsoj_safe_exit:
ret_stat = 0;
retval = __put_user(ret_stat,
Expand Down Expand Up @@ -1410,12 +1414,15 @@ static int cyasgadget_ioctl(
return -EFAULT;

map_filename = kmalloc(k_d.name_length + 1, GFP_KERNEL);
if (map_filename == NULL)
return -ENOMEM;
if (copy_from_user(map_filename, k_d.file_name,
k_d.name_length + 1)) {
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message("%s: copy file name from "
"user space failed\n", __func__);
#endif
kfree(map_filename);
return -EFAULT;
}

Expand Down Expand Up @@ -1561,6 +1568,7 @@ static int cyasgadget_ioctl(
__func__, map_filename);
}
#endif
kfree(map_filename);

ret_stat = 0;
retval = __put_user(ret_stat, (uint32_t __user *)
Expand Down

0 comments on commit 366e2c8

Please sign in to comment.