lkml.org 
[lkml]   [2020]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.19 41/89] devlink: validate length of region addr/len
    Date
    From: Jakub Kicinski <kuba@kernel.org>

    [ 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>
    ---
    net/core/devlink.c | 2 ++
    1 file changed, 2 insertions(+)

    --- a/net/core/devlink.c
    +++ b/net/core/devlink.c
    @@ -3607,6 +3607,8 @@ static const struct nla_policy devlink_n
    [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[] = {

    \
     
     \ /
      Last update: 2020-03-17 12:22    [W:8.513 / U:2.176 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site