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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOJsxLFu8CPmuDV4MD8vFmZYLpX3hYSKHOY29ChtsNrLfpzEvg@mail.gmail.com>
Date:	Sat, 9 Jul 2011 21:33:31 +0300
From:	Pekka Enberg <penberg@...nel.org>
To:	Julia Lawall <julia@...u.dk>
Cc:	Mark Fasheh <mfasheh@...e.com>, kernel-janitors@...r.kernel.org,
	Joel Becker <jlbec@...lplan.org>,
	Wengang Wang <wen.gang.wang@...cle.com>,
	Tao Ma <boyu.mt@...bao.com>, ocfs2-devel@....oracle.com,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fs/ocfs2/dlm/dlmlock.c: free kmem_cache_zalloc'd data
 using kmem_cache_free

On Sat, Jul 9, 2011 at 7:04 PM, Julia Lawall <julia@...u.dk> wrote:
> From: Julia Lawall <julia@...u.dk>
>
> Memory allocated using kmem_cache_zalloc should be freed using
> kmem_cache_free, not kfree.
>
> The semantic patch that fixes this problem is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @@
> expression x,e,e1,e2;
> @@
>
> x = kmem_cache_zalloc(e1,e2)
> ... when != x = e
> ?-kfree(x)
> +kmem_cache_free(e1,x)
> // </smpl>
>
> Signed-off-by: Julia Lawall <julia@...u.dk>

Reviewed-by: Pekka Enberg <penberg@...nel.org>

> ---
>  fs/ocfs2/dlm/dlmlock.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff -u -p a/fs/ocfs2/dlm/dlmlock.c b/fs/ocfs2/dlm/dlmlock.c
> --- a/fs/ocfs2/dlm/dlmlock.c
> +++ b/fs/ocfs2/dlm/dlmlock.c
> @@ -440,7 +440,7 @@ struct dlm_lock * dlm_new_lock(int type,
>                /* zero memory only if kernel-allocated */
>                lksb = kzalloc(sizeof(*lksb), GFP_NOFS);
>                if (!lksb) {
> -                       kfree(lock);
> +                       kmem_cache_free(dlm_lock_cache, lock);
>                        return NULL;
>                }
>                kernel_allocated = 1;
>
> --
> 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/
>
--
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