]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
api.c: fix null deference in is_cgrp_ctrl_shared_mnt()
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Wed, 27 Jul 2022 19:34:45 +0000 (13:34 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 27 Jul 2022 19:34:49 +0000 (13:34 -0600)
commitc7ad94e3180dc674f049b5e15f84ccdbded2ac61
tree50cff522a8b27267aaf75d6f6f43b6fdf9b48075
parentde951069e925a697a047c6327a8578ef6b5d2353
api.c: fix null deference in is_cgrp_ctrl_shared_mnt()

Fix explicit null dereferenced warning, reported by Coverity tool:

CID 258306 (#1 of 1): Explicit null dereferenced (FORWARD_NULL).
var_deref_model: Passing null pointer controller_name to
cgroup_find_parent, which dereferences it.

the code path which leads to the null dereference:
cgroup_delete_cgroup_ext()
- cgroup_find_parent()
  - is_cgrp_ctrl_shared_mnt()

is_cgrp_ctrl_shared_mnt(), assumes that the controller_name is non-NULL
but there are changes that, this static function might be called with
NULL controller_name, let's fix it with a check.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/api.c