From: Rabin Vincent Date: Wed, 22 Feb 2012 10:28:00 +0000 (+0530) Subject: staging: logger: hold mutex while removing reader X-Git-Tag: MMI-PSA29.97-13-9~17268^2~121 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=47de87a234aac8b2121557f3903bb16bb678af67;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git staging: logger: hold mutex while removing reader The readers list is traversed under the log->mutex lock (for example from fix_up_readers()), but the deletion of elements from this list is not being done under this lock. Cc: Brian Swetland Cc: Dima Zavin Signed-off-by: Rabin Vincent Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c index 0d2367f2c15f..ea69b6a77dac 100644 --- a/drivers/staging/android/logger.c +++ b/drivers/staging/android/logger.c @@ -459,7 +459,12 @@ static int logger_release(struct inode *ignored, struct file *file) { if (file->f_mode & FMODE_READ) { struct logger_reader *reader = file->private_data; + struct logger_log *log = reader->log; + + mutex_lock(&log->mutex); list_del(&reader->list); + mutex_unlock(&log->mutex); + kfree(reader); }