Skip to content

Commit

Permalink
nfp: bpf: Add check for nfp_app_ctrl_msg_alloc()
Browse files Browse the repository at this point in the history
Add check for the return value of nfp_app_ctrl_msg_alloc() in
nfp_bpf_cmsg_alloc() to prevent null pointer dereference.

Fixes: ff3d43f ("nfp: bpf: implement helpers for FW map ops")
Cc: [email protected]
Signed-off-by: Haoxiang Li <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
  • Loading branch information
Haoxiang Li authored and Paolo Abeni committed Feb 20, 2025
1 parent 9b6412e commit 878e7b1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/net/ethernet/netronome/nfp/bpf/cmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ nfp_bpf_cmsg_alloc(struct nfp_app_bpf *bpf, unsigned int size)
struct sk_buff *skb;

skb = nfp_app_ctrl_msg_alloc(bpf->app, size, GFP_KERNEL);
if (!skb)
return NULL;
skb_put(skb, size);

return skb;
Expand Down

0 comments on commit 878e7b1

Please sign in to comment.