Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp48123imu; Thu, 8 Nov 2018 14:32:29 -0800 (PST) X-Google-Smtp-Source: AJdET5ceyz0jKx0/IYwdWQ3PBmD8ViWfaKHEqixHHsuMrfSYXWbjK8Sxe5VN0RaiaP0kN4Oa9s++ X-Received: by 2002:a62:888c:: with SMTP id l134-v6mr6401897pfd.198.1541716349377; Thu, 08 Nov 2018 14:32:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541716349; cv=none; d=google.com; s=arc-20160816; b=zPCEQe8Sdy1z8Uk0tTMKSB4Hi1Ucbiq4rvImKEOsumZOqKhPx6gvBf0BuuX1mXYLjW 4aHTo6uPEEiSPBAncC241XYXzD433WO9/mhNWqC9AjhLafAO6eVt/yr+Zy9AnH+PgT2a M/cIEHSbXCt/b8dt8o42e1dr68poVTjAsM0QqrFq4U3nYXIhmvoxsDLcwfhq2TG2wEGs f1emXBbdMRcOtbBsBaFI5KnOj/wnQg43fauiMUvLC08M37KEyZHAJxqEelBoY7TDlfOt GsltI3HyRbWmVmkbyRioEwb7/qvHid1XuAw0KbVATvnQh7DSMAh8Y/5MlvObF8hW7vYL qWTQ== 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=XbGbuKf9Bt3oHHnMpig4kxlCh63fU4OcRQYn58bZPuU=; b=hh2i8AuMxf7dLPtI9svbdMS8hGP1TZ23mVuo8rWvp4Me5QUxT5IJVOnbk8UqLJ8E9Q 4RUYSn3WjQEMAY8E4fLfhKY1zlGPdkGQeeqot1+vyBGVzGRrMGLRzaMTJXOt4n2qOlFp /FzvAViPQ0/f/oVKhqxIYMp3NYrw9xDoA68DuWK03T+naEdRr6LNLdvu36bXblVPAZ8Z nv7/VQsBV5ZOoWjfRy9xpsN33EbE1T0Vd07cefFvfxYyOtbfCKzM5b61P8ZflYHZJT5I +0hpGVLxZu8mzr4fVY5rG1EiiOhYFge/XGtX9qMuGNlAq/o4jPOKxQpvNCtq23jK/CyE Cgvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2Ibss5zT; 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 l4-v6si5978593plb.258.2018.11.08.14.32.04; Thu, 08 Nov 2018 14:32:29 -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=2Ibss5zT; 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 S1730601AbeKIHiI (ORCPT + 99 others); Fri, 9 Nov 2018 02:38:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:57216 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730594AbeKIHiI (ORCPT ); Fri, 9 Nov 2018 02:38:08 -0500 Received: from localhost (unknown [208.72.13.198]) (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 10D2520892; Thu, 8 Nov 2018 22:00:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541714439; bh=kzDABeTk9QOnqbP+2hp0YUUNdh/tMOEcvjdATl8X1qg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2Ibss5zTd2NrkVOV04S5JFAwtAKoBgSCsuQYeU3Gsuy/mQIWQDS1wt/V9c3SxxewU bimYO5j2F3S3sKIC4WAsxpqpx2Ar3F5i1MqXKINoe6J6dr0zwavUkG8bJfuRzZ+wDk 1Hv6u3zzeBuZ/0dozj657rEGiETcxa7w2pPLvyvQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefano Brivio , Sabrina Dubroca , "David S. Miller" Subject: [PATCH 4.4 091/114] ipv6/ndisc: Preserve IPv6 control buffer if protocol error handlers are called Date: Thu, 8 Nov 2018 13:51:46 -0800 Message-Id: <20181108215109.010136833@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108215059.051093652@linuxfoundation.org> References: <20181108215059.051093652@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.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stefano Brivio [ Upstream commit ee1abcf689353f36d9322231b4320926096bdee0 ] Commit a61bbcf28a8c ("[NET]: Store skb->timestamp as offset to a base timestamp") introduces a neighbour control buffer and zeroes it out in ndisc_rcv(), as ndisc_recv_ns() uses it. Commit f2776ff04722 ("[IPV6]: Fix address/interface handling in UDP and DCCP, according to the scoping architecture.") introduces the usage of the IPv6 control buffer in protocol error handlers (e.g. inet6_iif() in present-day __udp6_lib_err()). Now, with commit b94f1c0904da ("ipv6: Use icmpv6_notify() to propagate redirect, instead of rt6_redirect()."), we call protocol error handlers from ndisc_redirect_rcv(), after the control buffer is already stolen and some parts are already zeroed out. This implies that inet6_iif() on this path will always return zero. This gives unexpected results on UDP socket lookup in __udp6_lib_err(), as we might actually need to match sockets for a given interface. Instead of always claiming the control buffer in ndisc_rcv(), do that only when needed. Fixes: b94f1c0904da ("ipv6: Use icmpv6_notify() to propagate redirect, instead of rt6_redirect().") Signed-off-by: Stefano Brivio Reviewed-by: Sabrina Dubroca Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv6/ndisc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -1649,10 +1649,9 @@ int ndisc_rcv(struct sk_buff *skb) return 0; } - memset(NEIGH_CB(skb), 0, sizeof(struct neighbour_cb)); - switch (msg->icmph.icmp6_type) { case NDISC_NEIGHBOUR_SOLICITATION: + memset(NEIGH_CB(skb), 0, sizeof(struct neighbour_cb)); ndisc_recv_ns(skb); break;