提交 ee2ad765 编写于 作者: L Lin Ma 提交者: Yang Yingliang

NFC: add necessary privilege flags in netlink layer

mainline inclusion
from mainline-v5.16-rc1
commit aedddb4e
category: bugfix
bugzilla: NA
CVE: CVE-2021-4202

--------------------------------

The CAP_NET_ADMIN checks are needed to prevent attackers faking a
device under NCIUARTSETDRIVER and exploit privileged commands.

This patch add GENL_ADMIN_PERM flags in genl_ops to fulfill the check.
Except for commands like NFC_CMD_GET_DEVICE, NFC_CMD_GET_TARGET,
NFC_CMD_LLC_GET_PARAMS, and NFC_CMD_GET_SE, which are mainly information-
read operations.
Signed-off-by: NLin Ma <linma@zju.edu.cn>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Conflicts:
  net/nfc/netlink.c
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: NXiu Jianfeng <xiujianfeng@huawei.com>
Reviewed-by: NYue Haibing <yuehaibing@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 b77d2ff8
......@@ -1677,31 +1677,37 @@ static const struct genl_ops nfc_genl_ops[] = {
.cmd = NFC_CMD_DEV_UP,
.doit = nfc_genl_dev_up,
.policy = nfc_genl_policy,
.flags = GENL_ADMIN_PERM,
},
{
.cmd = NFC_CMD_DEV_DOWN,
.doit = nfc_genl_dev_down,
.policy = nfc_genl_policy,
.flags = GENL_ADMIN_PERM,
},
{
.cmd = NFC_CMD_START_POLL,
.doit = nfc_genl_start_poll,
.policy = nfc_genl_policy,
.flags = GENL_ADMIN_PERM,
},
{
.cmd = NFC_CMD_STOP_POLL,
.doit = nfc_genl_stop_poll,
.policy = nfc_genl_policy,
.flags = GENL_ADMIN_PERM,
},
{
.cmd = NFC_CMD_DEP_LINK_UP,
.doit = nfc_genl_dep_link_up,
.policy = nfc_genl_policy,
.flags = GENL_ADMIN_PERM,
},
{
.cmd = NFC_CMD_DEP_LINK_DOWN,
.doit = nfc_genl_dep_link_down,
.policy = nfc_genl_policy,
.flags = GENL_ADMIN_PERM,
},
{
.cmd = NFC_CMD_GET_TARGET,
......@@ -1718,26 +1724,31 @@ static const struct genl_ops nfc_genl_ops[] = {
.cmd = NFC_CMD_LLC_SET_PARAMS,
.doit = nfc_genl_llc_set_params,
.policy = nfc_genl_policy,
.flags = GENL_ADMIN_PERM,
},
{
.cmd = NFC_CMD_LLC_SDREQ,
.doit = nfc_genl_llc_sdreq,
.policy = nfc_genl_policy,
.flags = GENL_ADMIN_PERM,
},
{
.cmd = NFC_CMD_FW_DOWNLOAD,
.doit = nfc_genl_fw_download,
.policy = nfc_genl_policy,
.flags = GENL_ADMIN_PERM,
},
{
.cmd = NFC_CMD_ENABLE_SE,
.doit = nfc_genl_enable_se,
.policy = nfc_genl_policy,
.flags = GENL_ADMIN_PERM,
},
{
.cmd = NFC_CMD_DISABLE_SE,
.doit = nfc_genl_disable_se,
.policy = nfc_genl_policy,
.flags = GENL_ADMIN_PERM,
},
{
.cmd = NFC_CMD_GET_SE,
......@@ -1749,21 +1760,25 @@ static const struct genl_ops nfc_genl_ops[] = {
.cmd = NFC_CMD_SE_IO,
.doit = nfc_genl_se_io,
.policy = nfc_genl_policy,
.flags = GENL_ADMIN_PERM,
},
{
.cmd = NFC_CMD_ACTIVATE_TARGET,
.doit = nfc_genl_activate_target,
.policy = nfc_genl_policy,
.flags = GENL_ADMIN_PERM,
},
{
.cmd = NFC_CMD_VENDOR,
.doit = nfc_genl_vendor_cmd,
.policy = nfc_genl_policy,
.flags = GENL_ADMIN_PERM,
},
{
.cmd = NFC_CMD_DEACTIVATE_TARGET,
.doit = nfc_genl_deactivate_target,
.policy = nfc_genl_policy,
.flags = GENL_ADMIN_PERM,
},
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册