Netdev List
 help / color / mirror / Atom feed
* [PATCH] tools: ynl: handle calloc failure in ynl_ntf_parse
@ 2026-08-18 13:27 Triet Hoang
  2026-08-19  8:11 ` Hangbin Liu
  2026-08-20 20:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 4+ messages in thread
From: Triet Hoang @ 2026-08-18 13:27 UTC (permalink / raw)
  To: netdev; +Cc: donald.hunter, kuba, davem, edumazet, pabeni, horms, Triet Hoang

Check the return value of calloc() before dereferencing the allocated
response structure in ynl_ntf_parse().

Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>
---
 tools/net/ynl/lib/ynl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/net/ynl/lib/ynl.c b/tools/net/ynl/lib/ynl.c
index 2bcd781111d7..af101544c31a 100644
--- a/tools/net/ynl/lib/ynl.c
+++ b/tools/net/ynl/lib/ynl.c
@@ -889,6 +889,9 @@ static int ynl_ntf_parse(struct ynl_sock *ys, const struct nlmsghdr *nlh)
 		return YNL_PARSE_CB_ERROR;
 
 	rsp = calloc(1, info->alloc_sz);
+	if (!rsp)
+		return YNL_PARSE_CB_ERROR;
+
 	rsp->free = info->free;
 	yarg.data = rsp->data;
 	yarg.rsp_policy = info->policy;
-- 
2.53.0


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

* Re: [PATCH] tools: ynl: handle calloc failure in ynl_ntf_parse
  2026-08-18 13:27 [PATCH] tools: ynl: handle calloc failure in ynl_ntf_parse Triet Hoang
@ 2026-08-19  8:11 ` Hangbin Liu
  2026-08-20 17:33   ` Jakub Kicinski
  2026-08-20 20:40 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 4+ messages in thread
From: Hangbin Liu @ 2026-08-19  8:11 UTC (permalink / raw)
  To: Triet Hoang; +Cc: netdev, donald.hunter, kuba, davem, edumazet, pabeni, horms

Hi Triet,

I think your target tree is net-next, but it's close now. You can repost
the patch with the net-next tag after it's reopened.

https://netdev.bots.linux.dev/net-next.html

Thanks
Hangbin
On Tue, Aug 18, 2026 at 01:27:39PM +0000, Triet Hoang wrote:
> Check the return value of calloc() before dereferencing the allocated
> response structure in ynl_ntf_parse().
> 
> Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>
> ---
>  tools/net/ynl/lib/ynl.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/tools/net/ynl/lib/ynl.c b/tools/net/ynl/lib/ynl.c
> index 2bcd781111d7..af101544c31a 100644
> --- a/tools/net/ynl/lib/ynl.c
> +++ b/tools/net/ynl/lib/ynl.c
> @@ -889,6 +889,9 @@ static int ynl_ntf_parse(struct ynl_sock *ys, const struct nlmsghdr *nlh)
>  		return YNL_PARSE_CB_ERROR;
>  
>  	rsp = calloc(1, info->alloc_sz);
> +	if (!rsp)
> +		return YNL_PARSE_CB_ERROR;
> +
>  	rsp->free = info->free;
>  	yarg.data = rsp->data;
>  	yarg.rsp_policy = info->policy;
> -- 
> 2.53.0
> 

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

* Re: [PATCH] tools: ynl: handle calloc failure in ynl_ntf_parse
  2026-08-19  8:11 ` Hangbin Liu
@ 2026-08-20 17:33   ` Jakub Kicinski
  0 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2026-08-20 17:33 UTC (permalink / raw)
  To: Hangbin Liu
  Cc: Triet Hoang, netdev, donald.hunter, davem, edumazet, pabeni,
	horms

On Wed, 19 Aug 2026 16:11:31 +0800 Hangbin Liu wrote:
> I think your target tree is net-next, but it's close now. You can repost
> the patch with the net-next tag after it's reopened.

It's fine, please do not send process related feedback.

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

* Re: [PATCH] tools: ynl: handle calloc failure in ynl_ntf_parse
  2026-08-18 13:27 [PATCH] tools: ynl: handle calloc failure in ynl_ntf_parse Triet Hoang
  2026-08-19  8:11 ` Hangbin Liu
@ 2026-08-20 20:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-08-20 20:40 UTC (permalink / raw)
  To: Triet Hoang; +Cc: netdev, donald.hunter, kuba, davem, edumazet, pabeni, horms

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 18 Aug 2026 13:27:39 +0000 you wrote:
> Check the return value of calloc() before dereferencing the allocated
> response structure in ynl_ntf_parse().
> 
> Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>
> ---
>  tools/net/ynl/lib/ynl.c | 3 +++
>  1 file changed, 3 insertions(+)

Here is the summary with links:
  - tools: ynl: handle calloc failure in ynl_ntf_parse
    https://git.kernel.org/netdev/net/c/25b863cd6d12

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] 4+ messages in thread

end of thread, other threads:[~2026-08-20 20:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18 13:27 [PATCH] tools: ynl: handle calloc failure in ynl_ntf_parse Triet Hoang
2026-08-19  8:11 ` Hangbin Liu
2026-08-20 17:33   ` Jakub Kicinski
2026-08-20 20: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