public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] block: fix bugs in bio-integrity mempool usage
@ 2010-01-29  1:02 Chuck Ebbert
  2010-01-30 19:09 ` Martin K. Petersen
  0 siblings, 1 reply; 3+ messages in thread
From: Chuck Ebbert @ 2010-01-29  1:02 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel, Martin K. Petersen

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>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] block: fix bugs in bio-integrity mempool usage
  2010-01-29  1:02 [patch] block: fix bugs in bio-integrity mempool usage Chuck Ebbert
@ 2010-01-30 19:09 ` Martin K. Petersen
  2010-01-30 19:28   ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Martin K. Petersen @ 2010-01-30 19:09 UTC (permalink / raw)
  To: Chuck Ebbert; +Cc: Jens Axboe, linux-kernel, Martin K. Petersen


block: fix bugs in bio-integrity mempool usage

Acked-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] block: fix bugs in bio-integrity mempool usage
  2010-01-30 19:09 ` Martin K. Petersen
@ 2010-01-30 19:28   ` Jens Axboe
  0 siblings, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2010-01-30 19:28 UTC (permalink / raw)
  To: Martin K. Petersen; +Cc: Chuck Ebbert, linux-kernel

On Sat, Jan 30 2010, Martin K. Petersen wrote:
> 
> block: fix bugs in bio-integrity mempool usage
> 
> Acked-by: Martin K. Petersen <martin.petersen@oracle.com>

Thanks Chuck and Martin, applied to for-linus

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-01-30 19:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-29  1:02 [patch] block: fix bugs in bio-integrity mempool usage Chuck Ebbert
2010-01-30 19:09 ` Martin K. Petersen
2010-01-30 19:28   ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox