From: Stéphane Veyret Date: Wed, 19 Jun 2019 07:03:14 +0000 (+0200) Subject: netfilter: nft_ct: fix null pointer in ct expectations support X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=2f0513d487d2619c751fd08f5b7c64e759435ff4;p=openwrt%2Fstaging%2Fblogic.git netfilter: nft_ct: fix null pointer in ct expectations support nf_ct_helper_ext_add may return null, which must then be checked. Fixes: 857b46027d6f ("netfilter: nft_ct: add ct expectations support") Reported-by: Colin Ian King Signed-off-by: Stéphane Veyret Signed-off-by: Pablo Neira Ayuso --- diff --git a/net/netfilter/nft_ct.c b/net/netfilter/nft_ct.c index 06b52c894573..77dab1bdb3ca 100644 --- a/net/netfilter/nft_ct.c +++ b/net/netfilter/nft_ct.c @@ -1232,6 +1232,10 @@ static void nft_ct_expect_obj_eval(struct nft_object *obj, help = nfct_help(ct); if (!help) help = nf_ct_helper_ext_add(ct, GFP_ATOMIC); + if (!help) { + regs->verdict.code = NF_DROP; + return; + } if (help->expecting[NF_CT_EXPECT_CLASS_DEFAULT] >= priv->size) { regs->verdict.code = NFT_BREAK;