Skip to content

Commit 94d6fe6

Browse files
Dan Carpentergregkh
authored andcommitted
netfilter: nft_socket: Fix a NULL vs IS_ERR() bug in nft_socket_cgroup_subtree_level()
commit 7052622 upstream. The cgroup_get_from_path() function never returns NULL, it returns error pointers. Update the error handling to match. Fixes: 7f3287d ("netfilter: nft_socket: make cgroupsv2 matching work with namespaces") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Acked-by: Florian Westphal <fw@strlen.de> Acked-by: Pablo Neira Ayuso <pablo@netfilter.org> Link: https://patch.msgid.link/bbc0c4e0-05cc-4f44-8797-2f4b3920a820@stanley.mountain Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f07e28e commit 94d6fe6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/netfilter/nft_socket.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ static noinline int nft_socket_cgroup_subtree_level(void)
6161
struct cgroup *cgrp = cgroup_get_from_path("/");
6262
int level;
6363

64-
if (!cgrp)
65-
return -ENOENT;
64+
if (IS_ERR(cgrp))
65+
return PTR_ERR(cgrp);
6666

6767
level = cgrp->level;
6868

0 commit comments

Comments
 (0)