Skip to contentSkip to conversation

rtc: use after free in pcf50633_rtc_probe()

PATCH In review Dan Carpenter 2 participants 2 messages Nov 18, 2009 Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc: use after free in pcf50633_rtc_probe()

"rtc" is freed and then dereferenced on the next line. This patch fixes that.

This is a resend. I have been offline for the last few months so I may have missed a reply or something. Not sure what the status was.

regards,
dan carpenter

drivers/rtc/rtc-pcf50633.c +2 -1
@@ -291,8 +291,9 @@
 				&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,
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · On Wed, 18 Nov 2009 10:30:14 +0200 (SAST) Dan Carpenter <[email protected]>…

"rtc" is freed and then dereferenced on the next line. This patch fixes that.

This is a resend. I have been offline for the last few months so I may have missed a reply or something. Not sure what the status was.

regards,
dan carpenter

Signature · 6 lines
 Best regards,

 Alessandro Zummo,
  Tower Technologies - Torino, Italy

  http://www.towertech.it