]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[PATCH] cciss: bug fix for BIG_PASS_THRU
authorJens Axboe <axboe@suse.de>
Fri, 18 Nov 2005 22:02:54 +0000 (14:02 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 14 Dec 2005 23:43:00 +0000 (15:43 -0800)
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 <mike.miller@hp.com>
Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/block/cciss.c

index 486b6e1c7dfb96aaa1a8e98e06169d7ce7164f27..7bb1f1aac0e096672597403e420a51ddadc3fcec 100644 (file)
@@ -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);
                        }