net/netfilter/nft_socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
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
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>
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>
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 :)
© 2016 - 2024 Red Hat, Inc.