diff options
author | Eli Billauer <eli.billauer@gmail.com> | 2015-03-27 04:56:06 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-04-03 10:15:30 -0400 |
commit | 127af8828518074ab24e9b5678229513d198d832 (patch) | |
tree | a90aa2b61478e17ea53de4caba0874d13cf87b31 /drivers/char/xillybus | |
parent | be29bc2eaa5360537df422a237c889dc493492f4 (diff) |
char: xillybus: Don't return -EFAULT on user-triggered flush
The API allows the application to flush a host-to-FPGA stream by calling
write() with the data count set to zero. Before this patch, copy_from_user()
was called with a non-zero byte count, which possibly made it attempt to read
from unmapped user memory. Such attempts caused the driver to return -EFAULT
instead of 0, even though the desired operation went through fine.
This patch ensures the driver returns 0 on a successful flush.
Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/char/xillybus')
-rw-r--r-- | drivers/char/xillybus/xillybus_core.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/char/xillybus/xillybus_core.c b/drivers/char/xillybus/xillybus_core.c index b827fa095f1b..77d6c127e691 100644 --- a/drivers/char/xillybus/xillybus_core.c +++ b/drivers/char/xillybus/xillybus_core.c | |||
@@ -1237,6 +1237,8 @@ static ssize_t xillybus_write(struct file *filp, const char __user *userbuf, | |||
1237 | unsigned char *tail; | 1237 | unsigned char *tail; |
1238 | int i; | 1238 | int i; |
1239 | 1239 | ||
1240 | howmany = 0; | ||
1241 | |||
1240 | end_offset_plus1 = bufpos >> | 1242 | end_offset_plus1 = bufpos >> |
1241 | channel->log2_element_size; | 1243 | channel->log2_element_size; |
1242 | 1244 | ||