Commit 8c5b6671 authored by Stephen Suryaputra's avatar Stephen Suryaputra Committed by Stefan Bader

ipv4: recompile ip options in ipv4_link_failure

BugLink: https://bugs.launchpad.net/bugs/1828420

[ Upstream commit ed0de45a ]

Recompile IP options since IPCB may not be valid anymore when
ipv4_link_failure is called from arp_error_report.

Refer to the commit 3da1ed7a ("net: avoid use IPCB in cipso_v4_error")
and the commit before that (9ef6b42a) for a similar issue.
Signed-off-by: default avatarStephen Suryaputra <ssuryaextr@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
parent 5d21bfb5
...@@ -1184,8 +1184,16 @@ static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) ...@@ -1184,8 +1184,16 @@ static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie)
static void ipv4_link_failure(struct sk_buff *skb) static void ipv4_link_failure(struct sk_buff *skb)
{ {
struct rtable *rt; struct rtable *rt;
struct ip_options opt;
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0); /* Recompile ip options since IPCB may not be valid anymore.
*/
memset(&opt, 0, sizeof(opt));
opt.optlen = ip_hdr(skb)->ihl*4 - sizeof(struct iphdr);
if (__ip_options_compile(dev_net(skb->dev), &opt, skb, NULL))
return;
__icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0, &opt);
rt = skb_rtable(skb); rt = skb_rtable(skb);
if (rt) if (rt)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment