Skip to content

Commit

Permalink
staging: logger: hold mutex while removing reader
Browse files Browse the repository at this point in the history
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 <swetland@google.com>
Cc: Dima Zavin <dima@android.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Rabin Vincent authored and Greg Kroah-Hartman committed Feb 24, 2012
1 parent 6f6c4dc commit 47de87a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/staging/android/logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 47de87a

Please sign in to comment.