Skip to content

Commit

Permalink
netfilter: nft_socket: Fix a NULL vs IS_ERR() bug in nft_socket_cgrou…
Browse files Browse the repository at this point in the history
…p_subtree_level()

commit 7052622fccb1efb850c6b55de477f65d03525a30 upstream.

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 <[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]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Dan Carpenter authored and Avenger-285714 committed Oct 6, 2024
1 parent 41fa8e6 commit e3f6f4a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/netfilter/nft_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit e3f6f4a

Please sign in to comment.