Skip to content

Commit

Permalink
cgroups: skip and warn about invalid file descriptors
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Feb 22, 2021
1 parent 1d54461 commit 7f02fd2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lxc/cgroups/cgfsng.c
Expand Up @@ -1305,6 +1305,9 @@ static int chown_cgroup_wrapper(void *data)
for (int i = 0; arg->hierarchies[i]; i++) {
int dirfd = arg->hierarchies[i]->dfd_con;

if (dirfd < 0)
return syserrno_set(-EBADF, "Invalid cgroup file descriptor");

(void)fchowmodat(dirfd, "", destuid, nsgid, 0775);

/*
Expand Down

0 comments on commit 7f02fd2

Please sign in to comment.