All of lore.kernel.org
 help / color / mirror / Atom feed
* d_path errors
@ 2004-08-06 15:23 Andrea Arcangeli
  2004-08-06 17:23 ` viro
  0 siblings, 1 reply; 3+ messages in thread
From: Andrea Arcangeli @ 2004-08-06 15:23 UTC (permalink / raw)
  To: viro, Andrew Morton; +Cc: linux-kernel

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 {

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-08-06 18:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-06 15:23 d_path errors Andrea Arcangeli
2004-08-06 17:23 ` viro
2004-08-06 18:34   ` Andrea Arcangeli

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.