Skip to content

Commit

Permalink
[SCSI] lpfc: fix oops when parsing dodgy VPD
Browse files Browse the repository at this point in the history
We have seen two cases where VPD on an emulex card has been incorrect
and we end up walking off the end of memory. It looks like someone made
an update (increased the length of a string) without increasing the
Length field. Then we do:

	Length -= (3+i);

And since Length is unsigned it becomes very large and we loop forever
in the encapsulating:

	while (Length > 0) {

If we make Length signed then we fall out of the loop and proceed on.

Its important to note we have only seen this in the lab and it may be
the only two cases of this in existence, but since the rest of the code
has been written to be resilient against bad VPD we may as well fix this
too.

Signed-off-by: Anton Blanchard <anton@samba.org>
Acked-by: James Smart <James.Smart@Emulex.Com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
  • Loading branch information
Anton Blanchard authored and James Bottomley committed Apr 1, 2007
1 parent 802ae2f commit 07da60c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/scsi/lpfc/lpfc_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ static int
lpfc_parse_vpd(struct lpfc_hba * phba, uint8_t * vpd, int len)
{
uint8_t lenlo, lenhi;
uint32_t Length;
int Length;
int i, j;
int finished = 0;
int index = 0;
Expand Down

0 comments on commit 07da60c

Please sign in to comment.