From: "Serge E. Hallyn" <serge@hallyn.com>
To: Tvrtko Ursulin <tvrtko.ursulin@sophos.com>
Cc: James Morris <jmorris@namei.org>,
"greg@kroah.com" <greg@kroah.com>,
Al Viro <viro@zeniv.linux.org.uk>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
linux-security-module@vger.kernel.org
Subject: Re: [PATCH][securityfs][2.6.34] Drop dentry reference count when mknod fails
Date: Thu, 15 Jul 2010 09:59:46 -0500 [thread overview]
Message-ID: <20100715145946.GA26067@hallyn.com> (raw)
In-Reply-To: <201007151325.06942.tvrtko.ursulin@sophos.com>
Quoting Tvrtko Ursulin (tvrtko.ursulin@sophos.com):
>
> lookup_one_len increments dentry reference count which is not decremented
> when the create operation fails. This can cause a kernel BUG at
> fs/dcache.c:676 at unmount time. Also error code returned when new_inode()
> fails was replaced with more appropriate -ENOMEM.
>
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@sophos.com>
Looks right.
Acked-by: Serge E. Hallyn <serge@hallyn.com>
thanks,
-serge
> ---
> inode.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff -upr linux-2.6.34/security/inode.c linux-2.6.34-new/security/inode.c
> --- linux-2.6.34/security/inode.c 2010-05-16 22:17:36.000000000 +0100
> +++ linux-2.6.34-new/security/inode.c 2010-07-15 13:20:38.133783253 +0100
> @@ -86,7 +86,7 @@ static int mknod(struct inode *dir, stru
> int mode, dev_t dev)
> {
> struct inode *inode;
> - int error = -EPERM;
> + int error = -ENOMEM;
>
> if (dentry->d_inode)
> return -EEXIST;
> @@ -166,6 +166,8 @@ static int create_by_name(const char *na
> error = mkdir(parent->d_inode, *dentry, mode);
> else
> error = create(parent->d_inode, *dentry, mode);
> + if (error)
> + dput(dentry);
> } else
> error = PTR_ERR(*dentry);
> mutex_unlock(&parent->d_inode->i_mutex);
>
>
>
> Sophos Plc, The Pentagon, Abingdon Science Park, Abingdon, OX14 3YP, United Kingdom.
> Company Reg No 2096520. VAT Reg No GB 348 3873 20.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-07-15 14:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-15 12:25 [PATCH][securityfs][2.6.34] Drop dentry reference count when mknod fails Tvrtko Ursulin
2010-07-15 14:59 ` Serge E. Hallyn [this message]
2010-07-15 17:10 ` Greg KH
2010-07-16 1:38 ` James Morris
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=20100715145946.GA26067@hallyn.com \
--to=serge@hallyn.com \
--cc=greg@kroah.com \
--cc=jmorris@namei.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=tvrtko.ursulin@sophos.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