lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 21 Nov 2007 22:54:50 +0300
From:	Dmitri Vorobiev <dmitri.vorobiev@...il.com>
To:	Zach Brown <zach.brown@...cle.com>
CC:	linux-fsdevel@...r.kernel.org,
	Linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH]loop cleanup in fs/namespace.c - repost

Zach Brown пишет:
>> The patch given below replaces the goto-loop by a while-based one.
> 
> That certainly looks fine.  I would also replace the 'return' with
> 'break', but I guess that's more of a question of personal preference.
> 
>> Besides, it removes the export for the same routine, because there are
>> no users for it outside of the core VFS code.
> 
> This doesn't look fine.  Did you test this?

Oops, my fault. Of course, I tested the patch, but kernel modules are disabled in my test setup, so I missed the error. Thanks for pointing that out, Zach.

Enclosed to this message is a new patch, which replaces the goto-loop by the while-based one, but leaves the EXPORT_SYMBOL macro intact.

And yes, I agree that for this routine, the break statement looks more appropriate than return.

> 
> mntput_no_expire() is called from mntput() which is an inline function
> in mount.h.  So lots of callers of mntput() in modules will end up
> trying to call mntput_no_expire() from modules.
> 
> $ nm fs/fuse/fuse.ko | grep mntput_no_expire
>                  U mntput_no_expire
> 
> - z
> 

Signed-off-by Dmitri Vorobiev <dmitri.vorobiev@...il.com>
---
diff --git a/fs/namespace.c b/fs/namespace.c
index 0608388..410e766 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -278,19 +278,17 @@ static inline void __mntput(struct vfsmo
 
 void mntput_no_expire(struct vfsmount *mnt)
 {
-repeat:
-	if (atomic_dec_and_lock(&mnt->mnt_count, &vfsmount_lock)) {
+	while (atomic_dec_and_lock(&mnt->mnt_count, &vfsmount_lock)) {
 		if (likely(!mnt->mnt_pinned)) {
 			spin_unlock(&vfsmount_lock);
 			__mntput(mnt);
-			return;
+			break;
 		}
 		atomic_add(mnt->mnt_pinned + 1, &mnt->mnt_count);
 		mnt->mnt_pinned = 0;
 		spin_unlock(&vfsmount_lock);
 		acct_auto_close_mnt(mnt);
 		security_sb_umount_close(mnt);
-		goto repeat;
 	}
 }
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ