OpenCloudOS-Kernel/drivers/net/xen-netback
Juergen Gross 6032046ec4 xen/netback: fix rx queue stall detection
Commit 1d5d485239 ("xen-netback: require fewer guest Rx slots when
not using GSO") introduced a security problem in netback, as an
interface would only be regarded to be stalled if no slot is available
in the rx queue ring page. In case the SKB at the head of the queued
requests will need more than one rx slot and only one slot is free the
stall detection logic will never trigger, as the test for that is only
looking for at least one slot to be free.

Fix that by testing for the needed number of slots instead of only one
slot being available.

In order to not have to take the rx queue lock that often, store the
number of needed slots in the queue data. As all SKB dequeue operations
happen in the rx queue kernel thread this is safe, as long as the
number of needed slots is accessed via READ/WRITE_ONCE() only and
updates are always done with the rx queue lock held.

Add a small helper for obtaining the number of free slots.

This is part of XSA-392

Fixes: 1d5d485239 ("xen-netback: require fewer guest Rx slots when not using GSO")
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2021-12-16 08:42:56 +01:00
..
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
common.h xen/netback: fix rx queue stall detection 2021-12-16 08:42:56 +01:00
hash.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
interface.c net: xen: use eth_hw_addr_set() 2021-10-22 10:15:54 -07:00
netback.c xen-netback: Remove redundant initialization of variable err 2021-10-15 11:02:36 +01:00
rx.c xen/netback: fix rx queue stall detection 2021-12-16 08:42:56 +01:00
xenbus.c xen-netback: Check for hotplug-status existence before watching 2021-04-13 15:24:14 -07:00