]> 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>
Wed, 18 Jan 2023 10:41:50 +0000 (11:41 +0100)
commita9836f80f60b64d9d9ad8b68f00b62d37013a318
tree233455a59198f9e92b8b4dcccd1542181ed7294d
parentbdb9c453c5922c0ac49aee677ddfcdc5f4c5af1e
device_cgroup: Roll back to original exceptions after copy failure

commit e68bfbd3b3c3a0ec3cf8c230996ad8cabe90322f 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: 53ea10b1e18f ("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