diff mbox

[v2] NFSD: Error out when getting more than one fsloc/secinfo/uuid

Message ID 53800FDD.7030001@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kinglong Mee May 24, 2014, 3:19 a.m. UTC
v2:
remove WARN_ON_ONCE(1) and return -EINVAL instead of ignoring it. 

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 fs/nfsd/export.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

J. Bruce Fields May 27, 2014, 3:47 p.m. UTC | #1
On Sat, May 24, 2014 at 11:19:57AM +0800, Kinglong Mee wrote:
> v2:
> remove WARN_ON_ONCE(1) and return -EINVAL instead of ignoring it. 

Thanks, applying.--b.

> 
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
> ---
>  fs/nfsd/export.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
> index 7884051..13b85f9 100644
> --- a/fs/nfsd/export.c
> +++ b/fs/nfsd/export.c
> @@ -389,6 +389,10 @@ fsloc_parse(char **mesg, char *buf, struct nfsd4_fs_locations *fsloc)
>  	int len;
>  	int migrated, i, err;
>  
> +	/* more than one fsloc */
> +	if (fsloc->locations)
> +		return -EINVAL;
> +
>  	/* listsize */
>  	err = get_uint(mesg, &fsloc->locations_count);
>  	if (err)
> @@ -442,6 +446,10 @@ static int secinfo_parse(char **mesg, char *buf, struct svc_export *exp)
>  	u32 listsize;
>  	int err;
>  
> +	/* more than one secinfo */
> +	if (exp->ex_nflavors)
> +		return -EINVAL;
> +
>  	err = get_uint(mesg, &listsize);
>  	if (err)
>  		return err;
> @@ -481,6 +489,10 @@ uuid_parse(char **mesg, char *buf, unsigned char **puuid)
>  {
>  	int len;
>  
> +	/* more than one uuid */
> +	if (*puuid)
> +		return -EINVAL;
> +
>  	/* expect a 16 byte uuid encoded as \xXXXX... */
>  	len = qword_get(mesg, buf, PAGE_SIZE);
>  	if (len != EX_UUID_LEN)
> -- 
> 1.9.3
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 7884051..13b85f9 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -389,6 +389,10 @@  fsloc_parse(char **mesg, char *buf, struct nfsd4_fs_locations *fsloc)
 	int len;
 	int migrated, i, err;
 
+	/* more than one fsloc */
+	if (fsloc->locations)
+		return -EINVAL;
+
 	/* listsize */
 	err = get_uint(mesg, &fsloc->locations_count);
 	if (err)
@@ -442,6 +446,10 @@  static int secinfo_parse(char **mesg, char *buf, struct svc_export *exp)
 	u32 listsize;
 	int err;
 
+	/* more than one secinfo */
+	if (exp->ex_nflavors)
+		return -EINVAL;
+
 	err = get_uint(mesg, &listsize);
 	if (err)
 		return err;
@@ -481,6 +489,10 @@  uuid_parse(char **mesg, char *buf, unsigned char **puuid)
 {
 	int len;
 
+	/* more than one uuid */
+	if (*puuid)
+		return -EINVAL;
+
 	/* expect a 16 byte uuid encoded as \xXXXX... */
 	len = qword_get(mesg, buf, PAGE_SIZE);
 	if (len != EX_UUID_LEN)