From fa00e106eb6f082654d822a0946c0c86297ede2c Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 1 Dec 2009 13:17:41 -0800 Subject: drivers/rtc/rtc-pcf50633.c: fix use after free in pcf50633_rtc_probe() "rtc" is freed and then dereferenced on the next line. This patch fixes that. Signed-off-by: Dan Carpenter Acked-by: Alessandro Zummo Cc: David Brownell Cc: Paul Gortmaker Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/rtc/rtc-pcf50633.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-pcf50633.c b/drivers/rtc/rtc-pcf50633.c index 33a10c47260e..4c5d5d0c4cfc 100644 --- a/drivers/rtc/rtc-pcf50633.c +++ b/drivers/rtc/rtc-pcf50633.c @@ -292,8 +292,9 @@ static int __devinit pcf50633_rtc_probe(struct platform_device *pdev) &pcf50633_rtc_ops, THIS_MODULE); if (IS_ERR(rtc->rtc_dev)) { + int ret = PTR_ERR(rtc->rtc_dev); kfree(rtc); - return PTR_ERR(rtc->rtc_dev); + return ret; } pcf50633_register_irq(rtc->pcf, PCF50633_IRQ_ALARM, -- cgit v1.2.2