• Petr Machata's avatar
    mlxsw: spectrum_qdisc: Pass handle, not band number to find_class() · d566ed04
    Petr Machata authored
    In mlxsw Qdisc offload, find_class() is an operation that yields a qdisc
    offload descriptor given a parental qdisc descriptor and a class handle. In
    __mlxsw_sp_qdisc_ets_graft() however, a band number is passed to that
    function instead of a handle. This can lead to a trigger of a WARN_ON
    with the following splat:
    
     WARNING: CPU: 3 PID: 808 at drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c:1356 __mlxsw_sp_qdisc_ets_graft+0x115/0x130 [mlxsw_spectrum]
     [...]
     Call Trace:
      mlxsw_sp_setup_tc_prio+0xe3/0x100 [mlxsw_spectrum]
      qdisc_offload_graft_helper+0x35/0xa0
      prio_graft+0x176/0x290 [sch_prio]
      qdisc_graft+0xb3/0x540
      tc_modify_qdisc+0x56a/0x8a0
      rtnetlink_rcv_msg+0x12c/0x370
      netlink_rcv_skb+0x49/0xf0
      netlink_unicast+0x1f6/0x2b0
      netlink_sendmsg+0x1fb/0x410
      ____sys_sendmsg+0x1f3/0x220
      ___sys_sendmsg+0x70/0xb0
      __sys_sendmsg+0x54/0xa0
      do_syscall_64+0x3a/0x70
      entry_SYSCALL_64_after_hwframe+0x44/0xae
    
    Since the parent handle is not passed with the offload information, compute
    it from the band number and qdisc handle.
    
    Fixes: 28052e618b04 ("mlxsw: spectrum_qdisc: Track children per qdisc")
    Reported-by: default avatarMaksym Yaremchuk <maksymy@nvidia.com>
    Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
    Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    d566ed04
spectrum_qdisc.c 56.5 KB