From patchwork Fri Apr 12 20:19:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Suryaputra X-Patchwork-Id: 1084910 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Js7bSz/b"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44gq4Y5bpsz9s4V for ; Sat, 13 Apr 2019 06:19:41 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727067AbfDLUTk (ORCPT ); Fri, 12 Apr 2019 16:19:40 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:35847 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726843AbfDLUTj (ORCPT ); Fri, 12 Apr 2019 16:19:39 -0400 Received: by mail-it1-f194.google.com with SMTP id y10so17777521itc.1 for ; Fri, 12 Apr 2019 13:19:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=0FCeKmGOJbNesI72yIeDrgV9PMrGYOwEV7/piiS1EFo=; b=Js7bSz/b9nLqY7mxnALH25qN58O3rehWHgAHnky81LnJXBQmJ5hJqcJhD3eYy75Ht0 qMqiLit5RTiQujxll1HF9/WCKg3yjQzpYuPGmNX4xxZMPViSMIj8vBs2yYLiPZUsmcST xrYF5Nfyw07HLedmfpLSJ+DyFu5cBZlU63Vqh06LIpuUT1AhbdtJUVyhL2d/LAQKN+tD yqdza88GHMJyw/TkfNqv8VL+Ba/oQLH8PBR3A9McTa3NrwgTTo1C9eXsM3J2QTgcjK/t 1StdgFMRvjTgX0l1p8pFLH5/f/k9ND6g/q3Sw5CrpHaKNGkR80DESwpq1EDEz8nx9Oxz ukPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=0FCeKmGOJbNesI72yIeDrgV9PMrGYOwEV7/piiS1EFo=; b=jRaEcTX9dsqbTTT5aQ5LxRnEA3UMHQOj9gh4LX8d9pf1nNAnPt7bJkl7b5hOjp7bSc LtYBabTiKQvAnOyWGkpLUme15ee0xfiIkXQxIRTG5b/DufVb/sSvq5xIz9SACIW4ZSzR BtiHWrKmiAhQeyox49oeCeVxJwSjuhl9Yr41rKY53eBnUJoggNHk9FlVjIdyPREK+nt0 zaoZYSi3RxPhQfULOM8Zw6x0+B0vNAQdTXYX6Jgqx+jxo9MqOnxH6187GifTRSnDPHRJ +uFugxMoa5ggP3XNj2O025S5/L5XhYb/l16ZwoOvqtiCLbWHYFe1UvA4xHTRhNm64o2Q yr0Q== X-Gm-Message-State: APjAAAV8hu7aS1Aawc5dl0uA3xNX5s9GfO9DVjEHZ8Z8dfB/v6+IB84B W7V0i96Q480HFUcTbHejv3omQ2U= X-Google-Smtp-Source: APXvYqyZhUPOpp6FSjbkzslm27dfTQLfsBjdz76oMcrqHDusq/XpzGLKqP+WYs/0CMxtILrbREZKbw== X-Received: by 2002:a02:2b1d:: with SMTP id h29mr43642599jaa.76.1555100378770; Fri, 12 Apr 2019 13:19:38 -0700 (PDT) Received: from ubuntu.extremenetworks.com ([12.38.14.8]) by smtp.gmail.com with ESMTPSA id y11sm4667821ita.14.2019.04.12.13.19.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Apr 2019 13:19:38 -0700 (PDT) From: Stephen Suryaputra To: netdev@vger.kernel.org Cc: Stephen Suryaputra Subject: [PATCH net] ipv4: recompile ip options in ipv4_link_failure Date: Fri, 12 Apr 2019 16:19:27 -0400 Message-Id: <20190412201927.7615-1-ssuryaextr@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- net/ipv4/route.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/net/ipv4/route.c b/net/ipv4/route.c index a5da63e5faa2..0206789bc2b7 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -1186,8 +1186,16 @@ static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) static void ipv4_link_failure(struct sk_buff *skb) { 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); if (rt)