From: Jay Vosburgh <jay.vosburgh@canonical.com>
To: Hangbin Liu <liuhangbin@gmail.com>
Cc: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Jonathan Toppins <jtoppins@redhat.com>,
Paolo Abeni <pabeni@redhat.com>, David Ahern <dsahern@gmail.com>,
Liang Li <liali@redhat.com>
Subject: Re: [PATCH net] bonding: fix ICMPv6 header handling when receiving IPv6 messages
Date: Tue, 01 Nov 2022 11:12:43 +0100 [thread overview]
Message-ID: <72467.1667297563@vermin> (raw)
In-Reply-To: <20221101091356.531160-1-liuhangbin@gmail.com>
Hangbin Liu <liuhangbin@gmail.com> wrote:
>Some drivers, like bnx2x, will call ipv6_gro_receive() and set skb
>IPv6 transport header before bond_handle_frame(). But some other drivers,
>like be2net, will not call ipv6_gro_receive() and skb transport header
>is not set properly. Thus we can't use icmp6_hdr(skb) to get the icmp6
>header directly when dealing with IPv6 messages.
I don't understand this explanation, as ipv6_gro_receive() isn't
called directly by the device drivers, but from within the GRO
processing, e.g., by dev_gro_receive().
Could you explain how the call paths actually differ?
-J
>Fix this by checking the skb length manually and getting icmp6 header based
>on the IPv6 header offset.
>
>Reported-by: Liang Li <liali@redhat.com>
>Fixes: 4e24be018eb9 ("bonding: add new parameter ns_targets")
>Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
>---
> drivers/net/bonding/bond_main.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index e84c49bf4d0c..08b5f512f5fb 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -3231,12 +3231,23 @@ static int bond_na_rcv(const struct sk_buff *skb, struct bonding *bond,
> struct slave *slave)
> {
> struct slave *curr_active_slave, *curr_arp_slave;
>- struct icmp6hdr *hdr = icmp6_hdr(skb);
>+ const struct icmp6hdr *icmp6_hdr;
> struct in6_addr *saddr, *daddr;
>+ const struct ipv6hdr *hdr;
>+ u16 pkt_len;
>+
>+ /* Check if the length is enough manually as we can't use pskb_may_pull */
>+ hdr = ipv6_hdr(skb);
>+ pkt_len = ntohs(hdr->payload_len);
>+ if (hdr->nexthdr != NEXTHDR_ICMP || pkt_len < sizeof(*icmp6_hdr) ||
>+ skb_headlen(skb) < sizeof(*hdr) + pkt_len)
>+ goto out;
>+
>+ icmp6_hdr = (const struct icmp6hdr *)(skb->data + sizeof(*hdr));
>
> if (skb->pkt_type == PACKET_OTHERHOST ||
> skb->pkt_type == PACKET_LOOPBACK ||
>- hdr->icmp6_type != NDISC_NEIGHBOUR_ADVERTISEMENT)
>+ icmp6_hdr->icmp6_type != NDISC_NEIGHBOUR_ADVERTISEMENT)
> goto out;
>
> saddr = &ipv6_hdr(skb)->saddr;
>--
>2.38.1
>
---
-Jay Vosburgh, jay.vosburgh@canonical.com
next prev parent reply other threads:[~2022-11-01 10:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-01 9:13 [PATCH net] bonding: fix ICMPv6 header handling when receiving IPv6 messages Hangbin Liu
2022-11-01 10:12 ` Jay Vosburgh [this message]
2022-11-01 13:39 ` Hangbin Liu
2022-11-01 14:17 ` Hangbin Liu
2022-11-03 16:03 ` Jay Vosburgh
2022-11-04 8:08 ` Hangbin Liu
2022-11-04 8:18 ` Jay Vosburgh
2022-11-04 11:50 ` Hangbin Liu
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=72467.1667297563@vermin \
--to=jay.vosburgh@canonical.com \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=jtoppins@redhat.com \
--cc=kuba@kernel.org \
--cc=liali@redhat.com \
--cc=liuhangbin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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;
as well as URLs for NNTP newsgroup(s).