public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dustin Kirkland <kirkland@canonical.com>
To: Duane Griffin <duaneg@dghda.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Al Viro <viro@zeniv.linux.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	Tyler Hicks <tyhicks@linux.vnet.ibm.com>,
	ecryptfs-devel@lists.launchpad.net
Subject: Re: [PATCH, v5] eCryptfs: check readlink result was not an error before using it
Date: Mon, 22 Dec 2008 14:06:43 -0600	[thread overview]
Message-ID: <1229976403.8252.169.camel@t61p> (raw)
In-Reply-To: <1229719638-6982-3-git-send-email-duaneg@dghda.com>

[-- Attachment #1: Type: text/plain, Size: 1316 bytes --]

On Fri, 2008-12-19 at 20:47 +0000, Duane Griffin wrote:
> The result from readlink is being used to index into the link name
> buffer without checking whether it is a valid length. If readlink
> returns an error this will fault or cause memory corruption.
> 
> Cc: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
> Cc: Dustin Kirkland <kirkland@canonical.com>

Acked-by: Dustin Kirkland <kirkland@canonical.com>

> Cc: ecryptfs-devel@lists.launchpad.net
> Signed-off-by: Duane Griffin <duaneg@dghda.com>
> Acked-by: Michael Halcrow <mhalcrow@us.ibm.com>
> ---
> 
> Unchanged from original version.
> 
>  fs/ecryptfs/inode.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
> index 89209f0..5e78fc1 100644
> --- a/fs/ecryptfs/inode.c
> +++ b/fs/ecryptfs/inode.c
> @@ -673,10 +673,11 @@ static void *ecryptfs_follow_link(struct dentry *dentry, struct nameidata *nd)
>  	ecryptfs_printk(KERN_DEBUG, "Calling readlink w/ "
>  			"dentry->d_name.name = [%s]\n", dentry->d_name.name);
>  	rc = dentry->d_inode->i_op->readlink(dentry, (char __user *)buf, len);
> -	buf[rc] = '\0';
>  	set_fs(old_fs);
>  	if (rc < 0)
>  		goto out_free;
> +	else
> +		buf[rc] = '\0';
>  	rc = 0;
>  	nd_set_link(nd, buf);
>  	goto out;

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  parent reply	other threads:[~2008-12-22 20:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-19 20:47 [PATCH 0/10] make link target handling more robust Duane Griffin
2008-12-19 20:47 ` [PATCH, v5] 9p: don't print IS_ERR strings Duane Griffin
2008-12-19 20:47   ` [PATCH, v5] eCryptfs: check readlink result was not an error before using it Duane Griffin
2008-12-19 20:47     ` [PATCH, v5] vfs: introduce helper function to safely NUL-terminate symlinks Duane Griffin
2008-12-19 20:47       ` [PATCH, v5] vfs: ensure page symlinks are NUL-terminated Duane Griffin
2008-12-19 20:47         ` [PATCH, v5] ext2: ensure fast " Duane Griffin
2008-12-19 20:47           ` [PATCH, v5] ext3: " Duane Griffin
2008-12-19 20:47             ` [PATCH, v5] ext4: " Duane Griffin
2008-12-19 20:47               ` [PATCH, v5] sysv: " Duane Griffin
2008-12-19 20:47                 ` [PATCH, v5] freevxfs: " Duane Griffin
2008-12-19 20:47                   ` [PATCH, v5] befs: " Duane Griffin
2008-12-22 19:58     ` [PATCH, v5] eCryptfs: check readlink result was not an error before using it Tyler Hicks
2008-12-22 20:06     ` Dustin Kirkland [this message]
2008-12-19 22:07   ` [PATCH, v5] 9p: don't print IS_ERR strings Eric Van Hensbergen
2008-12-19 22:22     ` Duane Griffin

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=1229976403.8252.169.camel@t61p \
    --to=kirkland@canonical.com \
    --cc=akpm@linux-foundation.org \
    --cc=duaneg@dghda.com \
    --cc=ecryptfs-devel@lists.launchpad.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tyhicks@linux.vnet.ibm.com \
    --cc=viro@zeniv.linux.org.uk \
    /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