bug in gdth.c crashing machine
PATCH 29/29 bug in gdth.c crashing machine
From: Joerg Dorchain <[email protected]>
Undocumented...
---
drivers/scsi/gdth.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/gdth.c renamed from drivers/scsi/gdth.c~bug-in-gdthc-crashing-machine +2 -0
@@ -3091,6 +3091,7 @@ static int gdth_fill_raw_cmd(int hanum,S cmdp->u.raw64.direction = gdth_direction_tab[scp->cmnd[0 ]]==DOU ?GDTH_DATA_OUT :GDTH_DATA_IN ;memcpy (cmdp->u.raw64.cmd,scp->cmnd,16 ); + cmdp->u.raw64.sg_ranz =0 ; }else { cmdp->u.raw.reserved =0 ; cmdp->u.raw.mdisc_time =0 ;
@@ -3107,6 +3108,7 @@ static int gdth_fill_raw_cmd(int hanum,S cmdp->u.raw.direction = gdth_direction_tab[scp->cmnd[0 ]]==DOU ?GDTH_DATA_OUT :GDTH_DATA_IN ;memcpy (cmdp->u.raw.cmd,scp->cmnd,12 ); + cmdp->u.raw.sg_ranz =0 ; }if (scp->use_sg) {
_
Quoted 3 lines · On Tue, 2007-03-06 at 02:46 -0800, [email protected] wrote:
From: Joerg Dorchain <[email protected]>
Undocumented...
This is a bit of a problem, isn't it?
I have no report of any problem this fixes, and no input from the gdth maintainer about this. The first I actually knew of this patch request is that it appeared in an akpm patch stream yesterday.
I really think we need more details before this gets applied to anything, let alone the stable tree.
James
Quoted 5 lines · James Bottomley
Quoted 3 lines · On Tue, 2007-03-06 at 02:46 -0800, [email protected] wrote:
From: Joerg Dorchain <[email protected]>
Undocumented...
Quoted 8 lines
This is a bit of a problem, isn't it?
I have no report of any problem this fixes, and no input from the gdth maintainer about this. The first I actually knew of this patch request is that it appeared in an akpm patch stream yesterday.
I really think we need more details before this gets applied to anything, let alone the stable tree.
Randy did forward it to the stable team a while ago too, but I didn't know even what tree it applied to as the patch level was a bit off. I think he might have some more information about it?
thanks,
greg k-h
Quoted 12 lines · On Wed, 7 Mar 2007 09:40:21 -0800 Greg KH <[email protected]> wrote:
Quoted 11 lines · James Bottomley
Quoted 3 lines · On Tue, 2007-03-06 at 02:46 -0800, [email protected] wrote:
From: Joerg Dorchain <[email protected]>
Undocumented...
This is a bit of a problem, isn't it?
I have no report of any problem this fixes, and no input from the gdth maintainer about this. The first I actually knew of this patch request is that it appeared in an akpm patch stream yesterday.
Quoted 7 lines
Quoted 2 lines
I really think we need more details before this gets applied to anything, let alone the stable tree.
Randy did forward it to the stable team a while ago too, but I didn't know even what tree it applied to as the patch level was a bit off. I think he might have some more information about it?
Achim did reply: http://lkml.org/lkml/2007/2/23/138
So we don't know what the patch does, but it should be merged into -stable (and mainline, heaven forfend)
Quoted 15 lines · Andrew Morton
Quoted 15 lines · James Bottomley
Quoted 13 lines · On Tue, 2007-03-06 at 02:46 -0800, [email protected] wrote:
Quoted 3 lines
From: Joerg Dorchain <[email protected]>
Undocumented...
This is a bit of a problem, isn't it?
I have no report of any problem this fixes, and no input from the gdth maintainer about this. The first I actually knew of this patch request is that it appeared in an akpm patch stream yesterday.
I really think we need more details before this gets applied to anything, let alone the stable tree.
Quoted 6 lines
Quoted 4 lines
Randy did forward it to the stable team a while ago too, but I didn't know even what tree it applied to as the patch level was a bit off. I think he might have some more information about it?
Achim did reply: http://lkml.org/lkml/2007/2/23/138
The current gdth driver crashes the machine with a panic() when accessing certain tape drives, really not a good thing for stable.
This patch fixes it, tested by me and acknowledged by Achim. See http://lkml.org/lkml/2006/10/13/60 and
http://lkml.org/lkml/2006/10/12/35 for further reference.
The patch is against Linus' 2.6.20
Bye,
Joerg
Quoted 1 line · Andrew Morton
Achim did reply: http://lkml.org/lkml/2007/2/23/138
Ah ... OK; sorry, I'm parochial ... if it didn't appear on linux-scsi, you can usually assume I haven't seen it.
Quoted 3 lines
So we don't know what the patch does, but it should be merged into -stable
(and mainline, heaven forfend)
Well ... I would, except what this patch does is to initialise the command sg_ranz field (for both 64 bit and 32 bit commands). If you look in the code just below the patch application at the
if (scp->use_sg) {
...
} else if (scp->request_bufflen) {
...
}
You'll find a line setting these parameters in each of the cases of the if statement. So the bug appears to be that there's a missing else clause to this if, which would initialise the zero transfer commands. Is that a correct analysis?
James
Quoted 20 lines · James Bottomley
Quoted 1 line · Andrew Morton
Achim did reply: http://lkml.org/lkml/2007/2/23/138
Ah ... OK; sorry, I'm parochial ... if it didn't appear on linux-scsi, you can usually assume I haven't seen it.
Quoted 3 lines
So we don't know what the patch does, but it should be merged into -stable
(and mainline, heaven forfend)Well ... I would, except what this patch does is to initialise the command
sg_ranzfield (for both 64 bit and 32 bit commands). If you look in the code just below the patch application at theif (
scp->use_sg) {
...
} else if (scp->request_bufflen) {
...
}
Quoted 4 lines
You'll find a line setting these parameters in each of the cases of the if statement. So the bug appears to be that there's a missing else clause to this if, which would initialise the zero transfer commands. Is that a correct analysis?
Well, as no one has really responded to this thread about what the patch really does, and it's not in even James's tree yet, I've dropped it from -stable.
If James does send it to Linus, I'll be glad to reconsider it at that time.
thanks,
greg k-h
James Bottomley
Acked-by Leubner, AchimQuoted 26 lines · Greg KH
Quoted 20 lines · James Bottomley
Quoted 1 line · Andrew Morton
Achim did reply: http://lkml.org/lkml/2007/2/23/138
Ah ... OK; sorry, I'm parochial ... if it didn't appear on linux-scsi, you can usually assume I haven't seen it.
Quoted 3 lines
So we don't know what the patch does, but it should be merged into -stable
(and mainline, heaven forfend)Well ... I would, except what this patch does is to initialise the command
sg_ranzfield (for both 64 bit and 32 bit commands). If you look in the code just below the patch application at theif (
scp->use_sg) {
...
} else if (scp->request_bufflen) {
...
}Quoted 4 lines
You'll find a line setting these parameters in each of the cases of the if statement. So the bug appears to be that there's a missing else clause to this if, which would initialise the zero transfer commands. Is that a correct analysis?
Quoted 6 lines
Well, as no one has really responded to this thread about what the patch really does, and it's not in even James's tree yet, I've dropped it from -stable.
If James does send it to Linus, I'll be glad to reconsider it at that time.
I found the correct explanation. It was actually given by the bug reporter a while ago. I've got the following in scsi-rc-fixes-2.6, which should be upstream track.
James
Quoted 1 line
From
bb9ba31ca3b88fd396e38950d1caedf2f83521c6Mon Sep 17 00:00:00 2001
From: Joerg Dorchain <[email protected]>
Date: Tue, 6 Mar 2007 02:46:54 -0800
Subject: [SCSI] gdth: fix oops in gdth_copy_cmd()
Recent alterations to the gdth_fill_raw_cmd() path no longer set the sg_ranz field for zero transfer commands. However, this field is used lower down in the function to initialise ha->cmd_len to the size of the firmware packet. If this uninitialised field contains a bogus value, ha->cmd_len can become much larger than the actual firmware packet and end up oopsing in gdth_copy_cmd() as it tries to copy this huge packet to the device (usually because it runs into an unallocated page).
The fix is to initialise the sg_ranz field to zero at the start of gdth_fill_raw_cmd().
--- drivers/scsi/gdth.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/scsi/gdth.c +2 -0
@@ -3091,6 +3091,7 @@ static int gdth_fill_raw_cmd(int hanum,Scsi_Cmnd *scp,unchar b) cmdp->u.raw64.direction = gdth_direction_tab[scp->cmnd[0 ]]==DOU ?GDTH_DATA_OUT :GDTH_DATA_IN ;memcpy (cmdp->u.raw64.cmd,scp->cmnd,16 ); + cmdp->u.raw64.sg_ranz =0 ; }else { cmdp->u.raw.reserved =0 ; cmdp->u.raw.mdisc_time =0 ;
@@ -3107,6 +3108,7 @@ static int gdth_fill_raw_cmd(int hanum,Scsi_Cmnd *scp,unchar b) cmdp->u.raw.direction = gdth_direction_tab[scp->cmnd[0 ]]==DOU ?GDTH_DATA_OUT :GDTH_DATA_IN ;memcpy (cmdp->u.raw.cmd,scp->cmnd,12 ); + cmdp->u.raw.sg_ranz =0 ; }if (scp->use_sg) {
Signature · 1 line
1.5.0.2