Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6252635imu; Mon, 21 Jan 2019 05:53:46 -0800 (PST) X-Google-Smtp-Source: ALg8bN6FyUa+Ic7ObG89Szf2EbRRmzVDgMOKAIjFxeDiFZEG8E4QvYCctNO1uziel6oENQQ78sm5 X-Received: by 2002:a63:ac46:: with SMTP id z6mr28101763pgn.162.1548078826116; Mon, 21 Jan 2019 05:53:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548078826; cv=none; d=google.com; s=arc-20160816; b=XQ6QMqb02FlaxOJvcrVR4DSydVmnZ1Oa71sfXMYgPRfsK0Yg91jUTOI/jn9S70nCSQ EE4u8z2yNYkoBs2AuLF6F5ePq/ndalrJGPR691+Ai6R6hjQD9yAawXiAEazp36C3od8M E3s67jf6ZgHSvLqxz+lsDITE79WMc+YQvDqPyJVuZupVj3NW53ueT8F+gjES/kWaZvfA D+StWCA3xsv7XtaCMmnpmIBTbF8fYZ605i1LOmPMm5DR2tQ6OjlkeQ6wu2Sf95oCFPM4 U/Dh8cPILW2ptNXyDqrQcv43OprSwUWIpF8hJbtqphnpS674OrfuwNYon/lwKPavmKg5 Dg4w== 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=aZwdQZaeR6QFr3TgkXKjjAK/LGeeZDWHBta/8pAhLEY=; b=m5vaXOP5VsBO4w7q81GFsRaJPLJvLk4RhkOw0AJQk51MltaYmFNjt89yCX4rlugsgE oWZF4GP60cmHlWCPw1L8+kHgcMrxE/jNqXaNBbNlMMkQPX6sXzoXnXAvd0Ey5GTiSJe+ gLvuJr2+8m6NljsEN2JMy9wpk72Q/z+hf/7hBWrR4lhZJIhySXLiazxGjy51G1CWkt/b X3k5isyS4cgSpXu9/86CYqJXSes4P/+as5U3a7Zq7Q/bLHcPfUfk4wdohrocFdJgIK+E TmVLbdgteQhbLVHXKJDO9GlaAzlQzqMJxgH3keoBuNSzu3qVApthjUC0/X+9qz3DNl7t oZGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=U4c2jT+z; 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 x23si9695658pgk.272.2019.01.21.05.53.30; Mon, 21 Jan 2019 05:53:46 -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=U4c2jT+z; 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 S1730888AbfAUNvt (ORCPT + 99 others); Mon, 21 Jan 2019 08:51:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:34748 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730855AbfAUNvp (ORCPT ); Mon, 21 Jan 2019 08:51:45 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 CDFE62063F; Mon, 21 Jan 2019 13:51:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548078704; bh=PtuhXk7dGUDUxjJP/ZdRnuGO4zPbWzGL9I7baJefNtc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U4c2jT+zkVhNCw529GmZ7DakGW4QLCXipwPRVy+Hkan0R64ox730LimTCL0IjD52X Z+o6C1s73YAsQbhM1mdQj2Ras9xJ4U6+CLvrXYK8kK36UYA+bD8OgGDrfvSJgJJN6u iHxaSBXaPNxS21MWh9CMrR39eSTwBRWoIr3+SAs4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, JianJhen Chen , JinLin Chen , "David S. Miller" Subject: [PATCH 4.14 14/59] net: bridge: fix a bug on using a neighbour cache entry without checking its state Date: Mon, 21 Jan 2019 14:43:39 +0100 Message-Id: <20190121122458.119171067@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121122456.529172919@linuxfoundation.org> References: <20190121122456.529172919@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: JianJhen Chen [ Upstream commit 4c84edc11b76590859b1e45dd676074c59602dc4 ] When handling DNAT'ed packets on a bridge device, the neighbour cache entry from lookup was used without checking its state. It means that a cache entry in the NUD_STALE state will be used directly instead of entering the NUD_DELAY state to confirm the reachability of the neighbor. This problem becomes worse after commit 2724680bceee ("neigh: Keep neighbour cache entries if number of them is small enough."), since all neighbour cache entries in the NUD_STALE state will be kept in the neighbour table as long as the number of cache entries does not exceed the value specified in gc_thresh1. This commit validates the state of a neighbour cache entry before using the entry. Signed-off-by: JianJhen Chen Reviewed-by: JinLin Chen Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/bridge/br_netfilter_hooks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/bridge/br_netfilter_hooks.c +++ b/net/bridge/br_netfilter_hooks.c @@ -275,7 +275,7 @@ int br_nf_pre_routing_finish_bridge(stru struct nf_bridge_info *nf_bridge = nf_bridge_info_get(skb); int ret; - if (neigh->hh.hh_len) { + if ((neigh->nud_state & NUD_CONNECTED) && neigh->hh.hh_len) { neigh_hh_bridge(&neigh->hh, skb); skb->dev = nf_bridge->physindev; ret = br_handle_frame_finish(net, sk, skb);