diff options
author | Salyzyn, Mark <mark_salyzyn@adaptec.com> | 2007-03-21 13:22:56 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-03-21 13:45:15 -0400 |
commit | 20235f35221472f1a127a5d5414f11091eb0a845 (patch) | |
tree | 4b827f2e8a8056974fe6cae63cf06b8c31aa1780 /drivers/scsi/aacraid | |
parent | 0272bf7271eb6895b081c3df34c3ebe50cb769b7 (diff) |
[SCSI] aacraid: check buffer address in aac_internal_transfer
Captured a panic on an older kernel where an application issuing
commands via sg was sending requests that lacked a request_buffer, thus
the buffer pointer used in aac_internal_transer was NULL. The
application was fixed closing the issue, but felt it was advised to
immunize the driver against the eventuality.
Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/aacraid')
-rw-r--r-- | drivers/scsi/aacraid/aachba.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 0c4e27eb6520..f9deab686dc4 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c | |||
@@ -350,8 +350,9 @@ static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, unsigne | |||
350 | buf = scsicmd->request_buffer; | 350 | buf = scsicmd->request_buffer; |
351 | transfer_len = min(scsicmd->request_bufflen, len + offset); | 351 | transfer_len = min(scsicmd->request_bufflen, len + offset); |
352 | } | 352 | } |
353 | 353 | transfer_len -= offset; | |
354 | memcpy(buf + offset, data, transfer_len - offset); | 354 | if (buf && transfer_len) |
355 | memcpy(buf + offset, data, transfer_len); | ||
355 | 356 | ||
356 | if (scsicmd->use_sg) | 357 | if (scsicmd->use_sg) |
357 | kunmap_atomic(buf - sg->offset, KM_IRQ0); | 358 | kunmap_atomic(buf - sg->offset, KM_IRQ0); |