fix oops in namespace.c
PATCH 1/1 fix oops in namespace.c
Number four in the series of namespace.c fixes:
A familar type of Oops: d_path() can return an error ENAMETOOLONG, and if we fail to test a segfault occurs.
So we must test. What we do is a different matter. Rather arbitrarily I return the string " (too long)" for use in /proc/mounts.
Andries
namespace.c renamed from namespace.c~ +2 -0
@@ -217,6 +217,8 @@if (!path_buf)return -ENOMEM ; path =d_path (mnt->mnt_root, mnt, path_buf,PAGE_SIZE ); +if (IS_ERR (path)) + path =" (too long)" ;mangle (m, mnt->mnt_devname ? mnt->mnt_devname :"none" );seq_putc (m,' ' );
Quoted 8 lines · On Mon, May 19, 2003 at 12:57:37AM +0200, [email protected] wrote:
Number four in the series of
namespace.cfixes:A familar type of Oops:
d_path()can return an error ENAMETOOLONG, and if we fail to test a segfault occurs.So we must test. What we do is a different matter. Rather arbitrarily I return the string " (too long)" for use in
/proc/mounts.
There's a better fix. Since we are going to use seq_...() anyway, we both have a buffer and length. Moreover, if there's not enough space to store the result, generic seq_file code will take care about expanding buffer and calling us again.
IOW, we need to add seq_path(seq_file *, vfsmount *, dentry *) that would DTRT. That would have a benefit of avoiding extra allocation/freeing.
I'll send such patch in ~20 minutes. BTW, it's also needed for /proc/swaps and can be used for /proc/<pid>/maps if we switch it to seq_file (worth doing anyway).
PS: math.psu.edu account is alive, but I'm not checking it often these days, so Cc there is not too useful.