From: sashiko-bot@kernel.org
To: "Geliang Tang" <geliang@kernel.org>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH v3 3/4] nvmet-tcp: support IPv6 traffic class
Date: Sun, 16 Aug 2026 01:12:17 +0000 [thread overview]
Message-ID: <20260816011218.020481F000E9@smtp.kernel.org> (raw)
In-Reply-To: <7d09c3211dfa76d536c7a30505cea6da626ee5e6.1786841319.git.tanggeliang@kylinos.cn>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The nvmet_tcp_sock_set_tclass function attempts to configure the IPv6 Traffic Class by passing a 1-byte length to do_sock_setsockopt. However, do_ipv6_setsockopt rigidly requires the option length to be at least 4 bytes for IPV6_TCLASS. As a result, the operation fails with -EINVAL, which is silently ignored, and the traffic class is never applied.
--
--- Patch [3]: [PATCH v3 3/4] nvmet-tcp: support IPv6 traffic class ---
commit 97f9471c35e4e1cd4f5b7c6f1f3a6b3f8e13683a
Author: Geliang Tang <geliang@kernel.org>
nvmet-tcp: support IPv6 traffic class
Currently, nvmet-tcp only applies the received IPv4 TOS value when setting
up a queue socket, but does not handle the IPv6 traffic class. This patch
extends the queue socket setup to handle AF_INET6 sockets.
> diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
> index e64592b792577..d34249cf37564 100644
> --- a/drivers/nvme/target/tcp.c
> +++ b/drivers/nvme/target/tcp.c
> @@ -1735,6 +1735,20 @@ static void nvmet_tcp_sock_set_tos(struct sock *sk)
> KERNEL_SOCKPTR(&tos), sizeof(tos));
> }
>
> +static void nvmet_tcp_sock_set_tclass(struct sock *sk)
> +{
> +#if IS_ENABLED(CONFIG_IPV6)
> + if (sk->sk_family == AF_INET6) {
> + u8 tclass = ip6_tclass(inet6_sk(sk)->rcv_flowinfo);
> +
> + if (tclass > 0)
> + do_sock_setsockopt(sk->sk_socket, false, SOL_IPV6,
> + IPV6_TCLASS, KERNEL_SOCKPTR(&tclass),
> + sizeof(tclass));
[Severity: Medium]
Will this silently fail to set the traffic class?
Looking at do_ipv6_setsockopt() in net/ipv6/ipv6_sockglue.c, the IPV6_TCLASS
handler explicitly requires a minimum optlen of sizeof(int):
case IPV6_TCLASS:
if (optlen < sizeof(int))
goto e_inval;
Since tclass is a u8, sizeof(tclass) is 1. This causes the internal
setsockopt implementation to reject the option with -EINVAL, leaving the
traffic class unset.
Would it be better to store the traffic class in an int variable before
passing it to do_sock_setsockopt()?
> + }
> +#endif
> +}
> +
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1786841319.git.tanggeliang@kylinos.cn?part=3
next prev parent reply other threads:[~2026-08-16 1:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-16 0:59 [PATCH v3 0/4] nvme-tcp: add IPv6 traffic class support Geliang Tang
2026-08-16 0:59 ` [PATCH v3 1/4] nvmet-tcp: unify sockopt with do_sock_setsockopt Geliang Tang
2026-08-16 0:59 ` [PATCH v3 2/4] nvme-tcp: " Geliang Tang
2026-08-16 1:16 ` sashiko-bot
2026-08-16 0:59 ` [PATCH v3 3/4] nvmet-tcp: support IPv6 traffic class Geliang Tang
2026-08-16 1:12 ` sashiko-bot [this message]
2026-08-16 1:00 ` [PATCH v3 4/4] nvme-tcp: " Geliang Tang
2026-08-16 1:09 ` sashiko-bot
2026-08-16 2:13 ` [PATCH v3 0/4] nvme-tcp: add IPv6 traffic class support MPTCP CI
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=20260816011218.020481F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=geliang@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
/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