diff options
author | Chuck Ebbert <cebbert@redhat.com> | 2010-01-30 14:28:19 -0500 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2010-01-30 14:28:19 -0500 |
commit | 9e9432c267e4047db98b9d4fba95099c6effcef9 (patch) | |
tree | 4e261dd44d4f5129f64696a87d448ad89c106110 /fs/bio-integrity.c | |
parent | 1d6165851cd8e3f919d446cd6da35dee44e8837e (diff) |
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 <cebbert@redhat.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'fs/bio-integrity.c')
-rw-r--r-- | fs/bio-integrity.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c index 49a34e7f7306..a16f29e888cd 100644 --- a/fs/bio-integrity.c +++ b/fs/bio-integrity.c | |||
@@ -61,7 +61,7 @@ static inline unsigned int vecs_to_idx(unsigned int nr) | |||
61 | 61 | ||
62 | static inline int use_bip_pool(unsigned int idx) | 62 | static inline int use_bip_pool(unsigned int idx) |
63 | { | 63 | { |
64 | if (idx == BIOVEC_NR_POOLS) | 64 | if (idx == BIOVEC_MAX_IDX) |
65 | return 1; | 65 | return 1; |
66 | 66 | ||
67 | return 0; | 67 | return 0; |
@@ -95,6 +95,7 @@ struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *bio, | |||
95 | 95 | ||
96 | /* Use mempool if lower order alloc failed or max vecs were requested */ | 96 | /* Use mempool if lower order alloc failed or max vecs were requested */ |
97 | if (bip == NULL) { | 97 | if (bip == NULL) { |
98 | idx = BIOVEC_MAX_IDX; /* so we free the payload properly later */ | ||
98 | bip = mempool_alloc(bs->bio_integrity_pool, gfp_mask); | 99 | bip = mempool_alloc(bs->bio_integrity_pool, gfp_mask); |
99 | 100 | ||
100 | if (unlikely(bip == NULL)) { | 101 | if (unlikely(bip == NULL)) { |