remarkable-linux/drivers/scsi/lpfc
Jesper Juhl a0a74e4505 [SCSI] lpfc: fix potential overflow of hbqs array
The Coverity checker noticed that we may overrun a statically allocated
array in drivers/scsi/lpfc/lpfc_sli.c::lpfc_sli_hbqbuf_find().

The case is this; In 'struct lpfc_hba' we have

	#define LPFC_MAX_HBQS  4
	...
	struct lpfc_hba {
		...
		struct hbq_s hbqs[LPFC_MAX_HBQS];
		...
	};

But then in lpfc_sli_hbqbuf_find() we have this code

	hbqno = tag >> 16;
	if (hbqno > LPFC_MAX_HBQS)
		return NULL;

if 'hbqno' ends up as exactely 4, then we won't return, and then this

	list_for_each_entry(d_buf, &phba->hbqs[hbqno].hbq_buffer_list, list) {

will cause an overflow of the statically allocated array at index 4,
since the valid indices are only 0-3.

I propose this patch, that simply changes the 'hbqno > LPFC_MAX_HBQS'
into 'hbqno >= LPFC_MAX_HBQS' as a possible fix.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: James Smart <James.Smart@Emulex.Com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:40:03 -04:00
..
lpfc.h [SCSI] lpfc 8.2.2 : Style cleanups 2007-08-01 12:25:39 -05:00
lpfc_attr.c [SCSI] lpfc 8.2.2 : Style cleanups 2007-08-01 12:25:39 -05:00
lpfc_compat.h
lpfc_crtn.h [SCSI] lpfc 8.2.2 : Style cleanups 2007-08-01 12:25:39 -05:00
lpfc_ct.c [SCSI] lpfc 8.2.2 : Style cleanups 2007-08-01 12:25:39 -05:00
lpfc_debugfs.c [SCSI] lpfc 8.2.2 : Style cleanups 2007-08-01 12:25:39 -05:00
lpfc_debugfs.h [SCSI] lpfc 8.2.2 : Error messages and debugfs updates 2007-08-01 12:17:30 -05:00
lpfc_disc.h
lpfc_els.c [SCSI] lpfc 8.2.2 : Miscellaneous Bug Fixes 2007-08-01 12:24:10 -05:00
lpfc_hbadisc.c [SCSI] lpfc 8.2.2 : Style cleanups 2007-08-01 12:25:39 -05:00
lpfc_hw.h [SCSI] lpfc 8.2.2 : Style cleanups 2007-08-01 12:25:39 -05:00
lpfc_init.c [SCSI] lpfc 8.2.2 : Style cleanups 2007-08-01 12:25:39 -05:00
lpfc_logmsg.h [SCSI] lpfc 8.2.2 : Rework the lpfc_printf_log() macro 2007-08-01 12:21:26 -05:00
lpfc_mbox.c [SCSI] lpfc 8.2.2 : Miscellaneous Bug Fixes 2007-08-01 12:24:10 -05:00
lpfc_mem.c [SCSI] lpfc 8.2.2 : Miscellaneous Bug Fixes 2007-08-01 12:24:10 -05:00
lpfc_nportdisc.c [SCSI] lpfc 8.2.2 : Miscellaneous Bug Fixes 2007-08-01 12:24:10 -05:00
lpfc_scsi.c [SCSI] lpfc : scsi command accessor fix for 8.2.2 2007-08-03 11:30:09 -05:00
lpfc_scsi.h
lpfc_sli.c [SCSI] lpfc: fix potential overflow of hbqs array 2007-10-12 14:40:03 -04:00
lpfc_sli.h [SCSI] lpfc 8.2.2 : Style cleanups 2007-08-01 12:25:39 -05:00
lpfc_version.h [SCSI] lpfc 8.2.2 : Change version number to 8.2.2 2007-08-01 12:26:04 -05:00
lpfc_vport.c [SCSI] lpfc 8.2.2 : Style cleanups 2007-08-01 12:25:39 -05:00
lpfc_vport.h [SCSI] lpfc 8.2.2 : Fix locking around HBA's port_list 2007-08-01 12:18:23 -05:00
Makefile