From: Jakub Kicinski <kuba@kernel.org>
To: edumazet@google.com
Cc: Jakub Kicinski <kuba@kernel.org>,
davem@davemloft.net, pabeni@redhat.com, horms@kernel.org,
dsahern@kernel.org, netdev@vger.kernel.org,
eric.dumazet@gmail.com, yimingqian591@gmail.com,
justin.iurman@gmail.com
Subject: Re: [PATCH net] ipv6: ioam: fix potential NULL dereferences in __ioam6_fill_trace_data()
Date: Fri, 3 Apr 2026 14:44:19 -0700 [thread overview]
Message-ID: <20260403214418.2233266-2-kuba@kernel.org> (raw)
In-Reply-To: <20260402101732.1188059-1-edumazet@google.com>
This is an AI-generated review of your patch. The human sending this
email says "more bugs to fix.."
---
ipv6: ioam: fix potential NULL dereferences in __ioam6_fill_trace_data()
This commit fixes potential NULL pointer dereferences in
__ioam6_fill_trace_data() by checking __in6_dev_get() and using
skb_dst_dev_rcu(). It also adds missing READ_ONCE() annotations.
> diff --git a/net/ipv6/ioam6.c b/net/ipv6/ioam6.c
> index 3978773bec42..05a0b7d7e2aa 100644
> --- a/net/ipv6/ioam6.c
> +++ b/net/ipv6/ioam6.c
> @@ -710,7 +710,9 @@ static void __ioam6_fill_trace_data(struct sk_buff *skb,
> struct ioam6_schema *sc,
> unsigned int sclen, bool is_input)
> {
> - struct net_device *dev = skb_dst_dev(skb);
> + /* Note: skb_dst_dev_rcu() can't be NULL at this point. */
> + struct net_device *dev = skb_dst_dev_rcu(skb);
Could this code lead to an out-of-bounds access of the dev->_tx[] array
further down in this function?
While reviewing this patch, a pre-existing regression was noticed when
trace->type.bit6 is set:
if (trace->type.bit6) {
...
queue = skb_get_tx_queue(dev, skb);
qdisc = rcu_dereference(queue->qdisc);
When is_input is true, the packet is on the RX path and skb->queue_mapping
contains the RX queue index of the ingress device.
If the ingress device has more RX queues than the egress device (dev) has
TX queues, skb_get_queue_mapping(skb) will exceed dev->num_tx_queues.
Since skb_get_tx_queue() does not clamp the index, will it return an
out-of-bounds pointer into the egress device's dev->_tx array, causing
dereferencing queue->qdisc to read invalid memory?
next prev parent reply other threads:[~2026-04-03 21:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 10:17 [PATCH net] ipv6: ioam: fix potential NULL dereferences in __ioam6_fill_trace_data() Eric Dumazet
2026-04-02 18:10 ` Justin Iurman
2026-04-03 21:44 ` Jakub Kicinski [this message]
2026-04-03 21:47 ` Eric Dumazet
2026-04-03 21:50 ` Jakub Kicinski
2026-04-03 21:51 ` Eric Dumazet
2026-04-04 10:13 ` Justin Iurman
2026-04-04 11:44 ` Eric Dumazet
2026-04-04 17:32 ` Justin Iurman
2026-04-03 22:00 ` patchwork-bot+netdevbpf
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=20260403214418.2233266-2-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=horms@kernel.org \
--cc=justin.iurman@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=yimingqian591@gmail.com \
/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