linux/drivers/isdn/mISDN
Eric Dumazet 138b787804 mISDN: fix MISDN_TIME_STAMP handling
syzbot reports one unsafe call to copy_from_sockptr() [1]

Use copy_safe_from_sockptr() instead.

[1]

 BUG: KASAN: slab-out-of-bounds in copy_from_sockptr_offset include/linux/sockptr.h:49 [inline]
 BUG: KASAN: slab-out-of-bounds in copy_from_sockptr include/linux/sockptr.h:55 [inline]
 BUG: KASAN: slab-out-of-bounds in data_sock_setsockopt+0x46c/0x4cc drivers/isdn/mISDN/socket.c:417
Read of size 4 at addr ffff0000c6d54083 by task syz-executor406/6167

CPU: 1 PID: 6167 Comm: syz-executor406 Not tainted 6.8.0-rc7-syzkaller-g707081b61156 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call trace:
  dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:291
  show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:298
  __dump_stack lib/dump_stack.c:88 [inline]
  dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106
  print_address_description mm/kasan/report.c:377 [inline]
  print_report+0x178/0x518 mm/kasan/report.c:488
  kasan_report+0xd8/0x138 mm/kasan/report.c:601
  __asan_report_load_n_noabort+0x1c/0x28 mm/kasan/report_generic.c:391
  copy_from_sockptr_offset include/linux/sockptr.h:49 [inline]
  copy_from_sockptr include/linux/sockptr.h:55 [inline]
  data_sock_setsockopt+0x46c/0x4cc drivers/isdn/mISDN/socket.c:417
  do_sock_setsockopt+0x2a0/0x4e0 net/socket.c:2311
  __sys_setsockopt+0x128/0x1a8 net/socket.c:2334
  __do_sys_setsockopt net/socket.c:2343 [inline]
  __se_sys_setsockopt net/socket.c:2340 [inline]
  __arm64_sys_setsockopt+0xb8/0xd4 net/socket.c:2340
  __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline]
  invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48
  el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:133
  do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:152
  el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712
  el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730
  el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598

Fixes: 1b2b03f8e5 ("Add mISDN core files")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Cc: Karsten Keil <isdn@linux-pingi.de>
Link: https://lore.kernel.org/r/20240408082845.3957374-3-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2024-04-09 17:01:01 -07:00
..
clock.c isdn: replace deprecated strncpy with strscpy 2023-10-02 11:07:02 -07:00
core.c mISDN: remove unneeded mISDN_class_release() 2023-03-30 09:54:49 +02:00
core.h mISDN: change function names to avoid conflicts 2021-12-28 12:12:04 +00:00
dsp_audio.c
dsp_biquad.h
dsp_blowfish.c
dsp_cmx.c mISDN: Update parameter type of dsp_cmx_send() 2023-08-03 18:08:32 -07:00
dsp_core.c mISDN: Update parameter type of dsp_cmx_send() 2023-08-03 18:08:32 -07:00
dsp_dtmf.c
dsp_ecdis.h
dsp_hwec.c
dsp_hwec.h
dsp_pipeline.c isdn: mISDN: make elements_class constant 2024-03-07 20:26:24 -08:00
dsp_tones.c
dsp.h mISDN: Update parameter type of dsp_cmx_send() 2023-08-03 18:08:32 -07:00
fsm.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
fsm.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
hwchannel.c idsn: Use pr_warn instead of pr_warning 2019-10-18 15:00:21 +02:00
Kconfig misdn: dsp: select CONFIG_BITREVERSE 2021-01-05 15:50:36 -08:00
l1oip_codec.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 153 2019-05-30 11:26:32 -07:00
l1oip_core.c treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
l1oip.h mISDN: fix use-after-free bugs in l1oip timer handlers 2022-09-30 12:32:42 +01:00
layer1.c mISDN: change function names to avoid conflicts 2021-12-28 12:12:04 +00:00
layer1.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
layer2.c mISDN: Delete unnecessary checks before the macro call “dev_kfree_skb” 2019-08-22 16:22:03 -07:00
layer2.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
Makefile
socket.c mISDN: fix MISDN_TIME_STAMP handling 2024-04-09 17:01:01 -07:00
stack.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
tei.c mISDN: Delete unnecessary checks before the macro call “dev_kfree_skb” 2019-08-22 16:22:03 -07:00
timerdev.c treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00