bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Properly release console lock.


From: Diego Nieto Cid
Subject: [PATCH] Properly release console lock.
Date: Mon, 15 Nov 2010 04:10:58 -0300

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.
---
 console/console.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/console/console.c b/console/console.c
index dad7516..7106c8d 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,6 +879,11 @@ 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;
-- 
1.7.3.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]