Skip to content

cgroups: check the returned value of opendir - #414

Open
minhbq-99 wants to merge 1 commit into
Atoptool:masterfrom
minhbq-99:cgroup-crash
Open

cgroups: check the returned value of opendir#414
minhbq-99 wants to merge 1 commit into
Atoptool:masterfrom
minhbq-99:cgroup-crash

Conversation

@minhbq-99

Copy link
Copy Markdown

We have an unusual case when a cgroup controller directory grants other users with execute (x) permission but without read (r) permission. As a result, when running atop as a user who is not the owner of the directory, we succeed in the chdir but fail on opendir. Therefore, opendir returns NULL and leads to a crash. This commit checks the returned value of opendir and returns error when the value is NULL to avoid the crash.

We have an unusual case when a cgroup controller directory grants other
users with execute (x) permission but without read (r) permission. As a
result, when running atop as a user who is not the owner of the
directory, we succeed in the chdir but fail on opendir. Therefore,
opendir returns NULL and leads to a crash. This commit checks the
returned value of opendir and returns error when the value is NULL to
avoid the crash.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant