Netfilter fixes for net
Subsystems (3)
Pablo Neira Ayuso
maintainercover Netfilter fixes for net
Hi,
The following patchset contains Netfilter fixes for net:
1) Fix cgroupv2 from the input path, from Florian Westphal.
2) Fix incorrect return value of nft_parse_register(), from Antoine Tenart.
Please, pull these changes from:
git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git
Thanks.
----------------------------------------------------------------
The following changes since commit e8a64bbaaad1f6548cec5508297bc6d45e8ab69e:
net/sched: taprio: Check if socket flags are valid (2022-04-11 10:51:00 +0100)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git HEAD
for you to fetch changes up to 6c6f9f31ecd47dce1d0dafca4bec8805f9bc97cd:
netfilter: nf_tables: nft_parse_register can return a negative value (2022-04-12 11:36:37 +0200)
----------------------------------------------------------------
Antoine Tenart (1):
netfilter: nf_tables: nft_parse_register can return a negative value
Florian Westphal (1):
netfilter: nft_socket: make cgroup match work in input too
net/netfilter/nf_tables_api.c | 2 +- net/netfilter/nft_socket.c | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-)
Pablo Neira Ayuso
maintainerPATCH 1/2 netfilter: nft_socket: make cgroup match work in input too
From: Florian Westphal <[email protected]>
cgroupv2 helper function ignores the already-looked up sk and uses skb->sk instead.
Just pass sk from the calling function instead; this will make cgroup matching work for udp and tcp in input even when edemux did not set skb->sk already.
--- net/netfilter/nft_socket.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
net/netfilter/nft_socket.c +3 -4
@@ -37,12 +37,11 @@ static void nft_socket_wildcard(const struct nft_pktinfo *pkt,#ifdef CONFIG_SOCK_CGROUP_DATA static noinline bool -nft_sock_get_eval_cgroupv2 (u32 *dest,const struct nft_pktinfo *pkt,u32 level) +nft_sock_get_eval_cgroupv2 (u32 *dest,struct sock *sk,const struct nft_pktinfo *pkt,u32 level) { -struct sock *sk =skb_to_full_sk (pkt->skb);struct cgroup *cgrp; -if (!sk || !sk_fullsock (sk) || !net_eq (nft_net (pkt),sock_net (sk))) +if (!sk_fullsock (sk))return false; cgrp =sock_cgroup_ptr (&sk->sk_cgrp_data);
@@ -109,7 +108,7 @@ static void nft_socket_eval(const struct nft_expr *expr,break ;#ifdef CONFIG_SOCK_CGROUP_DATA case NFT_SOCKET_CGROUPV2 : -if (!nft_sock_get_eval_cgroupv2 (dest, pkt, priv->level)) { +if (!nft_sock_get_eval_cgroupv2 (dest, sk, pkt, priv->level)) { regs->verdict.code =NFT_BREAK ;return ; }
Signature · 1 line
2.30.2
Re: [PATCH net 1/2] netfilter: nft_socket: make cgroup match work in input too
This series was applied to netdev/net.git (master) by Pablo Neira Ayuso <[email protected]>:
Hello:
This series was applied to netdev/net.git (master) by Pablo Neira Ayuso <[email protected]>:
Quoted 10 lines · On Tue, 12 Apr 2022 11:42:45 +0200 you wrote:
From: Florian Westphal <[email protected]>
cgroupv2 helper function ignores the already-looked up sk and uses
skb->skinstead.Just pass sk from the calling function instead; this will make cgroup matching work for udp and tcp in input even when edemux did not set
skb->skalready.[...]
Here is the summary with links:
- [net,1/2] netfilter: nft_socket: make cgroup match work in input too
https://git.kernel.org/netdev/net/c/05ae2fba821c - [net,2/2] netfilter: nf_tables: nft_parse_register can return a negative value https://git.kernel.org/netdev/net/c/6c6f9f31ecd4
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Pablo Neira Ayuso
maintainerPATCH 2/2 netfilter: nf_tables: nft_parse_register can return a negative value
In reply to Pablo Neira AyusoFrom: Antoine Tenart <[email protected]>
Since commit 6e1acfa387b9 ("netfilter: nf_tables: validate registers coming from userspace.") nft_parse_register can return a negative value, but the function prototype is still returning an unsigned int.
--- net/netfilter/nf_tables_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_tables_api.c +1 -1
@@ -9363,7 +9363,7 @@ int nft_parse_u32_check(const struct nlattr *attr, int max, u32 *dest) }EXPORT_SYMBOL_GPL (nft_parse_u32_check); -static unsigned int nft_parse_register (const struct nlattr *attr,u32 *preg) +static int nft_parse_register (const struct nlattr *attr,u32 *preg) {unsigned int reg;
Signature · 1 line
2.30.2