]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.0/ipv4-recompile-ip-options-in-ipv4_link_failure.patch
5.0-stable patches
[thirdparty/kernel/stable-queue.git] / queue-5.0 / ipv4-recompile-ip-options-in-ipv4_link_failure.patch
1 From foo@baz Sat Apr 20 16:43:09 CEST 2019
2 From: Stephen Suryaputra <ssuryaextr@gmail.com>
3 Date: Fri, 12 Apr 2019 16:19:27 -0400
4 Subject: ipv4: recompile ip options in ipv4_link_failure
5
6 From: Stephen Suryaputra <ssuryaextr@gmail.com>
7
8 [ Upstream commit ed0de45a1008991fdaa27a0152befcb74d126a8b ]
9
10 Recompile IP options since IPCB may not be valid anymore when
11 ipv4_link_failure is called from arp_error_report.
12
13 Refer to the commit 3da1ed7ac398 ("net: avoid use IPCB in cipso_v4_error")
14 and the commit before that (9ef6b42ad6fd) for a similar issue.
15
16 Signed-off-by: Stephen Suryaputra <ssuryaextr@gmail.com>
17 Signed-off-by: David S. Miller <davem@davemloft.net>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19 ---
20 net/ipv4/route.c | 10 +++++++++-
21 1 file changed, 9 insertions(+), 1 deletion(-)
22
23 --- a/net/ipv4/route.c
24 +++ b/net/ipv4/route.c
25 @@ -1186,8 +1186,16 @@ static struct dst_entry *ipv4_dst_check(
26 static void ipv4_link_failure(struct sk_buff *skb)
27 {
28 struct rtable *rt;
29 + struct ip_options opt;
30
31 - icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0);
32 + /* Recompile ip options since IPCB may not be valid anymore.
33 + */
34 + memset(&opt, 0, sizeof(opt));
35 + opt.optlen = ip_hdr(skb)->ihl*4 - sizeof(struct iphdr);
36 + if (__ip_options_compile(dev_net(skb->dev), &opt, skb, NULL))
37 + return;
38 +
39 + __icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0, &opt);
40
41 rt = skb_rtable(skb);
42 if (rt)