]> git.baikalelectronics.ru Git - kernel.git/commit
netlink: add validation of NLA_F_NESTED flag
authorMichal Kubecek <mkubecek@suse.cz>
Thu, 2 May 2019 14:15:10 +0000 (16:15 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 4 May 2019 05:27:11 +0000 (01:27 -0400)
commit09ff7e5c7f1b8f1cca856bab97a8f2dca5c45c69
treef2aad0917c7a2e619bca6eefa82eb6b3355fb537
parente14c54327625806e487be34a8cb704626de2a0d1
netlink: add validation of NLA_F_NESTED flag

Add new validation flag NL_VALIDATE_NESTED which adds three consistency
checks of NLA_F_NESTED_FLAG:

  - the flag is set on attributes with NLA_NESTED{,_ARRAY} policy
  - the flag is not set on attributes with other policies except NLA_UNSPEC
  - the flag is set on attribute passed to nla_parse_nested()

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
v2: change error messages to mention NLA_F_NESTED explicitly
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/netlink.h
lib/nlattr.c