Skip to contentSkip to conversation

fix idr locking in rtc class

PATCH In review Sonny Rao 2 participants 2 messages Jun 27, 2006 Real time clock (RTC)

lore
Share & tools
lore

Sonny Rao

author
#0 lore raw

PATCH 1/1 fix idr locking in rtc class

We need to serialize access to the global rtc_idr even in this error path.

drivers/rtc/class.c renamed from drivers/rtc/class.c~orig +2 -0
@@ -93,7 +93,9 @@ exit_kfree:
 	kfree(rtc);
 
 exit_idr:
+	mutex_lock(&idr_lock);
 	idr_remove(&rtc_idr, id);
+	mutex_unlock(&idr_lock);
 
 exit:
 	dev_err(dev, "rtc core: unable to register %s, err = %d\n",
#1 lore raw

On Mon, 26 Jun 2006 20:19:51 -0400
Sonny Rao <[email protected]> wrote:

thanks for spotting this.

Quoted 16 lines

We need to serialize access to the global rtc_idr even in this error path.

drivers/rtc/class.c renamed from drivers/rtc/class.c~orig +2 -0
@@ -93,7 +93,9 @@ exit_kfree:
 	kfree(rtc);
 
 exit_idr:
+	mutex_lock(&idr_lock);
 	idr_remove(&rtc_idr, id);
+	mutex_unlock(&idr_lock);
 
 exit:
 	dev_err(dev, "rtc core: unable to register %s, err = %d\n",
Signature · 6 lines
 Best regards,

 Alessandro Zummo,
  Tower Technologies - Turin, Italy

  http://www.towertech.it