From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x225LcD1Mxo4pznydMjwZxabL9ULZmOkUc3fG5Z3I63vmLwU4T5kL68M9P/4+HkcR/BcCEPJ0 ARC-Seal: i=1; a=rsa-sha256; t=1517256721; cv=none; d=google.com; s=arc-20160816; b=WKMEY61QSgd+VBuHnWJSQf/GGpzG7GAt8tnAZdGcVCaExB5rA7txalCe2QF2mOSM2d 0c/PFKFadSD4DY9tgws0CDwNxZ1Gy4uqgYUReTPeXayNYYt9+jF23GgY9WbYTnzbQBq9 Po8BbhnPjtg/EsSu7W2g9Di4ZjGjlt7VXFkZbe1RnhujtJVkl4gUYSaoA7o3pB5OWROp ljc5h/+I64IHRwpHyQ8AYhiYX4K8+7Ys+8A0pWaqUHxz+4OC3QbYk/wMXyWnuYA1b+va 8xYsuS2soWPv7ZNXRAear+WqdgY1nJMYuicJWkMt8ZCL1tLE8q6jGmpw4xuQbLfVmlq4 Q4OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=53gBvSpSuG5gqxpAa0sqoXv4//pvcrnk8IjEXt6p0R4=; b=gMUcPBi+l+iRR89LGEfhCbJmXn/m0+jhSWja5AiHtpwY/vl87ZYgWmqyb5ZxDYipv+ sQBSf2QGq+C8Ia1A6/iFtJHKzyHzP8mL8RQoTf5oy2N1qMSsoyxeebu9Hm3NAH6tk1Np 3VGV1Wg1dsUkv3IL2dwhaouFL97DZtYY7pXeaNIO1ykb4KbpCeESQXpEk8WQx05O+ooz 6VWUz5N9k3v88RmGcymGRk8wl4wh9DxYPfvUoBSo/jDR5aE8zUDoz8vEVTWB5mAH6Ydx S6zOCHMSTCXziGfIzEjrf2CNMUPCz+yR4mZFjCk9y6Rd6SNc8W0K1jtGoTxr20tZfs2O FLvg== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org 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.4 59/74] ipv6: Fix getsockopt() for sockets with default IPV6_AUTOFLOWLABEL Date: Mon, 29 Jan 2018 13:57:04 +0100 Message-Id: <20180129123850.223291133@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123847.507563674@linuxfoundation.org> References: <20180129123847.507563674@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1590958471740326568?= X-GMAIL-MSGID: =?utf-8?q?1590958984557622177?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.4-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 @@ -281,6 +281,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 @@ -148,7 +148,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 @@ -1313,7 +1313,7 @@ static int do_ipv6_getsockopt(struct soc break; case IPV6_AUTOFLOWLABEL: - val = np->autoflowlabel; + val = ip6_autoflowlabel(sock_net(sk), np); break; default: