[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1427446566-17606-1-git-send-email-eli.billauer@gmail.com>
Date: Fri, 27 Mar 2015 11:56:06 +0300
From: Eli Billauer <eli.billauer@...il.com>
To: arnd@...db.de, gregkh@...uxfoundation.org
Cc: linux-kernel@...r.kernel.org, Eli Billauer <eli.billauer@...il.com>
Subject: [PATCH] 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@...il.com>
---
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 b827fa0..77d6c12 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,
unsigned char *tail;
int i;
+ howmany = 0;
+
end_offset_plus1 = bufpos >>
channel->log2_element_size;
--
1.7.2.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists