linux-stable/drivers
Jiangfeng Xiao e32473a7f7 net: hisilicon: Fix a BUG trigered by wrong bytes_compl
[ Upstream commit 90b3b33936 ]

When doing stress test, we get the following trace:
kernel BUG at lib/dynamic_queue_limits.c:26!
Internal error: Oops - BUG: 0 [#1] SMP ARM
Modules linked in: hip04_eth
CPU: 0 PID: 2003 Comm: tDblStackPcap0 Tainted: G           O L  4.4.197 #1
Hardware name: Hisilicon A15
task: c3637668 task.stack: de3bc000
PC is at dql_completed+0x18/0x154
LR is at hip04_tx_reclaim+0x110/0x174 [hip04_eth]
pc : [<c041abfc>]    lr : [<bf0003a8>]    psr: 800f0313
sp : de3bdc2c  ip : 00000000  fp : c020fb10
r10: 00000000  r9 : c39b4224  r8 : 00000001
r7 : 00000046  r6 : c39b4000  r5 : 0078f392  r4 : 0078f392
r3 : 00000047  r2 : 00000000  r1 : 00000046  r0 : df5d5c80
Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 32c5387d  Table: 1e189b80  DAC: 55555555
Process tDblStackPcap0 (pid: 2003, stack limit = 0xde3bc190)
Stack: (0xde3bdc2c to 0xde3be000)
[<c041abfc>] (dql_completed) from [<bf0003a8>] (hip04_tx_reclaim+0x110/0x174 [hip04_eth])
[<bf0003a8>] (hip04_tx_reclaim [hip04_eth]) from [<bf0012c0>] (hip04_rx_poll+0x20/0x388 [hip04_eth])
[<bf0012c0>] (hip04_rx_poll [hip04_eth]) from [<c04c8d9c>] (net_rx_action+0x120/0x374)
[<c04c8d9c>] (net_rx_action) from [<c021eaf4>] (__do_softirq+0x218/0x318)
[<c021eaf4>] (__do_softirq) from [<c021eea0>] (irq_exit+0x88/0xac)
[<c021eea0>] (irq_exit) from [<c0240130>] (msa_irq_exit+0x11c/0x1d4)
[<c0240130>] (msa_irq_exit) from [<c0267ba8>] (__handle_domain_irq+0x110/0x148)
[<c0267ba8>] (__handle_domain_irq) from [<c0201588>] (gic_handle_irq+0xd4/0x118)
[<c0201588>] (gic_handle_irq) from [<c0558360>] (__irq_svc+0x40/0x58)
Exception stack(0xde3bdde0 to 0xde3bde28)
dde0: 00000000 00008001 c3637668 00000000 00000000 a00f0213 dd3627a0 c0af6380
de00: c086d380 a00f0213 c0a22a50 de3bde6c 00000002 de3bde30 c0558138 c055813c
de20: 600f0213 ffffffff
[<c0558360>] (__irq_svc) from [<c055813c>] (_raw_spin_unlock_irqrestore+0x44/0x54)
Kernel panic - not syncing: Fatal exception in interrupt

Pre-modification code:
int hip04_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
{
[...]
[1]	priv->tx_head = TX_NEXT(tx_head);
[2]	count++;
[3]	netdev_sent_queue(ndev, skb->len);
[...]
}
An rx interrupt occurs if hip04_mac_start_xmit just executes to the line 2,
tx_head has been updated, but corresponding 'skb->len' has not been
added to dql_queue.

And then
hip04_mac_interrupt->__napi_schedule->hip04_rx_poll->hip04_tx_reclaim

In hip04_tx_reclaim, because tx_head has been updated,
bytes_compl will plus an additional "skb-> len"
which has not been added to dql_queue. And then
trigger the BUG_ON(bytes_compl > num_queued - dql->num_completed).

To solve the problem described above, we put
"netdev_sent_queue(ndev, skb->len);"
before
"priv->tx_head = TX_NEXT(tx_head);"

Fixes: a41ea46a9a ("net: hisilicon: new hip04 ethernet driver")
Signed-off-by: Jiangfeng Xiao <xiaojiangfeng@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-31 16:41:22 +01:00
..
accessibility
acpi ACPI: PM: Avoid attaching ACPI PM domain to certain devices 2019-12-17 19:56:35 +01:00
amba ARM updates for 5.4-rc: 2019-10-23 06:26:33 -04:00
android binder: fix incorrect calculation for num_valid 2019-12-17 19:55:33 +01:00
ata ata: libahci_platform: Fix regulator_get_optional() misuse 2019-10-25 14:22:20 -06:00
atm
auxdisplay
base driver core: platform: use the correct callback type for bus_find_device 2019-12-04 22:30:45 +01:00
bcma
block nbd: prevent memory leak 2019-11-29 10:09:47 +01:00
bluetooth Revert "Bluetooth: hci_ll: set operational frequency earlier" 2019-11-29 10:09:43 +01:00
bus bus: ti-sysc: Fix watchdog quirk handling 2019-10-18 08:45:32 -07:00
cdrom
char ppdev: fix PPGETTIME/PPSETTIME ioctls 2019-12-17 19:56:41 +01:00
clk Fixes for various clk driver issues that happened because of code we 2019-11-08 08:15:01 -08:00
clocksource - Fix scary messages in sh_mtu2 by using platform_irq_count() helper 2019-11-04 18:43:23 +01:00
connector
counter
cpufreq cpufreq: powernv: fix stack bloat and hard limit on number of CPUs 2019-12-17 19:56:26 +01:00
cpuidle cpuidle: use first valid target residency as poll time 2019-12-17 19:56:23 +01:00
crypto crypto: ccp - fix uninitialized list head 2019-12-13 08:43:08 +01:00
dax
dca
devfreq PM / devfreq: Lock devfreq in trans_stat_show 2019-12-17 19:56:26 +01:00
dio
dma dmaengine: cppi41: Fix cppi41_dma_prep_slave_sg() when idle 2019-10-23 21:15:21 +05:30
dma-buf dma-buf: Fix memory leak in sync_file_merge() 2019-12-21 11:04:48 +01:00
edac EDAC/ghes: Do not warn when incrementing refcount on 0 2019-12-17 19:56:54 +01:00
eisa
extcon
firewire
firmware firmware: qcom: scm: Ensure 'a0' status code is treated as signed 2019-12-17 19:56:50 +01:00
fpga
fsi
gnss
gpio gpio fixes for v5.4-rc8 2019-11-13 22:58:01 +01:00
gpu drm/amdgpu: add invalidate semaphore limit for SRIOV and picasso in gmc9 2019-12-21 11:05:22 +01:00
greybus
hid HID: core: check whether Usage Page item is after Usage ID items 2019-12-04 22:31:07 +01:00
hsi
hv
hwmon hwmon: (ina3221) Fix read timeout issue 2019-10-28 18:46:55 -07:00
hwspinlock
hwtracing coresight: Serialize enabling/disabling a link device. 2019-12-17 19:56:41 +01:00
i2c i2c: core: fix use after free in of_i2c_notify 2019-11-15 22:01:13 +01:00
i3c
ide
idle
iio iio: ad7949: fix channels mixups 2019-12-17 19:56:45 +01:00
infiniband net: ipv6_stub: use ip6_dst_lookup_flow instead of ip6_dst_lookup 2019-12-18 16:08:42 +01:00
input Input: Fix memory leak in psxpad_spi_probe 2019-12-13 08:42:44 +01:00
interconnect interconnect: qcom: qcs404: Walk the list safely on node removal 2019-12-17 19:55:39 +01:00
iommu iommu/vt-d: Fix panic after kexec -p for kdump 2019-10-30 10:30:22 +01:00
ipack
irqchip irqchip updates for 5.4, take 2 2019-10-25 14:25:15 +02:00
isdn net: use skb_queue_empty_lockless() in poll() handlers 2019-10-28 13:33:41 -07:00
leds
lightnvm
macintosh cpufreq: Use per-policy frequency QoS 2019-10-21 02:05:21 +02:00
mailbox mailbox: tegra: Fix superfluous IRQ error message 2019-12-13 08:42:19 +01:00
mcb
md dm thin: Flush data device before committing metadata 2019-12-21 11:05:03 +01:00
media media: radio: wl1273: fix interrupt masking on release 2019-12-17 19:56:19 +01:00
memory
memstick
message
mfd mfd: mt6397: Fix probe after changing mt6397-core 2019-10-24 08:49:25 +01:00
misc mei: me: add comet point V device id 2019-12-04 22:30:49 +01:00
mmc mmc: core: Re-work HW reset for SDIO cards 2019-12-21 11:04:24 +01:00
mtd mtd: rawnand: Change calculating of position page containing BBM 2019-12-17 19:55:54 +01:00
mux
net net: hisilicon: Fix a BUG trigered by wrong bytes_compl 2019-12-31 16:41:22 +01:00
nfc nfc: port100: handle command failure cleanly 2019-11-21 11:48:17 -08:00
ntb
nubus
nvdimm
nvme Revert "nvme: Add quirk for Kingston NVME SSD running FW E8FK11.T" 2019-12-17 19:55:25 +01:00
nvmem
of of: reserved_mem: add missing of_node_put() for proper ref-counting 2019-10-23 15:15:05 -05:00
opp opp: Reinitialize the list_kref before adding the static OPPs again 2019-10-23 10:58:44 +05:30
oprofile
parisc
parport
pci PCI: Apply Cavium ACS quirk to ThunderX2 and ThunderX3 2019-12-21 11:04:30 +01:00
pcmcia
perf
phy phy: renesas: rcar-gen3-usb2: Fix sysfs interface of "role" 2019-12-17 19:56:00 +01:00
pinctrl pinctrl: samsung: Fix device node refcount leaks in S3C64xx wakeup controller init 2019-12-17 19:56:39 +01:00
platform platform/x86: hp-wmi: Fix ACPI errors caused by passing 0 as input size 2019-12-04 22:31:08 +01:00
pnp
power
powercap
pps
ps3
ptp ptp: Introduce strict checking of external time stamp options. 2019-11-15 12:48:32 -08:00
pwm pwm: bcm-iproc: Prevent unloading the driver module while in use 2019-11-08 18:38:06 +01:00
rapidio
ras
regulator regulator: Fixes for v5.4 2019-10-23 15:31:17 -04:00
remoteproc
reset reset: fix of_reset_control_get_count kerneldoc comment 2019-10-24 10:26:33 +02:00
rpmsg rpmsg: glink: Free pending deferred work on remove 2019-12-21 11:04:41 +01:00
rtc rtc: disable uie before setting time and enable after 2019-12-17 19:56:52 +01:00
s390 scsi: zfcp: trace channel log even for FCP command responses 2019-12-17 19:55:26 +01:00
sbus
scsi scsi: qla2xxx: Fix incorrect SFUB length used for Secure Flash Update MB Cmd 2019-12-21 11:05:10 +01:00
sfi
sh
siox
slimbus
soc soc: mediatek: cmdq: fixup wrong input order of write api 2019-12-13 08:42:40 +01:00
soundwire soundwire: slave: fix scanf format 2019-10-24 16:55:45 +05:30
spi spi: Fix NULL pointer when setting SPI_CS_HIGH for GPIO CS 2019-12-13 08:43:15 +01:00
spmi
ssb
staging media: hantro: Fix picture order count table enable 2019-12-17 19:56:17 +01:00
target SCSI fixes on 20191101 2019-11-02 11:15:52 -07:00
tc
tee
thermal thermal: Fix deadlock in thermal thermal_zone_device_check 2019-12-13 08:43:21 +01:00
thunderbolt thunderbolt: Power cycle the router if NVM authentication fails 2019-12-04 22:30:50 +01:00
tty Revert "serial/8250: Add support for NI-Serial PXI/PXIe+485 devices" 2019-12-13 08:43:22 +01:00
uio
usb USB: Fix incorrect DMA allocations for local memory pool drivers 2019-12-21 11:04:21 +01:00
vfio vfio/pci: call irq_bypass_unregister_producer() before freeing irq 2019-12-21 11:04:48 +01:00
vhost vringh: fix copy direction of vringh_iov_push_kern() 2019-10-28 04:25:04 -04:00
video video/hdmi: Fix AVI bar unpack 2019-12-17 19:56:42 +01:00
virt
virtio virtio-balloon: fix managed page counts when migrating pages between zones 2019-12-17 19:55:56 +01:00
visorbus
vlynq
vme
w1
watchdog watchdog: aspeed: Fix clock behaviour for ast2600 2019-12-13 08:43:30 +01:00
xen Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2019-10-19 17:09:11 -04:00
zorro
Kconfig
Makefile