Skip to contentSkip to conversation

Remove incorrect unlock_kernel from failure path in efs_symlink_readpage

PATCH New Josh Triplett 1 participant 1 message Jul 24, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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().

---
This bug exists in the 2.4 kernel series as far back as 2.4.0, and this patch should apply there as well.

 fs/efs/symlink.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
fs/efs/symlink.c +2 -1
index e249cf7..1d30d2f 100644
@@ -22,7 +22,7 @@ static int efs_symlink_readpage(struct f
   
 	err = -ENAMETOOLONG;
 	if (size > 2 * EFS_BLOCKSIZE)
-		goto fail;
+		goto fail_notlocked;
   
 	lock_kernel();
 	/* read first 512 bytes of link target */
@@ -47,6 +47,7 @@ static int efs_symlink_readpage(struct f
 	return 0;
 fail:
 	unlock_kernel();
+fail_notlocked:
 	SetPageError(page);
 	kunmap(page);
 	unlock_page(page);