Skip to contentSkip to conversation

bna: fix list corruption

PATCH Applied Ivan Vecera 3 participants 3 messages Feb 26, 2016 – Mar 1, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bna: fix list corruption

Use list_move_tail() to move MAC address entry from list of pending to list of active entries. Simple list_add_tail() leaves the entry also in the first list, this leads to list corruption.

---
 drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/brocade/bna/bna_tx_rx.c +1 -1
index 04b0d16..95bc470 100644
@@ -987,7 +987,7 @@ bna_rxf_ucast_cfg_apply(struct bna_rxf *rxf)
 	if (!list_empty(&rxf->ucast_pending_add_q)) {
 		mac = list_first_entry(&rxf->ucast_pending_add_q,
 				       struct bna_mac, qe);
-		list_add_tail(&mac->qe, &rxf->ucast_active_q);
+		list_move_tail(&mac->qe, &rxf->ucast_active_q);
 		bna_bfi_ucast_req(rxf, mac, BFI_ENET_H2I_MAC_UCAST_ADD_REQ);
 		return 1;
 	}
Signature · 1 line
2.4.10
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines

From: Ivan Vecera [mailto:[email protected]]
Sent: Friday, February 26, 2016 12:16 AM

Use list_move_tail() to move MAC address entry from list of pending to list of active entries. Simple list_add_tail() leaves the entry also in the first list, this leads to list corruption.

Quoted 21 lines
---
 drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/brocade/bna/bna_tx_rx.c +1 -1
index 04b0d16..95bc470 100644
@@ -987,7 +987,7 @@ bna_rxf_ucast_cfg_apply(struct bna_rxf *rxf)
 	if (!list_empty(&rxf->ucast_pending_add_q)) {
 		mac = list_first_entry(&rxf->ucast_pending_add_q,
 				       struct bna_mac, qe);
-		list_add_tail(&mac->qe, &rxf->ucast_active_q);
+		list_move_tail(&mac->qe, &rxf->ucast_active_q);
 		bna_bfi_ucast_req(rxf, mac,
 BFI_ENET_H2I_MAC_UCAST_ADD_REQ);
 		return 1;

}
--
2.4.10