[PATCH 1/3] block/blk-map.c: blk_rq_append_bio should ensure it's not appending a chain

From: Jeff Garzik
Date: Fri Apr 10 2009 - 07:48:40 EST



Add a standard bit of list safety. The other functions called in
blk_rq_append_bio() are written to assume only a single bio is passed to
them. Therefore, it is an error to _ever_ pass a list to this function.

Enforce this error by ensuring the bio list is guaranteed to only append
a single list item with each blk_rq_append_bio() call.

Signed-off-by: Jeff Garzik <jgarzik@xxxxxxxxxx>

diff --git a/block/blk-map.c b/block/blk-map.c
index f103729..a7eeac4 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -19,6 +19,7 @@ int blk_rq_append_bio(struct request_queue *q, struct request *rq,
else {
rq->biotail->bi_next = bio;
rq->biotail = bio;
+ bio->bi_next = NULL;

rq->data_len += bio->bi_size;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/