Linux NFS development
 help / color / mirror / Atom feed
* [patch] nfsd4: memory corruption in numeric_name_to_id()
@ 2012-03-28 10:44 Dan Carpenter
  2012-03-28 14:19 ` J. Bruce Fields
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-03-28 10:44 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: linux-nfs, kernel-janitors

"id" is type is a uid_t (32 bits) but on 64 bit systems strict_strtoul()
modifies 64 bits of data.  We should use kstrtouint() instead.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c
index 69ca9c5..322d11c 100644
--- a/fs/nfsd/nfs4idmap.c
+++ b/fs/nfsd/nfs4idmap.c
@@ -581,7 +581,7 @@ numeric_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namel
 	/* Just to make sure it's null-terminated: */
 	memcpy(buf, name, namelen);
 	buf[namelen] = '\0';
-	ret = strict_strtoul(name, 10, (unsigned long *)id);
+	ret = kstrtouint(name, 10, id);
 	return ret == 0;
 }
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] nfsd4: memory corruption in numeric_name_to_id()
  2012-03-28 10:44 [patch] nfsd4: memory corruption in numeric_name_to_id() Dan Carpenter
@ 2012-03-28 14:19 ` J. Bruce Fields
  0 siblings, 0 replies; 2+ messages in thread
From: J. Bruce Fields @ 2012-03-28 14:19 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-nfs, kernel-janitors

On Wed, Mar 28, 2012 at 01:44:59PM +0300, Dan Carpenter wrote:
> "id" is type is a uid_t (32 bits) but on 64 bit systems strict_strtoul()
> modifies 64 bits of data.  We should use kstrtouint() instead.

Whoops--thanks, applied!

--b.

> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c
> index 69ca9c5..322d11c 100644
> --- a/fs/nfsd/nfs4idmap.c
> +++ b/fs/nfsd/nfs4idmap.c
> @@ -581,7 +581,7 @@ numeric_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namel
>  	/* Just to make sure it's null-terminated: */
>  	memcpy(buf, name, namelen);
>  	buf[namelen] = '\0';
> -	ret = strict_strtoul(name, 10, (unsigned long *)id);
> +	ret = kstrtouint(name, 10, id);
>  	return ret == 0;
>  }
>  

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-28 14:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-28 10:44 [patch] nfsd4: memory corruption in numeric_name_to_id() Dan Carpenter
2012-03-28 14:19 ` J. Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox