Re: [patch 1/3] NFS: fix potential NULL pointer dereference

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Trond Myklebust <trond.myklebust@...>
Cc: <bfields@...>, <neilb@...>, <ibm-acpi@...>, <len.brown@...>, <kkeil@...>, <akpm@...>, <linux-kernel@...>
Date: Wednesday, April 16, 2008 - 2:13 pm

[Trond Myklebust - Wed, Apr 16, 2008 at 02:11:31PM -0400]
| 
| On Wed, 2008-04-16 at 21:44 +0400, Cyrill Gorcunov wrote:
| > plain text document attachment (nfs-kstrdup-nul-fix)
| > It's possible to get NULL pointer dereference
| > if kstrndup failed
| > 
| > Here is a possible scenario
| > 
| > nfs4_get_sb
| >   nfs4_validate_mount_data
| >     o kstrndup failed so args->nfs_server.export_path = NULL
| >   nfs4_create_server
| >     nfs4_path_walk(..., NULL) -> Oops!
| > 
| > Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
| 
| Why fix only the one case? What about the other kstrdup/kstrndup cases
| in super.c that appear to be unchecked?
| 
| Trond
| 
| > ---
| > 
| > Index: linux-2.6.git/fs/nfs/super.c
| > ===================================================================
| > --- linux-2.6.git.orig/fs/nfs/super.c	2008-04-15 23:01:30.000000000 +0400
| > +++ linux-2.6.git/fs/nfs/super.c	2008-04-16 20:01:44.000000000 +0400
| > @@ -1858,6 +1858,8 @@ static int nfs4_validate_mount_data(void
| >  		if (len > NFS4_MAXPATHLEN)
| >  			return -ENAMETOOLONG;
| >  		args->nfs_server.export_path = kstrndup(c, len, GFP_KERNEL);
| > +		if (!args->nfs_server.export_path)
| > +			return -ENOMEM;
| >  
| >  		dprintk("NFS: MNTPATH: '%s'\n", args->nfs_server.export_path);
| > 
| 

This one is leading to NULL deref, others - don't

		- Cyrill -
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 1/3] NFS: fix potential NULL pointer dereference, Cyrill Gorcunov, (Wed Apr 16, 1:44 pm)
Re: [patch 1/3] NFS: fix potential NULL pointer dereference, Trond Myklebust, (Wed Apr 16, 2:11 pm)
Re: [patch 1/3] NFS: fix potential NULL pointer dereference, Cyrill Gorcunov, (Wed Apr 16, 2:13 pm)
Re: [patch 1/3] NFS: fix potential NULL pointer dereference, Trond Myklebust, (Wed Apr 16, 2:55 pm)
Re: [patch 1/3] NFS: fix potential NULL pointer dereference, Cyrill Gorcunov, (Wed Apr 16, 4:24 pm)
Re: [patch 1/3] NFS: fix potential NULL pointer dereference, Cyrill Gorcunov, (Wed Apr 16, 4:19 pm)
Re: [patch 1/3] NFS: fix potential NULL pointer dereference, Trond Myklebust, (Wed Apr 16, 4:40 pm)
Re: [patch 1/3] NFS: fix potential NULL pointer dereference, Cyrill Gorcunov, (Thu Apr 17, 12:25 am)
Re: [patch 1/3] NFS: fix potential NULL pointer dereference, Cyrill Gorcunov, (Thu Apr 17, 3:25 am)