linux-stable/fs/nfsd
Chuck Lever 335c54bdc4 NFSD: Prevent a buffer overflow in svc_xprt_names()
The svc_xprt_names() function can overflow its buffer if it's so near
the end of the passed in buffer that the "name too long" string still
doesn't fit.  Of course, it could never tell if it was near the end
of the passed in buffer, since its only caller passes in zero as the
buffer length.

Let's make this API a little safer.

Change svc_xprt_names() so it *always* checks for a buffer overflow,
and change its only caller to pass in the correct buffer length.

If svc_xprt_names() does overflow its buffer, it now fails with an
ENAMETOOLONG errno, instead of trying to write a message at the end
of the buffer.  I don't like this much, but I can't figure out a clean
way that's always safe to return some of the names, *and* an
indication that the buffer was not long enough.

The displayed error when doing a 'cat /proc/fs/nfsd/portlist' is
"File name too long".

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
2009-04-28 13:54:28 -04:00
..
auth.c nfsd: fix cred leak on every rpc 2009-01-27 17:26:59 -05:00
auth.h nfsd: minor fs/nfsd/auth.h cleanup 2008-02-01 16:42:05 -05:00
export.c rpcgss: remove redundant test on unsigned 2009-04-23 17:25:07 -04:00
Kconfig nfsd : Define NFSD only when FILE_LOCKING is enabled 2009-03-18 17:30:48 -04:00
lockd.c nfsd: common grace period control 2008-10-03 16:19:02 -04:00
Makefile knfsd: trivial makefile cleanup 2007-05-09 12:30:54 -07:00
nfs2acl.c nfsd: rename MAY_ flags 2008-06-23 13:02:50 -04:00
nfs3acl.c nfsd: rename MAY_ flags 2008-06-23 13:02:50 -04:00
nfs3proc.c Short write in nfsd becomes a full write to the client 2009-03-18 17:38:40 -04:00
nfs3xdr.c Use struct path in struct svc_export 2008-02-14 21:17:08 -08:00
nfs4acl.c nfsd: fix buffer overrun decoding NFSv4 acl 2008-09-01 14:24:24 -04:00
nfs4callback.c nfsd4: move rpc_client setup to a separate function 2009-03-18 17:38:39 -04:00
nfs4idmap.c nfsd: fix sparse warnings 2008-04-23 16:13:39 -04:00
nfs4proc.c nfsd41: CREATE_EXCLUSIVE4_1 2009-04-03 17:41:23 -07:00
nfs4recover.c Fix i_mutex vs. readdir handling in nfsd 2009-04-20 23:01:16 -04:00
nfs4state.c nfsd4: distinguish expired from stale stateids 2009-04-24 19:17:18 -04:00
nfs4xdr.c nfsd41: CREATE_EXCLUSIVE4_1 2009-04-03 17:41:23 -07:00
nfscache.c nfsd: fail module init on reply cache init failure 2008-02-01 16:42:04 -05:00
nfsctl.c NFSD: Prevent a buffer overflow in svc_xprt_names() 2009-04-28 13:54:28 -04:00
nfsfh.c NFSD: FIDs need to take precedence over UUIDs 2009-01-07 17:23:07 -05:00
nfsproc.c Short write in nfsd becomes a full write to the client 2009-03-18 17:38:40 -04:00
nfssvc.c Merge branch 'for-2.6.30' of git://linux-nfs.org/~bfields/linux 2009-04-06 13:25:56 -07:00
nfsxdr.c Use struct path in struct svc_export 2008-02-14 21:17:08 -08:00
stats.c [PATCH] knfsd: nfsd4: add per-operation server stats 2006-07-10 13:24:27 -07:00
vfs.c Fix i_mutex vs. readdir handling in nfsd 2009-04-20 23:01:16 -04:00