public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tim Gardner <tim.gardner@canonical.com>
To: Michael Halcrow <mhalcrow@us.ibm.com>
Cc: Duane Griffin <duaneg@dghda.com>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Boaz Harrosh <bharrosh@panasas.com>,
	Mike.Halcrow.mhalcrow@us.ibm.com,
	Phillip.Hellewell.phillip@hellewell.homeip.net,
	ecryptfs-devel@lists.sourceforge.net, stable@kernel.org
Subject: Re: [PATCH] eCryptfs: check readlink result was not an error	before using it
Date: Thu, 11 Dec 2008 17:48:49 -0800	[thread overview]
Message-ID: <4941C301.3050909@canonical.com> (raw)
In-Reply-To: <20081211193228.GA13627@halcrowt61p.lan>

Michael Halcrow wrote:
> On Thu, Dec 11, 2008 at 07:16:26PM +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.
>>
>> Signed-off-by: Duane Griffin <duaneg@dghda.com>
> 
> Acked-by: Michael Halcrow <mhalcrow@us.ibm.com>
> 
>> ---
>>  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;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

Please add 'Cc: stable@kernel.org' in the commit message. This looks
like a good candidate.

rtg
-- 
Tim Gardner tim.gardner@canonical.com

      reply	other threads:[~2008-12-12  1:49 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-11 19:16 [PATCH 0/11] make link target handling more robust Duane Griffin
     [not found] ` <1229022995-9898-2-git-send-email-duaneg@dghda.com>
     [not found]   ` <1229022995-9898-3-git-send-email-duaneg@dghda.com>
     [not found]     ` <1229022995-9898-4-git-send-email-duaneg@dghda.com>
2008-12-11 19:16       ` [PATCH] ext2: ensure link targets are NULL-terminated Duane Griffin
2008-12-11 19:21         ` Matthew Wilcox
2008-12-11 20:25           ` Duane Griffin
2008-12-11 22:23         ` [PATCH, v2] ext2: ensure link targets are NUL-terminated Duane Griffin
     [not found]         ` <1229022995-9898-6-git-send-email-duaneg@dghda.com>
2008-12-11 22:26           ` [PATCH, v2] ext3: ensure link targets are NULL-terminated Duane Griffin
2008-12-12  3:32             ` Andrew Morton
2008-12-12  9:40               ` Duane Griffin
2008-12-12 10:19                 ` Duane Griffin
2008-12-16  0:09                   ` Andrew Morton
     [not found]           ` <1229022995-9898-7-git-send-email-duaneg@dghda.com>
2008-12-11 22:27             ` [PATCH, v2] ext4: ensure link targets are NUL-terminated Duane Griffin
     [not found]             ` <1229022995-9898-8-git-send-email-duaneg@dghda.com>
     [not found]               ` <1229022995-9898-9-git-send-email-duaneg@dghda.com>
2008-12-11 20:06                 ` [PATCH] JFS: ensure link targets are NULL-terminated Dave Kleikamp
2008-12-11 20:34                   ` Duane Griffin
     [not found]                 ` <1229022995-9898-10-git-send-email-duaneg@dghda.com>
     [not found]                   ` <1229022995-9898-11-git-send-email-duaneg@dghda.com>
2008-12-11 22:35                     ` [PATCH, v2] sysv: ensure link targets are NUL-terminated Duane Griffin
2008-12-15 10:12                       ` Al Viro
     [not found]                     ` <1229022995-9898-12-git-send-email-duaneg@dghda.com>
2008-12-11 22:36                       ` [PATCH, v2] ufs: " Duane Griffin
2008-12-14 21:12                         ` Evgeniy Dushistov
2008-12-11 22:37               ` [PATCH, v2] freevxfs: " Duane Griffin
2008-12-11 19:32     ` [PATCH] eCryptfs: check readlink result was not an error before using it Michael Halcrow
2008-12-12  1:48       ` Tim Gardner [this message]

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=4941C301.3050909@canonical.com \
    --to=tim.gardner@canonical.com \
    --cc=Mike.Halcrow.mhalcrow@us.ibm.com \
    --cc=Phillip.Hellewell.phillip@hellewell.homeip.net \
    --cc=bharrosh@panasas.com \
    --cc=duaneg@dghda.com \
    --cc=ecryptfs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhalcrow@us.ibm.com \
    --cc=stable@kernel.org \
    /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