bpf/verifier: fix min/max handling in BPF_SUB
authorEdward Cree <ecree@solarflare.com>
Fri, 21 Jul 2017 13:37:34 +0000 (14:37 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Aug 2017 08:26:28 +0000 (10:26 +0200)
commitc9c682f3f029d3220a05c8d69ef9a022a93974fc
tree05eda64f478faaf7fe2813dbcf790513d1143c9c
parenteb6cf01cd6b7630d51df66d8f5fa28ef250372bc
bpf/verifier: fix min/max handling in BPF_SUB

[ Upstream commit 9305706c2e808ae59f1eb201867f82f1ddf6d7a6 ]

We have to subtract the src max from the dst min, and vice-versa, since
 (e.g.) the smallest result comes from the largest subtrahend.

Fixes: 484611357c19 ("bpf: allow access into map value arrays")
Signed-off-by: Edward Cree <ecree@solarflare.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/bpf/verifier.c