Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0db3dc73f7a3a73b0dc725b6a991253f5652c905
Commit:     0db3dc73f7a3a73b0dc725b6a991253f5652c905
Parent:     48d8d7ee5dd17c64833e0343ab4ae8ef01cc2648
Author:     Stephen Hemminger <[EMAIL PROTECTED]>
AuthorDate: Wed Jun 27 00:39:42 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Wed Jun 27 00:39:42 2007 -0700

    [NETPOLL]: tx lock deadlock fix
    
    If sky2 device poll routine is called from netpoll_send_skb, it would
    deadlock. The netpoll_send_skb held the netif_tx_lock, and the poll
    routine could acquire it to clean up skb's. Other drivers might use
    same locking model.
    
    The driver is correct, netpoll should not introduce more locking
    problems than it causes already. So change the code to drop lock
    before calling poll handler.
    
    Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/core/netpoll.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 758dafe..f8e74e5 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -250,22 +250,23 @@ static void netpoll_send_skb(struct netpoll *np, struct 
sk_buff *skb)
                unsigned long flags;
 
                local_irq_save(flags);
-               if (netif_tx_trylock(dev)) {
-                       /* try until next clock tick */
-                       for (tries = jiffies_to_usecs(1)/USEC_PER_POLL;
-                                       tries > 0; --tries) {
+               /* try until next clock tick */
+               for (tries = jiffies_to_usecs(1)/USEC_PER_POLL;
+                    tries > 0; --tries) {
+                       if (netif_tx_trylock(dev)) {
                                if (!netif_queue_stopped(dev))
                                        status = dev->hard_start_xmit(skb, dev);
+                               netif_tx_unlock(dev);
 
                                if (status == NETDEV_TX_OK)
                                        break;
 
-                               /* tickle device maybe there is some cleanup */
-                               netpoll_poll(np);
-
-                               udelay(USEC_PER_POLL);
                        }
-                       netif_tx_unlock(dev);
+
+                       /* tickle device maybe there is some cleanup */
+                       netpoll_poll(np);
+
+                       udelay(USEC_PER_POLL);
                }
                local_irq_restore(flags);
        }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to