Received: by 10.223.176.5 with SMTP id f5csp3419519wra; Mon, 29 Jan 2018 12:55:28 -0800 (PST) X-Google-Smtp-Source: AH8x225S/2I69ZYPh0e8FI6CN4J9ZTYhSSCDKk6hA+ctmgzqND0QLQGzcqMcQSM6It4JQQoJ76N+ X-Received: by 10.98.178.133 with SMTP id z5mr27907502pfl.88.1517259328414; Mon, 29 Jan 2018 12:55:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517259328; cv=none; d=google.com; s=arc-20160816; b=RaBCrVm+zhVVXuL/VnhAUlTpvZ5v3l1mcujlbPd9ts8I/dWswdh1OuR13ED1KOQatQ gGLHIKSYpeqBy4/iAAXU4GXJrZYtUL+ZC4RUsVX9FH56wi8URE/ztbFSDLRVommFn+DQ JJmuqKwp3nWOuYAv9OwbBwCIS1OvrJMHWofG1+Ig1tCOZLHVJQpqUii8NmvGyGwgBAft elZOy0wK8FluC+FcM3XkIrIwVWXd56svIaTqP9dufxn3mQju2Nut5h4zmmUNnLsRRL0b UouuVW+jhaGmoPbDtJdVFacrsJmUmbkLldlvodgVk0qWTVZKJncfS1BMh4ulB4ScNmeh zRog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=5WNKI71aZx0/KBtSKXYifkz3c98qcPftJ2OcTHSF/mk=; b=ilci9wBE/8UDZ5RS/aXzDerMrL4IOi+Rp+8KnetM/kNttrn7P+FmXrOfLZdNiGPBae wI0IcU57XV1xbuklyhdPJWK9Odg/Qok5gHcm4v3M5T1OVtNxDurLWFWhpC4uvQOS+wrq q2io6/EGgopXliV8qYjWj/l+Hjyf+dSoottNA+RB+YYDNywfCqmRo/OEAvvSnSTEK5SJ tAORjyFJIm/v0g+oGNArlWFP7znQSKGvki3QX3kEX1AcALfuSswaeDNcqKK7wXTD+Ht8 Shv/Wc+QL+lifOHZQn+jQsvMZvMla5u624b/9CV230Jo45sbOBgDgiDjhlyjQbY1aAlC rDOQ== ARC-Authentication-Results: i=1; mx.google.com; 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 r16si12564901pff.348.2018.01.29.12.55.14; Mon, 29 Jan 2018 12:55:28 -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; 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 S1753404AbeA2UKD (ORCPT + 99 others); Mon, 29 Jan 2018 15:10:03 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:56164 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753354AbeA2UKC (ORCPT ); Mon, 29 Jan 2018 15:10:02 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 3FAD12FF5; Mon, 29 Jan 2018 13:08:38 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ben Hutchings , "David S. Miller" Subject: [PATCH 4.14 26/71] ipv6: Fix getsockopt() for sockets with default IPV6_AUTOFLOWLABEL Date: Mon, 29 Jan 2018 13:56:54 +0100 Message-Id: <20180129123829.026747261@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123827.271171825@linuxfoundation.org> References: <20180129123827.271171825@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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: Ben Hutchings [ Upstream commit e9191ffb65d8e159680ce0ad2224e1acbde6985c ] Commit 513674b5a2c9 ("net: reevalulate autoflowlabel setting after sysctl setting") removed the initialisation of ipv6_pinfo::autoflowlabel and added a second flag to indicate whether this field or the net namespace default should be used. The getsockopt() handling for this case was not updated, so it currently returns 0 for all sockets for which IPV6_AUTOFLOWLABEL is not explicitly enabled. Fix it to return the effective value, whether that has been set at the socket or net namespace level. Fixes: 513674b5a2c9 ("net: reevalulate autoflowlabel setting after sysctl ...") Signed-off-by: Ben Hutchings Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- include/net/ipv6.h | 1 + net/ipv6/ip6_output.c | 2 +- net/ipv6/ipv6_sockglue.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -291,6 +291,7 @@ int ipv6_flowlabel_opt_get(struct sock * int flags); int ip6_flowlabel_init(void); void ip6_flowlabel_cleanup(void); +bool ip6_autoflowlabel(struct net *net, const struct ipv6_pinfo *np); static inline void fl6_sock_release(struct ip6_flowlabel *fl) { --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -166,7 +166,7 @@ int ip6_output(struct net *net, struct s !(IP6CB(skb)->flags & IP6SKB_REROUTED)); } -static bool ip6_autoflowlabel(struct net *net, const struct ipv6_pinfo *np) +bool ip6_autoflowlabel(struct net *net, const struct ipv6_pinfo *np) { if (!np->autoflowlabel_set) return ip6_default_np_autolabel(net); --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c @@ -1324,7 +1324,7 @@ static int do_ipv6_getsockopt(struct soc break; case IPV6_AUTOFLOWLABEL: - val = np->autoflowlabel; + val = ip6_autoflowlabel(sock_net(sk), np); break; case IPV6_RECVFRAGSIZE: