From: Ilya Maximets <i.maximets@ovn.org>
To: Fernando Fernandez Mancera <fmancera@suse.de>, netdev@vger.kernel.org
Cc: dev@openvswitch.org, aatteka@nicira.com, jesse@nicira.com,
horms@kernel.org, pabeni@redhat.com, kuba@kernel.org,
edumazet@kernel.org, davem@davemloft.net, i.maximets@ovn.org,
echaudro@redhat.com, aconole@redhat.com,
syzbot+4cc63fcfb3845e149969@syzkaller.appspotmail.com
Subject: Re: [PATCH net] net: openvswitch: validate transport header presence in set_ipv6_addr
Date: Thu, 1 Oct 2026 13:15:21 +0200 [thread overview]
Message-ID: <50b0db80-7d42-44fc-81eb-d0fed8047871@ovn.org> (raw)
In-Reply-To: <20261001085205.3822-1-fmancera@suse.de>
On 10/1/26 10:52 AM, Fernando Fernandez Mancera wrote:
> When executing IPv6 address rewrite actions on IPv6 fragments,
> set_ipv6_addr() might attempt to recalculate the L4 header checksum
> calling skb_transport_header() with an uninitialized transport header.
> This can potentially lead to a OOB write.
Not really. later fragments have l4_proto set to NEXTHDR_FRAGMENT
and so no writes will be performed. See parse_ipv6hdr().
> A warning is triggered with DEBUG_NET=y.
Yeah, while the value is not actually used to access the packet data,
the skbuff core generates a warning on read.
>
> Fix this by recalculating the checksum only if there is a valid
> transport header in the skb. Otherwise, assume this is a fragment and
> skip it.
>
> See the syzbot trace:
>
> !skb_transport_header_was_set(skb)
> WARNING: ./include/linux/skbuff.h:3075 at skb_transport_header include/linux/skbuff.h:3075 [inline], CPU#1: syz-executor463/5635
> WARNING: ./include/linux/skbuff.h:3075 at skb_transport_offset include/linux/skbuff.h:3250 [inline], CPU#1: syz-executor463/5635
> WARNING: ./include/linux/skbuff.h:3075 at update_ipv6_checksum net/openvswitch/actions.c:361 [inline], CPU#1: syz-executor463/5635
> WARNING: ./include/linux/skbuff.h:3075 at set_ipv6_addr+0x462/0x660 net/openvswitch/actions.c:399, CPU#1: syz-executor463/5635
> [...]
> RIP: 0010:skb_transport_header include/linux/skbuff.h:3075 [inline]
> RIP: 0010:skb_transport_offset include/linux/skbuff.h:3250 [inline]
> RIP: 0010:update_ipv6_checksum net/openvswitch/actions.c:361 [inline]
> RIP: 0010:set_ipv6_addr+0x462/0x660 net/openvswitch/actions.c:399
> [...]
> Call Trace:
> <TASK>
> set_ipv6 net/openvswitch/actions.c:531 [inline]
> do_execute_actions+0x557e/0x8600 net/openvswitch/actions.c:1366
> ovs_execute_actions+0xde/0x520 net/openvswitch/actions.c:1592
> ovs_packet_cmd_execute+0xb4f/0xf10 net/openvswitch/datapath.c:705
> genl_family_rcv_msg_doit+0x233/0x340 net/netlink/genetlink.c:1114
> genl_rcv_msg+0x614/0x7a0 net/netlink/genetlink.c:1209
> netlink_rcv_skb+0x226/0x4a0 net/netlink/af_netlink.c:2572
> genl_rcv+0x28/0x40 net/netlink/genetlink.c:1218
> netlink_unicast+0x7bd/0x940 net/netlink/af_netlink.c:1361
> netlink_sendmsg+0x813/0xb40 net/netlink/af_netlink.c:1916
> sock_sendmsg_nosec+0x14e/0x190 net/socket.c:800
>
> Reported-by: syzbot+4cc63fcfb3845e149969@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=4cc63fcfb3845e149969
> Fixes: 3fdbd1ce11e5 ("openvswitch: add ipv6 'set' action")
> Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
> ---
> net/openvswitch/actions.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
> index dc5ff859f114..a14668565ec4 100644
> --- a/net/openvswitch/actions.c
> +++ b/net/openvswitch/actions.c
> @@ -395,7 +395,7 @@ static void set_ipv6_addr(struct sk_buff *skb, u8 l4_proto,
> __be32 addr[4], const __be32 new_addr[4],
> bool recalculate_csum)
> {
> - if (recalculate_csum)
> + if (recalculate_csum && skb_transport_header_was_set(skb))
> update_ipv6_checksum(skb, l4_proto, addr, new_addr);
I'd suggest moving the check into update_ipv6_checksum() and maybe add
a small comment that the check is only to avoid warning on reading the
offset that wasn't set, offset must always be set for any l4_proto for
which the checksum is actually getting updated.
Best regards, Ilya Maximets.
next prev parent reply other threads:[~2026-10-01 11:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 8:52 [PATCH net] net: openvswitch: validate transport header presence in set_ipv6_addr Fernando Fernandez Mancera
2026-10-01 11:15 ` Ilya Maximets [this message]
2026-10-01 11:20 ` Fernando Fernandez Mancera
2026-10-01 12:00 ` [ovs-dev] " Ilya Maximets
2026-10-01 13:29 ` Fernando Fernandez Mancera
2026-10-01 22:10 ` Ilya Maximets
2026-10-02 6:34 ` 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=50b0db80-7d42-44fc-81eb-d0fed8047871@ovn.org \
--to=i.maximets@ovn.org \
--cc=aatteka@nicira.com \
--cc=aconole@redhat.com \
--cc=davem@davemloft.net \
--cc=dev@openvswitch.org \
--cc=echaudro@redhat.com \
--cc=edumazet@kernel.org \
--cc=fmancera@suse.de \
--cc=horms@kernel.org \
--cc=jesse@nicira.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=syzbot+4cc63fcfb3845e149969@syzkaller.appspotmail.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