1
0
Fork 0
alistair23-linux/drivers/net/ethernet/mellanox/mlx5/core
Qian Cai 60d60c8fbd net/mlx5e: always initialize frag->last_in_page
The commit 069d11465a ("net/mlx5e: RX, Enhance legacy Receive Queue
memory scheme") introduced an undefined behaviour below due to
"frag->last_in_page" is only initialized in mlx5e_init_frags_partition()
when,

if (next_frag.offset + frag_info[f].frag_stride > PAGE_SIZE)

or after bailed out the loop,

for (i = 0; i < mlx5_wq_cyc_get_size(&rq->wqe.wq); i++)

As the result, there could be some "frag" have uninitialized
value of "last_in_page".

Later, get_frag() obtains those "frag" and check "frag->last_in_page" in
mlx5e_put_rx_frag() and triggers the error during boot. Fix it by always
initializing "frag->last_in_page" to "false" in
mlx5e_init_frags_partition().

UBSAN: Undefined behaviour in
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c:325:12
load of value 170 is not a valid value for type 'bool' (aka '_Bool')
Call trace:
 dump_backtrace+0x0/0x264
 show_stack+0x20/0x2c
 dump_stack+0xb0/0x104
 __ubsan_handle_load_invalid_value+0x104/0x128
 mlx5e_handle_rx_cqe+0x8e8/0x12cc [mlx5_core]
 mlx5e_poll_rx_cq+0xca8/0x1a94 [mlx5_core]
 mlx5e_napi_poll+0x17c/0xa30 [mlx5_core]
 net_rx_action+0x248/0x940
 __do_softirq+0x350/0x7b8
 irq_exit+0x200/0x26c
 __handle_domain_irq+0xc8/0x128
 gic_handle_irq+0x138/0x228
 el1_irq+0xb8/0x140
 arch_cpu_idle+0x1a4/0x348
 do_idle+0x114/0x1b0
 cpu_startup_entry+0x24/0x28
 rest_init+0x1ac/0x1dc
 arch_call_rest_init+0x10/0x18
 start_kernel+0x4d4/0x57c

Fixes: 069d11465a ("net/mlx5e: RX, Enhance legacy Receive Queue memory scheme")
Signed-off-by: Qian Cai <cai@lca.pw>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-08-05 11:13:05 -07:00
..
accel net/mlx5e: Fix compilation error in TLS code 2019-07-11 15:04:38 -07:00
diag Merge branch 'mlx5-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux 2019-06-28 16:03:54 -07:00
en net/mlx5e: Fix matching of speed to PRM link modes 2019-07-25 13:31:00 -07:00
en_accel net/mlx5e: kTLS, Call WARN_ONCE on netdev mismatch 2019-07-25 13:31:00 -07:00
fpga net/mlx5: Kconfig, Better organize compilation flags 2019-07-05 16:29:19 -07:00
ipoib net/mlx5e: Fix wrong max num channels indication 2019-07-25 13:30:59 -07:00
lib mlx5-fixes-2019-07-11 2019-07-11 15:06:37 -07:00
Kconfig net/mlx5: Accel, Add core TLS support for the Connect-X family 2019-07-05 16:29:19 -07:00
Makefile net/mlx5e: Add kTLS TX HW offload support 2019-07-05 16:29:20 -07:00
alloc.c net/mlx5: Separate and generalize dma device from pci device 2019-04-29 16:55:05 -07:00
cmd.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-06-17 20:20:36 -07:00
cq.c net/mlx5: Report EQE data upon CQ completion 2019-07-03 21:00:20 +03:00
debugfs.c net/mlx5: EQ, Privatize eq_table and friends 2018-11-20 20:06:54 +02:00
dev.c net/mlx5: Use reversed order when unregister devices 2019-07-25 13:30:59 -07:00
devlink.c net/mlx5: Added devlink info callback 2019-07-04 16:43:16 -04:00
devlink.h net/mlx5: Move all devlink related functions calls to devlink.c 2019-06-13 13:23:16 -07:00
ecpf.c Merge branch 'mlx5-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux 2019-05-31 13:04:06 -07:00
ecpf.h net/mlx5: E-Switch, Replace host_params event with functions_changed event 2019-05-31 12:28:14 -07:00
en.h net/mlx5e: Fix wrong max num channels indication 2019-07-25 13:30:59 -07:00
en_arfs.c net/mlx5e: Add new counter for aRFS rule insertion failures 2018-10-03 16:17:59 -07:00
en_common.c net/mlx5e: Add a lock on tir list 2019-03-29 12:24:41 -07:00
en_dcbnl.c net/mlx5: Handle host PF vport mac/guid for ECPF 2019-07-01 16:40:30 -07:00
en_dim.c linux/dim: Move implementation to .c files 2019-06-25 13:46:39 -07:00
en_ethtool.c net/mlx5e: Fix matching of speed to PRM link modes 2019-07-25 13:31:00 -07:00
en_fs.c
en_fs_ethtool.c net/mlx5e: Fix wrong max num channels indication 2019-07-25 13:30:59 -07:00
en_main.c net/mlx5e: always initialize frag->last_in_page 2019-08-05 11:13:05 -07:00
en_rep.c mlx5-fixes-2019-07-25 2019-07-26 14:26:41 -07:00
en_rep.h net/mlx5e: Register devlink ports for physical link, PCI PF, VFs 2019-07-09 12:02:13 -07:00
en_rx.c mlx5-fixes-2019-07-11 2019-07-11 15:06:37 -07:00
en_selftest.c net/mlx5: Handle SW reset of FW in error flow 2019-06-13 13:23:17 -07:00
en_stats.c net/mlx5e: Fix wrong max num channels indication 2019-07-25 13:30:59 -07:00
en_stats.h net/mlx5e: Add kTLS TX HW offload support 2019-07-05 16:29:20 -07:00
en_tc.c net/mlx5e: Prevent encap flow counter update async to user query 2019-07-25 13:31:00 -07:00
en_tc.h net: flow_offload: rename tc_cls_flower_offload to flow_cls_offload 2019-07-09 14:38:51 -07:00
en_tx.c net/mlx5e: Add kTLS TX HW offload support 2019-07-05 16:29:20 -07:00
en_txrx.c linux/dim: Fix overflow in dim calculation 2019-07-25 11:34:39 -07:00
eq.c net/mlx5: Report EQE data upon CQ completion 2019-07-03 21:00:20 +03:00
eswitch.c ethernet: remove redundant memset 2019-07-15 11:06:27 -07:00
eswitch.h Merge branch 'mlx5-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux 2019-07-04 16:42:59 -04:00
eswitch_offloads.c ethernet: remove redundant memset 2019-07-15 11:06:27 -07:00
eswitch_offloads_termtbl.c net/mlx5e: reduce stack usage in mlx5_eswitch_termtbl_create 2019-06-28 16:03:59 -07:00
events.c net/mlx5: E-Switch, Replace host_params event with functions_changed event 2019-05-31 12:28:14 -07:00
fs_cmd.c net/mlx5e: Specifying known origin of packets matching the flow 2019-06-26 12:01:28 -07:00
fs_cmd.h net/mlx5: Pass flow steering objects to fs_cmd 2019-04-29 16:55:05 -07:00
fs_core.c Merge branch 'mlx5-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux 2019-07-04 16:42:59 -04:00
fs_core.h net/mlx5: Add missing RDMA_RX capabilities 2019-07-25 13:30:59 -07:00
fs_counters.c net/mlx5e: Prevent encap flow counter update async to user query 2019-07-25 13:31:00 -07:00
fw.c net/mlx5e: Add kTLS TX HW offload support 2019-07-05 16:29:20 -07:00
health.c net/mlx5: Replace kfree with kvfree 2019-07-18 12:11:12 -07:00
lag.c net/mlx5: E-Switch, Refactor eswitch SR-IOV interface 2019-07-01 16:40:30 -07:00
lag.h net/mlx5e: Activate HW multipath and handle port affinity based on FIB events 2019-03-01 12:04:16 -08:00
lag_mp.c mlx5: Fail attempts to use routes with nexthop objects 2019-06-04 19:26:50 -07:00
lag_mp.h net/mlx5e: Activate HW multipath and handle port affinity based on FIB events 2019-03-01 12:04:16 -08:00
main.c net/mlx5: Accel, Expose accel wrapper for IPsec FPGA function 2019-07-05 16:29:19 -07:00
mcg.c
mlx5_core.h net/mlx5: Added fw version query command 2019-07-04 16:43:15 -04:00
mr.c net/mlx5: Convert mkey_table to XArray 2019-06-24 16:44:40 -07:00
pagealloc.c net/mlx5: Separate and generalize dma device from pci device 2019-04-29 16:55:05 -07:00
pci_irq.c net/mlx5: Use a single IRQ for all async EQs 2019-06-13 10:59:49 -07:00
pd.c
port.c net/mlx5e: ethtool, Add support for EEPROM high pages query 2019-05-01 14:39:16 -07:00
qp.c IB/mlx5: Use mlx5 core to create/destroy a DEVX DCT 2019-03-17 21:40:39 -03:00
rdma.c net/mlx5: Handle host PF vport mac/guid for ECPF 2019-07-01 16:40:30 -07:00
rdma.h net/mlx5: Eswitch, enable RoCE loopback traffic 2019-04-29 16:55:32 -07:00
rl.c
sriov.c net/mlx5: Refactor mlx5_esw_query_functions for modularity 2019-07-03 12:50:42 -07:00
transobj.c net/mlx5: Introduce new TIR creation core API 2019-04-24 12:33:37 -07:00
uar.c Linux 5.1-rc1 2019-04-22 15:25:39 -07:00
vport.c net/mlx5: Introduce and use mlx5_eswitch_get_total_vports() 2019-07-03 12:50:42 -07:00
wq.c net/mlx5e: Use CQE padding for Ethernet CQs 2018-12-11 14:52:20 -08:00
wq.h net/mlx5e: Allow ICO SQ to be used by multiple RQs 2019-06-27 22:53:27 +02:00