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: <20100513131907.a3373db2.akpm@linux-foundation.org>
Date:	Thu, 13 May 2010 13:19:07 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	kirjanov@...il.com
Cc:	joern@...fs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] lib/btree: Fix possible NULL pointer dereference

On Thu, 13 May 2010 01:20:27 +0400
"Denis Kirjanov <kirjanov@...il.com" <kirjanov@...il.com> wrote:

> mempool_alloc can return null in atomic case.
> 
> Signed-off-by: Denis Kirjanov <kirjanov@...il.com>
> ---
> diff --git a/lib/btree.c b/lib/btree.c
> index 41859a8..542c904 100644
> --- a/lib/btree.c
> +++ b/lib/btree.c
> @@ -95,7 +94,8 @@ static unsigned long *btree_node_alloc(struct btree_head *head, gfp_t gfp)
>  	unsigned long *node;
>  
>  	node = mempool_alloc(head->mempool, gfp);
> -	memset(node, 0, NODESIZE);
> +	if (likely(node))
> +		memset(node, 0, NODESIZE);
>  	return node;
>  }

hm, why is btree.c using mempools?  mempools are only appropriate when
it is known that objects will become available if the allocating task
simply waits for a while.  Typically, things like BIOs and
request-structs.  Simply waiting for the disk to complete some IO will
cause some objects to be returned to the mempool.

If waiting-and-doing-nothing fails to cause objects to be returned to
the pool then the mempool code can lock up.



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