]> git.baikalelectronics.ru Git - kernel.git/commit
netlink: policy: correct validation type check
authorJohannes Berg <johannes.berg@intel.com>
Mon, 31 Aug 2020 18:28:05 +0000 (20:28 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 31 Aug 2020 19:01:15 +0000 (12:01 -0700)
commit39512d48567fcd63a61d0d11cc98b793aa401b12
treee8e271fe566350c071dc5563bd3a819b7cf9ac7c
parent9dd09fd967497bc6eed1b86fe6a9965c6cda8bb4
netlink: policy: correct validation type check

In the policy export for binary attributes I erroneously used
a != NLA_VALIDATE_NONE comparison instead of checking for the
two possible values, which meant that if a validation function
pointer ended up aliasing the min/max as negatives, we'd hit
a warning in nla_get_range_unsigned().

Fix this to correctly check for only the two types that should
be handled here, i.e. range with or without warn-too-long.

Reported-by: syzbot+353df1490da781637624@syzkaller.appspotmail.com
Fixes: d732cd7cc2ff ("netlink: make NLA_BINARY validation more flexible")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netlink/policy.c