ethernet/netronome/nfp: Fix a use after free in nfp_bpf_ctrl_msg_rx
authorLv Yunlong <lyl2019@mail.ustc.edu.cn>
Mon, 29 Mar 2021 11:50:02 +0000 (04:50 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Apr 2021 06:42:00 +0000 (08:42 +0200)
commitb52e88638f7105ca6921eff9970a5ad261b1a1bf
treeae782d8837881f73b99f70bd3a2e546149076ee6
parentd86046a77535a25654e9f4efc92adc2694298e5e
ethernet/netronome/nfp: Fix a use after free in nfp_bpf_ctrl_msg_rx

commit 6e5a03bcba44e080a6bf300194a68ce9bb1e5184 upstream.

In nfp_bpf_ctrl_msg_rx, if
nfp_ccm_get_type(skb) == NFP_CCM_TYPE_BPF_BPF_EVENT is true, the skb
will be freed. But the skb is still used by nfp_ccm_rx(&bpf->ccm, skb).

My patch adds a return when the skb was freed.

Fixes: bcf0cafab44fd ("nfp: split out common control message handling code")
Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/netronome/nfp/bpf/cmsg.c