Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0fec02c93f60fb44ba3a24a0d3e4a52521d34d3f
Commit:     0fec02c93f60fb44ba3a24a0d3e4a52521d34d3f
Parent:     7a39ac3f25bef018862a991d754aff681c019127
Author:     HighPoint Linux Team <[EMAIL PROTECTED]>
AuthorDate: Mon Oct 15 14:42:52 2007 +0800
Committer:  James Bottomley <[EMAIL PROTECTED]>
CommitDate: Wed Oct 17 21:56:13 2007 -0400

    [SCSI] hptiop: avoid buffer overflow when returning sense data
    
    The newer firmware may return more than 96 bytes of sense data when it
    does autosense.  Truncate this to the size of the SCSI layer sense
    buffer to avoid an overrun.
    
    Signed-off-by: HighPoint Linux Team <[EMAIL PROTECTED]>
    Signed-off-by: James Bottomley <[EMAIL PROTECTED]>
---
 drivers/scsi/hptiop.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index 8515054..0844331 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -375,8 +375,9 @@ static void hptiop_host_request_callback(struct hptiop_hba 
*hba, u32 _tag)
                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 git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to