Skip to content

Commit 1206427

Browse files
Dan Carpentermartinkpetersen
authored andcommitted
scsi: libfc: Prevent integer overflow in fc_fcp_recv_data()
The "offset" comes from the skb->data that we received. Here the code is verifying that "offset + len" is within bounds however it does not take integer overflows into account. Use size_add() to be safe. This would only be an issue on 32bit systems which are probably a very small percent of the users. Still, it's worth fixing just for correctness sake. Fixes: 42e9a92 ("[SCSI] libfc: A modular Fibre Channel library") Signed-off-by: Dan Carpenter <[email protected]> Message-Id: <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 987da23 commit 1206427

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/scsi/libfc/fc_fcp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ static void fc_fcp_recv_data(struct fc_fcp_pkt *fsp, struct fc_frame *fp)
503503
host_bcode = FC_ERROR;
504504
goto err;
505505
}
506-
if (offset + len > fsp->data_len) {
506+
if (size_add(offset, len) > fsp->data_len) {
507507
/* this should never happen */
508508
if ((fr_flags(fp) & FCPHF_CRC_UNCHECKED) &&
509509
fc_frame_crc_check(fp))

0 commit comments

Comments
 (0)