linux/drivers/net
Dongli Zhang a1afd826e5 xen-netfront: do not use ~0U as error return value for xennet_fill_frags()
[ Upstream commit a761129e36 ]

xennet_fill_frags() uses ~0U as return value when the sk_buff is not able
to cache extra fragments. This is incorrect because the return type of
xennet_fill_frags() is RING_IDX and 0xffffffff is an expected value for
ring buffer index.

In the situation when the rsp_cons is approaching 0xffffffff, the return
value of xennet_fill_frags() may become 0xffffffff which xennet_poll() (the
caller) would regard as error. As a result, queue->rx.rsp_cons is set
incorrectly because it is updated only when there is error. If there is no
error, xennet_poll() would be responsible to update queue->rx.rsp_cons.
Finally, queue->rx.rsp_cons would point to the rx ring buffer entries whose
queue->rx_skbs[i] and queue->grant_rx_ref[i] are already cleared to NULL.
This leads to NULL pointer access in the next iteration to process rx ring
buffer entries.

The symptom is similar to the one fixed in
commit 00b368502d ("xen-netfront: do not assume sk_buff_head list is
empty in error handling").

This patch changes the return type of xennet_fill_frags() to indicate
whether it is successful or failed. The queue->rx.rsp_cons will be
always updated inside this function.

Fixes: ad4f15dc2c ("xen/netfront: don't bug in case of too many frags")
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-10-07 18:57:25 +02:00
..
appletalk net/appletalk: fix minor pointer leak to userspace in SIOCFINDIPDDPRT 2018-09-13 10:35:57 -07:00
arcnet arcnet: provide a buffer big enough to actually receive packets 2019-10-05 13:09:26 +02:00
bonding bonding: Force slave speed check after link state recovery for 802.3ad 2019-08-29 08:28:28 +02:00
caif caif-hsi: fix possible deadlock in cfhsi_exit_module() 2019-07-28 08:29:23 +02:00
can can: peak_usb: force the string buffer NULL-terminated 2019-08-29 08:28:38 +02:00
dsa net: dsa: rtl8366: Check VLAN ID and not ports 2019-10-07 18:57:23 +02:00
ethernet net: qlogic: Fix memory leak in ql_alloc_large_buffers 2019-10-07 18:57:22 +02:00
fddi net: fddi: fix a possible null-ptr-deref 2018-06-08 18:47:46 -04:00
fjes fjes: use currently unused variable my_epid and max_epid 2018-07-05 19:34:21 +09:00
hamradio net/hamradio/6pack: use mod_timer() to rearm timers 2019-01-09 17:38:32 +01:00
hippi treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
hyperv hv_netvsc: Fix a warning of suspicious RCU usage 2019-09-10 10:33:43 +01:00
ieee802154 ieee802154: hwsim: unregister hw while hwsim_subscribe_all_others fails 2019-09-21 07:16:47 +02:00
ipvlan net: ipvlan: Fix ipvlan device tso disabled while NETIF_F_IP_CSUM is set 2019-06-25 11:35:58 +08:00
netdevsim Merge ra.kernel.org:/pub/scm/linux/kernel/git/davem/net 2018-08-02 10:55:32 -07:00
phy net/phy: fix DP83865 10 Mbps HDX loopback disable function 2019-10-05 13:09:27 +02:00
plip
ppp ppp: Fix memory leak in ppp_write 2019-10-05 13:09:29 +02:00
slip slip: make slhc_free() silently accept an error pointer 2019-05-02 09:58:56 +02:00
team team: Add vlan tx offload to hw_enc_features 2019-08-25 10:48:04 +02:00
usb qmi_wwan: add support for Cinterion CLS8 devices 2019-10-07 18:57:22 +02:00
vmxnet3 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-05-21 16:01:54 -04:00
wan net/wan: fix a double free in x25_asy_open_tty() 2019-01-09 17:38:32 +01:00
wimax wimax/i2400m: fix a memory leak bug 2019-09-10 10:33:48 +01:00
wireless iwlwifi: fw: don't send GEO_TX_POWER_LIMIT command to FW version 36 2019-10-05 13:09:59 +02:00
xen-netback xen/netback: Reset nr_frags before freeing skb 2019-08-25 10:48:05 +02:00
dummy.c
eql.c
geneve.c geneve: correctly handle ipv6.disable module parameter 2019-03-10 07:17:17 +01:00
gtp.c gtp: fix use-after-free in gtp_newlink() 2019-07-26 09:14:17 +02:00
ifb.c ifb: fix packets checksum 2018-05-28 23:02:22 -04:00
Kconfig gtp: change NET_UDP_TUNNEL dependency to select 2019-04-03 06:26:15 +02:00
LICENSE.SRC
loopback.c net: loopback: clear skb->tstamp before netif_rx() 2018-11-13 11:08:20 -08:00
macsec.c macsec: drop skb sk before calling gro_cells_receive 2019-10-05 13:09:27 +02:00
macvlan.c macvlan: return correct error value 2018-12-21 14:15:20 +01:00
macvtap.c
Makefile net: Always descend into dsa/ 2019-05-25 18:23:19 +02:00
mdio.c
mii.c
net_failover.c failover: Add missing check to validate 'slave_dev' in net_failover_slave_unregister 2018-11-13 11:08:28 -08:00
netconsole.c
nlmon.c
ntb_netdev.c net: drivers/net: Convert random_ether_addr to eth_random_addr 2018-06-23 10:49:14 +09:00
rionet.c rapidio/rionet: do not free skb before reading its length 2018-12-05 19:31:59 +01:00
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 net: thunderbolt: Unregister ThunderboltIP protocol handler when suspending 2019-06-15 11:54:07 +02:00
tun.c tun: fix use-after-free when register netdev failed 2019-09-19 09:09:33 +02:00
veth.c veth: Orphan skb before GRO 2018-09-16 15:33:50 -07:00
virtio_net.c virtio_net: Account for tx bytes and packets on sending xdp_frames 2019-02-12 19:47:23 +01:00
vrf.c vrf: make sure skb->data contains ip header to make routing 2019-07-28 08:29:26 +02:00
vsockmon.c
vxlan.c vxlan: Don't call gro_cells_destroy() before device is unregistered 2019-04-03 06:26:18 +02:00
xen-netfront.c xen-netfront: do not use ~0U as error return value for xennet_fill_frags() 2019-10-07 18:57:25 +02:00