From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x224LM1g4b0M2G9jjNhWFnRFoxMKV0HrWlx+VIIMDcc4IGfb/2sJLjLA0Ad0K4KjKoUjhvdLB ARC-Seal: i=1; a=rsa-sha256; t=1517256603; cv=none; d=google.com; s=arc-20160816; b=gtuw5Ar3dYCCM5h2UW/jclLe6lYgqyJHGc9F7ZuPs2sO113RPo0vliAQ3T0lJLq0yG TAo8g6fqRsvvIED0zZn+AwhONo9v8XRoLnxvxmfxEOBW5fIs/6ZtCCWYts48sj0MdLPR AfCoDM4deCAj8lcWuI9Umvh1LDJ25M+XHYHOby6TdEWiRwuE+CMEtJqRy23rSDsBN0Dv NOInTvh5L2QCCzepUCbawZikMY+qFErFn2VAeppHe5Shtx76iOyRTUHrxa1yksSe/EEg S8TYCcrhAW0UH5kxiLcyavIbzKexg3Itg80skXKG0+3DF0cYj9yFhs+Lj8dm0kHcOIm7 Jx0Q== 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=5WNKI71aZx0/KBtSKXYifkz3c98qcPftJ2OcTHSF/mk=; b=uK8gsso8JSnxn+6Ukc4aeLc0szrzMRXCZao13r3mTX08DjU1v8sVlULWD1OmKqb80P XRQ+LeOlmgd9echJmjY7n9g8lxx+9ROVxtC6PkWYWlWxD2eDytKgHwO9RVhVwJsIcrv4 gj7vxSGwBpZHEYOBEBxC8F3dIKJxMuaV105J0gfiTiYW+bXHub8GAAPbmXiefp9C1ftr pAfslXsv2uE08QBNpSaLa1NSpSkG+jnkAWVaj3D9+GkAHbq+N3LNtENJyU2nVxcvql/3 HqDu1gxCdeiblueD8EektAD4UtpsK454nnD2mRXFEYX2NPn4jwf5hBH8IrCAW/B5wMhI p39A== 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.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 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?1590958860405235936?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 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: