Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp288777ybe; Wed, 4 Sep 2019 20:12:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqzxpEp1QrKL51YOkO+HuuDycwcnr2hXvBkxYeGy9hlhn5bFpSOb1YtPdbjy0lrRcaZOHVUn X-Received: by 2002:a17:902:788b:: with SMTP id q11mr1059713pll.308.1567653152799; Wed, 04 Sep 2019 20:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567653152; cv=none; d=google.com; s=arc-20160816; b=A/o0gkSpJsHU09wFynvMdvmHgszXffzi7rh8nO8lvkwAUQVfD4aLo3RzDTvrh7PV18 Y/2XEdnUwnlQSXHVBbCwz3L2uqShXTrMADXMAIrS4zokm1YPnEpbHcITjd+5bp3TGoFd tNoR+j86u+Ax46Z2D4ApHHwEPBReqjsM4lhCu5zYKSfOhsb7nwDmkTTrn1nNLZyh5EtI 6Ff7tdpvUF3a7HIpYT9uyHR1HmfgiBKcc4BuPWxSePwpiEhidjqti8KDpvLDPOIDjJUR cPbSSyT4tfAJYdxaL5gL6NdZHew1aBeIYOpxBAsdz0Qq31hnSnSfoDJ5F9g4iFcEMjk6 3x4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=ELttBCRw1A5YO2An5LqOnscxESNC1jHrDOB2eOhUzf0=; b=V1uFAJ4fF7tIJbyzGhGSOZAVe+LAfp0WBc5JtaqIOQlga6Uvz7PvC/H4JFN/GCRi7K uJoLSiIhzHluBYzTCHFqlnQevQvRVtycmEv33rC6qSmbmdff9AE5hYjRX2cRAnharnF+ /J66mv0ih5xW82RP1t9ToExg9CpHG+DlmeQrumY3cM/uy4yyleBudFCLmXRkGaen/+Ci G+GF6sNf+aJ76ctkxzdH6UdWblv671gM0G6FWGCoGpQFIase2IdYyPD9nu+/hAMabPvj wVw8eVns8VWD05mnbSF+2o4UFIfeojILPbESPFfFNt3IKMjwfr0z9lmevemUrrloAhZq YngQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nPb1Hpra; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q10si687022pfc.288.2019.09.04.20.12.16; Wed, 04 Sep 2019 20:12:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nPb1Hpra; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731041AbfIEDGz (ORCPT + 99 others); Wed, 4 Sep 2019 23:06:55 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:33254 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730707AbfIEDGz (ORCPT ); Wed, 4 Sep 2019 23:06:55 -0400 Received: by mail-pf1-f196.google.com with SMTP id q10so766447pfl.0 for ; Wed, 04 Sep 2019 20:06:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ELttBCRw1A5YO2An5LqOnscxESNC1jHrDOB2eOhUzf0=; b=nPb1Hpra7lqtzWoDX7p3CwYYne28JfIDVytSB/01eknPmAJcb7kVWu95VG+U4ZEZgE l5VuOduJ/BjKaWI6PJMfHuIsIZoA06axlX2II/apMQ/HDWsfAvMOxTThrr5cCjTsPUz/ grodGpmKSfuMPURQWkJyvU+wUKQqG7i4MVckTpeYCEK+4FbcShEV/QALo+bKQXj132oy NSnHrBwwDCfRme5aKHxcALcRPXH5m+EsUIBjnYOXUoDPGA8YL+FEqsYRrxoLl4tVIjWo 7Wn9k/0y4dfyRVEBQT68Z+JMflYckhBJosyoUP1DYcsvz/qGmPBCXWceAAKgpjpQQuA6 RoUQ== 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:in-reply-to :references; bh=ELttBCRw1A5YO2An5LqOnscxESNC1jHrDOB2eOhUzf0=; b=j6HYUSp5z9wJ8bgZutnA0E3418GFr8+3i9ZxTklXfOS4i7t1AnrrpoBTIXyJsgZiop iirl6y49nogO2PLJcDQxr5GQ3H+X27WAf2k59EGNsW7KWHG2NyQyCrlYkryx43R7+tUw GrLvnTa7XqePv5JrvUjKJCRK0Dxk9V0O8M7l8FUrVIOy1iPXTxTu73G6YPRJ7mCPb3du MYYwONnog7Kqs4G7yO6x59+8sHNgY8dC/Ts5Wc/3E88urWln+nZDj3btIiM7KwgJJMWe 3GCpomlC+mlSBRyBGwf25WeuxqIbpJBu7zWLQS/pYqD+r2Kdq8GdCeMX8RvWEuL3Qde2 7v/g== X-Gm-Message-State: APjAAAVIxXX3+ptfd10bhDE9nHQNKJjMuiwHdPXMjvny/rya04lo4eI+ pi2lJqPh1RkB5u6xpg2cRyoz7A== X-Received: by 2002:a17:90a:8a02:: with SMTP id w2mr198598pjn.131.1567652814821; Wed, 04 Sep 2019 20:06:54 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id n9sm461728pgf.64.2019.09.04.20.06.51 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Sep 2019 20:06:54 -0700 (PDT) From: Baolin Wang To: stable@vger.kernel.org, davem@davemloft.net, kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org Cc: edumazet@google.com, netdev@vger.kernel.org, arnd@arndb.de, baolin.wang@linaro.org, orsonzhai@gmail.com, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.14.y v2 1/6] ip6: fix skb leak in ip6frag_expire_frag_queue() Date: Thu, 5 Sep 2019 11:06:18 +0800 Message-Id: <48fc1cc230c4840898ded9e57653b11f274d511a.1567649729.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Dumazet [Upstream commit 47d3d7fdb10a21c223036b58bd70ffdc24a472c4] Since ip6frag_expire_frag_queue() now pulls the head skb from frag queue, we should no longer use skb_get(), since this leads to an skb leak. Stefan Bader initially reported a problem in 4.4.stable [1] caused by the skb_get(), so this patch should also fix this issue. 296583.091021] kernel BUG at /build/linux-6VmqmP/linux-4.4.0/net/core/skbuff.c:1207! [296583.091734] Call Trace: [296583.091749] [] __pskb_pull_tail+0x50/0x350 [296583.091764] [] _decode_session6+0x26a/0x400 [296583.091779] [] __xfrm_decode_session+0x39/0x50 [296583.091795] [] icmpv6_route_lookup+0xf0/0x1c0 [296583.091809] [] icmp6_send+0x5e1/0x940 [296583.091823] [] ? __netif_receive_skb+0x18/0x60 [296583.091838] [] ? netif_receive_skb_internal+0x32/0xa0 [296583.091858] [] ? ixgbe_clean_rx_irq+0x594/0xac0 [ixgbe] [296583.091876] [] ? nf_ct_net_exit+0x50/0x50 [nf_defrag_ipv6] [296583.091893] [] icmpv6_send+0x21/0x30 [296583.091906] [] ip6_expire_frag_queue+0xe0/0x120 [296583.091921] [] nf_ct_frag6_expire+0x1f/0x30 [nf_defrag_ipv6] [296583.091938] [] call_timer_fn+0x37/0x140 [296583.091951] [] ? nf_ct_net_exit+0x50/0x50 [nf_defrag_ipv6] [296583.091968] [] run_timer_softirq+0x234/0x330 [296583.091982] [] __do_softirq+0x109/0x2b0 Fixes: d4289fcc9b16 ("net: IP6 defrag: use rbtrees for IPv6 defrag") Signed-off-by: Eric Dumazet Reported-by: Stefan Bader Cc: Peter Oskolkov Cc: Florian Westphal Signed-off-by: David S. Miller Signed-off-by: Baolin Wang --- include/net/ipv6_frag.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/net/ipv6_frag.h b/include/net/ipv6_frag.h index 28aa9b3..1f77fb4 100644 --- a/include/net/ipv6_frag.h +++ b/include/net/ipv6_frag.h @@ -94,7 +94,6 @@ static inline u32 ip6frag_obj_hashfn(const void *data, u32 len, u32 seed) goto out; head->dev = dev; - skb_get(head); spin_unlock(&fq->q.lock); icmpv6_send(head, ICMPV6_TIME_EXCEED, ICMPV6_EXC_FRAGTIME, 0); -- 1.7.9.5