Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1660636
| Path | csiph.com!news.freedyn.net!open-news-network.org!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Haishuang Yan <yanhaishuang@cmss.chinamobile.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 2/2] ip6_tunnel: fix potential issue in __ip6_tnl_rcv |
| Date | Thu, 08 Jun 2017 03:00:01 +0200 |
| Message-ID | <tPTXP-5yb-3@gated-at.bofh.it> (permalink) |
| References | <tPTXP-5yb-1@gated-at.bofh.it> |
| X-Rm-Transid | 2ee65938a1282ee-84206 |
| X-Rm-Spam-Flag | 00000000 |
| X-Rm-Transid | 2ee35938a126bef-8e454 |
| X-Mailer | git-send-email 1.8.3.1 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 36 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Haishuang Yan <yanhaishuang@cmss.chinamobile.com>, Alexei Starovoitov <ast@fb.com> |
| X-Original-Date | Thu, 8 Jun 2017 08:57:56 +0800 |
| X-Original-Message-ID | <1496883476-17445-2-git-send-email-yanhaishuang@cmss.chinamobile.com> |
| X-Original-References | <1496883476-17445-1-git-send-email-yanhaishuang@cmss.chinamobile.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1660636 |
Show key headers only | View raw
When __ip6_tnl_rcv fails, the tun_dst won't be freed, so move
skb_dst_set to begin and tun_dst would be freed by kfree_skb.
CC: Alexei Starovoitov <ast@fb.com>
Fixes: 8d79266bc48c ("ip6_tunnel: add collect_md mode to IPv6 tunnels")
Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
---
net/ipv6/ip6_tunnel.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 9b37f97..bf45f1b 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -789,6 +789,9 @@ static int __ip6_tnl_rcv(struct ip6_tnl *tunnel, struct sk_buff *skb,
const struct ipv6hdr *ipv6h = ipv6_hdr(skb);
int err;
+ if (tun_dst)
+ skb_dst_set(skb, (struct dst_entry *)tun_dst);
+
if ((!(tpi->flags & TUNNEL_CSUM) &&
(tunnel->parms.i_flags & TUNNEL_CSUM)) ||
((tpi->flags & TUNNEL_CSUM) &&
@@ -852,9 +855,6 @@ static int __ip6_tnl_rcv(struct ip6_tnl *tunnel, struct sk_buff *skb,
skb_scrub_packet(skb, !net_eq(tunnel->net, dev_net(tunnel->dev)));
- if (tun_dst)
- skb_dst_set(skb, (struct dst_entry *)tun_dst);
-
gro_cells_receive(&tunnel->gro_cells, skb);
return 0;
--
1.8.3.1
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH v2 2/2] ip6_tunnel: fix potential issue in __ip6_tnl_rcv Haishuang Yan <yanhaishuang@cmss.chinamobile.com> - 2017-06-08 03:00 +0200 Re: [PATCH v2 2/2] ip6_tunnel: fix potential issue in __ip6_tnl_rcv Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2017-06-08 04:50 +0200
csiph-web