[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF=yD-J-E8vWgDYPJCpG45DYi81-nFTz-EOcWZwH-tLpS2o3rw@mail.gmail.com>
Date: Sat, 25 Nov 2017 16:15:01 -0500
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: "Gustavo A. R. Silva" <garsilva@...eddedor.com>
Cc: Pravin Shelar <pshelar@...ira.com>,
"David S. Miller" <davem@...emloft.net>,
Willem de Bruijn <willemb@...gle.com>,
Network Development <netdev@...r.kernel.org>,
dev@...nvswitch.org, LKML <linux-kernel@...r.kernel.org>,
steffen.klassert@...unet.com
Subject: Re: [PATCH] net: openvswitch: datapath: fix data type in queue_gso_packets
On Sat, Nov 25, 2017 at 2:14 PM, Gustavo A. R. Silva
<garsilva@...eddedor.com> wrote:
> gso_type is being used in binary AND operations together with SKB_GSO_UDP.
> The issue is that variable gso_type is of type unsigned short and
> SKB_GSO_UDP expands to more than 16 bits:
>
> SKB_GSO_UDP = 1 << 16
>
> this makes any binary AND operation between gso_type and SKB_GSO_UDP to
> be always zero, hence making some code unreachable and likely causing
> undesired behavior.
>
> Fix this by changing the data type of variable gso_type to unsigned int.
>
> Addresses-Coverity-ID: 1462223
> Fixes: 0c19f846d582 ("net: accept UFO datagrams from tuntap and packet")
> Signed-off-by: Gustavo A. R. Silva <garsilva@...eddedor.com>
Acked-by: Willem de Bruijn <willemb@...gle.com>
Good catch, thanks!
The issue here is that I brought back SKB_GSO_UDP at the end of the
list at 1 << 16 to avoid renaming of all that used to follow, while it used
to be defined as 1 << 1.
The skb_shinfo(skb)->gso_type field itself has been expanded as of v4.12
in commit 7f564528a480 ("skbuff: Extend gso_type to unsigned int.").
A quick scan shows a few nic drivers that also still cast to unsigned
short: bnxt, atl1c and qede. Since UFO hardware offload no longer
exists, this is safe wrt this patch. And it is fine for older kernels as
no driver supported the previous entry at 1 << 16, SKB_GSO_ESP.
But it is fragile wrt follow-on offloads. Probably a net-next patch.
The only other likely issue I spotted with the longer gso_type is
in trace events. net_dev_start_xmit and net_dev_rx_verbose_template
both export as u16.
Powered by blists - more mailing lists