All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: iceberg <strakh@ispras.ru>
Cc: linux-kernel@vger.kernel.org, James Morris <jmorris@namei.org>
Subject: Re: BUG memory leakage at ./security/selinux/hooks.c
Date: Sat, 15 Aug 2009 00:17:15 -0700	[thread overview]
Message-ID: <4A8660FB.20102@goop.org> (raw)
In-Reply-To: <200908101253.40317.strakh@ispras.ru>

Added cc:

On 08/10/09 01:53, iceberg wrote:
> ????????KERNEL_VERSION: 2.6.30.4??
>   

Looks like you got some kind of charset conversion problem going on.

> ????????SUBJECT: ?in function inode_doinit_with_dentry memory is not released 
> on error  path (if rc<0).
> ????????DESCRIBE:
> ????????In ./security/selinux/hooks.c in function inode_doinit_with_dentry:??
> 1. If in the line 1278 we successfully allocate memory and assign it to 
> context variablehen 
> 2. if in the line 1284 getxattr returns -ERANGE and 
> 3. if in the line 1288 getxattr returns rc<0 
> then we go to out_unlock without releasing memory pointed to by context 
> variable.
>
> 1278 ????????????????context?=?kmalloc(len,?GFP_NOFS);
> 1279 ????????????????if?(!context)?{
> 1280 ????????????????????????rc?=?-ENOMEM;
> 1281 ????????????????????????dput(dentry);
> 1282 ????????????????????????goto?out_unlock;
> 1283 ????????????????}
> 1284 ????????????????rc?=?inode->i_op->getxattr(dentry,?XATTR_NAME_SELINUX,
> 1285 ???????????????????????????????????????????context,?len);
> 1286 ????????????????if?(rc?==?-ERANGE)?{
> 1287 ????????????????????????/*?Need?a?larger?buffer.??Query?for?the
> right?size.?*/
> 1288 ????????????????????????rc?=?inode->i_op->getxattr(dentry,
> XATTR_NAME_SELINUX,
> 1289 ???????????????????????????????????????????????????NULL,?0);
> 1290 ????????????????????????if?(rc?<?0)?{
> 1291 ????????????????????????????????dput(dentry);
> 1292 ????????????????????????????????goto?out_unlock;
> 1293 ????????????????????????}
> 1294 ????????????????????????kfree(context);
> 1295 ????????????????????????len?=?rc;
> 1296 ????????????????????????context?=?kmalloc(len,?GFP_NOFS);
> --
> 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/
>
>   


  reply	other threads:[~2009-08-15  7:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-10  8:53 BUG memory leakage at ./security/selinux/hooks.c iceberg
2009-08-15  7:17 ` Jeremy Fitzhardinge [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-08-10  8:57 iceberg
2009-08-10 11:53 ` James Morris
2009-08-10 11:53   ` 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=4A8660FB.20102@goop.org \
    --to=jeremy@goop.org \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=strakh@ispras.ru \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.