mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net v3] nfp: bpf: Add check for nfp_app_ctrl_msg_alloc()
@ 2025-02-18  3:04 Haoxiang Li
  2025-02-18  3:39 ` Kalesh Anakkur Purayil
  2025-02-20  8:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Haoxiang Li @ 2025-02-18  3:04 UTC (permalink / raw)
  To: kuba, louis.peens, andrew+netdev, davem, edumazet, pabeni,
	haoxiang_li2024, qmo, daniel
  Cc: bpf, oss-drivers, netdev, linux-kernel, stable

Add check for the return value of nfp_app_ctrl_msg_alloc() in
nfp_bpf_cmsg_alloc() to prevent null pointer dereference.

Fixes: ff3d43f7568c ("nfp: bpf: implement helpers for FW map ops")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
Changes in v3:
- modify a spell error. Thanks, Kalesh!
Changes in v2:
- remove the bracket for one single-statement. Thanks, Guru!
---
 drivers/net/ethernet/netronome/nfp/bpf/cmsg.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c b/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c
index 2ec62c8d86e1..59486fe2ad18 100644
--- a/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c
+++ b/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c
@@ -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;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net v3] nfp: bpf: Add check for nfp_app_ctrl_msg_alloc()
  2025-02-18  3:04 [PATCH net v3] nfp: bpf: Add check for nfp_app_ctrl_msg_alloc() Haoxiang Li
@ 2025-02-18  3:39 ` Kalesh Anakkur Purayil
  2025-02-20  8:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Kalesh Anakkur Purayil @ 2025-02-18  3:39 UTC (permalink / raw)
  To: Haoxiang Li
  Cc: kuba, louis.peens, andrew+netdev, davem, edumazet, pabeni, qmo,
	daniel, bpf, oss-drivers, netdev, linux-kernel, stable

[-- Attachment #1: Type: text/plain, Size: 1382 bytes --]

On Tue, Feb 18, 2025 at 8:56 AM Haoxiang Li <haoxiang_li2024@163.com> wrote:
>
> Add check for the return value of nfp_app_ctrl_msg_alloc() in
> nfp_bpf_cmsg_alloc() to prevent null pointer dereference.
>
> Fixes: ff3d43f7568c ("nfp: bpf: implement helpers for FW map ops")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
> ---
> Changes in v3:
> - modify a spell error. Thanks, Kalesh!
> Changes in v2:
> - remove the bracket for one single-statement. Thanks, Guru!
> ---
>  drivers/net/ethernet/netronome/nfp/bpf/cmsg.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c b/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c
> index 2ec62c8d86e1..59486fe2ad18 100644
> --- a/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c
> +++ b/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c
> @@ -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;
> --
> 2.25.1
>
>
You should wait 24 hours before posting a new version of the patch.

https://docs.kernel.org/process/maintainer-netdev.html#resending-after-review

-- 
Regards,
Kalesh AP

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4239 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net v3] nfp: bpf: Add check for nfp_app_ctrl_msg_alloc()
  2025-02-18  3:04 [PATCH net v3] nfp: bpf: Add check for nfp_app_ctrl_msg_alloc() Haoxiang Li
  2025-02-18  3:39 ` Kalesh Anakkur Purayil
@ 2025-02-20  8:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-02-20  8:40 UTC (permalink / raw)
  To: Haoxiang Li
  Cc: kuba, louis.peens, andrew+netdev, davem, edumazet, pabeni, qmo,
	daniel, bpf, oss-drivers, netdev, linux-kernel, stable

Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Tue, 18 Feb 2025 11:04:09 +0800 you wrote:
> Add check for the return value of nfp_app_ctrl_msg_alloc() in
> nfp_bpf_cmsg_alloc() to prevent null pointer dereference.
> 
> Fixes: ff3d43f7568c ("nfp: bpf: implement helpers for FW map ops")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
> 
> [...]

Here is the summary with links:
  - [net,v3] nfp: bpf: Add check for nfp_app_ctrl_msg_alloc()
    https://git.kernel.org/netdev/net/c/878e7b11736e

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-02-20  8:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-18  3:04 [PATCH net v3] nfp: bpf: Add check for nfp_app_ctrl_msg_alloc() Haoxiang Li
2025-02-18  3:39 ` Kalesh Anakkur Purayil
2025-02-20  8:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®