Commit 72c21479 authored by Andrea Arcangeli's avatar Andrea Arcangeli Committed by Linus Torvalds

[PATCH] Correctly handle d_path error returns

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: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 29d15009
...@@ -429,6 +429,8 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, ...@@ -429,6 +429,8 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
fn = d_path(filp->f_dentry, fn = d_path(filp->f_dentry,
filp->f_vfsmnt, path, filp->f_vfsmnt, path,
PAGE_SIZE); PAGE_SIZE);
if (IS_ERR(fn))
fn = "?";
} }
sprintf(buf,"'%c'", (cmd>>24) & 0x3f); sprintf(buf,"'%c'", (cmd>>24) & 0x3f);
......
...@@ -294,6 +294,11 @@ void svc_export_request(struct cache_detail *cd, ...@@ -294,6 +294,11 @@ void svc_export_request(struct cache_detail *cd,
qword_add(bpp, blen, exp->ex_client->name); qword_add(bpp, blen, exp->ex_client->name);
pth = d_path(exp->ex_dentry, exp->ex_mnt, *bpp, *blen); 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); qword_add(bpp, blen, pth);
(*bpp)[-1] = '\n'; (*bpp)[-1] = '\n';
} }
......
...@@ -708,7 +708,7 @@ void audit_log_d_path(struct audit_buffer *ab, const char *prefix, ...@@ -708,7 +708,7 @@ void audit_log_d_path(struct audit_buffer *ab, const char *prefix,
audit_log_move(ab); audit_log_move(ab);
avail = sizeof(ab->tmp) - ab->len; avail = sizeof(ab->tmp) - ab->len;
p = d_path(dentry, vfsmnt, ab->tmp + ab->len, avail); 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? */ /* FIXME: can we save some information here? */
audit_log_format(ab, "<toolong>"); audit_log_format(ab, "<toolong>");
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment