summaryrefslogtreecommitdiffstats
path: root/net/lapb/lapb_timer.c
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2014-04-05 01:04:03 +0200
committerDavid S. Miller <davem@davemloft.net>2014-04-07 18:54:39 +0200
commit5f9fde5f799df7156eeb3fa58282e9fd2f38a5f8 (patch)
tree26556f3c6534b9f725615d7db4a3772338add528 /net/lapb/lapb_timer.c
parentMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf (diff)
downloadlinux-5f9fde5f799df7156eeb3fa58282e9fd2f38a5f8.tar.xz
linux-5f9fde5f799df7156eeb3fa58282e9fd2f38a5f8.zip
net: filter: be more defensive on div/mod by X==0
The old interpreter behaviour was that we returned with 0 whenever we found a division by 0 would take place. In the new interpreter we would currently just skip that instead and continue execution. It's true that a value of 0 as return might not be appropriate in all cases, but current users (socket filters -> drop packet, seccomp -> SECCOMP_RET_KILL, cls_bpf -> unclassified, etc) seem fine with that behaviour. Better this than undefined BPF program behaviour as it's expected that A contains the result of the division. In future, as more use cases open up, we could further adapt this return value to our needs, if necessary. So reintroduce return of 0 for division by 0 as in the old interpreter. Also in case of K which is guaranteed to be 32bit wide, sk_chk_filter() already takes care of preventing division by 0 invoked through K, so we can generally spare us these tests. Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Reviewed-by: Alexei Starovoitov <ast@plumgrid.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/lapb/lapb_timer.c')
0 files changed, 0 insertions, 0 deletions