[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.LRH.2.00.1004222118280.14395@tundra.namei.org>
Date: Thu, 22 Apr 2010 21:18:55 +1000 (EST)
From: James Morris <jmorris@...ei.org>
To: Dan Carpenter <error27@...il.com>
cc: Eric Paris <eparis@...hat.com>, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org,
linux-security-module@...r.kernel.org
Subject: Re: [patch] security: testing the wrong variable in
create_by_name()
On Thu, 22 Apr 2010, Dan Carpenter wrote:
> There is a typo here. We should be testing "*dentry" instead of
> "dentry". If "*dentry" is an ERR_PTR, it gets dereferenced in either
> mkdir() or create() which would cause an OOPs.
>
> Signed-off-by: Dan Carpenter <error27@...il.com>
Looks correct -- queued for Linus.
>
> diff --git a/security/inode.c b/security/inode.c
> index c3a7938..1c812e8 100644
> --- a/security/inode.c
> +++ b/security/inode.c
> @@ -161,13 +161,13 @@ static int create_by_name(const char *name, mode_t mode,
>
> mutex_lock(&parent->d_inode->i_mutex);
> *dentry = lookup_one_len(name, parent, strlen(name));
> - if (!IS_ERR(dentry)) {
> + if (!IS_ERR(*dentry)) {
> if ((mode & S_IFMT) == S_IFDIR)
> error = mkdir(parent->d_inode, *dentry, mode);
> else
> error = create(parent->d_inode, *dentry, mode);
> } else
> - error = PTR_ERR(dentry);
> + error = PTR_ERR(*dentry);
> mutex_unlock(&parent->d_inode->i_mutex);
>
> return error;
>
--
James Morris
<jmorris@...ei.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists