]> www.infradead.org Git - users/jedix/linux-maple.git/commit
netlink: validate NLA_MSECS length
authorJohannes Berg <johannes.berg@intel.com>
Thu, 3 Nov 2011 00:07:32 +0000 (00:07 +0000)
committerMaxim Uvarov <maxim.uvarov@oracle.com>
Thu, 8 Dec 2011 19:18:15 +0000 (11:18 -0800)
commitd754f78d0f17891d460dcca13f05bba605f4c9af
treec14d9f20c559a36730b6e8a449f82e83b01abbdf
parent9d106e9fa1c29df7cfb944e711d1e30ba67ab4b7
netlink: validate NLA_MSECS length

commit c30bc94758ae2a38a5eb31767c1985c0aae0950b upstream.

L2TP for example uses NLA_MSECS like this:
policy:
        [L2TP_ATTR_RECV_TIMEOUT]        = { .type = NLA_MSECS, },
code:
        if (info->attrs[L2TP_ATTR_RECV_TIMEOUT])
                cfg.reorder_timeout = nla_get_msecs(info->attrs[L2TP_ATTR_RECV_TIMEOUT]);

As nla_get_msecs() is essentially nla_get_u64() plus the
conversion to a HZ-based value, this will not properly
reject attributes from userspace that aren't long enough
and might overrun the message.

Add NLA_MSECS to the attribute minlen array to check the
size properly.

Cc: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
lib/nlattr.c