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)
committerDavid S. Miller <davem@davemloft.net>
Tue, 30 Mar 2021 00:09:51 +0000 (17:09 -0700)
commit6e5a03bcba44e080a6bf300194a68ce9bb1e5184
tree06df0922268f3b72bcce956b16b6457f506c0d1c
parentca441a7129904a62fbc5692bb202e4694097bd45
ethernet/netronome/nfp: Fix a use after free in nfp_bpf_ctrl_msg_rx

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>
drivers/net/ethernet/netronome/nfp/bpf/cmsg.c