From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH libnftnl 2/2] tunnel: validate geneve class and type from setter
Date: Thu, 19 Mar 2026 12:44:41 +0100 [thread overview]
Message-ID: <20260319114441.205740-2-pablo@netfilter.org> (raw)
In-Reply-To: <20260319114441.205740-1-pablo@netfilter.org>
From: Pengpeng Hou <pengpeng@iscas.ac.cn>
Ensure size is correct, otherwise bail out with EINVAL.
Fixes: 239fbdb8979d ("tunnel: add support to geneve options")
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
src/obj/tunnel.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/obj/tunnel.c b/src/obj/tunnel.c
index 08adeb50b107..4b302f66ecc5 100644
--- a/src/obj/tunnel.c
+++ b/src/obj/tunnel.c
@@ -866,9 +866,17 @@ static int nftnl_tunnel_opt_geneve_set(struct nftnl_tunnel_opt *opt, uint16_t ty
{
switch(type) {
case NFTNL_TUNNEL_GENEVE_CLASS:
+ if (data_len != sizeof(uint16_t)) {
+ errno = EINVAL;
+ return -1;
+ }
memcpy(&opt->geneve.geneve_class, data, data_len);
break;
case NFTNL_TUNNEL_GENEVE_TYPE:
+ if (data_len != sizeof(uint8_t)) {
+ errno = EINVAL;
+ return -1;
+ }
memcpy(&opt->geneve.type, data, data_len);
break;
case NFTNL_TUNNEL_GENEVE_DATA:
--
2.47.3
next prev parent reply other threads:[~2026-03-19 11:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 11:44 [PATCH libnftnl 1/2] tunnel: check kernel does not provide too large geneve data Pablo Neira Ayuso
2026-03-19 11:44 ` Pablo Neira Ayuso [this message]
2026-03-19 11:59 ` [PATCH libnftnl 2/2] tunnel: validate geneve class and type from setter Fernando Fernandez Mancera
2026-03-19 11:57 ` [PATCH libnftnl 1/2] tunnel: check kernel does not provide too large geneve data Fernando Fernandez Mancera
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260319114441.205740-2-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox