linux-stable/drivers/net
Saeed Mahameed 432e629e56 net/mlx4_en: Don't reuse RX page when XDP is set
When a new rx packet arrives, the rx path will decide whether to reuse
the remainder of the page or not according to one of the below conditions:
1. frag_info->frag_stride == PAGE_SIZE / 2
2. frags->page_offset + frag_info->frag_size > PAGE_SIZE;

The first condition is no met for when XDP is set.
For XDP, page_offset is always set to priv->rx_headroom which is
XDP_PACKET_HEADROOM and frag_info->frag_size is around mtu size + some
padding, still the 2nd release condition will hold since
XDP_PACKET_HEADROOM + 1536 < PAGE_SIZE, as a result the page will not
be released and will be _wrongly_ reused for next free rx descriptor.

In XDP there is an assumption to have a page per packet and reuse can
break such assumption and might cause packet data corruptions.

Fix this by adding an extra condition (!priv->rx_headroom) to the 2nd
case to avoid page reuse when XDP is set, since rx_headroom is set to 0
for non XDP setup and set to XDP_PACKET_HEADROOM for XDP setup.

No additional cache line is required for the new condition.

Fixes: 34db548bfb ("mlx4: add page recycling in receive path")
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Suggested-by: Martin KaFai Lau <kafai@fb.com>
CC: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-07-16 14:05:25 -07:00
..
appletalk
arcnet
bonding treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
caif
can treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
dsa treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
ethernet net/mlx4_en: Don't reuse RX page when XDP is set 2018-07-16 14:05:25 -07:00
fddi net: fddi: fix a possible null-ptr-deref 2018-06-08 18:47:46 -04:00
fjes
hamradio net: hamradio: use eth_broadcast_addr 2018-06-20 07:51:43 +09:00
hippi treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
hyperv hv/netvsc: fix handling of fallback to single queue mode 2018-07-16 14:01:10 -07:00
ieee802154 net: ieee802154: adf7242: Fix OCL calibration runs 2018-07-09 10:53:12 +02:00
ipvlan ipvlan: call dev_change_flags when ipvlan mode is reset 2018-07-02 20:38:09 +09:00
netdevsim netdevsim: Add extack error message for devlink reload 2018-06-05 12:32:37 -04:00
phy sfp: fix module initialisation with netdev already up 2018-07-11 23:11:34 -07:00
plip
ppp Revert changes to convert to ->poll_mask() and aio IOCB_CMD_POLL 2018-06-28 10:40:47 -07:00
slip treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
team treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
usb qmi_wwan: add support for Quectel EG91 2018-07-05 20:22:12 +09:00
vmxnet3 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-05-21 16:01:54 -04:00
wan treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
wimax
wireless wireless-drivers fixes for 4.18 2018-07-03 23:29:29 +09:00
xen-netback treewide: Use array_size() in vzalloc() 2018-06-12 16:19:22 -07:00
dummy.c
eql.c
geneve.c net: fix use-after-free in GRO with ESP 2018-07-02 20:34:04 +09:00
gtp.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
ifb.c ifb: fix packets checksum 2018-05-28 23:02:22 -04:00
Kconfig virtio_net: Extend virtio to use VF datapath when available 2018-05-28 22:59:54 -04:00
LICENSE.SRC
loopback.c
macsec.c
macvlan.c
macvtap.c
Makefile net: Introduce net_failover driver 2018-05-28 22:59:54 -04:00
mdio.c
mii.c
net_failover.c net: net_failover: fix typo in net_failover_slave_register() 2018-06-20 07:56:44 +09:00
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c net: in virtio_net_hdr only add VLAN_HLEN to csum_start if payload holds vlan 2018-06-07 16:15:38 -04:00
thunderbolt.c
tun.c tun: Fix use-after-free on XDP_TX 2018-07-16 13:38:29 -07:00
veth.c
virtio_net.c virtio_net: split XDP_TX kick and XDP_REDIRECT map flushing 2018-06-28 14:27:52 +09:00
vrf.c vrf: add CRC32c offload to device features 2018-05-28 22:55:13 -04:00
vsockmon.c
vxlan.c net: fix use-after-free in GRO with ESP 2018-07-02 20:34:04 +09:00
xen-netfront.c xen-netfront: Update features after registering netdev 2018-06-22 07:54:54 +09:00