patch-2.4.23 linux-2.4.23/net/ipv4/icmp.c

Next file: linux-2.4.23/net/ipv4/igmp.c
Previous file: linux-2.4.23/net/ipv4/devinet.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.22/net/ipv4/icmp.c linux-2.4.23/net/ipv4/icmp.c
@@ -187,11 +187,17 @@
 #define icmp_socket (&__icmp_inode[smp_processor_id()].u.socket_i)
 #define icmp_socket_cpu(X) (&__icmp_inode[(X)].u.socket_i)
 
-static void icmp_xmit_lock(void)
+static int icmp_xmit_lock(void)
 {
 	local_bh_disable();
-	if (unlikely(!spin_trylock(&icmp_socket->sk->lock.slock)))
-		BUG();
+	if (unlikely(!spin_trylock(&icmp_socket->sk->lock.slock))) {
+		/* This can happen if the output path signals a
+		 * dst_link_failure() for an outgoing ICMP packet.
+		 */
+		local_bh_enable();
+		return 1;
+	}
+	return 0;
 }
 
 static void icmp_xmit_unlock(void)
@@ -320,7 +326,8 @@
 	if (ip_options_echo(&icmp_param->replyopts, skb))
 		return;
 
-	icmp_xmit_lock();
+	if (icmp_xmit_lock())
+		return;
 
 	icmp_param->data.icmph.checksum=0;
 	icmp_param->csum=0;
@@ -427,7 +434,8 @@
 		}
 	}
 
-	icmp_xmit_lock();
+	if (icmp_xmit_lock())
+		return;
 
 	/*
 	 *	Construct source address and options.

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)