Skip to content

Commit

Permalink
ethernet/netronome/nfp: Fix a use after free in nfp_bpf_ctrl_msg_rx
Browse files Browse the repository at this point in the history
commit 6e5a03b 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: bcf0caf ("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>
  • Loading branch information
Yunlongs authored and gregkh committed Apr 14, 2021
1 parent d86046a commit b52e886
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/ethernet/netronome/nfp/bpf/cmsg.c
Expand Up @@ -454,6 +454,7 @@ void nfp_bpf_ctrl_msg_rx(struct nfp_app *app, struct sk_buff *skb)
dev_consume_skb_any(skb);
else
dev_kfree_skb_any(skb);
return;
}

nfp_ccm_rx(&bpf->ccm, skb);
Expand Down

0 comments on commit b52e886

Please sign in to comment.