Re: [PATCH] hptiop: avoid buffer overflow when returning sense data

2007-10-15 Thread HighPoint Linux Team
Andrew Morton wrote:
> > 
> > avoid buffer overflow when returning sense data.
> > 
>
> That's really not enough information, sorry.
>
> > index 8b384fa..d32a4a9 100644
> > --- a/drivers/scsi/hptiop.c
> > +++ b/drivers/scsi/hptiop.c
> > @@ -375,8 +375,9 @@ static void hptiop_host_request_callback
> > scp->result = SAM_STAT_CHECK_CONDITION;
> > memset(>sense_buffer,
> > 0, sizeof(scp->sense_buffer));
> > -   memcpy(>sense_buffer,
> > -   >sg_list, le32_to_cpu(req->dataxfer_length));
> > +   memcpy(>sense_buffer, >sg_list,
> > +   min(sizeof(scp->sense_buffer),
> > +   le32_to_cpu(req->dataxfer_length)));
> > break;
> >  
> > default:
>
> See, we know what the fix does, but we don't know what the consequences are
> if the user's kernel doesn't have this fix.
> 
> So we are not able to work out whether this fix should be backported to
> 2.6.23.x and even to 2.6.22.x?

Sorry for ambiguity. With current adapter firmware the driver is working but 
future
firmware updates may return sense data larger than 96 bytes, causing overflow
on scp->sense_buffer and a kernel crash.

This fix should be backported to earlier kernels.

HighPoint Linux Team

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] hptiop: avoid buffer overflow when returning sense data

2007-10-15 Thread HighPoint Linux Team

avoid buffer overflow when returning sense data.

Signed-off-by: HighPoint Linux Team <[EMAIL PROTECTED]>
---

diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index 8b384fa..d32a4a9 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -375,8 +375,9 @@ static void hptiop_host_request_callback
scp->result = SAM_STAT_CHECK_CONDITION;
memset(>sense_buffer,
0, sizeof(scp->sense_buffer));
-   memcpy(>sense_buffer,
-   >sg_list, le32_to_cpu(req->dataxfer_length));
+   memcpy(>sense_buffer, >sg_list,
+   min(sizeof(scp->sense_buffer),
+   le32_to_cpu(req->dataxfer_length)));
break;
 
default:

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] hptiop: avoid buffer overflow when returning sense data

2007-10-15 Thread Andrew Morton
On Mon, 15 Oct 2007 14:42:52 +0800 HighPoint Linux Team <[EMAIL PROTECTED]> 
wrote:

> 
> avoid buffer overflow when returning sense data.
> 

That's really not enough information, sorry.

> index 8b384fa..d32a4a9 100644
> --- a/drivers/scsi/hptiop.c
> +++ b/drivers/scsi/hptiop.c
> @@ -375,8 +375,9 @@ static void hptiop_host_request_callback
>   scp->result = SAM_STAT_CHECK_CONDITION;
>   memset(>sense_buffer,
>   0, sizeof(scp->sense_buffer));
> - memcpy(>sense_buffer,
> - >sg_list, le32_to_cpu(req->dataxfer_length));
> + memcpy(>sense_buffer, >sg_list,
> + min(sizeof(scp->sense_buffer),
> + le32_to_cpu(req->dataxfer_length)));
>   break;
>  
>   default:

See, we know what the fix does, but we don't know what the consequences are
if the user's kernel doesn't have this fix.

So we are not able to work out whether this fix should be backported to
2.6.23.x and even to 2.6.22.x?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] hptiop: avoid buffer overflow when returning sense data

2007-10-15 Thread Andrew Morton
On Mon, 15 Oct 2007 14:42:52 +0800 HighPoint Linux Team [EMAIL PROTECTED] 
wrote:

 
 avoid buffer overflow when returning sense data.
 

That's really not enough information, sorry.

 index 8b384fa..d32a4a9 100644
 --- a/drivers/scsi/hptiop.c
 +++ b/drivers/scsi/hptiop.c
 @@ -375,8 +375,9 @@ static void hptiop_host_request_callback
   scp-result = SAM_STAT_CHECK_CONDITION;
   memset(scp-sense_buffer,
   0, sizeof(scp-sense_buffer));
 - memcpy(scp-sense_buffer,
 - req-sg_list, le32_to_cpu(req-dataxfer_length));
 + memcpy(scp-sense_buffer, req-sg_list,
 + min(sizeof(scp-sense_buffer),
 + le32_to_cpu(req-dataxfer_length)));
   break;
  
   default:

See, we know what the fix does, but we don't know what the consequences are
if the user's kernel doesn't have this fix.

So we are not able to work out whether this fix should be backported to
2.6.23.x and even to 2.6.22.x?
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] hptiop: avoid buffer overflow when returning sense data

2007-10-15 Thread HighPoint Linux Team

avoid buffer overflow when returning sense data.

Signed-off-by: HighPoint Linux Team [EMAIL PROTECTED]
---

diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index 8b384fa..d32a4a9 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -375,8 +375,9 @@ static void hptiop_host_request_callback
scp-result = SAM_STAT_CHECK_CONDITION;
memset(scp-sense_buffer,
0, sizeof(scp-sense_buffer));
-   memcpy(scp-sense_buffer,
-   req-sg_list, le32_to_cpu(req-dataxfer_length));
+   memcpy(scp-sense_buffer, req-sg_list,
+   min(sizeof(scp-sense_buffer),
+   le32_to_cpu(req-dataxfer_length)));
break;
 
default:

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] hptiop: avoid buffer overflow when returning sense data

2007-10-15 Thread HighPoint Linux Team
Andrew Morton wrote:
  
  avoid buffer overflow when returning sense data.
  

 That's really not enough information, sorry.

  index 8b384fa..d32a4a9 100644
  --- a/drivers/scsi/hptiop.c
  +++ b/drivers/scsi/hptiop.c
  @@ -375,8 +375,9 @@ static void hptiop_host_request_callback
  scp-result = SAM_STAT_CHECK_CONDITION;
  memset(scp-sense_buffer,
  0, sizeof(scp-sense_buffer));
  -   memcpy(scp-sense_buffer,
  -   req-sg_list, le32_to_cpu(req-dataxfer_length));
  +   memcpy(scp-sense_buffer, req-sg_list,
  +   min(sizeof(scp-sense_buffer),
  +   le32_to_cpu(req-dataxfer_length)));
  break;
   
  default:

 See, we know what the fix does, but we don't know what the consequences are
 if the user's kernel doesn't have this fix.
 
 So we are not able to work out whether this fix should be backported to
 2.6.23.x and even to 2.6.22.x?

Sorry for ambiguity. With current adapter firmware the driver is working but 
future
firmware updates may return sense data larger than 96 bytes, causing overflow
on scp-sense_buffer and a kernel crash.

This fix should be backported to earlier kernels.

HighPoint Linux Team

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/