]> git.itanic.dy.fi Git - linux-stable/commit
netfilter: nftables_offload: KASAN slab-out-of-bounds Read in nft_flow_rule_create
authorSaeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com>
Tue, 20 Oct 2020 11:41:36 +0000 (13:41 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 1 Nov 2020 11:45:34 +0000 (12:45 +0100)
commit6e1f770fbc0aea308be1d5b6f3dffee89d0717ce
tree78a322d34831d97152e421ded0431cee845cb670
parent33156ccb29d933783595deaab64b13ec5303a22a
netfilter: nftables_offload: KASAN slab-out-of-bounds Read in nft_flow_rule_create

commit 31cc578ae2de19c748af06d859019dced68e325d upstream.

This patch fixes the issue due to:

BUG: KASAN: slab-out-of-bounds in nft_flow_rule_create+0x622/0x6a2
net/netfilter/nf_tables_offload.c:40
Read of size 8 at addr ffff888103910b58 by task syz-executor227/16244

The error happens when expr->ops is accessed early on before performing the boundary check and after nft_expr_next() moves the expr to go out-of-bounds.

This patch checks the boundary condition before expr->ops that fixes the slab-out-of-bounds Read issue.

Add nft_expr_more() and use it to fix this problem.

Signed-off-by: Saeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/net/netfilter/nf_tables.h
net/netfilter/nf_tables_api.c
net/netfilter/nf_tables_offload.c