Skip to contentSkip to conversation

unlock_kernel() in autofs

PATCH In review Dan Carpenter 2 participants 3 messages Apr 7, 2009 – Apr 8, 2009 Kernel automounter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 unlock_kernel() in autofs

There are a couple missing unlock_kernel() calls on error paths in autofs version 2.6.29.

Found by smatch (http://repo.or.cz/w/smatch.git). Compile tested.

regards,
dan carpenter

fs/autofs/root.c +4 -1
@@ -334,8 +334,10 @@
 	autofs_hash_insert(dh,ent);
 
 	inode = autofs_iget(dir->i_sb, ent->ino);
-	if (IS_ERR(inode))
+	if (IS_ERR(inode)) {
+		unlock_kernel();
 		return PTR_ERR(inode);
+	}
 
 	d_instantiate(dentry, inode);
 	unlock_kernel();
@@ -480,6 +482,7 @@
 	inode = autofs_iget(dir->i_sb, ino);
 	if (IS_ERR(inode)) {
 		drop_nlink(dir);
+		unlock_kernel();
 		return PTR_ERR(inode);
 	}
maintainer
#1 lore raw
Quoted 2 lines · Dan Carpenter

There are a couple missing unlock_kernel() calls on error paths in autofs version 2.6.29.

Hi Dan,

Thanks for your patch.

You may not be aware but the autofs4 kernel module may satisfy your needs and it is actively maintained whereas I haven't been paying much attention to the autofs module for some time now.

I plan on submitting patches to retire the autofs module sometime fairly soon but haven't yet constructed a list of relevant maintainers to start the awareness and discussion process.

Can you tell me in what environment you use the autofs kernel module? Do you actually need to use autofs version 2 kernel communication protocol? Have you checked to see if the autofs4 kernel module will satisfy your needs?

Quoted 2 lines

Found by smatch (http://repo.or.cz/w/smatch.git). Compile tested.

Source code analysis?
Is there a home page or download?

Quoted 33 lines

regards,
dan carpenter

fs/autofs/root.c +4 -1
@@ -334,8 +334,10 @@
 	autofs_hash_insert(dh,ent);
 
 	inode = autofs_iget(dir->i_sb, ent->ino);
-	if (IS_ERR(inode))
+	if (IS_ERR(inode)) {
+		unlock_kernel();
 		return PTR_ERR(inode);
+	}
 
 	d_instantiate(dentry, inode);
 	unlock_kernel();
@@ -480,6 +482,7 @@
 	inode = autofs_iget(dir->i_sb, ino);
 	if (IS_ERR(inode)) {
 		drop_nlink(dir);
+		unlock_kernel();
 		return PTR_ERR(inode);
 	}
 

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

#2 lore raw
Quoted 11 lines · Ian Kent
Quoted 2 lines · Dan Carpenter

There are a couple missing unlock_kernel() calls on error paths in autofs version 2.6.29.

Hi Dan,

Thanks for your patch.

You may not be aware but the autofs4 kernel module may satisfy your needs and it is actively maintained whereas I haven't been paying much attention to the autofs module for some time now.

No problem. I'm just randomly sending patches for my allyesconfig.

Quoted 6 lines
Quoted 2 lines

Found by smatch (http://repo.or.cz/w/smatch.git). Compile tested.

Source code analysis?
Is there a home page or download?

You can download it from http://repo.or.cz/w/smatch.git. There are tar balls available as well on the right hand side of the page. It's still pretty rough and has too many false positives, but it's easy enough to test...

make
cd /usr/src/kernel
make C=1 CHECK=/path/to/smatch fs/autofs/root.c | egrep '(warn|error):'

regards,
dan carpenter