android_kernel_oneplus_msm8998/include
Eric Biggers 79bf5c3c94 isdn/capi: check message length in capi_write()
[ Upstream commit fe163e534e5eecdfd7b5920b0dfd24c458ee85d6 ]

syzbot reported:

    BUG: KMSAN: uninit-value in capi_write+0x791/0xa90 drivers/isdn/capi/capi.c:700
    CPU: 0 PID: 10025 Comm: syz-executor379 Not tainted 4.20.0-rc7+ 
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
    Call Trace:
      __dump_stack lib/dump_stack.c:77 [inline]
      dump_stack+0x173/0x1d0 lib/dump_stack.c:113
      kmsan_report+0x12e/0x2a0 mm/kmsan/kmsan.c:613
      __msan_warning+0x82/0xf0 mm/kmsan/kmsan_instr.c:313
      capi_write+0x791/0xa90 drivers/isdn/capi/capi.c:700
      do_loop_readv_writev fs/read_write.c:703 [inline]
      do_iter_write+0x83e/0xd80 fs/read_write.c:961
      vfs_writev fs/read_write.c:1004 [inline]
      do_writev+0x397/0x840 fs/read_write.c:1039
      __do_sys_writev fs/read_write.c:1112 [inline]
      __se_sys_writev+0x9b/0xb0 fs/read_write.c:1109
      __x64_sys_writev+0x4a/0x70 fs/read_write.c:1109
      do_syscall_64+0xbc/0xf0 arch/x86/entry/common.c:291
      entry_SYSCALL_64_after_hwframe+0x63/0xe7
    [...]

The problem is that capi_write() is reading past the end of the message.
Fix it by checking the message's length in the needed places.

Reported-and-tested-by: syzbot+0849c524d9c634f5ae66@syzkaller.appspotmail.com
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-09-21 07:12:39 +02:00
..
acpi Merge branch 'acpi-pci' 2015-11-07 01:30:10 +01:00
asm-generic asm-generic: default BUG_ON(x) to if(x)BUG() 2019-08-25 10:53:04 +02:00
clocksource
crypto crypto: vmac - separate tfm and request context 2018-08-17 20:56:45 +02:00
drm drm: Add DP PSR2 sink enable bit 2018-08-06 16:24:39 +02:00
dt-bindings ARM: dts: Fix omap3 off mode pull defines 2017-11-21 09:21:19 +01:00
keys KEYS: user: Align the payload buffer 2019-03-23 08:44:17 +01:00
kvm KVM: arm/arm64: arch_timer: Preserve physical dist. active state on LR.active 2015-11-24 18:07:40 +01:00
linux libceph: allow ceph_buffer_put() to receive a NULL ceph_buffer 2019-09-10 10:29:49 +01:00
math-emu
media media: v4l: event: Prevent freeing event subscriptions while accessed 2018-10-10 08:52:10 +02:00
memory
misc
net xfrm: clean up xfrm protocol checks 2019-09-16 08:13:35 +02:00
pcmcia
ras
rdma IB/core: Make testing MR flags for writability a static inline function 2018-08-15 17:42:06 +02:00
rxrpc
scsi scsi: fcoe: Embed fc_rport_priv in fcoe_rport structure 2019-08-25 10:53:04 +02:00
soc memory: tegra: Apply interrupts mask per SoC 2018-08-06 16:24:38 +02:00
sound ALSA: compress: Fix regression on compressed capture streams 2019-08-25 10:52:48 +02:00
target target: Avoid early CMD_T_PRE_EXECUTE failures during ABORT_TASK 2018-01-17 09:35:31 +01:00
trace ext4: force inode writes when nfsd calls commit_metadata() 2019-01-13 10:05:30 +01:00
uapi isdn/capi: check message length in capi_write() 2019-09-21 07:12:39 +02:00
video udlfb: set optimal write delay 2018-09-09 20:04:36 +02:00
xen fix xen_swiotlb_dma_mmap prototype 2017-10-05 09:41:48 +02:00
Kbuild