2010-01-29 01:03:08

by Chuck Ebbert

[permalink] [raw]
Subject: [patch] block: fix bugs in bio-integrity mempool usage

block: fix bugs in bio-integrity mempool usage

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 <[email protected]>

--- linux-2.6.32.noarch.orig/fs/bio-integrity.c
+++ linux-2.6.32.noarch/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)) {


2010-01-30 19:10:44

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [patch] block: fix bugs in bio-integrity mempool usage


block: fix bugs in bio-integrity mempool usage

Acked-by: Martin K. Petersen <[email protected]>

--
Martin K. Petersen Oracle Linux Engineering

2010-01-30 19:28:49

by Jens Axboe

[permalink] [raw]
Subject: Re: [patch] block: fix bugs in bio-integrity mempool usage

On Sat, Jan 30 2010, Martin K. Petersen wrote:
>
> block: fix bugs in bio-integrity mempool usage
>
> Acked-by: Martin K. Petersen <[email protected]>

Thanks Chuck and Martin, applied to for-linus

--
Jens Axboe