The RX packet handling can be called from several places, yet does not protect the rx ring structure. This patch places the ring buffer pointers under a lock.
Signed-off-by: Linas Vepstas <[EMAIL PROTECTED]> Cc: James K Lewis <[EMAIL PROTECTED]> Cc: Arnd Bergmann <[EMAIL PROTECTED]> ---- drivers/net/spider_net.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) Index: linux-2.6.19-git7/drivers/net/spider_net.c =================================================================== --- linux-2.6.19-git7.orig/drivers/net/spider_net.c 2006-12-06 15:58:27.000000000 -0600 +++ linux-2.6.19-git7/drivers/net/spider_net.c 2006-12-06 16:01:49.000000000 -0600 @@ -969,28 +969,33 @@ static int spider_net_decode_one_descr(struct spider_net_card *card, int napi) { struct spider_net_descr_chain *chain = &card->rx_chain; - struct spider_net_descr *descr = chain->tail; + struct spider_net_descr *descr; int status; int result; + unsigned long flags; + + spin_lock_irqsave(&chain->lock, flags); + descr = chain->tail; status = spider_net_get_descr_status(descr); if (status == SPIDER_NET_DESCR_CARDOWNED) { /* nothing in the descriptor yet */ - result=0; - goto out; + spin_unlock_irqrestore(&chain->lock, flags); + return 0; } if (status == SPIDER_NET_DESCR_NOT_IN_USE) { /* not initialized yet, the ring must be empty */ + spin_unlock_irqrestore(&chain->lock, flags); spider_net_refill_rx_chain(card); spider_net_enable_rxdmac(card); - result=0; - goto out; + return 0; } /* descriptor definitively used -- move on tail */ chain->tail = descr->next; + spin_unlock_irqrestore(&chain->lock, flags); result = 0; if ( (status == SPIDER_NET_DESCR_RESPONSE_ERROR) || @@ -1022,7 +1027,6 @@ refill: /* change the descriptor state: */ if (!napi) spider_net_refill_rx_chain(card); -out: return result; } - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html