From patchwork Tue Sep 3 06:56:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 172778 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5274758ily; Mon, 2 Sep 2019 23:57:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqxzn7I99IBvdQZie15/PGpQrLujFKIu6Cehqu1WzJtGlt/iFhYs3ig1TCDHlTTBod1xNqed X-Received: by 2002:a63:5f95:: with SMTP id t143mr28594850pgb.304.1567493831118; Mon, 02 Sep 2019 23:57:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567493831; cv=none; d=google.com; s=arc-20160816; b=u+vA/034Ao2/rLryz1Oom+0NlGVELHMmqzEN+EtIKawilYpTFpEVDrgqxYxODVzaY2 89sVjCW4xt1FpUEOJ5LV6sKgW8iobfk2w1EhGHSlyQl+NglCpI0aqpjj8gmb9SGXlEVk MA7EUJgfgWCNSh7bVnGiyI4LB43uLmHTviR5WVN3Kd7dvWTi2ff8OsrQNBWCMWqRa2jr tUX3RQM2sQqV9+o/g3JnlN35AxMULE/umOEYTYZPRwFx7Rp4PhFa11szWILeyL6gcDOE TaAWkU/RJjM6kE1onwlw9ENwt2zU1cEckvQywjf2RQbJDbA5Vmws0+nLdK/3u7Bu4VcD xUsg== 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=KB/V8KmhO87QpU2qi6NuMt+cmKaMtWbc3N1EFYpdy18=; b=cxYa8di2OVmnXMmS7dZhoY9wYB8zIcD/Tjy8py5LHEXcIDL7N8btxQeNXoxdEVnqUw C3ExB4FOAasfS95rnSOGgswakAeM4BSF6cbxI5EKXTLSFcPMo0XF1uY2FlFn1Xuou1iV PTShVkvmoV42CPf3G3qJXoCIy4tdw/C9fb+4iEQFTlGCdNppqhv77/RvU+/QVtgvVpjB sn7IkEYSJOACkfO84Hihf8x5O2Yv6uoLsOn4P2zITpVXpAKOUBYsAePUD/4dmOkr1OHG oHpsRPUZw7mkRax5H917cP5LNOiH/yFUmUA22tEqJ02vvsNOY8vIRa6yJ1tX9+SW9wnH DFhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=A8hMB12r; 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 s15si13243388pgm.413.2019.09.02.23.57.10; Mon, 02 Sep 2019 23:57:11 -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=A8hMB12r; 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 S1727602AbfICG5J (ORCPT + 28 others); Tue, 3 Sep 2019 02:57:09 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:40111 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725919AbfICG5J (ORCPT ); Tue, 3 Sep 2019 02:57:09 -0400 Received: by mail-pl1-f195.google.com with SMTP id y10so1551198pll.7 for ; Mon, 02 Sep 2019 23:57:09 -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=KB/V8KmhO87QpU2qi6NuMt+cmKaMtWbc3N1EFYpdy18=; b=A8hMB12rzSIXxfNLfvQpaXb05wViyP2+l2zkaePY3jY9xLsOYXyLQWNvuXoUjKYdYN aVEdikjHvxlsATSHPqByhDsXFeMegocbBJZB6BrUKuSUM34tMIYiSBRSOaRBDDLzzOOm 4c+lh19B+smCdveQxL5zxCOCRiNP2ssUIM4XuQXxl+Iqi4niG/BblKaKI5fdu9kf1tPA qJUgEXWDofovWWdVES/7abXnZRPNKx2VnEVI5u0ABQB5rCFFlAxLrBUP5Xcr5i1z0xWD gAbEPtvR5qlXbdBe+KvwSmpz/tPGBjcIKTp/Hw8T+bZmD7g+tXwXPBt0n1YU+wMO8iZZ ePxA== 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=KB/V8KmhO87QpU2qi6NuMt+cmKaMtWbc3N1EFYpdy18=; b=iKGJ/b6dm5FL3vneaWe0flkST73KGvAXal6T0S+xNwpJYg3E9RNHTQSIeP21gICwH+ k+3Tj18+nbzPzIiMDwsDosS+WUTr4K6ttdh1OafnlLY/FHTZcxXlYlvKnS1Af4QN5z/C LPhIF6wYuSYB4dxC5WLmCz+3u8b4QvJ+zOKR4XKLshOSVy06Qutu5riYRmPpkwdZL9tp M8xQrm4cFjStok42nb2IQ6zrlMqx1/lkVudh1IPyvfFzrGe7jT3HL1VJeagF3RdgvXrZ qXSSNT6UjLUYPz0Z4dURFukPNecsrcPRDa8bJ3iUDDAV50gL3NDKSTxQwIVUHt4ZWhyX Ay0A== X-Gm-Message-State: APjAAAV07BQUy+5b2CvzyFH1Dv9cIURDXSMejMW7Awg2fY3cSsP+jpep 0nro8M4IMoivQ+aWesZhWBrLBA== X-Received: by 2002:a17:902:d886:: with SMTP id b6mr8606471plz.149.1567493828795; Mon, 02 Sep 2019 23:57:08 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id p20sm17786228pgi.81.2019.09.02.23.57.04 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Sep 2019 23:57:08 -0700 (PDT) From: Baolin Wang To: stable@vger.kernel.org, davem@davemloft.net, kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org, edumazet@google.com Cc: 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 2/8] ip6: fix skb leak in ip6frag_expire_frag_queue() Date: Tue, 3 Sep 2019 14:56:42 +0800 Message-Id: <3cf0695f42e8f1b4172b68ad145a5d2afae39a0e.1567492316.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 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(-) -- 1.7.9.5 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);