From 2fb1e3086df9b454538491fba8121298da37cd23 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 19 Aug 2005 22:42:16 +0100 Subject: [PATCH] jffs2: fix symlink error handling The current calling conventions for ->follow_link() are already fairly complex. What we have is 1) you can return -error; then you must release nameidata yourself and ->put_link() will _not_ be called. 2) you can do nd_set_link(nd, ERR_PTR(-error)) and return 0 3) you can do nd_set_link(nd, path) and return 0 4) you can return 0 (after having moved nameidata yourself) jffs2 follow_link() is broken - it has an exit where it returns -EIO and leaks nameidata. Signed-off-by: Linus Torvalds --- fs/jffs2/symlink.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'fs/jffs2') diff --git a/fs/jffs2/symlink.c b/fs/jffs2/symlink.c index 65ab6b001dc..073633e11ea 100644 --- a/fs/jffs2/symlink.c +++ b/fs/jffs2/symlink.c @@ -30,6 +30,7 @@ struct inode_operations jffs2_symlink_inode_operations = static int jffs2_follow_link(struct dentry *dentry, struct nameidata *nd) { struct jffs2_inode_info *f = JFFS2_INODE_INFO(dentry->d_inode); + char *p = (char *)f->dents; /* * We don't acquire the f->sem mutex here since the only data we @@ -45,13 +46,14 @@ static int jffs2_follow_link(struct dentry *dentry, struct nameidata *nd) * nd_set_link() call. */ - if (!f->dents) { + if (!p) { printk(KERN_ERR "jffs2_follow_link(): can't find symlink taerget\n"); - return -EIO; + p = ERR_PTR(-EIO); + } else { + D1(printk(KERN_DEBUG "jffs2_follow_link(): target path is '%s'\n", (char *) f->dents)); } - D1(printk(KERN_DEBUG "jffs2_follow_link(): target path is '%s'\n", (char *) f->dents)); - nd_set_link(nd, (char *)f->dents); + nd_set_link(nd, p); /* * We unlock the f->sem mutex but VFS will use the f->dents string. This is safe -- cgit v1.2.3 From 008b150a3c4d971cd65d02d107b8fcc860bc959c Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 20 Aug 2005 00:17:39 +0100 Subject: [PATCH] Fix up symlink function pointers This fixes up the symlink functions for the calling convention change: * afs, autofs4, befs, devfs, freevxfs, jffs2, jfs, ncpfs, procfs, smbfs, sysvfs, ufs, xfs - prototype change for ->follow_link() * befs, smbfs, xfs - same for ->put_link() Signed-off-by: Linus Torvalds --- fs/jffs2/symlink.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'fs/jffs2') diff --git a/fs/jffs2/symlink.c b/fs/jffs2/symlink.c index 073633e11ea..82ef484f5e1 100644 --- a/fs/jffs2/symlink.c +++ b/fs/jffs2/symlink.c @@ -18,7 +18,7 @@ #include #include "nodelist.h" -static int jffs2_follow_link(struct dentry *dentry, struct nameidata *nd); +static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd); struct inode_operations jffs2_symlink_inode_operations = { @@ -27,7 +27,7 @@ struct inode_operations jffs2_symlink_inode_operations = .setattr = jffs2_setattr }; -static int jffs2_follow_link(struct dentry *dentry, struct nameidata *nd) +static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd) { struct jffs2_inode_info *f = JFFS2_INODE_INFO(dentry->d_inode); char *p = (char *)f->dents; @@ -60,6 +60,6 @@ static int jffs2_follow_link(struct dentry *dentry, struct nameidata *nd) * since the only way that may cause f->dents to be changed is iput() operation. * But VFS will not use f->dents after iput() has been called. */ - return 0; + return NULL; } -- cgit v1.2.3 From 5e1efe4931bf7d95b2f3d48ca0b79ea0e8341cc2 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Tue, 6 Sep 2005 15:17:23 -0700 Subject: [PATCH] jffs/jffs2: remove wrong function prototypes This patch removes prototypes for the generic_file_open and generic_file_llseek functions. Besides being superfluous because they are already present in fs.h, they were also wrong because the actual functions aren't weak functions. Signed-off-by: Adrian Bunk Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/jffs2/file.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'fs/jffs2') diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c index bd9ed9b0247..8279bf0133f 100644 --- a/fs/jffs2/file.c +++ b/fs/jffs2/file.c @@ -21,9 +21,6 @@ #include #include "nodelist.h" -extern int generic_file_open(struct inode *, struct file *) __attribute__((weak)); -extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin) __attribute__((weak)); - static int jffs2_commit_write (struct file *filp, struct page *pg, unsigned start, unsigned end); static int jffs2_prepare_write (struct file *filp, struct page *pg, -- cgit v1.2.3 From 4e57b6817880946a3a78d5d8cad1ace363f7e449 Mon Sep 17 00:00:00 2001 From: Tim Schmielau Date: Sun, 30 Oct 2005 15:03:48 -0800 Subject: [PATCH] fix missing includes I recently picked up my older work to remove unnecessary #includes of sched.h, starting from a patch by Dave Jones to not include sched.h from module.h. This reduces the number of indirect includes of sched.h by ~300. Another ~400 pointless direct includes can be removed after this disentangling (patch to follow later). However, quite a few indirect includes need to be fixed up for this. In order to feed the patches through -mm with as little disturbance as possible, I've split out the fixes I accumulated up to now (complete for i386 and x86_64, more archs to follow later) and post them before the real patch. This way this large part of the patch is kept simple with only adding #includes, and all hunks are independent of each other. So if any hunk rejects or gets in the way of other patches, just drop it. My scripts will pick it up again in the next round. Signed-off-by: Tim Schmielau Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/jffs2/background.c | 1 + fs/jffs2/wbuf.c | 2 ++ 2 files changed, 3 insertions(+) (limited to 'fs/jffs2') diff --git a/fs/jffs2/background.c b/fs/jffs2/background.c index 0f224384f17..8210ac16a36 100644 --- a/fs/jffs2/background.c +++ b/fs/jffs2/background.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "nodelist.h" diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c index 996d922e503..316133c626b 100644 --- a/fs/jffs2/wbuf.c +++ b/fs/jffs2/wbuf.c @@ -18,6 +18,8 @@ #include #include #include +#include + #include "nodelist.h" /* For testing write failures */ -- cgit v1.2.3