mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
libct/intelrdt: fix potential nil dereference
In case getIntelRdtData() returns an error, d is set to nil. In case the error returned is of NotFoundError type (which happens if resctlr mount is not found in /proc/self/mountinfo), the function proceeds to call d.join(), resulting in a nil deref and a panic. In practice, this never happens in runc because of the checks in intelrdt() function in libcontainer/configs/validate, which raises an error in case any of the parameters are set in config but the IntelRTD itself is not available (that includes checking that the mount point is there). Nevertheless, the code is wrong, and can result in nil dereference if some external users uses Apply on a system without resctrl mount. Fix this by removing the exclusion. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -547,7 +547,7 @@ func (m *intelRdtManager) Apply(pid int) (err error) {
|
||||
return nil
|
||||
}
|
||||
d, err := getIntelRdtData(m.config, pid)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user