* [PATCH] dpt_i2o.c: fix transferred data length for scsi_set_resid()
@ 2008-11-04 23:09 Miquel van Smoorenburg
2008-11-05 14:05 ` Boaz Harrosh
0 siblings, 1 reply; 3+ messages in thread
From: Miquel van Smoorenburg @ 2008-11-04 23:09 UTC (permalink / raw)
To: linux-scsi; +Cc: James Bottomley, mikevs
This should go into 2.6.28 and -stable, I think.
dpt_i2o-fix-xferlen-for-scsi_set_resid.patch
[PATCH] dpt_i2o.c: fix transferred data length for scsi_set_resid()
dpt_i2o.c::adpt_i2o_to_scsi() reads the value at (reply+5) which
should contain the length in bytes of the transferred data. This
would be correct if reply was a u32 *. However it is a void * here,
so we need to read the value at (reply+20) instead.
The value at (reply+5) is usually 0xff0000, which is apparently
'large enough' and didn't cause any trouble until 2.6.27 where
427e59f09fdba387547106de7bab980b7fff77be caused this to become
visible through e.g. iostat -x .
Signed-off-by: Miquel van Smoorenburg <mikevs@xs4all.net>
--- linux-2.6.27.4/drivers/scsi/dpt_i2o.c.ORIG 2008-10-26 00:05:07.000000000 +0200
+++ linux-2.6.27.4/drivers/scsi/dpt_i2o.c 2008-11-04 23:43:13.000000000 +0100
@@ -2445,7 +2445,7 @@
hba_status = detailed_status >> 8;
// calculate resid for sg
- scsi_set_resid(cmd, scsi_bufflen(cmd) - readl(reply+5));
+ scsi_set_resid(cmd, scsi_bufflen(cmd) - readl(reply+20));
pHba = (adpt_hba*) cmd->device->host->hostdata[0];
@@ -2456,7 +2456,7 @@
case I2O_SCSI_DSC_SUCCESS:
cmd->result = (DID_OK << 16);
// handle underflow
- if(readl(reply+5) < cmd->underflow ) {
+ if (readl(reply+20) < cmd->underflow) {
cmd->result = (DID_ERROR <<16);
printk(KERN_WARNING"%s: SCSI CMD underflow\n",pHba->name);
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] dpt_i2o.c: fix transferred data length for scsi_set_resid()
2008-11-04 23:09 [PATCH] dpt_i2o.c: fix transferred data length for scsi_set_resid() Miquel van Smoorenburg
@ 2008-11-05 14:05 ` Boaz Harrosh
2008-11-06 15:48 ` Miquel van Smoorenburg
0 siblings, 1 reply; 3+ messages in thread
From: Boaz Harrosh @ 2008-11-05 14:05 UTC (permalink / raw)
To: Miquel van Smoorenburg; +Cc: linux-scsi, James Bottomley
Miquel van Smoorenburg wrote:
> This should go into 2.6.28 and -stable, I think.
>
> dpt_i2o-fix-xferlen-for-scsi_set_resid.patch
>
> [PATCH] dpt_i2o.c: fix transferred data length for scsi_set_resid()
>
> dpt_i2o.c::adpt_i2o_to_scsi() reads the value at (reply+5) which
> should contain the length in bytes of the transferred data. This
> would be correct if reply was a u32 *. However it is a void * here,
> so we need to read the value at (reply+20) instead.
>
> The value at (reply+5) is usually 0xff0000, which is apparently
> 'large enough' and didn't cause any trouble until 2.6.27 where
> 427e59f09fdba387547106de7bab980b7fff77be caused this to become
> visible through e.g. iostat -x .
>
> Signed-off-by: Miquel van Smoorenburg <mikevs@xs4all.net>
>
> --- linux-2.6.27.4/drivers/scsi/dpt_i2o.c.ORIG 2008-10-26 00:05:07.000000000 +0200
> +++ linux-2.6.27.4/drivers/scsi/dpt_i2o.c 2008-11-04 23:43:13.000000000 +0100
> @@ -2445,7 +2445,7 @@
> hba_status = detailed_status >> 8;
>
> // calculate resid for sg
> - scsi_set_resid(cmd, scsi_bufflen(cmd) - readl(reply+5));
> + scsi_set_resid(cmd, scsi_bufflen(cmd) - readl(reply+20));
>
I do wish that someone could do a:
+ scsi_set_resid(cmd, scsi_bufflen(cmd) - readl(REG_BYTE_COUNT));
or what ever. To prevent just these errors from happening.
> pHba = (adpt_hba*) cmd->device->host->hostdata[0];
>
> @@ -2456,7 +2456,7 @@
> case I2O_SCSI_DSC_SUCCESS:
> cmd->result = (DID_OK << 16);
> // handle underflow
> - if(readl(reply+5) < cmd->underflow ) {
> + if (readl(reply+20) < cmd->underflow) {
Look here it is used a gain. I would say it calls for a constant
> cmd->result = (DID_ERROR <<16);
> printk(KERN_WARNING"%s: SCSI CMD underflow\n",pHba->name);
> }
I understand that this is not your fault, but Just for the record, as a
"TODO:" comment for us all.
Thanks
Boaz
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] dpt_i2o.c: fix transferred data length for scsi_set_resid()
2008-11-05 14:05 ` Boaz Harrosh
@ 2008-11-06 15:48 ` Miquel van Smoorenburg
0 siblings, 0 replies; 3+ messages in thread
From: Miquel van Smoorenburg @ 2008-11-06 15:48 UTC (permalink / raw)
To: Boaz Harrosh; +Cc: linux-scsi, James Bottomley
On Wed, 2008-11-05 at 16:05 +0200, Boaz Harrosh wrote:
> Miquel van Smoorenburg wrote:
> > This should go into 2.6.28 and -stable, I think.
> >
> > dpt_i2o-fix-xferlen-for-scsi_set_resid.patch
>
>
> I do wish that someone could do a:
> + scsi_set_resid(cmd, scsi_bufflen(cmd) - readl(REG_BYTE_COUNT));
>
> or what ever. To prevent just these errors from happening.
>
> I understand that this is not your fault, but Just for the record, as a
> "TODO:" comment for us all.
Yes, dpt_i2o could use some more cleaning up. A while ago I said I'd
look at that (after I did the 64-bit support patches), but due to
circumstances I have even less time available than usual.
Anyway, this is the minimal patch for 2.6.28 and 2.6.27-stable, which is
correct for -rc and -stable patches, right ?
Mike.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-11-06 15:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-04 23:09 [PATCH] dpt_i2o.c: fix transferred data length for scsi_set_resid() Miquel van Smoorenburg
2008-11-05 14:05 ` Boaz Harrosh
2008-11-06 15:48 ` Miquel van Smoorenburg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox