Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2452761imd; Fri, 2 Nov 2018 11:39:03 -0700 (PDT) X-Google-Smtp-Source: AJdET5dsnbfsJWmxZUFtVJT9qlatATGH+L8mt9/vNwtDnWXNfKIYCKeoX5Q2ufm9szSPrEu2D/NE X-Received: by 2002:a62:4e01:: with SMTP id c1-v6mr12673318pfb.141.1541183943481; Fri, 02 Nov 2018 11:39:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541183943; cv=none; d=google.com; s=arc-20160816; b=IXdp7kG251WlNcT8dFkTgEZKnlJwGd8+oCSLHBW91pKzXK56+0hAjYUZyazOlefBcC Nz8otcu46NhHuLM0qFyws/DJOZfHAmOF4zmL8FvFlezP7lUxGaoQPkkE+U2GFOaSWFlU N7fZk5Uux7lfKM9IzdkGGu+VPEZSMkmIHOvcXzn9fr7R2d0vfUcay5BU0zmx6GfNwn/Q KUFfmWZhLuja+34j3PbW/ngMqU6foiq0yh9GpCVzhdWasQvJ92zYhoHiS4X4/q7RM+nA htCuRPb5assBkjMxVVqo8zUDAUtkFHMnqo9muzIRZigbZJFL5w5qpdrda5wA9SQ9Pklx nJ7A== 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=ILj8rVeVyljnnVpj4zRV3MtiwOGm82SbKXZ52wF7dvI=; b=VFruX2OHo4zN+02GB77CuNrYgfWTbHHzTbPLtN4UShBN1/Q89GvYysyb+dMWT2ocMc l80RUFtsYe2KHDxwJfT8o9InYs578xF4cEl6Q3VbVn9ttgIu85tKDTV6WQeNKxEz+2Rq fZptPwQTsRIVGwL4oMvTXkKjk+5CjxPJDP+hhHxgT6GSfzeLa8K8v3OTEZia70p53vkL 4oArzQYnQWCEzGm57ZLZO6VM/usejQwVTdPnRk0nYfJP2eeozVlij8ityuCV8WNxFJR2 TW/Ela1/UJ9yV5KJfT0TTWC9lgl4q6MXEvKM9UDdXznBnAIQfs/q8XVmuJzzuTrif9Mn Zacg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2rSO2e1u; 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 w19-v6si34599951pgl.278.2018.11.02.11.38.48; Fri, 02 Nov 2018 11:39:03 -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=2rSO2e1u; 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 S1728645AbeKCDpx (ORCPT + 99 others); Fri, 2 Nov 2018 23:45:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:39528 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727556AbeKCDpx (ORCPT ); Fri, 2 Nov 2018 23:45:53 -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 AD5F52081B; Fri, 2 Nov 2018 18:37:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541183862; bh=aioBmV3gd3Ky3gFkzBPwB7CyPS19jILqYkIhJdbaZno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2rSO2e1uLh4CgMEcpeKC+oSfyNLIoKieJBHYr/Sm83CHXiWw3UsTJ6iHajLp2RMnY m2GOvDYg/lAvSpyQL4CjR8KyLyPjfDIKrfMC2xsPRPDVlCGGrDRxTEpxnBLYjMIdeI wX4UaGR9xWQvKJi/fKMMcQms7/VN88lfsyLms0PU= 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.19 02/24] ipv6/ndisc: Preserve IPv6 control buffer if protocol error handlers are called Date: Fri, 2 Nov 2018 19:34:35 +0100 Message-Id: <20181102182840.089362316@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181102182839.725385066@linuxfoundation.org> References: <20181102182839.725385066@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.19-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;