linux-stable/include
Eric Biggers 4a7e12395a isdn/capi: check message length in capi_write()
[ Upstream commit fe163e534e ]

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+ #2
    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:14:01 +02:00
..
acpi ACPICA: Reference Counts: increase max to 0x4000 for large servers 2019-03-19 13:14:07 +01:00
asm-generic asm-generic: fix -Wtype-limits compiler warnings 2019-08-25 10:51:50 +02:00
clocksource
crypto crypto: vmac - separate tfm and request context 2018-08-17 20:59:29 +02:00
drm drm: disable uncached DMA optimization for ARM and arm64 2019-03-13 14:05:01 -07:00
dt-bindings dt-bindings: clock: mediatek: add binding for fixed-factor clock axisel_d4 2018-04-24 09:34:14 +02:00
keys KEYS: user: Align the payload buffer 2019-02-27 10:07:00 +01:00
kvm arm/arm64: KVM: Add PSCI version selection API 2018-05-09 09:50:19 +02:00
linux libceph: allow ceph_buffer_put() to receive a NULL ceph_buffer 2019-09-10 10:31:03 +01:00
math-emu
media media: v4l: event: Prevent freeing event subscriptions while accessed 2018-10-03 17:01:55 -07:00
memory
misc
net ip6: fix skb leak in ip6frag_expire_frag_queue() 2019-09-16 08:19:33 +02:00
pcmcia
ras
rdma IB/core: Make testing MR flags for writability a static inline function 2018-08-15 18:14:43 +02:00
rxrpc
scsi scsi: fcoe: Embed fc_rport_priv in fcoe_rport structure 2019-08-11 12:22:12 +02:00
soc memory: tegra: Apply interrupts mask per SoC 2018-08-03 07:55:24 +02:00
sound ALSA: compress: Fix regression on compressed capture streams 2019-08-25 10:51:26 +02:00
target target: Avoid early CMD_T_PRE_EXECUTE failures during ABORT_TASK 2018-01-17 09:38:54 +01:00
trace ext4: force inode writes when nfsd calls commit_metadata() 2019-01-09 16:16:44 +01:00
uapi isdn/capi: check message length in capi_write() 2019-09-21 07:14:01 +02:00
video udlfb: set optimal write delay 2018-09-09 20:01:25 +02:00
xen
Kbuild