Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp6569346ybx; Mon, 11 Nov 2019 11:06:37 -0800 (PST) X-Google-Smtp-Source: APXvYqzmC2VhYXcEsBKZU0uwiOLIyNAFIb7mKfAMR+b5Rvx/LIuHEajL5/t/bMWkZAve/bS+c4Hr X-Received: by 2002:a17:906:1f44:: with SMTP id d4mr24398610ejk.16.1573499197496; Mon, 11 Nov 2019 11:06:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573499197; cv=none; d=google.com; s=arc-20160816; b=0uLLijqxiYbbnN2QPMix5WHblXmp5UTXj+kEz8MWXHF933yjFwbCQ+ikvNiacaFP5a INXjTxr3hrgYNtUq1A5ABg5FVTbunW9WhPkzCbaf6Q+hOQn7KCkYrkWDHNXNmX456y+g 7k2JNotnwyqht70bmsCmlSyTbEbVUsZTCF+hHQE/0UaWQI6HDo5pR22d4hR8/B+b+DJr 1ie1rxJt8tcXAOS36Ac1KDHI2A5A1AbPympD2Bt96d+lfXYI5jnmJ2Toa+cts8+BLGRj 9g/Iofh72V7ZoBi4PjWTWV+ZioZ81D8Ym5cZefg6szCgPo/KP6EidjAQv2NtUBjDz9tJ KUPg== 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=StJ4/CKMq3Oow866ZeKHeMsS1KLaJKOzlbtsYpT91XE=; b=gTr2rFZ6nQM5wVLA73hjQ4ktoecBpLexLEljASggS3nxs+mwaa6ZyhJMvIx0AXPWMC XiSwvqR7IaDnkjv96hl3HQcYMsUYVbJutJz2k8hpCbDWh1pu84fM2gAKOS3vw6xZ0zuH RkiK1khrh+LPBqQZpWc64WoSdvt5NvXzVU7KLmdiXDvYlt9EDxMDEH0Gafl7tUurzWD3 r1Qb/YIXpW3L56qoaQX4yDWBQbmHypityodgN05GDQQJSgrd8OHoQzu4YPbgit33iMHY 1oSOYG9hRoLRac5QWBT7vTJ2Hb9u7HI21VUgyXItMgbk5E0NQgdcquS7/Xr3OWklIRNR 52xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MSXDGjA6; 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 p22si9956199eja.204.2019.11.11.11.06.13; Mon, 11 Nov 2019 11:06:37 -0800 (PST) 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=MSXDGjA6; 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 S1729372AbfKKSrF (ORCPT + 99 others); Mon, 11 Nov 2019 13:47:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:39646 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730050AbfKKSq7 (ORCPT ); Mon, 11 Nov 2019 13:46:59 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 14F9621655; Mon, 11 Nov 2019 18:46:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573498018; bh=xmWQpLT2KJLMmCxIVrT4Qukhiz7jYNjuK8yXyTX1ISM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MSXDGjA61GmdkcEB8ZnmHPUVPVIc+93w5FkAwRDdKzYaKpZhZBkWuk6jI4HlIAAwB CxsZC7zdz2J+sVcnwlhCA0f2weoYQm1N/3pxxd6AmEDeTaHOSR3YpQn56GXb5KBSPd /vfaVjBwg15iTmXIeHFghEEOxxSC5xjOs0BRSEeg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 4.19 084/125] netfilter: nf_flow_table: set timeout before insertion into hashes Date: Mon, 11 Nov 2019 19:28:43 +0100 Message-Id: <20191111181451.347524746@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191111181438.945353076@linuxfoundation.org> References: <20191111181438.945353076@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Pablo Neira Ayuso [ Upstream commit daf61b026f4686250e6afa619e6d7b49edc61df7 ] Other garbage collector might remove an entry not fully set up yet. [570953.958293] RIP: 0010:memcmp+0x9/0x50 [...] [570953.958567] flow_offload_hash_cmp+0x1e/0x30 [nf_flow_table] [570953.958585] flow_offload_lookup+0x8c/0x110 [nf_flow_table] [570953.958606] nf_flow_offload_ip_hook+0x135/0xb30 [nf_flow_table] [570953.958624] nf_flow_offload_inet_hook+0x35/0x37 [nf_flow_table_inet] [570953.958646] nf_hook_slow+0x3c/0xb0 [570953.958664] __netif_receive_skb_core+0x90f/0xb10 [570953.958678] ? ip_rcv_finish+0x82/0xa0 [570953.958692] __netif_receive_skb_one_core+0x3b/0x80 [570953.958711] __netif_receive_skb+0x18/0x60 [570953.958727] netif_receive_skb_internal+0x45/0xf0 [570953.958741] napi_gro_receive+0xcd/0xf0 [570953.958764] ixgbe_clean_rx_irq+0x432/0xe00 [ixgbe] [570953.958782] ixgbe_poll+0x27b/0x700 [ixgbe] [570953.958796] net_rx_action+0x284/0x3c0 [570953.958817] __do_softirq+0xcc/0x27c [570953.959464] irq_exit+0xe8/0x100 [570953.960097] do_IRQ+0x59/0xe0 [570953.960734] common_interrupt+0xf/0xf Fixes: 43c8f131184f ("netfilter: nf_flow_table: fix missing error check for rhashtable_insert_fast") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/nf_flow_table_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c index 8ade405129444..70bd730ca0597 100644 --- a/net/netfilter/nf_flow_table_core.c +++ b/net/netfilter/nf_flow_table_core.c @@ -187,6 +187,8 @@ int flow_offload_add(struct nf_flowtable *flow_table, struct flow_offload *flow) { int err; + flow->timeout = (u32)jiffies + NF_FLOW_TIMEOUT; + err = rhashtable_insert_fast(&flow_table->rhashtable, &flow->tuplehash[0].node, nf_flow_offload_rhash_params); @@ -203,7 +205,6 @@ int flow_offload_add(struct nf_flowtable *flow_table, struct flow_offload *flow) return err; } - flow->timeout = (u32)jiffies + NF_FLOW_TIMEOUT; return 0; } EXPORT_SYMBOL_GPL(flow_offload_add); -- 2.20.1