• David Ahern's avatar
    netlink: Add strict version of nlmsg_parse and nla_parse · a5f6cba2
    David Ahern authored
    nla_parse is currently lenient on message parsing, allowing type to be 0
    or greater than max expected and only logging a message
    
        "netlink: %d bytes leftover after parsing attributes in process `%s'."
    
    if the netlink message has unknown data at the end after parsing. What this
    could mean is that the header at the front of the attributes is actually
    wrong and the parsing is shifted from what is expected.
    
    Add a new strict version that actually fails with EINVAL if there are any
    bytes remaining after the parsing loop completes, if the atttrbitue type
    is 0 or greater than max expected.
    Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
    Acked-by: default avatarChristian Brauner <christian@brauner.io>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    a5f6cba2