Skip to contentSkip to conversation

RXRPC: Use skb_queue_walk_safe()

PATCH In review Wang Chen 2 participants 2 messages May 22, 2008

Subsystems (3)
lore
Share & tools
lore

Wang Chen

author
#0 lore raw

PATCH 1/1 RXRPC: Use skb_queue_walk_safe()

Because the list could be modified inside the loop, use skb_queue_walk_safe().

---
 net/rxrpc/ar-ack.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
net/rxrpc/ar-ack.c +2 -1
index 3ac1672..cbd70d1 100644
@@ -468,6 +468,7 @@ static void rxrpc_insert_oos_packet(struct rxrpc_call *call,
 {
 	struct rxrpc_skb_priv *sp, *psp;
 	struct sk_buff *p;
+	struct sk_buff *tmp;
 	u32 seq;
 
 	sp = rxrpc_skb(skb);
@@ -482,7 +483,7 @@ static void rxrpc_insert_oos_packet(struct rxrpc_call *call,
 	/* insert into the buffer in sequence order */
 	spin_lock_bh(&call->lock);
 
-	skb_queue_walk(&call->rx_oos_queue, p) {
+	skb_queue_walk_safe(&call->rx_oos_queue, p, tmp) {
 		psp = rxrpc_skb(p);
 		if (ntohl(psp->hdr.seq) > seq) {
 			_debug("insert oos #%u before #%u",
Signature · 1 line
1.5.4.rc3
maintainer
#1 lore raw
Quoted 2 lines · Wang Chen

Because the list could be modified inside the loop, use skb_queue_walk_safe().

This is unnecessary. If skb_insert() is called in the loop, the very next line is a goto that exits the loop immediately.

David