]> Git Repo - linux.git/commit
net/mlx5e: Fix division by 0 in mlx5e_select_queue
authorMaxim Mikityanskiy <[email protected]>
Mon, 1 Mar 2021 18:59:59 +0000 (20:59 +0200)
committerSaeed Mahameed <[email protected]>
Mon, 22 Mar 2021 20:16:41 +0000 (13:16 -0700)
commit846d6da1fcdb14105f86b46b4345233550a79d55
treefe64c3d0889cee715ca949cfd188bfd6671a2478
parent4eacfe72e3e037e3fc019113df32c39a705148c2
net/mlx5e: Fix division by 0 in mlx5e_select_queue

mlx5e_select_queue compares num_tc_x_num_ch to real_num_tx_queues to
determine if HTB and/or PTP offloads are active. If they are, it
calculates netdev_pick_tx() % num_tc_x_num_ch to prevent it from
selecting HTB and PTP queues for regular traffic. However, before the
channels are first activated, num_tc_x_num_ch is zero. If
ndo_select_queue gets called at this point, the HTB/PTP check will pass,
and mlx5e_select_queue will attempt to take a modulo by num_tc_x_num_ch,
which equals to zero.

This commit fixes the bug by assigning num_tc_x_num_ch to a non-zero
value before registering the netdev.

Fixes: 214baf22870c ("net/mlx5e: Support HTB offload")
Reported-by: Jesper Dangaard Brouer <[email protected]>
Signed-off-by: Maxim Mikityanskiy <[email protected]>
Reviewed-by: Tariq Toukan <[email protected]>
Signed-off-by: Saeed Mahameed <[email protected]>
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
This page took 0.057911 seconds and 4 git commands to generate.