netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] netfilter: nft_socket: Fix a NULL vs IS_ERR() bug in nft_socket_cgroup_subtree_level()
@ 2024-09-14  9:56 Dan Carpenter
  2024-09-14 11:19 ` Florian Westphal
  2024-09-15 16:01 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: Dan Carpenter @ 2024-09-14  9:56 UTC (permalink / raw)
  To: Florian Westphal
  Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netfilter-devel,
	coreteam, netdev, linux-kernel, kernel-janitors

The cgroup_get_from_path() function never returns NULL, it returns error
pointers.  Update the error handling to match.

Fixes: 7f3287db6543 ("netfilter: nft_socket: make cgroupsv2 matching work with namespaces")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 net/netfilter/nft_socket.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nft_socket.c b/net/netfilter/nft_socket.c
index ac3c9e9cf0f3..f5da0c1775f2 100644
--- a/net/netfilter/nft_socket.c
+++ b/net/netfilter/nft_socket.c
@@ -61,8 +61,8 @@ static noinline int nft_socket_cgroup_subtree_level(void)
 	struct cgroup *cgrp = cgroup_get_from_path("/");
 	int level;
 
-	if (!cgrp)
-		return -ENOENT;
+	if (IS_ERR(cgrp))
+		return PTR_ERR(cgrp);
 
 	level = cgrp->level;
 
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net] netfilter: nft_socket: Fix a NULL vs IS_ERR() bug in nft_socket_cgroup_subtree_level()
  2024-09-14  9:56 [PATCH net] netfilter: nft_socket: Fix a NULL vs IS_ERR() bug in nft_socket_cgroup_subtree_level() Dan Carpenter
@ 2024-09-14 11:19 ` Florian Westphal
  2024-09-14 15:21   ` Simon Horman
  2024-09-14 22:07   ` Pablo Neira Ayuso
  2024-09-15 16:01 ` patchwork-bot+netdevbpf
  1 sibling, 2 replies; 5+ messages in thread
From: Florian Westphal @ 2024-09-14 11:19 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Florian Westphal, Pablo Neira Ayuso, Jozsef Kadlecsik,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netfilter-devel, coreteam, netdev, linux-kernel, kernel-janitors

Dan Carpenter <dan.carpenter@linaro.org> wrote:
> The cgroup_get_from_path() function never returns NULL, it returns error
> pointers.  Update the error handling to match.

Good news, I will retire in the next few years so I don't send shit
patches anymore.

Acked-by: Florian Westphal <fw@strlen.de>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] netfilter: nft_socket: Fix a NULL vs IS_ERR() bug in nft_socket_cgroup_subtree_level()
  2024-09-14 11:19 ` Florian Westphal
@ 2024-09-14 15:21   ` Simon Horman
  2024-09-14 22:07   ` Pablo Neira Ayuso
  1 sibling, 0 replies; 5+ messages in thread
From: Simon Horman @ 2024-09-14 15:21 UTC (permalink / raw)
  To: Florian Westphal
  Cc: Dan Carpenter, Pablo Neira Ayuso, Jozsef Kadlecsik,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netfilter-devel, coreteam, netdev, linux-kernel, kernel-janitors

On Sat, Sep 14, 2024 at 01:19:40PM +0200, Florian Westphal wrote:
> Dan Carpenter <dan.carpenter@linaro.org> wrote:
> > The cgroup_get_from_path() function never returns NULL, it returns error
> > pointers.  Update the error handling to match.
> 
> Good news, I will retire in the next few years so I don't send shit
> patches anymore.
> 
> Acked-by: Florian Westphal <fw@strlen.de>

Everyone makes mistakes, don't be too hard on yourself :)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] netfilter: nft_socket: Fix a NULL vs IS_ERR() bug in nft_socket_cgroup_subtree_level()
  2024-09-14 11:19 ` Florian Westphal
  2024-09-14 15:21   ` Simon Horman
@ 2024-09-14 22:07   ` Pablo Neira Ayuso
  1 sibling, 0 replies; 5+ messages in thread
From: Pablo Neira Ayuso @ 2024-09-14 22:07 UTC (permalink / raw)
  To: Florian Westphal
  Cc: Dan Carpenter, Jozsef Kadlecsik, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netfilter-devel, coreteam, netdev,
	linux-kernel, kernel-janitors

On Sat, Sep 14, 2024 at 01:19:40PM +0200, Florian Westphal wrote:
> Dan Carpenter <dan.carpenter@linaro.org> wrote:
> > The cgroup_get_from_path() function never returns NULL, it returns error
> > pointers.  Update the error handling to match.
> 
> Good news, I will retire in the next few years so I don't send shit
> patches anymore.
> 
> Acked-by: Florian Westphal <fw@strlen.de>

This is also my fault, I did not help to catch this error in any way:

Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] netfilter: nft_socket: Fix a NULL vs IS_ERR() bug in nft_socket_cgroup_subtree_level()
  2024-09-14  9:56 [PATCH net] netfilter: nft_socket: Fix a NULL vs IS_ERR() bug in nft_socket_cgroup_subtree_level() Dan Carpenter
  2024-09-14 11:19 ` Florian Westphal
@ 2024-09-15 16:01 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-09-15 16:01 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: fw, pablo, kadlec, davem, edumazet, kuba, pabeni, netfilter-devel,
	coreteam, netdev, linux-kernel, kernel-janitors

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Sat, 14 Sep 2024 12:56:51 +0300 you wrote:
> The cgroup_get_from_path() function never returns NULL, it returns error
> pointers.  Update the error handling to match.
> 
> Fixes: 7f3287db6543 ("netfilter: nft_socket: make cgroupsv2 matching work with namespaces")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  net/netfilter/nft_socket.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Here is the summary with links:
  - [net] netfilter: nft_socket: Fix a NULL vs IS_ERR() bug in nft_socket_cgroup_subtree_level()
    https://git.kernel.org/netdev/net/c/7052622fccb1

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-09-15 16:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-14  9:56 [PATCH net] netfilter: nft_socket: Fix a NULL vs IS_ERR() bug in nft_socket_cgroup_subtree_level() Dan Carpenter
2024-09-14 11:19 ` Florian Westphal
2024-09-14 15:21   ` Simon Horman
2024-09-14 22:07   ` Pablo Neira Ayuso
2024-09-15 16:01 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).