Commit 20235f35 authored by Salyzyn, Mark's avatar Salyzyn, Mark Committed by James Bottomley

[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: default avatarMark Salyzyn <aacraid@adaptec.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 0272bf72
...@@ -350,8 +350,9 @@ static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, unsigne ...@@ -350,8 +350,9 @@ static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, unsigne
buf = scsicmd->request_buffer; buf = scsicmd->request_buffer;
transfer_len = min(scsicmd->request_bufflen, len + offset); transfer_len = min(scsicmd->request_bufflen, len + offset);
} }
transfer_len -= offset;
memcpy(buf + offset, data, transfer_len - offset); if (buf && transfer_len)
memcpy(buf + offset, data, transfer_len);
if (scsicmd->use_sg) if (scsicmd->use_sg)
kunmap_atomic(buf - sg->offset, KM_IRQ0); kunmap_atomic(buf - sg->offset, KM_IRQ0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment