]> git.baikalelectronics.ru Git - kernel.git/commit
sch_htb: Fix select_queue for non-offload mode
authorMaxim Mikityanskiy <maximmi@nvidia.com>
Thu, 11 Mar 2021 14:42:05 +0000 (16:42 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 12 Mar 2021 02:30:32 +0000 (18:30 -0800)
commit27d68981babd26a45b9f194cb52832e81f8caf3d
tree6d79a62ca47853b088e41d919a71b3489cf8f5c4
parent3c9e75fcb6be5d23d0e7bd1ff70abe8f5ba1b806
sch_htb: Fix select_queue for non-offload mode

htb_select_queue assumes it's always the offload mode, and it ends up in
calling ndo_setup_tc without any checks. It may lead to a NULL pointer
dereference if ndo_setup_tc is not implemented, or to an error returned
from the driver, which will prevent attaching qdiscs to HTB classes in
the non-offload mode.

This commit fixes the bug by adding the missing check to
htb_select_queue. In the non-offload mode it will return sch->dev_queue,
mimicking tc_modify_qdisc's behavior for the case where select_queue is
not implemented.

Reported-by: syzbot+b53a709f04722ca12a3c@syzkaller.appspotmail.com
Fixes: c027dd73e5c3 ("sch_htb: Hierarchical QoS hardware offload")
Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_htb.c