]> asedeno.scripts.mit.edu Git - linux.git/commit
char: xillybus: Don't return -EFAULT on user-triggered flush
authorEli Billauer <eli.billauer@gmail.com>
Fri, 27 Mar 2015 08:56:06 +0000 (11:56 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Apr 2015 14:15:30 +0000 (16:15 +0200)
commit127af8828518074ab24e9b5678229513d198d832
treea90aa2b61478e17ea53de4caba0874d13cf87b31
parentbe29bc2eaa5360537df422a237c889dc493492f4
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>
drivers/char/xillybus/xillybus_core.c