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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 12 Sep 2006 17:57:38 -0700
From:	Ram Pai <linuxram@...ibm.com>
To:	linux-kernel@...r.kernel.org
Cc:	akpm@...l.org, linuxram@...ibm.com, nacc@...ibm.com,
	viro@....linux.org.uk
Subject: [PATCH 1/1] VFS: fixes a bug in sys_linkat() 

Hardlink using sys_linkat() returns EXDEV when the source and the destination
point to the same filesystem, residing under different mounts.

An example scenario is:

mount /dev/sda /mnt
mount /dev/sdb /mnt1
mkdir /mnt1/src
mkdir /mnt/dest
mount --bind /mnt1/src /mnt/dest   (note: at this point the filesystems
			under /mnt1/src and /mnt/dest is same)
touch /mnt1/src/testfile
ln /mnt1/src/testfile /mnt/dest/sametestfile  (note: this should succeed).

The ln command fails. It does not correctly recognize that both
the source and destination point to the same filesystem.

The following patch fixes the problem.
Thanks to Nishanth Aravamudan(nacc@...ibm.com) for identifying the bug.

Signed by Ram Pai (linuxram@...ibm.com)
---
 fs/namei.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.17.10/fs/namei.c
===================================================================
--- linux-2.6.17.10.orig/fs/namei.c
+++ linux-2.6.17.10/fs/namei.c
@@ -2263,7 +2263,7 @@ asmlinkage long sys_linkat(int olddfd, c
 	if (error)
 		goto out;
 	error = -EXDEV;
-	if (old_nd.mnt != nd.mnt)
+	if (old_nd.mnt->mnt_sb != nd.mnt->mnt_sb)
 		goto out_release;
 	new_dentry = lookup_create(&nd, 0);
 	error = PTR_ERR(new_dentry);
-
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