lkml.org 
[lkml]   [2010]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateThu, 04 Feb 2010 09:12:30 -0800
FromGreg KH <>
Subject[59/74] block: fix bugs in bio-integrity mempool usage
2.6.32-stable review patch.  If anyone has any objections, please let us know.

------------------
From: Chuck Ebbert <cebbert@redhat.com>

commit 9e9432c267e4047db98b9d4fba95099c6effcef9 upstream.

Fix two bugs in the bio integrity code:

use_bip_pool() always returns 0 because it checks against the wrong limit,
causing the mempool to be used only when regular allocation fails.

When the mempool is used as a fallback we don't free the data properly.

Signed-Off-By: Chuck Ebbert <cebbert@redhat.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
fs/bio-integrity.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/fs/bio-integrity.c
+++ b/fs/bio-integrity.c
@@ -61,7 +61,7 @@ static inline unsigned int vecs_to_idx(u

static inline int use_bip_pool(unsigned int idx)
{
- if (idx == BIOVEC_NR_POOLS)
+ if (idx == BIOVEC_MAX_IDX)
return 1;

return 0;
@@ -95,6 +95,7 @@ struct bio_integrity_payload *bio_integr

/* Use mempool if lower order alloc failed or max vecs were requested */
if (bip == NULL) {
+ idx = BIOVEC_MAX_IDX; /* so we free the payload properly later */
bip = mempool_alloc(bs->bio_integrity_pool, gfp_mask);

if (unlikely(bip == NULL)) {



\
 
 \ /
  Last update: 2010-02-04 18:45    [from the cache]
©2003-2010