王贇 b193e15ac6 net: prevent user from passing illegal stab size
We observed below report when playing with netlink sock:

  UBSAN: shift-out-of-bounds in net/sched/sch_api.c:580:10
  shift exponent 249 is too large for 32-bit type
  CPU: 0 PID: 685 Comm: a.out Not tainted
  Call Trace:
   dump_stack_lvl+0x8d/0xcf
   ubsan_epilogue+0xa/0x4e
   __ubsan_handle_shift_out_of_bounds+0x161/0x182
   __qdisc_calculate_pkt_len+0xf0/0x190
   __dev_queue_xmit+0x2ed/0x15b0

it seems like kernel won't check the stab log value passing from
user, and will use the insane value later to calculate pkt_len.

This patch just add a check on the size/cell_log to avoid insane
calculation.

Reported-by: Abaci <abaci@linux.alibaba.com>
Signed-off-by: Michael Wang <yun.wang@linux.alibaba.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-09-26 11:09:07 +01:00
..
2021-09-05 08:36:44 +09:00
2021-07-27 20:11:45 +01:00
2021-08-03 11:21:39 +01:00
2021-09-03 15:33:47 -07:00
2021-08-05 13:27:50 +01:00
2021-06-30 15:51:09 -07:00
2021-09-20 09:41:29 +01:00
2021-06-29 11:28:21 -07:00
2021-08-05 13:27:50 +01:00
2021-08-13 14:09:19 -07:00
2021-09-08 15:55:42 -07:00
2021-07-29 15:06:49 +01:00
2021-07-29 15:06:49 +01:00
2021-08-31 16:43:06 -07:00