lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <47824D31.8040104@ak.jp.nec.com>
Date:	Tue, 08 Jan 2008 01:02:57 +0900
From:	KaiGai Kohei <kaigai@...jp.nec.com>
To:	Julia Lawall <julia@...u.dk>
CC:	dwmw2@...radead.org, linux-mtd@...ts.infradead.org,
	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
	KaiGai Kohei <kaigai@...jp.nec.com>
Subject: Re: [PATCH] fs/jffs2: Add missing call to posix_acl_release

Julia Lawall wrote:
> From: Julia Lawall <julia@...u.dk>
> 
> posix_acl_clone does a memory allocation and sets a reference count, so
> posix_acl_release is needed afterwards to free it.
> 
> 
> The problem was fixed using the following semantic patch.
> (http://www.emn.fr/x-info/coccinelle/)
> 
> // <smpl>
> @@
> type T;
> identifier E;
> expression E1, E2;
> int ret;
> statement S;
> @@
> 
>   T E;
>   <+...
> (
>   E = \(posix_acl_clone\|posix_acl_alloc\|posix_acl_dup\)(...);
>   if (E == NULL) S
> |
>   if ((E = \(posix_acl_clone\|posix_acl_alloc\|posix_acl_dup\)(...)) == NULL) S
> )
>   ... when != E2 = E
>       when strict
> (
>   posix_acl_release(E);
> |
>   E1 = E;
> |
> + posix_acl_release(E);
>   return;
> |
> + posix_acl_release(E);
>   return ret;
> )
>   ...+>
> // </smpl>
> 
> Signed-off-by: Julia Lawall <julia@...u.dk>
> ---
> 
> diff -u -p a/fs/jffs2/acl.c b/fs/jffs2/acl.c
> --- a/fs/jffs2/acl.c 2008-01-03 09:49:31.000000000 +0100
> +++ b/fs/jffs2/acl.c 2008-01-06 17:38:52.000000000 +0100
> @@ -345,8 +345,10 @@ int jffs2_init_acl_pre(struct inode *dir
>  		if (!clone)
>  			return -ENOMEM;
>  		rc = posix_acl_create_masq(clone, (mode_t *)i_mode);
> -		if (rc < 0)
> +		if (rc < 0) {
> +			posix_acl_release(clone);
>  			return rc;
> +		}
>  		if (rc > 0)
>  			jffs2_iset_acl(inode, &f->i_acl_access, clone);

Indeed, there was a possibility to cause memory leaking.

Acked-by: KaiGai Kohei <kaigai@...jp.nec.com>

-- 
OSS Platform Development Division, NEC
KaiGai Kohei <kaigai@...jp.nec.com>

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ