* [PATCH net-next] netdev: check for nla_put_u32() failures
@ 2026-08-09 0:06 Jakub Kicinski
2026-08-09 21:09 ` Daniel Borkmann
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Jakub Kicinski @ 2026-08-09 0:06 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, Jakub Kicinski,
daniel, bobbyeshleman, joe, razor, sdf, dw
Make sure we check if nla_put_u32(id) was successful after creating
objects. This is theoretical today, the skbs are large enough to
always fit the ID.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
v2:
- don't handle, just WARN
v1: https://lore.kernel.org/20260609190804.1137085-2-kuba@kernel.org
CC: daniel@iogearbox.net
CC: bobbyeshleman@gmail.com
CC: joe@dama.to
CC: razor@blackwall.org
CC: sdf@fomichev.me
CC: dw@davidwei.uk
---
net/core/netdev-genl.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c
index c0a86f3ae33b..fa9edfdb32c2 100644
--- a/net/core/netdev-genl.c
+++ b/net/core/netdev-genl.c
@@ -1119,7 +1119,9 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info)
goto err_unbind;
}
- nla_put_u32(rsp, NETDEV_A_DMABUF_ID, binding->id);
+ /* rsp was allocated large enough */
+ WARN_ON_ONCE(nla_put_u32(rsp, NETDEV_A_DMABUF_ID, binding->id));
+
genlmsg_end(rsp, hdr);
err = genlmsg_reply(rsp, info);
@@ -1253,7 +1255,9 @@ int netdev_nl_bind_tx_doit(struct sk_buff *skb, struct genl_info *info)
goto err_unlock_bind_dev;
}
- nla_put_u32(rsp, NETDEV_A_DMABUF_ID, binding->id);
+ /* rsp was allocated large enough */
+ WARN_ON_ONCE(nla_put_u32(rsp, NETDEV_A_DMABUF_ID, binding->id));
+
genlmsg_end(rsp, hdr);
if (bind_dev != netdev)
@@ -1420,7 +1424,9 @@ int netdev_nl_queue_create_doit(struct sk_buff *skb, struct genl_info *info)
netdev_rx_queue_lease(rxq, rxq_lease);
- nla_put_u32(rsp, NETDEV_A_QUEUE_ID, queue_id);
+ /* rsp was allocated large enough */
+ WARN_ON_ONCE(nla_put_u32(rsp, NETDEV_A_QUEUE_ID, queue_id));
+
genlmsg_end(rsp, hdr);
netdev_unlock(dev_lease);
--
2.55.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] netdev: check for nla_put_u32() failures
2026-08-09 0:06 [PATCH net-next] netdev: check for nla_put_u32() failures Jakub Kicinski
@ 2026-08-09 21:09 ` Daniel Borkmann
2026-08-10 6:31 ` Nikolay Aleksandrov
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Daniel Borkmann @ 2026-08-09 21:09 UTC (permalink / raw)
To: Jakub Kicinski, davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, bobbyeshleman,
joe, razor, sdf, dw
On 8/9/26 2:06 AM, Jakub Kicinski wrote:
> Make sure we check if nla_put_u32(id) was successful after creating
> objects. This is theoretical today, the skbs are large enough to
> always fit the ID.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] netdev: check for nla_put_u32() failures
2026-08-09 0:06 [PATCH net-next] netdev: check for nla_put_u32() failures Jakub Kicinski
2026-08-09 21:09 ` Daniel Borkmann
@ 2026-08-10 6:31 ` Nikolay Aleksandrov
2026-08-10 20:39 ` Joe Damato
2026-08-10 23:50 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Nikolay Aleksandrov @ 2026-08-10 6:31 UTC (permalink / raw)
To: Jakub Kicinski, davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, daniel,
bobbyeshleman, joe, sdf, dw
On 09/08/2026 03:06, Jakub Kicinski wrote:
> Make sure we check if nla_put_u32(id) was successful after creating
> objects. This is theoretical today, the skbs are large enough to
> always fit the ID.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> v2:
> - don't handle, just WARN
> v1: https://lore.kernel.org/20260609190804.1137085-2-kuba@kernel.org
>
> CC: daniel@iogearbox.net
> CC: bobbyeshleman@gmail.com
> CC: joe@dama.to
> CC: razor@blackwall.org
> CC: sdf@fomichev.me
> CC: dw@davidwei.uk
> ---
> net/core/netdev-genl.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c
> index c0a86f3ae33b..fa9edfdb32c2 100644
> --- a/net/core/netdev-genl.c
> +++ b/net/core/netdev-genl.c
> @@ -1119,7 +1119,9 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info)
> goto err_unbind;
> }
>
> - nla_put_u32(rsp, NETDEV_A_DMABUF_ID, binding->id);
> + /* rsp was allocated large enough */
> + WARN_ON_ONCE(nla_put_u32(rsp, NETDEV_A_DMABUF_ID, binding->id));
> +
> genlmsg_end(rsp, hdr);
>
> err = genlmsg_reply(rsp, info);
> @@ -1253,7 +1255,9 @@ int netdev_nl_bind_tx_doit(struct sk_buff *skb, struct genl_info *info)
> goto err_unlock_bind_dev;
> }
>
> - nla_put_u32(rsp, NETDEV_A_DMABUF_ID, binding->id);
> + /* rsp was allocated large enough */
> + WARN_ON_ONCE(nla_put_u32(rsp, NETDEV_A_DMABUF_ID, binding->id));
> +
> genlmsg_end(rsp, hdr);
>
> if (bind_dev != netdev)
> @@ -1420,7 +1424,9 @@ int netdev_nl_queue_create_doit(struct sk_buff *skb, struct genl_info *info)
>
> netdev_rx_queue_lease(rxq, rxq_lease);
>
> - nla_put_u32(rsp, NETDEV_A_QUEUE_ID, queue_id);
> + /* rsp was allocated large enough */
> + WARN_ON_ONCE(nla_put_u32(rsp, NETDEV_A_QUEUE_ID, queue_id));
> +
> genlmsg_end(rsp, hdr);
>
> netdev_unlock(dev_lease);
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] netdev: check for nla_put_u32() failures
2026-08-09 0:06 [PATCH net-next] netdev: check for nla_put_u32() failures Jakub Kicinski
2026-08-09 21:09 ` Daniel Borkmann
2026-08-10 6:31 ` Nikolay Aleksandrov
@ 2026-08-10 20:39 ` Joe Damato
2026-08-10 23:50 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Joe Damato @ 2026-08-10 20:39 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, daniel,
bobbyeshleman, razor, sdf, dw
On Sat, Aug 08, 2026 at 05:06:09PM -0700, Jakub Kicinski wrote:
> Make sure we check if nla_put_u32(id) was successful after creating
> objects. This is theoretical today, the skbs are large enough to
> always fit the ID.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> v2:
> - don't handle, just WARN
> v1: https://lore.kernel.org/20260609190804.1137085-2-kuba@kernel.org
>
> CC: daniel@iogearbox.net
> CC: bobbyeshleman@gmail.com
> CC: joe@dama.to
> CC: razor@blackwall.org
> CC: sdf@fomichev.me
> CC: dw@davidwei.uk
> ---
> net/core/netdev-genl.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
Reviewed-by: Joe Damato <joe@dama.to>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] netdev: check for nla_put_u32() failures
2026-08-09 0:06 [PATCH net-next] netdev: check for nla_put_u32() failures Jakub Kicinski
` (2 preceding siblings ...)
2026-08-10 20:39 ` Joe Damato
@ 2026-08-10 23:50 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-08-10 23:50 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, daniel,
bobbyeshleman, joe, razor, sdf, dw
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Sat, 8 Aug 2026 17:06:09 -0700 you wrote:
> Make sure we check if nla_put_u32(id) was successful after creating
> objects. This is theoretical today, the skbs are large enough to
> always fit the ID.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> v2:
> - don't handle, just WARN
> v1: https://lore.kernel.org/20260609190804.1137085-2-kuba@kernel.org
>
> [...]
Here is the summary with links:
- [net-next] netdev: check for nla_put_u32() failures
https://git.kernel.org/netdev/net-next/c/ae2998ab62e4
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] 5+ messages in thread
end of thread, other threads:[~2026-08-10 23:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-09 0:06 [PATCH net-next] netdev: check for nla_put_u32() failures Jakub Kicinski
2026-08-09 21:09 ` Daniel Borkmann
2026-08-10 6:31 ` Nikolay Aleksandrov
2026-08-10 20:39 ` Joe Damato
2026-08-10 23:50 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.