diff options
author | Stephen M. Cameron <scameron@beardog.cce.hp.com> | 2014-05-29 11:52:41 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-06-02 03:54:52 -0400 |
commit | 9233fb10f35ab523f788e635ff07c355bb31bbdd (patch) | |
tree | b807ad655c867cb81fac729b08d9e7d544f9c456 | |
parent | 84ce1ee5bf0de5daec3d28d009d74099cee3cf46 (diff) |
hpsa: allow passthru ioctls to work with bidirectional commands
Treat the the data direction bits as a bit mask allowing both
READ and WRITE at the same time instead of testing for equality
to see if it's a exclusively a READ or a WRITE.
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Mike Miller <michael.miller@canonical.com>
Reviewed-by: Webb Scales <webb.scales@hp.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r-- | drivers/scsi/hpsa.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 13c53fa410ea..59e7b19a971b 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -4963,7 +4963,7 @@ static int hpsa_passthru_ioctl(struct ctlr_info *h, void __user *argp) | |||
4963 | buff = kmalloc(iocommand.buf_size, GFP_KERNEL); | 4963 | buff = kmalloc(iocommand.buf_size, GFP_KERNEL); |
4964 | if (buff == NULL) | 4964 | if (buff == NULL) |
4965 | return -EFAULT; | 4965 | return -EFAULT; |
4966 | if (iocommand.Request.Type.Direction == XFER_WRITE) { | 4966 | if (iocommand.Request.Type.Direction & XFER_WRITE) { |
4967 | /* Copy the data into the buffer we created */ | 4967 | /* Copy the data into the buffer we created */ |
4968 | if (copy_from_user(buff, iocommand.buf, | 4968 | if (copy_from_user(buff, iocommand.buf, |
4969 | iocommand.buf_size)) { | 4969 | iocommand.buf_size)) { |
@@ -5026,7 +5026,7 @@ static int hpsa_passthru_ioctl(struct ctlr_info *h, void __user *argp) | |||
5026 | rc = -EFAULT; | 5026 | rc = -EFAULT; |
5027 | goto out; | 5027 | goto out; |
5028 | } | 5028 | } |
5029 | if (iocommand.Request.Type.Direction == XFER_READ && | 5029 | if ((iocommand.Request.Type.Direction & XFER_READ) && |
5030 | iocommand.buf_size > 0) { | 5030 | iocommand.buf_size > 0) { |
5031 | /* Copy the data out of the buffer we created */ | 5031 | /* Copy the data out of the buffer we created */ |
5032 | if (copy_to_user(iocommand.buf, buff, iocommand.buf_size)) { | 5032 | if (copy_to_user(iocommand.buf, buff, iocommand.buf_size)) { |
@@ -5103,7 +5103,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp) | |||
5103 | status = -ENOMEM; | 5103 | status = -ENOMEM; |
5104 | goto cleanup1; | 5104 | goto cleanup1; |
5105 | } | 5105 | } |
5106 | if (ioc->Request.Type.Direction == XFER_WRITE) { | 5106 | if (ioc->Request.Type.Direction & XFER_WRITE) { |
5107 | if (copy_from_user(buff[sg_used], data_ptr, sz)) { | 5107 | if (copy_from_user(buff[sg_used], data_ptr, sz)) { |
5108 | status = -ENOMEM; | 5108 | status = -ENOMEM; |
5109 | goto cleanup1; | 5109 | goto cleanup1; |
@@ -5155,7 +5155,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp) | |||
5155 | status = -EFAULT; | 5155 | status = -EFAULT; |
5156 | goto cleanup0; | 5156 | goto cleanup0; |
5157 | } | 5157 | } |
5158 | if (ioc->Request.Type.Direction == XFER_READ && ioc->buf_size > 0) { | 5158 | if ((ioc->Request.Type.Direction & XFER_READ) && ioc->buf_size > 0) { |
5159 | /* Copy the data out of the buffer we created */ | 5159 | /* Copy the data out of the buffer we created */ |
5160 | BYTE __user *ptr = ioc->buf; | 5160 | BYTE __user *ptr = ioc->buf; |
5161 | for (i = 0; i < sg_used; i++) { | 5161 | for (i = 0; i < sg_used; i++) { |