]> git.baikalelectronics.ru Git - kernel.git/commit
device_cgroup: Roll back to original exceptions after copy failure
authorWang Weiyang <wangweiyang2@huawei.com>
Tue, 25 Oct 2022 11:31:01 +0000 (19:31 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 7 Jan 2023 10:11:56 +0000 (11:11 +0100)
commit0e779782ace3a0381bbeccec43103a40897a93da
treeb52bc120fa81db7bfd6634030399f0f49285159b
parent6b50e4287f1300bbdd43130a97dba66db715010c
device_cgroup: Roll back to original exceptions after copy failure

commit 0d8f4ed80228455229aae91349059c9c206aacaf upstream.

When add the 'a *:* rwm' entry to devcgroup A's whitelist, at first A's
exceptions will be cleaned and A's behavior is changed to
DEVCG_DEFAULT_ALLOW. Then parent's exceptions will be copyed to A's
whitelist. If copy failure occurs, just return leaving A to grant
permissions to all devices. And A may grant more permissions than
parent.

Backup A's whitelist and recover original exceptions after copy
failure.

Cc: stable@vger.kernel.org
Fixes: 292eeecf08ef ("device_cgroup: add proper checking when changing default behavior")
Signed-off-by: Wang Weiyang <wangweiyang2@huawei.com>
Reviewed-by: Aristeu Rozanski <aris@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
security/device_cgroup.c