Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2457988imd; Fri, 2 Nov 2018 11:44:52 -0700 (PDT) X-Google-Smtp-Source: AJdET5fpT2hUO3Q4ofBQsasbNlIRqbKaf8RV5Hn4VFGYWMF4OBquYY4Wbq9auMemi0squQfMRd/W X-Received: by 2002:a62:1bcf:: with SMTP id b198-v6mr309959pfb.102.1541184292562; Fri, 02 Nov 2018 11:44:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541184292; cv=none; d=google.com; s=arc-20160816; b=h6FGOkgYS4qwhuR8e1Jr3AKVroRt1kKiulJmfIc/sq3PWCyXp+m2YonCYFT2JnL0ci toRIE5m/Li0VadP1PMdHo99hEkZ2wHLaPHO+4JEQfsD1uibbwy127vjcMD1ZsDfyTVlL w6N1/qwaFwytiVfQm4EqexxkOPL+7WI5CXD5lPK0PzBUSabFsdQyzDNyXCjACubV53mP VtPGEgbUns/56SkEnPiL+CwyNhv3ifDVmmBmsH1Za5kz1xYd38TFGlxhFjopd80zwTsk iXOeYVt8re0dbq6OBqTXhnMUoqMTth4LucKjZGeCEsrvM9A4ijXjV511QPVw9f986C61 eVvw== 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=tauWi8stF5eKYOEBSJNriHTSg7NLMojIsYrLdrTJ8uM=; b=Lsjgfqzyr16nLYoVEc16Bbv6ILDIW+c2qKry+r3VDonMGV0iGKWlwtSjSE8UpSu4Ym KzLSJsQBAnNe47/tiMLCIn64tT0ORh0g6IAQM4oJkiiGqIO4Y/zaxXVIM3Tun5ib/SPq yinJ3S978bgVwXiWFAzuKb+wJSDJMkuk8zKZokmmsItKxiY3PQkb9F4bhwgspQwXKEeU DnvmQSPjL2rU3Q6Pznw8Vau/nEb46QxHd74iWFZwqx8u8BNHNeahazQwYvCCQ4+7Nwb8 D2BKVyjDBTGpb8s2ZRhPRo707z5gJzN1XdfFsM3IOCQ6ODMHRUKn7c/BRXgCAVagMHq2 lIaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="MUPQkD/c"; 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 f3-v6si25076706pld.186.2018.11.02.11.44.38; Fri, 02 Nov 2018 11:44:52 -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="MUPQkD/c"; 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 S1729437AbeKCDvd (ORCPT + 99 others); Fri, 2 Nov 2018 23:51:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:46714 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728961AbeKCDvc (ORCPT ); Fri, 2 Nov 2018 23:51:32 -0400 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 E153720847; Fri, 2 Nov 2018 18:43:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541184200; bh=CNUIqoRNb7EWS/eBQixQ62OQSJRkfYfd62Dtq0k6Nec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MUPQkD/celYgJRe3hgUqcVscExdQEJawJXUQ2zdKk1YAJVE9kAH1/jl4ngSQmIvpn FoT+PBF2+Q4xIEWN+ZdXWgMPUPgPrQxKOmxpv+MRkoLiTdAbXTxAA7ANYb31Ev14pj rs4ZEiB0HQLvCh6Nnf3MKRulL1hvzJkt6VQ609Zo= 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.18 105/150] ipv6/ndisc: Preserve IPv6 control buffer if protocol error handlers are called Date: Fri, 2 Nov 2018 19:34:27 +0100 Message-Id: <20181102182910.616911895@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181102182902.250560510@linuxfoundation.org> References: <20181102182902.250560510@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.18-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 @@ -1732,10 +1732,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;