mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] tpm: fix ordering bug in error path
@ 2006-04-19 19:13 Kylene Jo Hall
  0 siblings, 0 replies; only message in thread
From: Kylene Jo Hall @ 2006-04-19 19:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, TPM Device Driver List

The clear_bit of chip->dev_num ended up after the kfree of chip in the
error path of the tpm_register_hardware function.  This patch fixes
things to avoid a potential segmentation fault.

This bug was found by Coverity.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
---
 drivers/char/tpm/tpm.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.17-rc1/drivers/char/tpm/tpm.c	2006-04-18 15:14:45.630390500 -0500
+++ linux-2.6.17-rc1-tpm/drivers/char/tpm/tpm.c	2006-04-19 13:17:51.363688750 -0500
@@ -1139,8 +1139,8 @@ struct tpm_chip *tpm_register_hardware(s
 			chip->vendor.miscdev.name,
 			chip->vendor.miscdev.minor);
 		put_device(dev);
-		kfree(chip);
 		clear_bit(chip->dev_num, dev_mask);
+		kfree(chip);
 		return NULL;
 	}
 



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-04-19 19:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-19 19:13 [PATCH] tpm: fix ordering bug in error path Kylene Jo Hall

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

all inboxes | Powered by JetHome®