Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipv4: recompile ip options in ipv4_link_failure

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

Refer to the commit 3da1ed7ac398 ("net: avoid use IPCB in cipso_v4_error")
and the commit before that (9ef6b42ad6fd) for a similar issue.

Signed-off-by: Stephen Suryaputra <ssuryaextr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Stephen Suryaputra and committed by
David S. Miller
ed0de45a 9e550f01

+9 -1
+9 -1
net/ipv4/route.c
··· 1186 1186 static void ipv4_link_failure(struct sk_buff *skb) 1187 1187 { 1188 1188 struct rtable *rt; 1189 + struct ip_options opt; 1189 1190 1190 - icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0); 1191 + /* Recompile ip options since IPCB may not be valid anymore. 1192 + */ 1193 + memset(&opt, 0, sizeof(opt)); 1194 + opt.optlen = ip_hdr(skb)->ihl*4 - sizeof(struct iphdr); 1195 + if (__ip_options_compile(dev_net(skb->dev), &opt, skb, NULL)) 1196 + return; 1197 + 1198 + __icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0, &opt); 1191 1199 1192 1200 rt = skb_rtable(skb); 1193 1201 if (rt)