]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Correctly handle d_path error returns
authorAndrea Arcangeli <andrea@suse.de>
Tue, 24 Aug 2004 04:26:07 +0000 (21:26 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 24 Aug 2004 04:26:07 +0000 (21:26 -0700)
There's some minor bug in the d_path handling (the nfsd one may not the the
correct fix, there's no failure path for it, so I just terminate the
string, and the last one in the audit subsystem is just a robustness
cleanup if somebody will extend d_path in the future, right now it's a
noop).

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/compat.c
fs/nfsd/export.c
kernel/audit.c

index 709a02fc8e5019f605b4fad02371e4c3b9700707..3cddaab903548daa382ed722b59ddeac9bc0dcd7 100644 (file)
@@ -429,6 +429,8 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
                                        fn = d_path(filp->f_dentry,
                                                filp->f_vfsmnt, path,
                                                PAGE_SIZE);
+                                       if (IS_ERR(fn))
+                                               fn = "?";
                                }
 
                                sprintf(buf,"'%c'", (cmd>>24) & 0x3f);
index 3b9e865c4abc1bab05b0315b700dc0caa026994d..1a53ff65dc3f73f5c8a51b57e002805892f4ff25 100644 (file)
@@ -294,6 +294,11 @@ void svc_export_request(struct cache_detail *cd,
 
        qword_add(bpp, blen, exp->ex_client->name);
        pth = d_path(exp->ex_dentry, exp->ex_mnt, *bpp, *blen);
+       if (IS_ERR(pth)) {
+               /* is this correct? */
+               (*bpp)[0] = '\n';
+               return;
+       }
        qword_add(bpp, blen, pth);
        (*bpp)[-1] = '\n';
 }
index 765822b03b910b881ff09b93b219f8609971b2f2..a86aaf2c8fadbe2b7486970bd59da050fd1bf2b4 100644 (file)
@@ -708,7 +708,7 @@ void audit_log_d_path(struct audit_buffer *ab, const char *prefix,
                audit_log_move(ab);
        avail = sizeof(ab->tmp) - ab->len;
        p = d_path(dentry, vfsmnt, ab->tmp + ab->len, avail);
-       if (p == ERR_PTR(-ENAMETOOLONG)) {
+       if (IS_ERR(p)) {
                /* FIXME: can we save some information here? */
                audit_log_format(ab, "<toolong>");
        } else {