summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Nieto Cid <dnietoc@gmail.com>2010-11-15 04:10:58 -0300
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2010-11-20 21:58:58 +0100
commit3206e09443e604d8aa5d20f75fd39357d0bf03d4 (patch)
tree2b0a1f8ae7421b241dd5a660700134bb335cf3f9
parent0da1805bdd58125b01c3b1a9d95c3d6f495d2159 (diff)
Properly release console lock.
The console lock was released only when there were no allocation errors leaving it locked in the event mmap failed. This patch moves the mutex_unlock call to a point in the flow of control where it is consistent with the lock acquisition. * console/console.c(netfs_get_dirents): Relocate mutex_unlock call to common return path.
-rw-r--r--console/console.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/console/console.c b/console/console.c
index dad7516e..bac9eb8e 100644
--- a/console/console.c
+++ b/console/console.c
@@ -862,7 +862,6 @@ netfs_get_dirents (struct iouser *cred, struct node *dir,
if (!add_dir_entry (vcons->name,
vcons->id << 2, DT_DIR))
break;
- mutex_unlock (&dir->nn->cons->lock);
}
else
{
@@ -880,7 +879,10 @@ netfs_get_dirents (struct iouser *cred, struct node *dir,
add_dir_entry ("input", (dir->nn->vcons->id << 3) + 2, DT_FIFO);
}
}
-
+
+ if (dir->nn->cons)
+ mutex_unlock(&dir->nn->cons->lock);
+
fshelp_touch (&dir->nn_stat, TOUCH_ATIME, console_maptime);
return err;
}