From: Trond Myklebust <trond.myklebust@fys.uio.no>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: bfields@fieldses.org, neilb@suse.de, ibm-acpi@hmh.eng.br,
len.brown@intel.com, kkeil@suse.de, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org
Subject: Re: [patch 1/3] NFS: fix potential NULL pointer dereference
Date: Wed, 16 Apr 2008 14:55:22 -0400 [thread overview]
Message-ID: <1208372123.5376.43.camel@heimdal.trondhjem.org> (raw)
In-Reply-To: <20080416181336.GA7657@cvg>
On Wed, 2008-04-16 at 22:13 +0400, Cyrill Gorcunov wrote:
> [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
So? The defensive coding principle is that you perform validity checks
when the pointer is created. Otherwise, we could equally well have added
the NULL deref check to nfs4_path_walk()...
Trond
next prev parent reply other threads:[~2008-04-16 18:55 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20080416174421.442716301@gmail.com>
2008-04-16 17:44 ` Cyrill Gorcunov
2008-04-16 18:11 ` Trond Myklebust
2008-04-16 18:13 ` Cyrill Gorcunov
2008-04-16 18:55 ` Trond Myklebust [this message]
2008-04-16 20:19 ` Cyrill Gorcunov
2008-04-16 20:40 ` Trond Myklebust
2008-04-17 4:25 ` Cyrill Gorcunov
2008-04-17 7:25 ` Cyrill Gorcunov
2008-04-16 20:24 ` Cyrill Gorcunov
2008-04-16 17:44 ` [patch 2/3] CAPIFS: fix memory leak on remount Cyrill Gorcunov
2008-04-16 17:44 ` [patch 3/3] ThinkPad ACPI: fix possible NULL pointer dereference Cyrill Gorcunov
2008-04-16 20:52 ` Henrique de Moraes Holschuh
2008-04-18 12:41 ` Pavel Machek
2008-04-18 12:55 ` Cyrill Gorcunov
2008-04-18 13:07 ` Cyrill Gorcunov
2008-04-19 4:10 ` Henrique de Moraes Holschuh
2008-04-18 13:53 ` Cyrill Gorcunov
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=1208372123.5376.43.camel@heimdal.trondhjem.org \
--to=trond.myklebust@fys.uio.no \
--cc=akpm@linux-foundation.org \
--cc=bfields@fieldses.org \
--cc=gorcunov@gmail.com \
--cc=ibm-acpi@hmh.eng.br \
--cc=kkeil@suse.de \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=neilb@suse.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®