patch-2.1.51 linux/fs/isofs/symlink.c

Next file: linux/fs/namei.c
Previous file: linux/fs/isofs/namei.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.50/linux/fs/isofs/symlink.c linux/fs/isofs/symlink.c
@@ -19,6 +19,7 @@
 #include <asm/uaccess.h>
 
 static int isofs_readlink(struct inode *, char *, int);
+static struct dentry * isofs_follow_link(struct inode * inode, struct dentry *base);
 
 /*
  * symlinks can't do much...
@@ -35,6 +36,7 @@
 	NULL,			/* mknod */
 	NULL,			/* rename */
 	isofs_readlink,		/* readlink */
+	isofs_follow_link,	/* follow_link */
 	NULL,			/* readpage */
 	NULL,			/* writepage */
 	NULL,			/* bmap */
@@ -51,7 +53,6 @@
 		buflen = 1023;
 	pnt = get_rock_ridge_symlink(inode);
 
-	iput(inode);
 	if (!pnt)
 		return 0;
 
@@ -62,4 +63,21 @@
 		i = -EFAULT; 	
 	kfree(pnt);
 	return i;
+}
+
+static struct dentry * isofs_follow_link(struct inode * inode, struct dentry *base)
+{
+	char * pnt;
+
+	pnt = get_rock_ridge_symlink(inode);
+
+	if(!pnt) {
+		dput(base);
+		return ERR_PTR(-ELOOP);
+	}
+
+	base = lookup_dentry(pnt, base, 1);
+
+	kfree(pnt);
+	return base;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov