From: sashiko-bot@kernel.org
To: "Nilay Shroff" <nilay@linux.ibm.com>
Cc: linux-nvme@lists.infradead.org
Subject: Re: [PATCH v5 1/1] nvme-tcp: expose per-queue socket addresses via sysfs
Date: Tue, 01 Dec 2026 10:04:04 +0000 [thread overview]
Message-ID: <sashiko-outbox-243032@kernel.org> (raw)
In-Reply-To: <20261201095146.510810-4-nilay@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] nvme-tcp: address_show() emits %0 scope ID when one IPv6
endpoint is unscoped
--
commit cef888fe89d146daf5915c1274fff0343c037eb2
Author: Nilay Shroff <nilay@linux.ibm.com>
nvme-tcp: expose per-queue socket addresses via sysfs
This commit adds a read-only per-queue sysfs attribute named "address" to
expose the local and peer socket endpoint addresses for each NVMe/TCP I/O
queue, and documents it in Documentation/ABI/stable/sysfs-nvme.
> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
> index cf3c98b188bd1..05cf7000ef678 100644
> --- a/drivers/nvme/host/tcp.c
> +++ b/drivers/nvme/host/tcp.c
> @@ -2127,14 +2127,73 @@ static ssize_t managed_show(struct kobject *kobj, struct kobj_attribute *attr,
> !test_bit(NVME_TCP_Q_IO_CPU_USER, &queue->flags));
> }
>
> +static ssize_t address_show(struct kobject *kobj, struct kobj_attribute *attr,
> + char *buf)
> +{
> + struct nvme_tcp_queue *queue = nvme_queue_info_data(kobj);
> + struct sockaddr_storage src, dst;
> + int ret = 0;
> +
> + mutex_lock(&queue->queue_lock);
> +
> + if (!test_bit(NVME_TCP_Q_LIVE, &queue->flags))
> + goto out;
> +
> + ret = kernel_getsockname(queue->sock, (struct sockaddr *)&src);
> + if (ret <= 0)
> + goto out;
> +
> + ret = kernel_getpeername(queue->sock, (struct sockaddr *)&dst);
> + if (ret <= 0)
> + goto out;
> +
> + if (src.ss_family != dst.ss_family) {
> + ret = -EAFNOSUPPORT;
> + goto out;
> + }
> +
> + if (src.ss_family == AF_INET) {
> + struct sockaddr_in *sip = (struct sockaddr_in *)&src;
> + struct sockaddr_in *dip = (struct sockaddr_in *)&dst;
> +
> + ret = sysfs_emit(buf, "sip=%pI4,sport=%hu,dip=%pI4,dport=%hu\n",
> + &sip->sin_addr.s_addr, ntohs(sip->sin_port),
> + &dip->sin_addr.s_addr, ntohs(dip->sin_port));
> + } else if (src.ss_family == AF_INET6) {
> + struct sockaddr_in6 *sip6 = (struct sockaddr_in6 *)&src;
> + struct sockaddr_in6 *dip6 = (struct sockaddr_in6 *)&dst;
> +
> + if (sip6->sin6_scope_id || dip6->sin6_scope_id)
> + ret = sysfs_emit(buf, "sip=%pI6c%%%u,sport=%hu,dip=%pI6c%%%u,dport=%hu\n",
> + &sip6->sin6_addr, sip6->sin6_scope_id,
> + ntohs(sip6->sin6_port),
> + &dip6->sin6_addr, dip6->sin6_scope_id,
> + ntohs(dip6->sin6_port));
[Severity: Medium]
Does this emit a "%0" suffix on the unscoped endpoint when only one of
sip6->sin6_scope_id or dip6->sin6_scope_id is non-zero?
inet6_getname() sets sin6_scope_id via ipv6_iface_scope_id(), which only
returns sk->sk_bound_dev_if for addresses that need a scope ID (such as
link-local addresses) and returns 0 for global or unique-local addresses.
If one side of the connection uses a link-local address and the other uses
a global or unique-local address, formatting both with "%%%u" appends "%0"
to the unscoped address.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201095146.510810-3-nilay@linux.ibm.com?part=1
next prev parent reply other threads:[~2026-12-01 10:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 9:51 [PATCH v5 0/1] nvme-tcp: NIC topology aware I/O queue scaling and queue info export Nilay Shroff
2026-12-01 9:51 ` [PATCH v5 1/1] nvme-tcp: expose per-queue socket addresses via sysfs Nilay Shroff
2026-12-01 10:04 ` sashiko-bot [this message]
2026-12-02 6:37 ` Christoph Hellwig
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=sashiko-outbox-243032@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=nilay@linux.ibm.com \
--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 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.