From 66a93b1c3da9f7a06cee254d6a2ac79e739419ac Mon Sep 17 00:00:00 2001 From: Xuewei Niu Date: Mon, 31 Jul 2023 13:42:00 +0800 Subject: [PATCH] devices: Throw an error if device resources are invalid The cgroup-rs should throw errors while setting devices cgroup if the rule is invalid. For example, if a cgroup has permissions of some devices. Then we set a `a *:* rwm` to its parent's `devices.deny`. An error should be thrown to make users realize that it is a invalid rule. Signed-off-by: Xuewei Niu --- src/devices.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices.rs b/src/devices.rs index d5325c1..eef95f1 100644 --- a/src/devices.rs +++ b/src/devices.rs @@ -171,9 +171,9 @@ impl ControllerInternal for DevicesController { for i in &res.devices { if i.allow { - let _ = self.allow_device(i.devtype, i.major, i.minor, &i.access); + self.allow_device(i.devtype, i.major, i.minor, &i.access)?; } else { - let _ = self.deny_device(i.devtype, i.major, i.minor, &i.access); + self.deny_device(i.devtype, i.major, i.minor, &i.access)?; } }