Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5451856imm; Tue, 16 Oct 2018 10:25:27 -0700 (PDT) X-Google-Smtp-Source: ACcGV61VmuPwfTiCbA8nn/VXu8xag5E/xsMhr2Y7eFF1d10zBAGJlyy0EgrXacpQW7PVpg2jzYO8 X-Received: by 2002:a17:902:167:: with SMTP id 94-v6mr21815076plb.142.1539710727862; Tue, 16 Oct 2018 10:25:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539710727; cv=none; d=google.com; s=arc-20160816; b=MFPrqh6Rnexdy2uTnFE0Ngjl7CaTfk+Pzkd60r8Q+SDXIFOJ1AeoTxxrstEgRexXbl JjHwxDou/wK3Ss46KV8PumQMjKtQbBi5TC8aWi9XXepiPKUN5ARzJVuKLgXZgwB9qhPw 9IjMDfysH1mYzepFM/UwrmLRU+O7C0PAMsd+xKfqJNjqB7/0g3EmxP9jCZcaVWC8ijQc oGvJrRwMOAMmqheRfP1Z1jAgnnSSlLmPmY2efLa9aMUDEDX5ZfFWks3tzAmqQMGgW4U+ 3UFxnGs03fWH3fFpTcfOTBqNn77GtzmHyc+kql2JQrXwUP5ZSFUuwiJHTB///7vcMVmH A5Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EusI4fOGCbANshow0tS9b0bkVfSAGyuJ2hjj2zJr7QA=; b=Ji4o1872ZjOCdhjGm74cnuNao32RFoYlFGC1bPhnugD5+Lh/ratAEyZeOz6gfs/pZ8 /xkVtr66gpT3Y2aMxUvWRRM26Dt2AYWVo8QET5ZtkNrHtXOpoSJBSwnCZxD5W0/CLHgo 1RAfWB/eu53/qdC6V62zKlEp4BoEcI7X4tiPZkSA5OqfvEipdQRiYWQUOQX9/jUtsjrn L/00NPH1Agb/3QbZWpAG9vweDor2Jp/pDgrbjj+h7rVgvOIP2zKjmtJhNQpJP9FuxfTE tiy12HBwQG8Nldu/q4L5ffFlBrC5da+vTbUaqMR7ZYKcg+5V+Ay8vuY73E5XtDj+GSaG Gxhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kVhBExXq; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gn11si14397244plb.19.2018.10.16.10.25.12; Tue, 16 Oct 2018 10:25:27 -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=@kernel.org header.s=default header.b=kVhBExXq; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731796AbeJQBQQ (ORCPT + 99 others); Tue, 16 Oct 2018 21:16:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:34986 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730396AbeJQBQP (ORCPT ); Tue, 16 Oct 2018 21:16:15 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F03FD20866; Tue, 16 Oct 2018 17:24:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539710689; bh=4/eYkQh3ZJZXiu1trVWW+0YZ1SWUbuQ1AFjaPcttflo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kVhBExXqjzd7AxE/QgwP//Rhz7IAwPRewHL0EdsiTdcwpqKkpHiN7MOX7ebkH3md8 kNgBh3mBwRNutk4Gd38pBvkPorqQFyDfsfwozPlmSRhGyzdDRRDlO1J1snlduKn6TR tN4sZSoAzHDaUxL3GWE9WSp1YQrBMyfaTiNalc1I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , "David S. Miller" Subject: [PATCH 4.9 56/71] ipv6: frags: rewrite ip6_expire_frag_queue() Date: Tue, 16 Oct 2018 19:09:53 +0200 Message-Id: <20181016170542.173622918@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181016170539.315587743@linuxfoundation.org> References: <20181016170539.315587743@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet Make it similar to IPv4 ip_expire(), and release the lock before calling icmp functions. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller (cherry picked from commit 05c0b86b9696802fd0ce5676a92a63f1b455bdf3) Signed-off-by: Greg Kroah-Hartman --- net/ipv6/reassembly.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c @@ -92,7 +92,9 @@ EXPORT_SYMBOL(ip6_frag_init); void ip6_expire_frag_queue(struct net *net, struct frag_queue *fq) { struct net_device *dev = NULL; + struct sk_buff *head; + rcu_read_lock(); spin_lock(&fq->q.lock); if (fq->q.flags & INET_FRAG_COMPLETE) @@ -100,28 +102,34 @@ void ip6_expire_frag_queue(struct net *n inet_frag_kill(&fq->q); - rcu_read_lock(); dev = dev_get_by_index_rcu(net, fq->iif); if (!dev) - goto out_rcu_unlock; + goto out; __IP6_INC_STATS(net, __in6_dev_get(dev), IPSTATS_MIB_REASMFAILS); __IP6_INC_STATS(net, __in6_dev_get(dev), IPSTATS_MIB_REASMTIMEOUT); /* Don't send error if the first segment did not arrive. */ - if (!(fq->q.flags & INET_FRAG_FIRST_IN) || !fq->q.fragments) - goto out_rcu_unlock; + head = fq->q.fragments; + if (!(fq->q.flags & INET_FRAG_FIRST_IN) || !head) + goto out; /* But use as source device on which LAST ARRIVED * segment was received. And do not use fq->dev * pointer directly, device might already disappeared. */ - fq->q.fragments->dev = dev; - icmpv6_send(fq->q.fragments, ICMPV6_TIME_EXCEED, ICMPV6_EXC_FRAGTIME, 0); -out_rcu_unlock: - rcu_read_unlock(); + head->dev = dev; + skb_get(head); + spin_unlock(&fq->q.lock); + + icmpv6_send(head, ICMPV6_TIME_EXCEED, ICMPV6_EXC_FRAGTIME, 0); + kfree_skb(head); + goto out_rcu_unlock; + out: spin_unlock(&fq->q.lock); +out_rcu_unlock: + rcu_read_unlock(); inet_frag_put(&fq->q); } EXPORT_SYMBOL(ip6_expire_frag_queue);