From: Sonny Rao We need to serialize access to the global rtc_idr even in this error path. Signed-off-by: Sonny Rao Cc: Alessandro Zummo Signed-off-by: Andrew Morton --- drivers/rtc/class.c | 2 ++ 1 file changed, 2 insertions(+) diff -puN drivers/rtc/class.c~rtc-fix-idr-locking drivers/rtc/class.c --- a/drivers/rtc/class.c~rtc-fix-idr-locking +++ a/drivers/rtc/class.c @@ -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", _