public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix lpfc oops when parsing dodgy VPD
@ 2007-03-21 13:41 Anton Blanchard
  2007-03-22 17:13 ` James Smart
  0 siblings, 1 reply; 2+ messages in thread
From: Anton Blanchard @ 2007-03-21 13:41 UTC (permalink / raw)
  To: james.smart; +Cc: linux-scsi


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>
---

Index: kernel/drivers/scsi/lpfc/lpfc_init.c
===================================================================
--- kernel.orig/drivers/scsi/lpfc/lpfc_init.c	2007-02-07 17:02:43.000000000 -0600
+++ kernel/drivers/scsi/lpfc/lpfc_init.c	2007-02-07 17:23:31.000000000 -0600
@@ -662,7 +662,7 @@
 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;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-03-22 17:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-21 13:41 [PATCH] Fix lpfc oops when parsing dodgy VPD Anton Blanchard
2007-03-22 17:13 ` James Smart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox