rsxx: Handling failed pci_map_page on PowerPC and double free.
PATCH v3 1/2 rsxx: Handling failed pci_map_page on PowerPC and double free.
From: Philip J Kelleher <[email protected]>
The rsxx driver was not checking the correct value during a pci_map_page failure. Fixing this also uncovered a double free if the bio was returned before it was broken up into indiviadual 4k dmas, that is also fixed here.
Signed-off-by Philip J Kelleher <[email protected]>
-------------------------------------------------------------------------------
drivers/block/rsxx/core.c +2 -1
@@ -654,7 +654,8 @@ static void rsxx_eeh_failure(struct pci_for (i =0 ; i < card->n_targets; i++) {spin_lock_bh (&card->ctrl[i].queue_lock); cnt =rsxx_cleanup_dma_queue (&card->ctrl[i], - &card->ctrl[i].queue); + &card->ctrl[i].queue, +COMPLETE_DMA );spin_unlock_bh (&card->ctrl[i].queue_lock); cnt +=rsxx_dma_cancel (&card->ctrl[i]);
drivers/block/rsxx/dma.c +27 -20
107 lines not on this page · raw message
drivers/block/rsxx/rsxx_priv.h +8 -1
@@ -345,6 +345,11 @@ enum rsxx_creg_stat { CREG_STAT_TAG_MASK = 0x0000ff00, }; +enum rsxx_dma_finish { +FREE_DMA =0x0 , +COMPLETE_DMA =0x1 , +}; +static inline unsigned int CREG_DATA (int N ) {return CREG_DATA0 + (N <<2 );
@@ -379,7 +384,9 @@ typedef void (*rsxx_dma_cb)(struct rsxx_int rsxx_dma_setup (struct rsxx_cardinfo *card);void rsxx_dma_destroy (struct rsxx_cardinfo *card);int rsxx_dma_init (void ); -int rsxx_cleanup_dma_queue (struct rsxx_dma_ctrl *ctrl,struct list_head *q); +int rsxx_cleanup_dma_queue (struct rsxx_dma_ctrl *ctrl, +struct list_head *q, +unsigned int done);int rsxx_dma_cancel (struct rsxx_dma_ctrl *ctrl);void rsxx_dma_cleanup (void );void rsxx_dma_queue_reset (struct rsxx_cardinfo *card);
Quoted 9 lines · Philip J. Kelleher
From: Philip J Kelleher <[email protected]>
The rsxx driver was not checking the correct value during a
pci_map_pagefailure. Fixing this also uncovered a double free if the bio was returned before it was broken up into indiviadual 4k dmas, that is also fixed here.Signed-off-by Philip J Kelleher <[email protected]>
Reviewed-by Brian King <[email protected]>
Signature · 3 lines
Brian King Power Linux I/O IBM Linux Technology Center