From 1a6e1022c1f5cc1ae2efb73ff2b4daf5eec5819f Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 18 Nov 2005 14:02:54 -0800 Subject: [PATCH] cciss: bug fix for BIG_PASS_THRU Applications using CCISS_BIG_PASSTHRU complained that the data written was zeros. The problem is that the buffer is being cleared after the user copy, unless the user copy has failed... Correct that logic. Signed-off-by: Mike Miller Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/block/cciss.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 486b6e1c7df..7bb1f1aac0e 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -1016,10 +1016,11 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, status = -ENOMEM; goto cleanup1; } - if (ioc->Request.Type.Direction == XFER_WRITE && - copy_from_user(buff[sg_used], data_ptr, sz)) { + if (ioc->Request.Type.Direction == XFER_WRITE) { + if (copy_from_user(buff[sg_used], data_ptr, sz)) { status = -ENOMEM; - goto cleanup1; + goto cleanup1; + } } else { memset(buff[sg_used], 0, sz); } -- cgit v1.2.3-18-g5258