Browse Source

[PATCH] efs: Remove incorrect unlock_kernel from failure path in efs_symlink_readpage()

If efs_symlink_readpage hits the -ENAMETOOLONG error path, it will call
unlock_kernel without ever having called lock_kernel(); fix this by
creating and jumping to a new label fail_notlocked rather than the fail
label used after calling lock_kernel().

Signed-off-by: Josh Triplett <josh@freedesktop.org>
Cc: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Josh Triplett 19 years ago
parent
commit
0aa9e4f147
1 changed files with 2 additions and 1 deletions
  1. 2 1
      fs/efs/symlink.c

+ 2 - 1
fs/efs/symlink.c

@@ -22,7 +22,7 @@ static int efs_symlink_readpage(struct file *file, struct page *page)
   
   
 	err = -ENAMETOOLONG;
 	err = -ENAMETOOLONG;
 	if (size > 2 * EFS_BLOCKSIZE)
 	if (size > 2 * EFS_BLOCKSIZE)
-		goto fail;
+		goto fail_notlocked;
   
   
 	lock_kernel();
 	lock_kernel();
 	/* read first 512 bytes of link target */
 	/* read first 512 bytes of link target */
@@ -47,6 +47,7 @@ static int efs_symlink_readpage(struct file *file, struct page *page)
 	return 0;
 	return 0;
 fail:
 fail:
 	unlock_kernel();
 	unlock_kernel();
+fail_notlocked:
 	SetPageError(page);
 	SetPageError(page);
 	kunmap(page);
 	kunmap(page);
 	unlock_page(page);
 	unlock_page(page);