summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2020-03-02 21:05:12 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-03-18 07:14:18 +0100
commit48aea14b8840a60662bac14f670ea4e265c546c8 (patch)
tree93eb4f7bebf8ccc64aef3ed496c6a7c93ca3f600
parent3c2893a77cef0b05127c2d5c21cf08e19904b092 (diff)
downloadlinux-stable-48aea14b8840a60662bac14f670ea4e265c546c8.tar.gz
linux-stable-48aea14b8840a60662bac14f670ea4e265c546c8.tar.bz2
linux-stable-48aea14b8840a60662bac14f670ea4e265c546c8.zip
devlink: validate length of region addr/len
[ Upstream commit ff3b63b8c299b73ac599b120653b47e275407656 ] DEVLINK_ATTR_REGION_CHUNK_ADDR and DEVLINK_ATTR_REGION_CHUNK_LEN lack entries in the netlink policy. Corresponding nla_get_u64()s may read beyond the end of the message. Fixes: 4e54795a27f5 ("devlink: Add support for region snapshot read command") Signed-off-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--net/core/devlink.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 3095b5ba3c85..a77e3777c8dd 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -3607,6 +3607,8 @@ static const struct nla_policy devlink_nl_policy[DEVLINK_ATTR_MAX + 1] = {
[DEVLINK_ATTR_PARAM_VALUE_CMODE] = { .type = NLA_U8 },
[DEVLINK_ATTR_REGION_NAME] = { .type = NLA_NUL_STRING },
[DEVLINK_ATTR_REGION_SNAPSHOT_ID] = { .type = NLA_U32 },
+ [DEVLINK_ATTR_REGION_CHUNK_ADDR] = { .type = NLA_U64 },
+ [DEVLINK_ATTR_REGION_CHUNK_LEN] = { .type = NLA_U64 },
};
static const struct genl_ops devlink_nl_ops[] = {