linux-stable/include
Eric Biggers fe163e534e isdn/capi: check message length in capi_write()
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>
2019-09-07 17:44:25 +02:00
..
acpi
asm-generic include/asm-generic/5level-fixup.h: fix variable 'p4d' set but not used 2019-08-13 16:06:52 -07:00
clocksource
crypto
drm drm/fb-helper: Instanciate shadow FB if configured in device's mode_config 2019-08-01 15:01:35 +02:00
dt-bindings ARM: Device-tree updates 2019-07-19 17:19:24 -07:00
keys
kvm KVM: arm/arm64: Sync ICH_VMCR_EL2 back when about to block 2019-08-05 15:36:46 +01:00
linux net: fixed_phy: Add forward declaration for struct gpio_desc; 2019-09-05 11:54:14 +02:00
math-emu nds32: Mark expected switch fall-throughs 2019-08-29 11:06:56 -05:00
media
misc auxdisplay: charlcd: move charlcd.h to drivers/auxdisplay 2019-08-08 19:59:17 +02:00
net Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec 2019-09-06 15:09:16 +02:00
pcmcia
ras
rdma RDMA/restrack: Rewrite PID namespace check to be reliable 2019-08-20 13:44:44 -04:00
scsi scsi: fcoe: Embed fc_rport_priv in fcoe_rport structure 2019-07-29 21:12:35 -04:00
soc ARC updates for 5.3-rc7 2019-08-27 10:50:27 -07:00
sound sound fixes for 5.3-rc4 2019-08-09 09:21:27 -07:00
target
trace rxrpc: Use skb_unshare() rather than skb_cow_data() 2019-08-27 10:13:46 +01:00
uapi isdn/capi: check message length in capi_write() 2019-09-07 17:44:25 +02:00
vdso
video drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
xen xen: avoid link error on ARM 2019-07-31 08:14:12 +02:00
Kbuild kbuild: add net/netfilter/nf_tables_offload.h to header-test blacklist. 2019-07-21 11:43:43 -07:00