All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: linux-nfs@vger.kernel.org
Cc: Chuck Lever <chuck.lever@oracle.com>
Subject: [PATCH 25/30] NFS: SETCLIENTID truncates client ID and netid
Date: Tue, 07 Oct 2008 18:19:54 -0400	[thread overview]
Message-ID: <20081007221954.20945.76616.stgit@localhost.localdomain> (raw)
In-Reply-To: <20081007221952.20945.69529.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>

From: Chuck Lever <chuck.lever@oracle.com>

The sc_name field is currently 56 bytes long.  This is not large enough
to hold a pair of IPv6 addresses, the authentication type, the protocol
name, and a uniquifier number.  The maximum possible size of the name
string using IPv6 addresses is just under 110 bytes, so I increased the
size of the sc_name field to accomodate this maximum.

In addition, the strings in the nfs4_setclientid structure are
constructed with scnprintf(), which wants to terminate its output with
'\0'.  The sc_netid field was large enough only for a three byte netid
string and a '\0' so inet6 netids were being truncated.  Perhaps we
don't need the overhead of scnprintf() to do a simple string copy, but
I fixed this by increasing the size of the buffer by one byte.

Since all three of the string buffers in nfs4_setclientid are
constructed with scnprintf(), I increased the size of all three by one
byte to document the requirement, although I don't think either the
universal address field or the name field will be so small that these
strings get truncated in this way.

The size of the Linux client's client ID on the wire will be larger
than before.  RFC 3530 suggests the size limit for client IDs is 1024,
and we are still well below that.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
---

 include/linux/nfs_xdr.h |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 9cabbb3..f6e95bf 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -672,16 +672,16 @@ struct nfs4_rename_res {
 	struct nfs_fattr *		new_fattr;
 };
 
-#define NFS4_SETCLIENTID_NAMELEN	(56)
+#define NFS4_SETCLIENTID_NAMELEN	(128)
 struct nfs4_setclientid {
 	const nfs4_verifier *		sc_verifier;
 	unsigned int			sc_name_len;
-	char				sc_name[NFS4_SETCLIENTID_NAMELEN];
+	char				sc_name[NFS4_SETCLIENTID_NAMELEN + 1];
 	u32				sc_prog;
 	unsigned int			sc_netid_len;
-	char				sc_netid[RPCBIND_MAXNETIDLEN];
+	char				sc_netid[RPCBIND_MAXNETIDLEN + 1];
 	unsigned int			sc_uaddr_len;
-	char				sc_uaddr[RPCBIND_MAXUADDRLEN];
+	char				sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
 	u32				sc_cb_ident;
 };
 


  parent reply	other threads:[~2008-10-07 22:32 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-07 22:19 [PATCH 00/30] What's in the NFS queue for 2.6.27 Trond Myklebust
     [not found] ` <20081007221952.20945.69529.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-10-07 22:19   ` [PATCH 02/30] NFS: Clean up nfs_sb_active/nfs_sb_deactive Trond Myklebust
2008-10-07 22:19   ` [PATCH 01/30] NFS: Fix nfs_file_llseek() Trond Myklebust
2008-10-07 22:19   ` [PATCH 13/30] fix fs/nfs/nfsroot.c compilation Trond Myklebust
2008-10-07 22:19   ` [PATCH 08/30] NFS: Fix nfs_post_op_update_inode_force_wcc() Trond Myklebust
2008-10-07 22:19   ` [PATCH 10/30] NFS: Don't clear nfsi->cache_validity in nfs_check_inode_attributes() Trond Myklebust
2008-10-07 22:19   ` [PATCH 06/30] NFS: Clean up nfs_refresh_inode() and nfs_post_op_update_inode() Trond Myklebust
2008-10-07 22:19   ` [PATCH 09/30] NFS: Convert __nfs_revalidate_inode() to use nfs_refresh_inode() Trond Myklebust
2008-10-07 22:19   ` [PATCH 15/30] sunrpc: do not pin sunrpc module in the memory Trond Myklebust
2008-10-07 22:19   ` [PATCH 20/30] nfs: break up nfs_follow_referral Trond Myklebust
2008-10-07 22:19   ` [PATCH 22/30] nfs: prepare to share nfs_set_port Trond Myklebust
2008-10-07 22:19   ` [PATCH 04/30] NFS: Don't apply NFS_MOUNT_FLAGMASK to text-based mounts Trond Myklebust
2008-10-07 22:19   ` [PATCH 07/30] NFS: Fix the NFS attribute update Trond Myklebust
2008-10-07 22:19   ` [PATCH 14/30] nfs: ERR_PTR is expected on failure from nfs_do_clone_mount Trond Myklebust
2008-10-07 22:19   ` [PATCH 03/30] NFS: Add options for finer control of the lookup cache Trond Myklebust
2008-10-07 22:19   ` [PATCH 16/30] nfs: BUG_ON in nfs_follow_mountpoint Trond Myklebust
2008-10-07 22:19   ` [PATCH 18/30] NFS: missing nfs_fattr_init in nfs3_proc_getacl and nfs3_proc_setacls (resend #2) Trond Myklebust
2008-10-07 22:19   ` [PATCH 21/30] nfs: replace while loop by for loops in nfs_follow_referral Trond Myklebust
2008-10-07 22:19   ` [PATCH 05/30] NFS: Add mount options for controlling the lookup cache Trond Myklebust
2008-10-07 22:19   ` [PATCH 11/30] NFS: Fix up nfs_setattr_update_inode() Trond Myklebust
2008-10-07 22:19   ` [PATCH 17/30] nfs: remove an obsolete nfs_flock comment Trond Myklebust
2008-10-07 22:19   ` [PATCH 19/30] nfs: authenticated deep mounting Trond Myklebust
2008-10-07 22:19   ` [PATCH 12/30] NFS: Allow concurrent inode revalidation Trond Myklebust
2008-10-07 22:19   ` Trond Myklebust [this message]
     [not found]     ` <20081007221954.20945.76616.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-10-08 14:55       ` [PATCH 25/30] NFS: SETCLIENTID truncates client ID and netid Chuck Lever
2008-10-08 17:56         ` Trond Myklebust
2008-10-15 15:36           ` Chuck Lever
2008-10-07 22:19   ` [PATCH 30/30] sunrpc: fix oops in rpc_create when the mount namespace is unshared Trond Myklebust
2008-10-07 22:19   ` [PATCH 28/30] NFS: Client mounts hang when exported directory do not exist Trond Myklebust
2008-10-07 22:19   ` [PATCH 27/30] SUNRPC: Fix a memory leak in rpcb_getport_async Trond Myklebust
2008-10-07 22:19   ` [PATCH 29/30] NFS: Don't use range_cyclic for data integrity syncs Trond Myklebust
2008-10-07 22:19   ` [PATCH 23/30] nfs: Fix misparsing of nfsv4 fs_locations attribute Trond Myklebust
2008-10-07 22:19   ` [PATCH 26/30] SUNRPC: Fix autobind on cloned rpc clients Trond Myklebust
2008-10-07 22:19   ` [PATCH 24/30] NFS: remove 8 bytes of padding from struct nfs_fattr on 64 bit builds Trond Myklebust
2008-10-08 19:31   ` [PATCH 00/30] What's in the NFS queue for 2.6.27 J. Bruce Fields
2008-10-08 19:37     ` Trond Myklebust
2008-10-08 19:39       ` J. Bruce Fields
2008-10-08 19:38     ` [PATCH 1/5] NFS: fix nfs_parse_ip_address() corner case J. Bruce Fields
2008-10-08 19:38       ` [PATCH 2/5] nfs: break up nfs_follow_referral J. Bruce Fields
2008-10-08 19:38         ` [PATCH 3/5] nfs: replace while loop by for loops in nfs_follow_referral J. Bruce Fields
2008-10-08 19:38           ` [PATCH 4/5] nfs: prepare to share nfs_set_port J. Bruce Fields
2008-10-08 19:38             ` [PATCH 5/5] nfs: Fix misparsing of nfsv4 fs_locations attribute J. Bruce Fields

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=20081007221954.20945.76616.stgit@localhost.localdomain \
    --to=trond.myklebust@netapp.com \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /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.