Skip to content

Commit 7052622

Browse files
Dan Carpenterkuba-moo
authored andcommitted
netfilter: nft_socket: Fix a NULL vs IS_ERR() bug in nft_socket_cgroup_subtree_level()
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 <[email protected]> Acked-by: Florian Westphal <[email protected]> Acked-by: Pablo Neira Ayuso <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 36f6b72 commit 7052622

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)