From: Andrea Arcangeli <andrea@suse.de>
To: viro@parcelfarce.linux.theplanet.co.uk, Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: d_path errors
Date: Fri, 6 Aug 2004 17:23:56 +0200 [thread overview]
Message-ID: <20040806152356.GD2514@dualathlon.random> (raw)
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).
on a slightly different topic, Al, could you suggest how to hack d_path
so that it provides an absolute path with respect to the init_task root
directory?
d_path currently returns /meminfo for dentries from /proc, instead
of /proc/meminfo. I need to build '/proc/meminfo' instead. I'm unsure if
to hack d_path to do it internally, or if to work around d_path and to
walk the mountpoints externally to it. I think the internal one is
simpler though.
Index: linux-2.5/fs/compat.c
===================================================================
RCS file: /home/andrea/crypto/cvs/linux-2.5/fs/compat.c,v
retrieving revision 1.35
diff -u -p -r1.35 compat.c
--- linux-2.5/fs/compat.c 13 Jul 2004 18:30:17 -0000 1.35
+++ linux-2.5/fs/compat.c 6 Aug 2004 14:58:05 -0000
@@ -429,6 +429,8 @@ asmlinkage long compat_sys_ioctl(unsigne
fn = d_path(filp->f_dentry,
filp->f_vfsmnt, path,
PAGE_SIZE);
+ if (IS_ERR(fn))
+ fn = "?";
}
sprintf(buf,"'%c'", (cmd>>24) & 0x3f);
Index: linux-2.5/fs/nfsd/export.c
===================================================================
RCS file: /home/andrea/crypto/cvs/linux-2.5/fs/nfsd/export.c,v
retrieving revision 1.92
diff -u -p -r1.92 export.c
--- linux-2.5/fs/nfsd/export.c 19 May 2004 23:39:57 -0000 1.92
+++ linux-2.5/fs/nfsd/export.c 6 Aug 2004 15:02:54 -0000
@@ -294,6 +294,11 @@ void svc_export_request(struct cache_det
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: linux-2.5/kernel/audit.c
===================================================================
RCS file: /home/andrea/crypto/cvs/linux-2.5/kernel/audit.c,v
retrieving revision 1.2
diff -u -p -r1.2 audit.c
--- linux-2.5/kernel/audit.c 12 Apr 2004 20:29:12 -0000 1.2
+++ linux-2.5/kernel/audit.c 6 Aug 2004 15:05:32 -0000
@@ -708,7 +708,7 @@ void audit_log_d_path(struct audit_buffe
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 {
next reply other threads:[~2004-08-06 15:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-06 15:23 Andrea Arcangeli [this message]
2004-08-06 17:23 ` d_path errors viro
2004-08-06 18:34 ` Andrea Arcangeli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040806152356.GD2514@dualathlon.random \
--to=andrea@suse.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@parcelfarce.linux.theplanet.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.