Skip to content
  1. Oct 17, 2017
    • Andi Kleen's avatar
      x86/fpu: Remove the explicit clearing of XSAVE dependent features · 73e3a7d2
      Andi Kleen authored
      
      
      Clearing a CPU feature with setup_clear_cpu_cap() clears all features
      which depend on it. Expressing feature dependencies in one place is
      easier to maintain than keeping functions like
      fpu__xstate_clear_all_cpu_caps() up to date.
      
      The features which depend on XSAVE have their dependency expressed in the
      dependency table, so its sufficient to clear X86_FEATURE_XSAVE.
      
      Remove the explicit clearing of XSAVE dependent features.
      
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20171013215645.23166-6-andi@firstfloor.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      73e3a7d2
    • Andi Kleen's avatar
      x86/fpu: Make XSAVE check the base CPUID features before enabling · ccb18db2
      Andi Kleen authored
      
      
      Before enabling XSAVE, not only check the XSAVE specific CPUID bits,
      but also the base CPUID features of the respective XSAVE feature.
      This allows to disable individual XSAVE states using the existing
      clearcpuid= option, which can be useful for performance testing
      and debugging, and also in general avoids inconsistencies.
      
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20171013215645.23166-5-andi@firstfloor.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      ccb18db2
    • Andi Kleen's avatar
      x86/fpu: Parse clearcpuid= as early XSAVE argument · 0c2a3913
      Andi Kleen authored
      
      
      With a followon patch we want to make clearcpuid affect the XSAVE
      configuration. But xsave is currently initialized before arguments
      are parsed. Move the clearcpuid= parsing into the special
      early xsave argument parsing code.
      
      Since clearcpuid= contains a = we need to keep the old __setup
      around as a dummy, otherwise it would end up as a environment
      variable in init's environment.
      
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20171013215645.23166-4-andi@firstfloor.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      0c2a3913
    • Andi Kleen's avatar
      x86/cpuid: Add generic table for CPUID dependencies · 0b00de85
      Andi Kleen authored
      
      
      Some CPUID features depend on other features. Currently it's
      possible to to clear dependent features, but not clear the base features,
      which can cause various interesting problems.
      
      This patch implements a generic table to describe dependencies
      between CPUID features, to be used by all code that clears
      CPUID.
      
      Some subsystems (like XSAVE) had an own implementation of this,
      but it's better to do it all in a single place for everyone.
      
      Then clear_cpu_cap and setup_clear_cpu_cap always look up
      this table and clear all dependencies too.
      
      This is intended to be a practical table: only for features
      that make sense to clear. If someone for example clears FPU,
      or other features that are essentially part of the required
      base feature set, not much is going to work. Handling
      that is right now out of scope. We're only handling
      features which can be usefully cleared.
      
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Jonathan McDowell <noodles@earth.li>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20171013215645.23166-3-andi@firstfloor.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      0b00de85
    • Andi Kleen's avatar
      bitops: Add clear/set_bit32() to linux/bitops.h · cbe96375
      Andi Kleen authored
      
      
      Add two simple wrappers around set_bit/clear_bit() that accept
      the common case of an u32 array. This avoids writing
      casts in all callers.
      
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20171013215645.23166-2-andi@firstfloor.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      cbe96375
  2. Oct 13, 2017
    • Steven Rostedt (VMware)'s avatar
      x86/fpu/debug: Remove unused 'x86_fpu_state' and 'x86_fpu_deactivate_state' tracepoints · 127a1bea
      Steven Rostedt (VMware) authored
      Commit:
      
        d1898b73
      
       ("x86/fpu: Add tracepoints to dump FPU state at key points")
      
      ... added the 'x86_fpu_state' and 'x86_fpu_deactivate_state' trace points,
      but never used them. Today they are still not used. As they take up
      and waste memory, remove them.
      
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20171012180619.670b68b6@gandalf.local.home
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      127a1bea
    • Linus Torvalds's avatar
      Merge tag 'devprop-4.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 3d788276
      Linus Torvalds authored
      Pull device properties framework fixes from Rafael Wysocki:
       "These fix an issue related to device removal introduced during the 4.9
        cycle and fix up new functionality added recently.
      
        Specifics:
      
         - Fix a device properties management issue, introduced during the 4.9
           cycle, that causes device properties associated with a parent
           device to go away on a removal of its child in some cases (Jarkko
           Nikula).
      
         - Fix inconsistencies in error codes returned by a new function
           helper in the device properties framework depending on the
           underlying low-level firmware interface, DT or ACPI, by making the
           meaning of error codes returned in the ACPI case agree with the
           meaning of DT error codes in analogous situations (Sakari Ailus)"
      
      * tag 'devprop-4.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI: properties: Fix __acpi_node_get_property_reference() return codes
        ACPI: properties: Align return codes of __acpi_node_get_property_reference()
        device property: Track owner device of device property
      3d788276
    • Linus Torvalds's avatar
      Merge tag 'xfs-4.14-fixes-5' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux · 8ff0b97c
      Linus Torvalds authored
      Pull xfs fixes from Darrick Wong:
      
       - Fix a stale kernel memory exposure when logging inodes.
      
       - Fix some build problems with CONFIG_XFS_RT=n
      
       - Don't change inode mode if the acl write fails, leaving the file
         totally inaccessible.
      
       - Fix a dangling pointer problem when removing an attr fork under
         memory pressure.
      
       - Don't crash while trying to invalidate a null buffer associated with
         a corrupt metadata pointer.
      
      * tag 'xfs-4.14-fixes-5' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
        xfs: handle error if xfs_btree_get_bufs fails
        xfs: reinit btree pointer on attr tree inactivation walk
        xfs: Fix bool initialization/comparison
        xfs: don't change inode mode if ACL update fails
        xfs: move more RT specific code under CONFIG_XFS_RT
        xfs: Don't log uninitialised fields in inode structures
      8ff0b97c
    • NeilBrown's avatar
      scripts: fix faddr2line to work on last symbol · 2aab9c3c
      NeilBrown authored
      
      
      If faddr2line is given a function name which is the last one listed by
      "nm -n", it will fail because it never finds the next symbol.
      
      So teach the awk script to catch that possibility, and use 'size' to
      provide the end point of the last function.
      
      Signed-off-by: default avatarNeilBrown <neilb@suse.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2aab9c3c
    • Linus Torvalds's avatar
      Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs · 3206e7d5
      Linus Torvalds authored
      Pull quota fix from Jan Kara:
       "A fix for a regression in handling of quota grace times and warnings"
      
      * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
        quota: Generate warnings for DQUOT_SPACE_NOFAIL allocations
      3206e7d5
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · cbaff876
      Linus Torvalds authored
      Pull kvm fixes from Paolo Bonzini:
       "Another latent bug related to PCID, an out-of-bounds access, and a
        submaintainer change being finally made official"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        MAINTAINERS: Add Paul Mackerras as maintainer for KVM/powerpc
        KVM: nVMX: fix guest CR4 loading when emulating L2 to L1 exit
        KVM: MMU: always terminate page walks at level 1
        KVM: nVMX: update last_nonleaf_level when initializing nested EPT
      cbaff876
    • Linus Torvalds's avatar
      Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 · 73a752cc
      Linus Torvalds authored
      Pull crypto fixes from Herbert Xu:
      
       - fix crashes in skcipher/shash from zero-length input.
      
       - fix softirq GFP_KERNEL allocation in shash_setkey_unaligned.
      
       - error path bug fix in xts create function.
      
       - fix compiler warning regressions in axis and stm32
      
      * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
        crypto: shash - Fix zero-length shash ahash digest crash
        crypto: skcipher - Fix crash on zero-length input
        crypto: shash - Fix a sleep-in-atomic bug in shash_setkey_unaligned
        crypto: xts - Fix an error handling path in 'create()'
        crypto: stm32 - Try to fix hash padding
        crypto: axis - hide an unused variable
      73a752cc
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching · 0de50ea7
      Linus Torvalds authored
      Pull livepatching fix from Jiri Kosina:
      
       - bugfix for handling of coming modules (incorrect handling of failure)
         from Joe Lawrence
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching:
        livepatch: unpatch all klp_objects if klp_module_coming fails
      0de50ea7
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid · be7484ac
      Linus Torvalds authored
      Pull HID fixes from Jiri Kosina:
      
       - fix for potential out-of-bounds memory access (found by fuzzing,
         likely requires specially crafted device to trigger) by Jaejoong Kim
      
       - two new device IDs for elecom driver from Alex Manoussakis
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
        HID: hid-elecom: extend to fix descriptor for HUGE trackball
        HID: usbhid: fix out-of-bounds bug
      be7484ac
    • Linus Torvalds's avatar
      Merge tag 'sound-4.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 7702f476
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "It's been a busy week for defending the attacks from fuzzer people.
      
        This contains various USB-audio driver fixes and sequencer core fixes
        spotted by syzkaller and other fuzzer, as well as one quirk for a
        Plantronics USB audio device"
      
      * tag 'sound-4.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: caiaq: Fix stray URB at probe error path
        ALSA: seq: Fix use-after-free at creating a port
        ALSA: usb-audio: Kill stray URB at exiting
        ALSA: line6: Fix leftover URB at error-path during probe
        ALSA: line6: Fix NULL dereference at podhd_disconnect()
        ALSA: line6: Fix missing initialization before error path
        ALSA: seq: Fix copy_from_user() call inside lock
        ALSA: usb-audio: Add sample rate quirk for Plantronics P610
      7702f476
  3. Oct 12, 2017
  4. Oct 11, 2017
    • Takashi Iwai's avatar
      ALSA: caiaq: Fix stray URB at probe error path · 99fee508
      Takashi Iwai authored
      
      
      caiaq driver doesn't kill the URB properly at its error path during
      the probe, which may lead to a use-after-free error later.  This patch
      addresses it.
      
      Reported-by: default avatarJohan Hovold <johan@kernel.org>
      Reviewed-by: default avatarJohan Hovold <johan@kernel.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      99fee508
    • Alex Manoussakis's avatar
      HID: hid-elecom: extend to fix descriptor for HUGE trackball · a0933a45
      Alex Manoussakis authored
      
      
      In addition to DEFT, Elecom introduced a larger trackball called HUGE, in
      both wired (M-HT1URBK) and wireless (M-HT1DRBK) versions. It has the same
      buttons and behavior as the DEFT. This patch adds the two relevant USB IDs
      to enable operation of the three Fn buttons on the top of the device.
      
      Cc: Diego Elio Petteno <flameeyes@flameeyes.eu>
      Signed-off-by: default avatarAlex Manoussakis <amanou@gnu.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      a0933a45
    • Jaejoong Kim's avatar
      HID: usbhid: fix out-of-bounds bug · f043bfc9
      Jaejoong Kim authored
      
      
      The hid descriptor identifies the length and type of subordinate
      descriptors for a device. If the received hid descriptor is smaller than
      the size of the struct hid_descriptor, it is possible to cause
      out-of-bounds.
      
      In addition, if bNumDescriptors of the hid descriptor have an incorrect
      value, this can also cause out-of-bounds while approaching hdesc->desc[n].
      
      So check the size of hid descriptor and bNumDescriptors.
      
      	BUG: KASAN: slab-out-of-bounds in usbhid_parse+0x9b1/0xa20
      	Read of size 1 at addr ffff88006c5f8edf by task kworker/1:2/1261
      
      	CPU: 1 PID: 1261 Comm: kworker/1:2 Not tainted
      	4.14.0-rc1-42251-gebb2c2437d80 #169
      	Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
      	Workqueue: usb_hub_wq hub_event
      	Call Trace:
      	__dump_stack lib/dump_stack.c:16
      	dump_stack+0x292/0x395 lib/dump_stack.c:52
      	print_address_description+0x78/0x280 mm/kasan/report.c:252
      	kasan_report_error mm/kasan/report.c:351
      	kasan_report+0x22f/0x340 mm/kasan/report.c:409
      	__asan_report_load1_noabort+0x19/0x20 mm/kasan/report.c:427
      	usbhid_parse+0x9b1/0xa20 drivers/hid/usbhid/hid-core.c:1004
      	hid_add_device+0x16b/0xb30 drivers/hid/hid-core.c:2944
      	usbhid_probe+0xc28/0x1100 drivers/hid/usbhid/hid-core.c:1369
      	usb_probe_interface+0x35d/0x8e0 drivers/usb/core/driver.c:361
      	really_probe drivers/base/dd.c:413
      	driver_probe_device+0x610/0xa00 drivers/base/dd.c:557
      	__device_attach_driver+0x230/0x290 drivers/base/dd.c:653
      	bus_for_each_drv+0x161/0x210 drivers/base/bus.c:463
      	__device_attach+0x26e/0x3d0 drivers/base/dd.c:710
      	device_initial_probe+0x1f/0x30 drivers/base/dd.c:757
      	bus_probe_device+0x1eb/0x290 drivers/base/bus.c:523
      	device_add+0xd0b/0x1660 drivers/base/core.c:1835
      	usb_set_configuration+0x104e/0x1870 drivers/usb/core/message.c:1932
      	generic_probe+0x73/0xe0 drivers/usb/core/generic.c:174
      	usb_probe_device+0xaf/0xe0 drivers/usb/core/driver.c:266
      	really_probe drivers/base/dd.c:413
      	driver_probe_device+0x610/0xa00 drivers/base/dd.c:557
      	__device_attach_driver+0x230/0x290 drivers/base/dd.c:653
      	bus_for_each_drv+0x161/0x210 drivers/base/bus.c:463
      	__device_attach+0x26e/0x3d0 drivers/base/dd.c:710
      	device_initial_probe+0x1f/0x30 drivers/base/dd.c:757
      	bus_probe_device+0x1eb/0x290 drivers/base/bus.c:523
      	device_add+0xd0b/0x1660 drivers/base/core.c:1835
      	usb_new_device+0x7b8/0x1020 drivers/usb/core/hub.c:2457
      	hub_port_connect drivers/usb/core/hub.c:4903
      	hub_port_connect_change drivers/usb/core/hub.c:5009
      	port_event drivers/usb/core/hub.c:5115
      	hub_event+0x194d/0x3740 drivers/usb/core/hub.c:5195
      	process_one_work+0xc7f/0x1db0 kernel/workqueue.c:2119
      	worker_thread+0x221/0x1850 kernel/workqueue.c:2253
      	kthread+0x3a1/0x470 kernel/kthread.c:231
      	ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431
      
      Cc: stable@vger.kernel.org
      Reported-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Signed-off-by: default avatarJaejoong Kim <climbbb.kim@gmail.com>
      Tested-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      f043bfc9
    • Joe Lawrence's avatar
      livepatch: unpatch all klp_objects if klp_module_coming fails · ef8daf8e
      Joe Lawrence authored
      
      
      When an incoming module is considered for livepatching by
      klp_module_coming(), it iterates over multiple patches and multiple
      kernel objects in this order:
      
      	list_for_each_entry(patch, &klp_patches, list) {
      		klp_for_each_object(patch, obj) {
      
      which means that if one of the kernel objects fails to patch,
      klp_module_coming()'s error path needs to unpatch and cleanup any kernel
      objects that were already patched by a previous patch.
      
      Reported-by: default avatarMiroslav Benes <mbenes@suse.cz>
      Suggested-by: default avatarPetr Mladek <pmladek@suse.com>
      Signed-off-by: default avatarJoe Lawrence <joe.lawrence@redhat.com>
      Acked-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      ef8daf8e
    • Takashi Iwai's avatar
      ALSA: seq: Fix use-after-free at creating a port · 71105998
      Takashi Iwai authored
      
      
      There is a potential race window opened at creating and deleting a
      port via ioctl, as spotted by fuzzing.  snd_seq_create_port() creates
      a port object and returns its pointer, but it doesn't take the
      refcount, thus it can be deleted immediately by another thread.
      Meanwhile, snd_seq_ioctl_create_port() still calls the function
      snd_seq_system_client_ev_port_start() with the created port object
      that is being deleted, and this triggers use-after-free like:
      
       BUG: KASAN: use-after-free in snd_seq_ioctl_create_port+0x504/0x630 [snd_seq] at addr ffff8801f2241cb1
       =============================================================================
       BUG kmalloc-512 (Tainted: G    B          ): kasan: bad access detected
       -----------------------------------------------------------------------------
       INFO: Allocated in snd_seq_create_port+0x94/0x9b0 [snd_seq] age=1 cpu=3 pid=4511
       	___slab_alloc+0x425/0x460
       	__slab_alloc+0x20/0x40
        	kmem_cache_alloc_trace+0x150/0x190
      	snd_seq_create_port+0x94/0x9b0 [snd_seq]
      	snd_seq_ioctl_create_port+0xd1/0x630 [snd_seq]
       	snd_seq_do_ioctl+0x11c/0x190 [snd_seq]
       	snd_seq_ioctl+0x40/0x80 [snd_seq]
       	do_vfs_ioctl+0x54b/0xda0
       	SyS_ioctl+0x79/0x90
       	entry_SYSCALL_64_fastpath+0x16/0x75
       INFO: Freed in port_delete+0x136/0x1a0 [snd_seq] age=1 cpu=2 pid=4717
       	__slab_free+0x204/0x310
       	kfree+0x15f/0x180
       	port_delete+0x136/0x1a0 [snd_seq]
       	snd_seq_delete_port+0x235/0x350 [snd_seq]
       	snd_seq_ioctl_delete_port+0xc8/0x180 [snd_seq]
       	snd_seq_do_ioctl+0x11c/0x190 [snd_seq]
       	snd_seq_ioctl+0x40/0x80 [snd_seq]
       	do_vfs_ioctl+0x54b/0xda0
       	SyS_ioctl+0x79/0x90
       	entry_SYSCALL_64_fastpath+0x16/0x75
       Call Trace:
        [<ffffffff81b03781>] dump_stack+0x63/0x82
        [<ffffffff81531b3b>] print_trailer+0xfb/0x160
        [<ffffffff81536db4>] object_err+0x34/0x40
        [<ffffffff815392d3>] kasan_report.part.2+0x223/0x520
        [<ffffffffa07aadf4>] ? snd_seq_ioctl_create_port+0x504/0x630 [snd_seq]
        [<ffffffff815395fe>] __asan_report_load1_noabort+0x2e/0x30
        [<ffffffffa07aadf4>] snd_seq_ioctl_create_port+0x504/0x630 [snd_seq]
        [<ffffffffa07aa8f0>] ? snd_seq_ioctl_delete_port+0x180/0x180 [snd_seq]
        [<ffffffff8136be50>] ? taskstats_exit+0xbc0/0xbc0
        [<ffffffffa07abc5c>] snd_seq_do_ioctl+0x11c/0x190 [snd_seq]
        [<ffffffffa07abd10>] snd_seq_ioctl+0x40/0x80 [snd_seq]
        [<ffffffff8136d433>] ? acct_account_cputime+0x63/0x80
        [<ffffffff815b515b>] do_vfs_ioctl+0x54b/0xda0
        .....
      
      We may fix this in a few different ways, and in this patch, it's fixed
      simply by taking the refcount properly at snd_seq_create_port() and
      letting the caller unref the object after use.  Also, there is another
      potential use-after-free by sprintf() call in snd_seq_create_port(),
      and this is moved inside the lock.
      
      This fix covers CVE-2017-15265.
      
      Reported-and-tested-by: default avatarMichael23 Yu <ycqzsy@gmail.com>
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      71105998
    • Al Viro's avatar
      bio_copy_user_iov(): don't ignore ->iov_offset · 1cfd0ddd
      Al Viro authored
      
      
      Since "block: support large requests in blk_rq_map_user_iov" we
      started to call it with partially drained iter; that works fine
      on the write side, but reads create a copy of iter for completion
      time.  And that needs to take the possibility of ->iov_iter != 0
      into account...
      
      Cc: stable@vger.kernel.org #v4.5+
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      1cfd0ddd
    • Al Viro's avatar
      more bio_map_user_iov() leak fixes · 2b04e8f6
      Al Viro authored
      
      
      we need to take care of failure exit as well - pages already
      in bio should be dropped by analogue of bio_unmap_pages(),
      since their refcounts had been bumped only once per reference
      in bio.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      2b04e8f6