Skip to content

Commit

Permalink
[SCSI] aacraid: check buffer address in aac_internal_transfer
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Salyzyn, Mark authored and James Bottomley committed Mar 21, 2007
1 parent 0272bf7 commit 20235f3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/scsi/aacraid/aachba.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,9 @@ static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, unsigne
buf = scsicmd->request_buffer;
transfer_len = min(scsicmd->request_bufflen, len + offset);
}

memcpy(buf + offset, data, transfer_len - offset);
transfer_len -= offset;
if (buf && transfer_len)
memcpy(buf + offset, data, transfer_len);

if (scsicmd->use_sg)
kunmap_atomic(buf - sg->offset, KM_IRQ0);
Expand Down

0 comments on commit 20235f3

Please sign in to comment.