netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nets: fix problem of using lock
@ 2008-11-06 10:41 Jianjun Kong
  2008-11-10 21:35 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Jianjun Kong @ 2008-11-06 10:41 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev


net/core/skbuff.c: void skb_queue_purge(struct sk_buff_head *list)

This function should takes the the list lock, because the operation to
this list shoule be atomic. And __skb_queue_purge()  (in
include/linux/skbuff.c) real delete the buffers in the list.

Signed-off-by: Jianjun Kong <jianjun@zeuux.org>
---
 net/core/skbuff.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index ebb6b94..3b89fb1 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1834,9 +1834,11 @@ struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list)
  */
 void skb_queue_purge(struct sk_buff_head *list)
 {
-	struct sk_buff *skb;
-	while ((skb = skb_dequeue(list)) != NULL)
-		kfree_skb(skb);
+	unsigned long flags;
+
+	spin_lock_irqsave(&list->lock, flags);
+	__skb_queue_purge(list);
+	spin_unlock_irqrestore(&list->lock, flags);
 }
 
 /**
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-11-11  1:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-06 10:41 [PATCH] nets: fix problem of using lock Jianjun Kong
2008-11-10 21:35 ` David Miller
2008-11-11  1:34   ` Jianjun Kong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).