From: Dan Carpenter Date: Tue, 1 Dec 2009 21:17:41 +0000 (-0800) Subject: drivers/rtc/rtc-pcf50633.c: fix use after free in pcf50633_rtc_probe() X-Git-Tag: v2.6.32~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fa00e106eb6f082654d822a0946c0c86297ede2c;p=profile%2Fcommon%2Fkernel-common.git 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 --- diff --git a/drivers/rtc/rtc-pcf50633.c b/drivers/rtc/rtc-pcf50633.c index 33a10c4..4c5d5d0 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,