Skip to content
Snippets Groups Projects
  1. Jun 12, 2019
  2. May 31, 2019
  3. Mar 04, 2019
  4. Mar 01, 2019
    • Todd Kjos's avatar
      UPSTREAM: binder: fix race that allows malicious free of live buffer · 8efacd33
      Todd Kjos authored
      
      commit 7bada55a upstream
      
      Malicious code can attempt to free buffers using the BC_FREE_BUFFER
      ioctl to binder. There are protections against a user freeing a buffer
      while in use by the kernel, however there was a window where
      BC_FREE_BUFFER could be used to free a recently allocated buffer that
      was not completely initialized. This resulted in a use-after-free
      detected by KASAN with a malicious test program.
      
      This window is closed by setting the buffer's allow_user_free attribute
      to 0 when the buffer is allocated or when the user has previously freed
      it instead of waiting for the caller to set it. The problem was that
      when the struct buffer was recycled, allow_user_free was stale and set
      to 1 allowing a free to go through.
      
      Bug: 116855682
      Change-Id: I0b38089f6fdb1adbf7e1102747e4119c9a05b191
      Signed-off-by: default avatarTodd Kjos <tkjos@google.com>
      Acked-by: default avatarArve Hjønnevåg <arve@android.com>
      Cc: stable <stable@vger.kernel.org> # 4.14
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8efacd33
    • Matthias Schwarzott's avatar
      media: em28xx: Fix use-after-free when disconnecting · 0492cf8f
      Matthias Schwarzott authored
      
      [ Upstream commit 910b0797 ]
      
      Fix bug by moving the i2c_unregister_device calls after deregistration
      of dvb frontend.
      
      The new style i2c drivers already destroys the frontend object at
      i2c_unregister_device time.
      When the dvb frontend is unregistered afterwards it leads to this oops:
      
        [ 6058.866459] BUG: unable to handle kernel NULL pointer dereference at 00000000000001f8
        [ 6058.866578] IP: dvb_frontend_stop+0x30/0xd0 [dvb_core]
        [ 6058.866644] PGD 0
        [ 6058.866646] P4D 0
      
        [ 6058.866726] Oops: 0000 [#1] SMP
        [ 6058.866768] Modules linked in: rc_pinnacle_pctv_hd(O) em28xx_rc(O) si2157(O) si2168(O) em28xx_dvb(O) em28xx(O) si2165(O) a8293(O) tda10071(O) tea5767(O) tuner(O) cx23885(O) tda18271(O) videobuf2_dvb(O) videobuf2_dma_sg(O) m88ds3103(O) tveeprom(O) cx2341x(O) v4l2_common(O) dvb_core(O) rc_core(O) videobuf2_memops(O) videobuf2_v4l2(O) videobuf2_core(O) videodev(O) media(O) bluetooth ecdh_generic ums_realtek uas rtl8192cu rtl_usb rtl8192c_common rtlwifi usb_storage snd_hda_codec_realtek snd_hda_codec_hdmi snd_hda_codec_generic i2c_mux snd_hda_intel snd_hda_codec snd_hwdep x86_pkg_temp_thermal snd_hda_core kvm_intel kvm irqbypass [last unloaded: videobuf2_memops]
        [ 6058.867497] CPU: 2 PID: 7349 Comm: kworker/2:0 Tainted: G        W  O    4.13.9-gentoo #1
        [ 6058.867595] Hardware name: MEDION E2050 2391/H81H3-EM2, BIOS H81EM2W08.308 08/25/2014
        [ 6058.867692] Workqueue: usb_hub_wq hub_event
        [ 6058.867746] task: ffff88011a15e040 task.stack: ffffc90003074000
        [ 6058.867825] RIP: 0010:dvb_frontend_stop+0x30/0xd0 [dvb_core]
        [ 6058.867896] RSP: 0018:ffffc90003077b58 EFLAGS: 00010293
        [ 6058.867964] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 000000010040001f
        [ 6058.868056] RDX: ffff88011a15e040 RSI: ffffea000464e400 RDI: ffff88001cbe3028
        [ 6058.868150] RBP: ffffc90003077b68 R08: ffff880119390380 R09: 000000010040001f
        [ 6058.868241] R10: ffffc90003077b18 R11: 000000000001e200 R12: ffff88001cbe3028
        [ 6058.868330] R13: ffff88001cbe68d0 R14: ffff8800cf734000 R15: ffff8800cf734098
        [ 6058.868419] FS:  0000000000000000(0000) GS:ffff88011fb00000(0000) knlGS:0000000000000000
        [ 6058.868511] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        [ 6058.868578] CR2: 00000000000001f8 CR3: 00000001113c5000 CR4: 00000000001406e0
        [ 6058.868662] Call Trace:
        [ 6058.868705]  dvb_unregister_frontend+0x2a/0x80 [dvb_core]
        [ 6058.868774]  em28xx_dvb_fini+0x132/0x220 [em28xx_dvb]
        [ 6058.868840]  em28xx_close_extension+0x34/0x90 [em28xx]
        [ 6058.868902]  em28xx_usb_disconnect+0x4e/0x70 [em28xx]
        [ 6058.868968]  usb_unbind_interface+0x6d/0x260
        [ 6058.869025]  device_release_driver_internal+0x150/0x210
        [ 6058.869094]  device_release_driver+0xd/0x10
        [ 6058.869150]  bus_remove_device+0xe4/0x160
        [ 6058.869204]  device_del+0x1ce/0x2f0
        [ 6058.869253]  usb_disable_device+0x99/0x270
        [ 6058.869306]  usb_disconnect+0x8d/0x260
        [ 6058.869359]  hub_event+0x93d/0x1520
        [ 6058.869408]  ? dequeue_task_fair+0xae5/0xd20
        [ 6058.869467]  process_one_work+0x1d9/0x3e0
        [ 6058.869522]  worker_thread+0x43/0x3e0
        [ 6058.869576]  kthread+0x104/0x140
        [ 6058.869602]  ? trace_event_raw_event_workqueue_work+0x80/0x80
        [ 6058.869640]  ? kthread_create_on_node+0x40/0x40
        [ 6058.869673]  ret_from_fork+0x22/0x30
        [ 6058.869698] Code: 54 49 89 fc 53 48 8b 9f 18 03 00 00 0f 1f 44 00 00 41 83 bc 24 04 05 00 00 02 74 0c 41 c7 84 24 04 05 00 00 01 00 00 00 0f ae f0 <48> 8b bb f8 01 00 00 48 85 ff 74 5c e8 df 40 f0 e0 48 8b 93 f8
        [ 6058.869850] RIP: dvb_frontend_stop+0x30/0xd0 [dvb_core] RSP: ffffc90003077b58
        [ 6058.869894] CR2: 00000000000001f8
        [ 6058.875880] ---[ end trace 717eecf7193b3fc6 ]---
      
      Signed-off-by: default avatarMatthias Schwarzott <zzam@gentoo.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0492cf8f
    • Theodore Ts'o's avatar
      ext4: avoid running out of journal credits when appending to an inline file · 69284080
      Theodore Ts'o authored
      commit 8bc1379b upstream.
      
      Use a separate journal transaction if it turns out that we need to
      convert an inline file to use an data block.  Otherwise we could end
      up failing due to not having journal credits.
      
      This addresses CVE-2018-10883.
      
      https://bugzilla.kernel.org/show_bug.cgi?id=200071
      
      
      
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Cc: stable@kernel.org
      [fengc@google.com: 4.4 and 4.9 backport: adjust context]
      Signed-off-by: default avatarChenbo Feng <fengc@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      69284080
  5. Feb 08, 2019
  6. Feb 01, 2019
  7. Jan 30, 2019
  8. Jan 08, 2019
    • Alexey Brodkin's avatar
      ARC: [zebu] Remove CONFIG_INITRAMFS_SOURCE from defconfigs · 44ee4df5
      Alexey Brodkin authored
      Zebu boards were added in v4.9 and then renamed to "haps" in v4.10.
      
      Thus backporting
      commit 64234961 (ARC: configs: Remove CONFIG_INITRAMFS_SOURCE from defconfigs)
      we missed "zebu" defconfigs in v4.9.
      
      Note this is only applicable to "linux-4.9.y"!
      
      Spotted by KerneCI, see [1].
      
      [1] https://storage.kernelci.org/stable/linux-4.9.y/v4.9.144/arc/zebu_hs_smp_defconfig/build.log
      
      
      
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      Cc: Kevin Hilman <khilman@baylibre.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      44ee4df5
    • Kevin Hilman's avatar
      ARC: change defconfig defaults to ARCv2 · 8552ba3e
      Kevin Hilman authored
      
      commit b7cc40c3 upstream.
      
      Change the default defconfig (used with 'make defconfig') to the ARCv2
      nsim_hs_defconfig, and also switch the default Kconfig ISA selection to
      ARCv2.
      
      This allows several default defconfigs (e.g. make defconfig, make
      allnoconfig, make tinyconfig) to all work with ARCv2 by default.
      
      Note since we change default architecture from ARCompact to ARCv2
      it's required to explicitly mention architecture type in ARCompact
      defconfigs otherwise ARCv2 will be implied and binaries will be
      generated for ARCv2.
      
      Cc: <stable@vger.kernel.org> # 4.4.x
      Signed-off-by: default avatarKevin Hilman <khilman@baylibre.com>
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8552ba3e
    • Alexey Brodkin's avatar
      ARC: build: Don't set CROSS_COMPILE in arch's Makefile · e2751188
      Alexey Brodkin authored
      commit 40660f1f upstream.
      
      There's not much sense in doing that because if user or
      his build-system didn't set CROSS_COMPILE we still may
      very well make incorrect guess.
      
      But as it turned out setting CROSS_COMPILE is not as harmless
      as one may think: with recent changes that implemented automatic
      discovery of __host__ gcc features unconditional setup of
      CROSS_COMPILE leads to failures on execution of "make xxx_defconfig"
      with absent cross-compiler, for more info see [1].
      
      Set CROSS_COMPILE as well gets in the way if we want only to build
      .dtb's (again with absent cross-compiler which is not really needed
      for building .dtb's), see [2].
      
      Note, we had to change LIBGCC assignment type from ":=" to "="
      so that is is resolved on its usage, otherwise if it is resolved
      at declaration time with missing CROSS_COMPILE we're getting this
      error message from host GCC:
      
      | gcc: error: unrecognized command line option -mmedium-calls
      | gcc: error: unrecognized command line option -mno-sdata
      
      [1] http://lists.infradead.org/pipermail/linux-snps-arc/2018-September/004308.html
      [2] http://lists.infradead.org/pipermail/linux-snps-arc/2018-September/004320.html
      
      
      
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Rob Herring <robh@kernel.org>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e2751188
    • Alexey Brodkin's avatar
      ARC: build: Get rid of toolchain check · 54f6c8a9
      Alexey Brodkin authored
      
      commit 615f6445 upstream.
      
      This check is very naive: we simply test if GCC invoked without
      "-mcpu=XXX" has ARC700 define set. In that case we think that GCC
      was built with "--with-cpu=arc700" and has libgcc built for ARC700.
      
      Otherwise if ARC700 is not defined we think that everythng was built
      for ARCv2.
      
      But in reality our life is much more interesting.
      
      1. Regardless of GCC configuration (i.e. what we pass in "--with-cpu"
         it may generate code for any ARC core).
      
      2. libgcc might be built with explicitly specified "--mcpu=YYY"
      
      That's exactly what happens in case of multilibbed toolchains:
       - GCC is configured with default settings
       - All the libs built for many different CPU flavors
      
      I.e. that check gets in the way of usage of multilibbed
      toolchains. And even non-multilibbed toolchains are affected.
      OpenEmbedded also builds GCC without "--with-cpu" because
      each and every target component later is compiled with explicitly
      set "-mcpu=ZZZ".
      
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      54f6c8a9
    • Alexey Brodkin's avatar
      ARC: Explicitly add -mmedium-calls to CFLAGS · 7b5d0784
      Alexey Brodkin authored
      
      [ Upstream commit 74c11e30 ]
      
      GCC built for arc*-*-linux has "-mmedium-calls" implicitly enabled by default
      thus we don't see any problems during Linux kernel compilation.
      ----------------------------->8------------------------
      arc-linux-gcc -mcpu=arc700 -Q --help=target | grep calls
        -mlong-calls                          [disabled]
        -mmedium-calls                        [enabled]
      ----------------------------->8------------------------
      
      But if we try to use so-called Elf32 toolchain with GCC configured for
      arc*-*-elf* then we'd see the following failure:
      ----------------------------->8------------------------
      init/do_mounts.o: In function 'init_rootfs':
      do_mounts.c:(.init.text+0x108): relocation truncated to fit: R_ARC_S21W_PCREL
      against symbol 'unregister_filesystem' defined in .text section in fs/filesystems.o
      
      arc-elf32-ld: final link failed: Symbol needs debug section which does not exist
      make: *** [vmlinux] Error 1
      ----------------------------->8------------------------
      
      That happens because neither "-mmedium-calls" nor "-mlong-calls" are enabled in
      Elf32 GCC:
      ----------------------------->8------------------------
      arc-elf32-gcc -mcpu=arc700 -Q --help=target | grep calls
        -mlong-calls                          [disabled]
        -mmedium-calls                        [disabled]
      ----------------------------->8------------------------
      
      Now to make it possible to use Elf32 toolchain for building Linux kernel
      we're explicitly add "-mmedium-calls" to CFLAGS.
      
      And since we add "-mmedium-calls" to the global CFLAGS there's no point in
      having per-file copies thus removing them.
      
      Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7b5d0784
  9. Jan 04, 2019
  10. Nov 02, 2018
    • Suren Baghdasaryan's avatar
      NFC: Fix the number of pipes · 9ad37d62
      Suren Baghdasaryan authored
      
      commit e285d5bf upstream.
      
      According to ETSI TS 102 622 specification chapter 4.4 pipe identifier
      is 7 bits long which allows for 128 unique pipe IDs. Because
      NFC_HCI_MAX_PIPES is used as the number of pipes supported and not
      as the max pipe ID, its value should be 128 instead of 127.
      
      nfc_hci_recv_from_llc extracts pipe ID from packet header using
      NFC_HCI_FRAGMENT(0x7F) mask which allows for pipe ID value of 127.
      Same happens when NCI_HCP_MSG_GET_PIPE() is being used. With
      pipes array having only 127 elements and pipe ID of 127 the OOB memory
      access will result.
      
      Cc: Samuel Ortiz <sameo@linux.intel.com>
      Cc: Allen Pais <allen.pais@oracle.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Suggested-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarSuren Baghdasaryan <surenb@google.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2 tags
      9ad37d62
    • Greg Hackmann's avatar
      staging: android: ion: fix ION_IOC_{MAP,SHARE} use-after-free · b6bb8eb0
      Greg Hackmann authored
      
      This patch is 4.9.y only.  Kernels 4.12 and later are unaffected, since
      all the underlying ion_handle infrastructure has been ripped out.
      
      The ION_IOC_{MAP,SHARE} ioctls drop and reacquire client->lock several
      times while operating on one of the client's ion_handles.  This creates
      windows where userspace can call ION_IOC_FREE on the same client with
      the same handle, and effectively make the kernel drop its own reference.
      For example:
      
      - thread A: ION_IOC_ALLOC creates an ion_handle with refcount 1
      - thread A: starts ION_IOC_MAP and increments the refcount to 2
      - thread B: ION_IOC_FREE decrements the refcount to 1
      - thread B: ION_IOC_FREE decrements the refcount to 0 and frees the
                  handle
      - thread A: continues ION_IOC_MAP with a dangling ion_handle * to
                  freed memory
      
      Fix this by holding client->lock for the duration of
      ION_IOC_{MAP,SHARE}, preventing the concurrent ION_IOC_FREE.  Also
      remove ion_handle_get_by_id(), since there's literally no way to use it
      safely.
      
      Cc: stable@vger.kernel.org # v4.11-
      Signed-off-by: default avatarGreg Hackmann <ghackmann@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b6bb8eb0
    • Adrian Salido's avatar
      ANDROID: tracing: fix race condition reading saved tgids · ac941ef6
      Adrian Salido authored
      
      Commit 939c7a4f ("tracing: Introduce saved_cmdlines_size file")
      introduced ability to change saved cmdlines size. This resized saved
      command lines but missed resizing tgid mapping as well.
      
      Another issue is that when the resize happens, it removes saved command
      lines and reallocates new memory for it. This introduced a race
      condition when reading the global savecmd as this can be freed in the
      middle of accessing it causing a use after free access. Fix this by
      implementing locking.
      
      Signed-off-by: default avatarAdrian Salido <salidoa@google.com>
      Bug: 36007735
      Change-Id: I334791ac35f8bcbd34362ed112aa624275a46947
      (cherry picked from commit 7116d306)
      ac941ef6
    • Mark Salyzyn's avatar
      Bluetooth: hidp: buffer overflow in hidp_process_report · 8a67b428
      Mark Salyzyn authored
      
      commit 7992c188 upstream.
      
      CVE-2018-9363
      
      The buffer length is unsigned at all layers, but gets cast to int and
      checked in hidp_process_report and can lead to a buffer overflow.
      Switch len parameter to unsigned int to resolve issue.
      
      This affects 3.18 and newer kernels.
      
      Signed-off-by: default avatarMark Salyzyn <salyzyn@android.com>
      Fixes: a4b1b587 ("HID: Bluetooth: hidp: make sure input buffers are big enough")
      Cc: Marcel Holtmann <marcel@holtmann.org>
      Cc: Johan Hedberg <johan.hedberg@gmail.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
      Cc: linux-bluetooth@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: security@kernel.org
      Cc: kernel-team@android.com
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8a67b428
  11. Oct 04, 2018
  12. Sep 14, 2018
  13. Aug 08, 2018
  14. Aug 06, 2018
Loading