Patchwork [3.5.y.z,extended,stable] Patch "ipv4: fix a bug in ping_err()." has been added to staging queue

mail settings
Submitter Luis Henriques
Date Feb. 28, 2013, 11:59 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/223948/
State New
Headers show


Luis Henriques - Feb. 28, 2013, 11:59 a.m.
This is a note to let you know that I have just added a patch titled

    ipv4: fix a bug in ping_err().

to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree 
which can be found at:;a=shortlog;h=refs/heads/linux-3.5.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.5.y.z tree, see



From 537514d212ff53b00f7067a51d8819950c4bd1b9 Mon Sep 17 00:00:00 2001
From: Li Wei <>
Date: Thu, 21 Feb 2013 00:09:54 +0000
Subject: [PATCH] ipv4: fix a bug in ping_err().

commit b531ed61a2a2a77eeb2f7c88b49aa5ec7d9880d8 upstream.

We should get 'type' and 'code' from the outer ICMP header.

Signed-off-by: Li Wei <>
Signed-off-by: David S. Miller <>
Signed-off-by: Luis Henriques <>
 net/ipv4/ping.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)



diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index 2c00e8b..79db4e5 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -328,8 +328,8 @@  void ping_err(struct sk_buff *skb, u32 info)
 	struct iphdr *iph = (struct iphdr *)skb->data;
 	struct icmphdr *icmph = (struct icmphdr *)(skb->data+(iph->ihl<<2));
 	struct inet_sock *inet_sock;
-	int type = icmph->type;
-	int code = icmph->code;
+	int type = icmp_hdr(skb)->type;
+	int code = icmp_hdr(skb)->code;
 	struct net *net = dev_net(skb->dev);
 	struct sock *sk;
 	int harderr;