Commit b62205986a73a40e4fc174d2ef668e3895e925bc

Authored by Artem B. Bityuckiy
Committed by Thomas Gleixner
1 parent e4fef66189

[JFFS2] Init locks early during mount

In case of a mount error locks might be uninitialized but
accessed by the resulting call to jffs2_kill_sb().

Signed-off-by: Artem B. Bityuckiy <dedekind@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

Showing 2 changed files with 11 additions and 9 deletions Side-by-side Diff

... ... @@ -7,7 +7,7 @@
7 7 *
8 8 * For licensing information, see the file 'LICENCE' in this directory.
9 9 *
10   - * $Id: build.c,v 1.70 2005/02/28 08:21:05 dedekind Exp $
  10 + * $Id: build.c,v 1.71 2005/07/12 16:37:08 dedekind Exp $
11 11 *
12 12 */
13 13  
... ... @@ -335,13 +335,6 @@
335 335 c->blocks[i].last_node = NULL;
336 336 c->blocks[i].bad_count = 0;
337 337 }
338   -
339   - init_MUTEX(&c->alloc_sem);
340   - init_MUTEX(&c->erase_free_sem);
341   - init_waitqueue_head(&c->erase_wait);
342   - init_waitqueue_head(&c->inocache_wq);
343   - spin_lock_init(&c->erase_completion_lock);
344   - spin_lock_init(&c->inocache_lock);
345 338  
346 339 INIT_LIST_HEAD(&c->clean_list);
347 340 INIT_LIST_HEAD(&c->very_dirty_list);
... ... @@ -7,7 +7,7 @@
7 7 *
8 8 * For licensing information, see the file 'LICENCE' in this directory.
9 9 *
10   - * $Id: super.c,v 1.106 2005/05/18 11:37:25 dedekind Exp $
  10 + * $Id: super.c,v 1.107 2005/07/12 16:37:08 dedekind Exp $
11 11 *
12 12 */
13 13  
... ... @@ -139,6 +139,15 @@
139 139  
140 140 D1(printk(KERN_DEBUG "jffs2_get_sb_mtd(): New superblock for device %d (\"%s\")\n",
141 141 mtd->index, mtd->name));
  142 +
  143 + /* Initialize JFFS2 superblock locks, the further initialization will be
  144 + * done later */
  145 + init_MUTEX(&c->alloc_sem);
  146 + init_MUTEX(&c->erase_free_sem);
  147 + init_waitqueue_head(&c->erase_wait);
  148 + init_waitqueue_head(&c->inocache_wq);
  149 + spin_lock_init(&c->erase_completion_lock);
  150 + spin_lock_init(&c->inocache_lock);
142 151  
143 152 sb->s_op = &jffs2_super_operations;
144 153 sb->s_flags = flags | MS_NOATIME;