]> 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)
commitcd9b978ca7b4d5db8e23f39c11b4eb73a5a4110d
treee8e271fe566350c071dc5563bd3a819b7cf9ac7c
parent315063644af93292f09e3f224828563af1091019
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: e276e081bae9 ("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