1. 02 May, 2020 40 commits
    • Xiyu Yang's avatar
      staging: comedi: Fix comedi_device refcnt leak in comedi_open · 264274de
      Xiyu Yang authored
      commit 332e0e17 upstream.
      
      comedi_open() invokes comedi_dev_get_from_minor(), which returns a
      reference of the COMEDI device to "dev" with increased refcount.
      
      When comedi_open() returns, "dev" becomes invalid, so the refcount
      should be decreased to keep refcount balanced.
      
      The reference counting issue happens in one exception handling path of
      comedi_open(). When "cfp" allocation is failed, the refcnt increased by
      comedi_dev_get_from_minor() is not decreased, causing a refcnt leak.
      
      Fix this issue by calling comedi_dev_put() on this error path when "cfp"
      allocation is failed.
      
      Fixes: 20f083c0 ("staging: comedi: prepare support for per-file read and write subdevices")
      Signed-off-by: default avatarXiyu Yang <xiyuyang19@fudan.edu.cn>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarXin Tan <tanxin.ctf@gmail.com>
      Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
      Link: https://lore.kernel.org/r/1587361459-83622-1-git-send-email-xiyuyang19@fudan.edu.cnSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      264274de
    • Ian Abbott's avatar
      staging: comedi: dt2815: fix writing hi byte of analog output · 607dd7b7
      Ian Abbott authored
      commit ed87d33d upstream.
      
      The DT2815 analog output command is 16 bits wide, consisting of the
      12-bit sample value in bits 15 to 4, the channel number in bits 3 to 1,
      and a voltage or current selector in bit 0.  Both bytes of the 16-bit
      command need to be written in turn to a single 8-bit data register.
      However, the driver currently only writes the low 8-bits.  It is broken
      and appears to have always been broken.
      
      Electronic copies of the DT2815 User's Manual seem impossible to find
      online, but looking at the source code, a best guess for the sequence
      the driver intended to use to write the analog output command is as
      follows:
      
      1. Wait for the status register to read 0x00.
      2. Write the low byte of the command to the data register.
      3. Wait for the status register to read 0x80.
      4. Write the high byte of the command to the data register.
      
      Step 4 is missing from the driver.  Add step 4 to (hopefully) fix the
      driver.
      
      Also add a "FIXME" comment about setting bit 0 of the low byte of the
      command.  Supposedly, it is used to choose between voltage output and
      current output, but the current driver always sets it to 1.
      Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20200406142015.126982-1-abbotti@mev.co.ukSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      607dd7b7
    • Ahmad Fatoum's avatar
      ARM: imx: provide v7_cpu_resume() only on ARM_CPU_SUSPEND=y · e454dc86
      Ahmad Fatoum authored
      commit f1baca88 upstream.
      
      512a928a ("ARM: imx: build v7_cpu_resume() unconditionally")
      introduced an unintended linker error for i.MX6 configurations that have
      ARM_CPU_SUSPEND=n which can happen if neither CONFIG_PM, CONFIG_CPU_IDLE,
      nor ARM_PSCI_FW are selected.
      
      Fix this by having v7_cpu_resume() compiled only when cpu_resume() it
      calls is available as well.
      
      The C declaration for the function remains unguarded to avoid future code
      inadvertently using a stub and introducing a regression to the bug the
      original commit fixed.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 512a928a ("ARM: imx: build v7_cpu_resume() unconditionally")
      Reported-by: default avatarClemens Gruber <clemens.gruber@pqgruber.com>
      Signed-off-by: default avatarAhmad Fatoum <a.fatoum@pengutronix.de>
      Tested-by: default avatarRoland Hieber <rhi@pengutronix.de>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e454dc86
    • Gyeongtaek Lee's avatar
      ASoC: dapm: fixup dapm kcontrol widget · 90c75e8c
      Gyeongtaek Lee authored
      commit ebf14747 upstream.
      
      snd_soc_dapm_kcontrol widget which is created by autodisable control
      should contain correct on_val, mask and shift because it is set when the
      widget is powered and changed value is applied on registers by following
      code in dapm_seq_run_coalesced().
      
      		mask |= w->mask << w->shift;
      		if (w->power)
      			value |= w->on_val << w->shift;
      		else
      			value |= w->off_val << w->shift;
      
      Shift on the mask in dapm_kcontrol_data_alloc() is removed to prevent
      double shift.
      And, on_val in dapm_kcontrol_set_value() is modified to get correct
      value in the dapm_seq_run_coalesced().
      Signed-off-by: default avatarGyeongtaek Lee <gt82.lee@samsung.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/000001d61537$b212f620$1638e260$@samsung.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      90c75e8c
    • Paul Moore's avatar
      audit: check the length of userspace generated audit records · 3fb1c816
      Paul Moore authored
      commit 763dafc5 upstream.
      
      Commit 75612528 ("audit: always check the netlink payload length
      in audit_receive_msg()") fixed a number of missing message length
      checks, but forgot to check the length of userspace generated audit
      records.  The good news is that you need CAP_AUDIT_WRITE to submit
      userspace audit records, which is generally only given to trusted
      processes, so the impact should be limited.
      
      Cc: stable@vger.kernel.org
      Fixes: 75612528 ("audit: always check the netlink payload length in audit_receive_msg()")
      Reported-by: syzbot+49e69b4d71a420ceda3e@syzkaller.appspotmail.com
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3fb1c816
    • Alan Stern's avatar
      usb-storage: Add unusual_devs entry for JMicron JMS566 · be76ff05
      Alan Stern authored
      commit 94f9c8c3 upstream.
      
      Cyril Roelandt reports that his JMicron JMS566 USB-SATA bridge fails
      to handle WRITE commands with the FUA bit set, even though it claims
      to support FUA.  (Oddly enough, a later version of the same bridge,
      version 2.03 as opposed to 1.14, doesn't claim to support FUA.  Also
      oddly, the bridge _does_ support FUA when using the UAS transport
      instead of the Bulk-Only transport -- but this device was blacklisted
      for uas in commit bc3bdb12 ("usb-storage: Disable UAS on JMicron
      SATA enclosure") for apparently unrelated reasons.)
      
      This patch adds a usb-storage unusual_devs entry with the BROKEN_FUA
      flag.  This allows the bridge to work properly with usb-storage.
      Reported-and-tested-by: default avatarCyril Roelandt <tipecaml@gmail.com>
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      CC: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/Pine.LNX.4.44L0.2004221613110.11262-100000@iolanthe.rowland.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      be76ff05
    • Jiri Slaby's avatar
      tty: rocket, avoid OOB access · 315ecf50
      Jiri Slaby authored
      commit 7127d243 upstream.
      
      init_r_port can access pc104 array out of bounds. pc104 is a 2D array
      defined to have 4 members. Each member has 8 submembers.
      * we can have more than 4 (PCI) boards, i.e. [board] can be OOB
      * line is not modulo-ed by anything, so the first line on the second
        board can be 4, on the 3rd 12 or alike (depending on previously
        registered boards). It's zero only on the first line of the first
        board. So even [line] can be OOB, quite soon (with the 2nd registered
        board already).
      
      This code is broken for ages, so just avoid the OOB accesses and don't
      try to fix it as we would need to find out the correct line number. Use
      the default: RS232, if we are out.
      
      Generally, if anyone needs to set the interface types, a module parameter
      is past the last thing that should be used for this purpose. The
      parameters' description says it's for ISA cards anyway.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: stable <stable@vger.kernel.org>
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Link: https://lore.kernel.org/r/20200417105959.15201-2-jslaby@suse.czSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      315ecf50
    • Andrew Melnychenko's avatar
      tty: hvc: fix buffer overflow during hvc_alloc(). · 8ecdbc14
      Andrew Melnychenko authored
      commit 9a9fc42b upstream.
      
      If there is a lot(more then 16) of virtio-console devices
      or virtio_console module is reloaded
      - buffers 'vtermnos' and 'cons_ops' are overflowed.
      In older kernels it overruns spinlock which leads to kernel freezing:
      https://bugzilla.redhat.com/show_bug.cgi?id=1786239
      
      To reproduce the issue, you can try simple script that
      loads/unloads module. Something like this:
      while [ 1 ]
      do
        modprobe virtio_console
        sleep 2
        modprobe -r virtio_console
        sleep 2
      done
      
      Description of problem:
      Guest get 'Call Trace' when loading module "virtio_console"
      and unloading it frequently - clearly reproduced on kernel-4.18.0:
      
      [   81.498208] ------------[ cut here ]------------
      [   81.499263] pvqspinlock: lock 0xffffffff92080020 has corrupted value 0xc0774ca0!
      [   81.501000] WARNING: CPU: 0 PID: 785 at kernel/locking/qspinlock_paravirt.h:500 __pv_queued_spin_unlock_slowpath+0xc0/0xd0
      [   81.503173] Modules linked in: virtio_console fuse xt_CHECKSUM ipt_MASQUERADE xt_conntrack ipt_REJECT nft_counter nf_nat_tftp nft_objref nf_conntrack_tftp tun bridge stp llc nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nf_tables_set nft_chain_nat_ipv6 nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 nft_chain_route_ipv6 nft_chain_nat_ipv4 nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack nft_chain_route_ipv4 ip6_tables nft_compat ip_set nf_tables nfnetlink sunrpc bochs_drm drm_vram_helper ttm drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm i2c_piix4 pcspkr crct10dif_pclmul crc32_pclmul joydev ghash_clmulni_intel ip_tables xfs libcrc32c sd_mod sg ata_generic ata_piix virtio_net libata crc32c_intel net_failover failover serio_raw virtio_scsi dm_mirror dm_region_hash dm_log dm_mod [last unloaded: virtio_console]
      [   81.517019] CPU: 0 PID: 785 Comm: kworker/0:2 Kdump: loaded Not tainted 4.18.0-167.el8.x86_64 #1
      [   81.518639] Hardware name: Red Hat KVM, BIOS 1.12.0-5.scrmod+el8.2.0+5159+d8aa4d83 04/01/2014
      [   81.520205] Workqueue: events control_work_handler [virtio_console]
      [   81.521354] RIP: 0010:__pv_queued_spin_unlock_slowpath+0xc0/0xd0
      [   81.522450] Code: 07 00 48 63 7a 10 e8 bf 64 f5 ff 66 90 c3 8b 05 e6 cf d6 01 85 c0 74 01 c3 8b 17 48 89 fe 48 c7 c7 38 4b 29 91 e8 3a 6c fa ff <0f> 0b c3 0f 0b 90 90 90 90 90 90 90 90 90 90 90 0f 1f 44 00 00 48
      [   81.525830] RSP: 0018:ffffb51a01ffbd70 EFLAGS: 00010282
      [   81.526798] RAX: 0000000000000000 RBX: 0000000000000010 RCX: 0000000000000000
      [   81.528110] RDX: ffff9e66f1826480 RSI: ffff9e66f1816a08 RDI: ffff9e66f1816a08
      [   81.529437] RBP: ffffffff9153ff10 R08: 000000000000026c R09: 0000000000000053
      [   81.530732] R10: 0000000000000000 R11: ffffb51a01ffbc18 R12: ffff9e66cd682200
      [   81.532133] R13: ffffffff9153ff10 R14: ffff9e6685569500 R15: ffff9e66cd682000
      [   81.533442] FS:  0000000000000000(0000) GS:ffff9e66f1800000(0000) knlGS:0000000000000000
      [   81.534914] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   81.535971] CR2: 00005624c55b14d0 CR3: 00000003a023c000 CR4: 00000000003406f0
      [   81.537283] Call Trace:
      [   81.537763]  __raw_callee_save___pv_queued_spin_unlock_slowpath+0x11/0x20
      [   81.539011]  .slowpath+0x9/0xe
      [   81.539585]  hvc_alloc+0x25e/0x300
      [   81.540237]  init_port_console+0x28/0x100 [virtio_console]
      [   81.541251]  handle_control_message.constprop.27+0x1c4/0x310 [virtio_console]
      [   81.542546]  control_work_handler+0x70/0x10c [virtio_console]
      [   81.543601]  process_one_work+0x1a7/0x3b0
      [   81.544356]  worker_thread+0x30/0x390
      [   81.545025]  ? create_worker+0x1a0/0x1a0
      [   81.545749]  kthread+0x112/0x130
      [   81.546358]  ? kthread_flush_work_fn+0x10/0x10
      [   81.547183]  ret_from_fork+0x22/0x40
      [   81.547842] ---[ end trace aa97649bd16c8655 ]---
      [   83.546539] general protection fault: 0000 [#1] SMP NOPTI
      [   83.547422] CPU: 5 PID: 3225 Comm: modprobe Kdump: loaded Tainted: G        W        --------- -  - 4.18.0-167.el8.x86_64 #1
      [   83.549191] Hardware name: Red Hat KVM, BIOS 1.12.0-5.scrmod+el8.2.0+5159+d8aa4d83 04/01/2014
      [   83.550544] RIP: 0010:__pv_queued_spin_lock_slowpath+0x19a/0x2a0
      [   83.551504] Code: c4 c1 ea 12 41 be 01 00 00 00 4c 8d 6d 14 41 83 e4 03 8d 42 ff 49 c1 e4 05 48 98 49 81 c4 40 a5 02 00 4c 03 24 c5 60 48 34 91 <49> 89 2c 24 b8 00 80 00 00 eb 15 84 c0 75 0a 41 0f b6 54 24 14 84
      [   83.554449] RSP: 0018:ffffb51a0323fdb0 EFLAGS: 00010202
      [   83.555290] RAX: 000000000000301c RBX: ffffffff92080020 RCX: 0000000000000001
      [   83.556426] RDX: 000000000000301d RSI: 0000000000000000 RDI: 0000000000000000
      [   83.557556] RBP: ffff9e66f196a540 R08: 000000000000028a R09: ffff9e66d2757788
      [   83.558688] R10: 0000000000000000 R11: 0000000000000000 R12: 646e61725f770b07
      [   83.559821] R13: ffff9e66f196a554 R14: 0000000000000001 R15: 0000000000180000
      [   83.560958] FS:  00007fd5032e8740(0000) GS:ffff9e66f1940000(0000) knlGS:0000000000000000
      [   83.562233] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   83.563149] CR2: 00007fd5022b0da0 CR3: 000000038c334000 CR4: 00000000003406e0
      Signed-off-by: default avatarAndrew Melnychenko <andrew@daynix.com>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20200414191503.3471783-1-andrew@daynix.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8ecdbc14
    • Uros Bizjak's avatar
      KVM: VMX: Enable machine check support for 32bit targets · f497d009
      Uros Bizjak authored
      commit fb56baae upstream.
      
      There is no reason to limit the use of do_machine_check
      to 64bit targets. MCE handling works for both target familes.
      
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Sean Christopherson <sean.j.christopherson@intel.com>
      Cc: stable@vger.kernel.org
      Fixes: a0861c02 ("KVM: Add VT-x machine check support")
      Signed-off-by: default avatarUros Bizjak <ubizjak@gmail.com>
      Message-Id: <20200414071414.45636-1-ubizjak@gmail.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f497d009
    • Sean Christopherson's avatar
      KVM: Check validity of resolved slot when searching memslots · a57c01c5
      Sean Christopherson authored
      commit b6467ab1 upstream.
      
      Check that the resolved slot (somewhat confusingly named 'start') is a
      valid/allocated slot before doing the final comparison to see if the
      specified gfn resides in the associated slot.  The resolved slot can be
      invalid if the binary search loop terminated because the search index
      was incremented beyond the number of used slots.
      
      This bug has existed since the binary search algorithm was introduced,
      but went unnoticed because KVM statically allocated memory for the max
      number of slots, i.e. the access would only be truly out-of-bounds if
      all possible slots were allocated and the specified gfn was less than
      the base of the lowest memslot.  Commit 36947254 ("KVM: Dynamically
      size memslot array based on number of used slots") eliminated the "all
      possible slots allocated" condition and made the bug embarrasingly easy
      to hit.
      
      Fixes: 9c1a5d38 ("kvm: optimize GFN to memslot lookup with large slots amount")
      Reported-by: syzbot+d889b59b2bb87d4047a2@syzkaller.appspotmail.com
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
      Message-Id: <20200408064059.8957-2-sean.j.christopherson@intel.com>
      Reviewed-by: default avatarCornelia Huck <cohuck@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a57c01c5
    • Jarkko Sakkinen's avatar
      tpm/tpm_tis: Free IRQ if probing fails · e1022704
      Jarkko Sakkinen authored
      commit b160c94b upstream.
      
      Call disable_interrupts() if we have to revert to polling in order not to
      unnecessarily reserve the IRQ for the life-cycle of the driver.
      
      Cc: stable@vger.kernel.org # 4.5.x
      Reported-by: default avatarHans de Goede <hdegoede@redhat.com>
      Fixes: e3837e74 ("tpm_tis: Refactor the interrupt setup")
      Signed-off-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e1022704
    • Alexander Tsoy's avatar
      ALSA: usb-audio: Filter out unsupported sample rates on Focusrite devices · b0fb9cbf
      Alexander Tsoy authored
      commit 1c826792 upstream.
      
      Many Focusrite devices supports a limited set of sample rates per
      altsetting. These includes audio interfaces with ADAT ports:
       - Scarlett 18i6, 18i8 1st gen, 18i20 1st gen;
       - Scarlett 18i8 2nd gen, 18i20 2nd gen;
       - Scarlett 18i8 3rd gen, 18i20 3rd gen;
       - Clarett 2Pre USB, 4Pre USB, 8Pre USB.
      
      Maximum rate is exposed in the last 4 bytes of Format Type descriptor
      which has a non-standard bLength = 10.
      Tested-by: default avatarAlexey Skobkin <skobkin-ru@ya.ru>
      Signed-off-by: default avatarAlexander Tsoy <alexander@tsoy.me>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20200418175815.12211-1-alexander@tsoy.meSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b0fb9cbf
    • Xiyu Yang's avatar
      ALSA: usb-audio: Fix usb audio refcnt leak when getting spdif · 0c29feae
      Xiyu Yang authored
      commit 59e1947c upstream.
      
      snd_microii_spdif_default_get() invokes snd_usb_lock_shutdown(), which
      increases the refcount of the snd_usb_audio object "chip".
      
      When snd_microii_spdif_default_get() returns, local variable "chip"
      becomes invalid, so the refcount should be decreased to keep refcount
      balanced.
      
      The reference counting issue happens in several exception handling paths
      of snd_microii_spdif_default_get(). When those error scenarios occur
      such as usb_ifnum_to_if() returns NULL, the function forgets to decrease
      the refcnt increased by snd_usb_lock_shutdown(), causing a refcnt leak.
      
      Fix this issue by jumping to "end" label when those error scenarios
      occur.
      
      Fixes: 447d6275 ("ALSA: usb-audio: Add sanity checks for endpoint accesses")
      Signed-off-by: default avatarXiyu Yang <xiyuyang19@fudan.edu.cn>
      Signed-off-by: default avatarXin Tan <tanxin.ctf@gmail.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/1587617711-13200-1-git-send-email-xiyuyang19@fudan.edu.cnSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0c29feae
    • Takashi Iwai's avatar
      ALSA: usx2y: Fix potential NULL dereference · 7a89acb1
      Takashi Iwai authored
      commit 7686e348 upstream.
      
      The error handling code in usX2Y_rate_set() may hit a potential NULL
      dereference when an error occurs before allocating all us->urb[].
      Add a proper NULL check for fixing the corner case.
      Reported-by: default avatarLin Yi <teroincn@gmail.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20200420075529.27203-1-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7a89acb1
    • Jann Horn's avatar
      vmalloc: fix remap_vmalloc_range() bounds checks · f8e84d7a
      Jann Horn authored
      commit bdebd6a2 upstream.
      
      remap_vmalloc_range() has had various issues with the bounds checks it
      promises to perform ("This function checks that addr is a valid
      vmalloc'ed area, and that it is big enough to cover the vma") over time,
      e.g.:
      
       - not detecting pgoff<<PAGE_SHIFT overflow
      
       - not detecting (pgoff<<PAGE_SHIFT)+usize overflow
      
       - not checking whether addr and addr+(pgoff<<PAGE_SHIFT) are the same
         vmalloc allocation
      
       - comparing a potentially wildly out-of-bounds pointer with the end of
         the vmalloc region
      
      In particular, since commit fc970227 ("bpf: Add mmap() support for
      BPF_MAP_TYPE_ARRAY"), unprivileged users can cause kernel null pointer
      dereferences by calling mmap() on a BPF map with a size that is bigger
      than the distance from the start of the BPF map to the end of the
      address space.
      
      This could theoretically be used as a kernel ASLR bypass, by using
      whether mmap() with a given offset oopses or returns an error code to
      perform a binary search over the possible address range.
      
      To allow remap_vmalloc_range_partial() to verify that addr and
      addr+(pgoff<<PAGE_SHIFT) are in the same vmalloc region, pass the offset
      to remap_vmalloc_range_partial() instead of adding it to the pointer in
      remap_vmalloc_range().
      
      In remap_vmalloc_range_partial(), fix the check against
      get_vm_area_size() by using size comparisons instead of pointer
      comparisons, and add checks for pgoff.
      
      Fixes: 83342314 ("[PATCH] mm: introduce remap_vmalloc_range()")
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: stable@vger.kernel.org
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: Andrii Nakryiko <andriin@fb.com>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: KP Singh <kpsingh@chromium.org>
      Link: http://lkml.kernel.org/r/20200415222312.236431-1-jannh@google.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f8e84d7a
    • Jason Gunthorpe's avatar
      overflow.h: Add arithmetic shift helper · e00b056f
      Jason Gunthorpe authored
      commit 0c668477 upstream.
      
      Add shift_overflow() helper to assist driver authors in ensuring that
      shift operations don't cause overflows or other odd conditions.
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      [kees: tweaked comments and commit log, dropped unneeded assignment]
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e00b056f
    • Alan Stern's avatar
      USB: hub: Fix handling of connect changes during sleep · fcef2fd0
      Alan Stern authored
      commit 9f952e26 upstream.
      
      Commit 8099f58f ("USB: hub: Don't record a connect-change event
      during reset-resume") wasn't very well conceived.  The problem it
      tried to fix was that if a connect-change event occurred while the
      system was asleep (such as a device disconnecting itself from the bus
      when it is suspended and then reconnecting when it resumes)
      requiring a reset-resume during the system wakeup transition, the hub
      port's change_bit entry would remain set afterward.  This would cause
      the hub driver to believe another connect-change event had occurred
      after the reset-resume, which was wrong and would lead the driver to
      send unnecessary requests to the device (which could interfere with a
      firmware update).
      
      The commit tried to fix this by not setting the change_bit during the
      wakeup.  But this was the wrong thing to do; it means that when a
      device is unplugged while the system is asleep, the hub driver doesn't
      realize anything has happened: The change_bit flag which would tell it
      to handle the disconnect event is clear.
      
      The commit needs to be reverted and the problem fixed in a different
      way.  Fortunately an alternative solution was noted in the commit's
      Changelog: We can continue to set the change_bit entry in
      hub_activate() but then clear it when a reset-resume occurs.  That way
      the the hub driver will see the change_bit when a device is
      disconnected but won't see it when the device is still present.
      
      That's what this patch does.
      Reported-and-tested-by: default avatarPeter Chen <peter.chen@nxp.com>
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Fixes: 8099f58f ("USB: hub: Don't record a connect-change event during reset-resume")
      Tested-by: default avatarPaul Zimmerman <pauldzim@gmail.com>
      CC: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/Pine.LNX.4.44L0.2004221602480.11262-100000@iolanthe.rowland.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fcef2fd0
    • Alan Stern's avatar
      USB: core: Fix free-while-in-use bug in the USB S-Glibrary · ab20e851
      Alan Stern authored
      commit 056ad39e upstream.
      
      FuzzUSB (a variant of syzkaller) found a free-while-still-in-use bug
      in the USB scatter-gather library:
      
      BUG: KASAN: use-after-free in atomic_read
      include/asm-generic/atomic-instrumented.h:26 [inline]
      BUG: KASAN: use-after-free in usb_hcd_unlink_urb+0x5f/0x170
      drivers/usb/core/hcd.c:1607
      Read of size 4 at addr ffff888065379610 by task kworker/u4:1/27
      
      CPU: 1 PID: 27 Comm: kworker/u4:1 Not tainted 5.5.11 #2
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
      1.10.2-1ubuntu1 04/01/2014
      Workqueue: scsi_tmf_2 scmd_eh_abort_handler
      Call Trace:
       __dump_stack lib/dump_stack.c:77 [inline]
       dump_stack+0xce/0x128 lib/dump_stack.c:118
       print_address_description.constprop.4+0x21/0x3c0 mm/kasan/report.c:374
       __kasan_report+0x153/0x1cb mm/kasan/report.c:506
       kasan_report+0x12/0x20 mm/kasan/common.c:639
       check_memory_region_inline mm/kasan/generic.c:185 [inline]
       check_memory_region+0x152/0x1b0 mm/kasan/generic.c:192
       __kasan_check_read+0x11/0x20 mm/kasan/common.c:95
       atomic_read include/asm-generic/atomic-instrumented.h:26 [inline]
       usb_hcd_unlink_urb+0x5f/0x170 drivers/usb/core/hcd.c:1607
       usb_unlink_urb+0x72/0xb0 drivers/usb/core/urb.c:657
       usb_sg_cancel+0x14e/0x290 drivers/usb/core/message.c:602
       usb_stor_stop_transport+0x5e/0xa0 drivers/usb/storage/transport.c:937
      
      This bug occurs when cancellation of the S-G transfer races with
      transfer completion.  When that happens, usb_sg_cancel() may continue
      to access the transfer's URBs after usb_sg_wait() has freed them.
      
      The bug is caused by the fact that usb_sg_cancel() does not take any
      sort of reference to the transfer, and so there is nothing to prevent
      the URBs from being deallocated while the routine is trying to use
      them.  The fix is to take such a reference by incrementing the
      transfer's io->count field while the cancellation is in progres and
      decrementing it afterward.  The transfer's URBs are not deallocated
      until io->complete is triggered, which happens when io->count reaches
      zero.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Reported-and-tested-by: default avatarKyungtae Kim <kt0755@gmail.com>
      CC: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/Pine.LNX.4.44L0.2003281615140.14837-100000@netrider.rowland.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ab20e851
    • Jonathan Cox's avatar
      USB: Add USB_QUIRK_DELAY_CTRL_MSG and USB_QUIRK_DELAY_INIT for Corsair K70 RGB RAPIDFIRE · 37de96d2
      Jonathan Cox authored
      commit be34a585 upstream.
      
      The Corsair K70 RGB RAPIDFIRE needs the USB_QUIRK_DELAY_INIT and
      USB_QUIRK_DELAY_CTRL_MSG to function or it will randomly not
      respond on boot, just like other Corsair keyboards
      Signed-off-by: default avatarJonathan Cox <jonathan@jdcox.net>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20200410212427.2886-1-jonathan@jdcox.netSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      37de96d2
    • Changming Liu's avatar
      USB: sisusbvga: Change port variable from signed to unsigned · f14c64ef
      Changming Liu authored
      commit 2df7405f upstream.
      
      Change a bunch of arguments of wrapper functions which pass signed
      integer to an unsigned integer which might cause undefined behaviors
      when sign integer overflow.
      Signed-off-by: default avatarChangming Liu <liu.changm@northeastern.edu>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/BL0PR06MB45482D71EA822D75A0E60A2EE5D50@BL0PR06MB4548.namprd06.prod.outlook.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f14c64ef
    • Piotr Krysiuk's avatar
      fs/namespace.c: fix mountpoint reference counter race · 91e99793
      Piotr Krysiuk authored
      A race condition between threads updating mountpoint reference counter
      affects longterm releases 4.4.220, 4.9.220, 4.14.177 and 4.19.118.
      
      The mountpoint reference counter corruption may occur when:
      * one thread increments m_count member of struct mountpoint
        [under namespace_sem, but not holding mount_lock]
          pivot_root()
      * another thread simultaneously decrements the same m_count
        [under mount_lock, but not holding namespace_sem]
          put_mountpoint()
            unhash_mnt()
              umount_mnt()
                mntput_no_expire()
      
      To fix this race condition, grab mount_lock before updating m_count in
      pivot_root().
      
      Reference: CVE-2020-12114
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarPiotr Krysiuk <piotras@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      91e99793
    • Lars-Peter Clausen's avatar
      iio: xilinx-xadc: Fix sequencer configuration for aux channels in simultaneous mode · 3d275f16
      Lars-Peter Clausen authored
      commit 8bef455c upstream.
      
      The XADC has two internal ADCs. Depending on the mode it is operating in
      either one or both of them are used. The device manual calls this
      continuous (one ADC) and simultaneous (both ADCs) mode.
      
      The meaning of the sequencing register for the aux channels changes
      depending on the mode.
      
      In continuous mode each bit corresponds to one of the 16 aux channels. And
      the single ADC will convert them one by one in order.
      
      In simultaneous mode the aux channels are split into two groups the first 8
      channels are assigned to the first ADC and the other 8 channels to the
      second ADC. The upper 8 bits of the sequencing register are unused and the
      lower 8 bits control both ADCs. This means a bit needs to be set if either
      the corresponding channel from the first group or the second group (or
      both) are set.
      
      Currently the driver does not have the special handling required for
      simultaneous mode. Add it.
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Fixes: bdc8cda1 ("iio:adc: Add Xilinx XADC driver")
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3d275f16
    • Lars-Peter Clausen's avatar
      iio: xilinx-xadc: Fix clearing interrupt when enabling trigger · 066bb358
      Lars-Peter Clausen authored
      commit f954b098 upstream.
      
      When enabling the trigger and unmasking the end-of-sequence (EOS) interrupt
      the EOS interrupt should be cleared from the status register. Otherwise it
      is possible that it was still set from a previous capture. If that is the
      case the interrupt would fire immediately even though no conversion has
      been done yet and stale data is being read from the device.
      
      The old code only clears the interrupt if the interrupt was previously
      unmasked. Which does not make much sense since the interrupt is always
      masked at this point and in addition masking the interrupt does not clear
      the interrupt from the status register. So the clearing needs to be done
      unconditionally.
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Fixes: bdc8cda1 ("iio:adc: Add Xilinx XADC driver")
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      066bb358
    • Lars-Peter Clausen's avatar
      iio: xilinx-xadc: Fix ADC-B powerdown · 41208288
      Lars-Peter Clausen authored
      commit e44ec779 upstream.
      
      The check for shutting down the second ADC is inverted. This causes it to
      be powered down when it should be enabled. As a result channels that are
      supposed to be handled by the second ADC return invalid conversion results.
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Fixes: bdc8cda1 ("iio:adc: Add Xilinx XADC driver")
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      41208288
    • Takashi Iwai's avatar
      ALSA: hda: Remove ASUS ROG Zenith from the blacklist · cfd559a9
      Takashi Iwai authored
      [ Upstream commit a8cf44f0 ]
      
      The commit 3c6fd1f0 ("ALSA: hda: Add driver blacklist") added a
      new blacklist for the devices that are known to have empty codecs, and
      one of the entries was ASUS ROG Zenith II (PCI SSID 1043:874f).
      However, it turned out that the very same PCI SSID is used for the
      previous model that does have the valid HD-audio codecs and the change
      broke the sound on it.
      
      This patch reverts the corresponding entry as a temporary solution.
      Although Zenith II and co will see get the empty HD-audio bus again,
      it'd be merely resource wastes and won't affect the functionality,
      so it's no end of the world.  We'll need to address this later,
      e.g. by either switching to DMI string matching or using PCI ID &
      SSID pairs.
      
      Fixes: 3c6fd1f0 ("ALSA: hda: Add driver blacklist")
      Reported-by: default avatarJohnathan Smithinovic <johnathan.smithinovic@gmx.at>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20200419071926.22683-1-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cfd559a9
    • David Ahern's avatar
      xfrm: Always set XFRM_TRANSFORMED in xfrm{4,6}_output_finish · d95f959a
      David Ahern authored
      [ Upstream commit 0c922a48 ]
      
      IPSKB_XFRM_TRANSFORMED and IP6SKB_XFRM_TRANSFORMED are skb flags set by
      xfrm code to tell other skb handlers that the packet has been passed
      through the xfrm output functions. Simplify the code and just always
      set them rather than conditionally based on netfilter enabled thus
      making the flag available for other users.
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d95f959a
    • Florian Fainelli's avatar
      net: dsa: b53: Fix ARL register definitions · 4245e14e
      Florian Fainelli authored
      [ Upstream commit c2e77a18 ]
      
      The ARL {MAC,VID} tuple and the forward entry were off by 0x10 bytes,
      which means that when we read/wrote from/to ARL bin index 0, we were
      actually accessing the ARLA_RWCTRL register.
      
      Fixes: 1da6df85 ("net: dsa: b53: Implement ARL add/del/dump operations")
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4245e14e
    • Taehee Yoo's avatar
      team: fix hang in team_mode_get() · edd12ef9
      Taehee Yoo authored
      [ Upstream commit 1c30fbc7 ]
      
      When team mode is changed or set, the team_mode_get() is called to check
      whether the mode module is inserted or not. If the mode module is not
      inserted, it calls the request_module().
      In the request_module(), it creates a child process, which is
      the "modprobe" process and waits for the done of the child process.
      At this point, the following locks were used.
      down_read(&cb_lock()); by genl_rcv()
          genl_lock(); by genl_rcv_msc()
              rtnl_lock(); by team_nl_cmd_options_set()
                  mutex_lock(&team->lock); by team_nl_team_get()
      
      Concurrently, the team module could be removed by rmmod or "modprobe -r"
      The __exit function of team module is team_module_exit(), which calls
      team_nl_fini() and it tries to acquire following locks.
      down_write(&cb_lock);
          genl_lock();
      Because of the genl_lock() and cb_lock, this process can't be finished
      earlier than request_module() routine.
      
      The problem secenario.
      CPU0                                     CPU1
      team_mode_get
          request_module()
                                               modprobe -r team_mode_roundrobin
                                                           team <--(B)
              modprobe team <--(A)
                  team_mode_roundrobin
      
      By request_module(), the "modprobe team_mode_roundrobin" command
      will be executed. At this point, the modprobe process will decide
      that the team module should be inserted before team_mode_roundrobin.
      Because the team module is being removed.
      
      By the module infrastructure, the same module insert/remove operations
      can't be executed concurrently.
      So, (A) waits for (B) but (B) also waits for (A) because of locks.
      So that the hang occurs at this point.
      
      Test commands:
          while :
          do
              teamd -d &
      	killall teamd &
      	modprobe -rv team_mode_roundrobin &
          done
      
      The approach of this patch is to hold the reference count of the team
      module if the team module is compiled as a module. If the reference count
      of the team module is not zero while request_module() is being called,
      the team module will not be removed at that moment.
      So that the above scenario could not occur.
      
      Fixes: 3d249d4c ("net: introduce ethernet teaming device")
      Signed-off-by: default avatarTaehee Yoo <ap420073@gmail.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      edd12ef9
    • Eric Dumazet's avatar
      tcp: cache line align MAX_TCP_HEADER · 32004fbc
      Eric Dumazet authored
      [ Upstream commit 9bacd256 ]
      
      TCP stack is dumb in how it cooks its output packets.
      
      Depending on MAX_HEADER value, we might chose a bad ending point
      for the headers.
      
      If we align the end of TCP headers to cache line boundary, we
      make sure to always use the smallest number of cache lines,
      which always help.
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Soheil Hassas Yeganeh <soheil@google.com>
      Acked-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      32004fbc
    • Xiyu Yang's avatar
      net/x25: Fix x25_neigh refcnt leak when receiving frame · 74f971a2
      Xiyu Yang authored
      [ Upstream commit f35d1297 ]
      
      x25_lapb_receive_frame() invokes x25_get_neigh(), which returns a
      reference of the specified x25_neigh object to "nb" with increased
      refcnt.
      
      When x25_lapb_receive_frame() returns, local variable "nb" becomes
      invalid, so the refcount should be decreased to keep refcount balanced.
      
      The reference counting issue happens in one path of
      x25_lapb_receive_frame(). When pskb_may_pull() returns false, the
      function forgets to decrease the refcnt increased by x25_get_neigh(),
      causing a refcnt leak.
      
      Fix this issue by calling x25_neigh_put() when pskb_may_pull() returns
      false.
      
      Fixes: cb101ed2 ("x25: Handle undersized/fragmented skbs")
      Signed-off-by: default avatarXiyu Yang <xiyuyang19@fudan.edu.cn>
      Signed-off-by: default avatarXin Tan <tanxin.ctf@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      74f971a2
    • Xiyu Yang's avatar
      net: netrom: Fix potential nr_neigh refcnt leak in nr_add_node · 9d983585
      Xiyu Yang authored
      [ Upstream commit d03f2284 ]
      
      nr_add_node() invokes nr_neigh_get_dev(), which returns a local
      reference of the nr_neigh object to "nr_neigh" with increased refcnt.
      
      When nr_add_node() returns, "nr_neigh" becomes invalid, so the refcount
      should be decreased to keep refcount balanced.
      
      The issue happens in one normal path of nr_add_node(), which forgets to
      decrease the refcnt increased by nr_neigh_get_dev() and causes a refcnt
      leak. It should decrease the refcnt before the function returns like
      other normal paths do.
      
      Fix this issue by calling nr_neigh_put() before the nr_add_node()
      returns.
      Signed-off-by: default avatarXiyu Yang <xiyuyang19@fudan.edu.cn>
      Signed-off-by: default avatarXin Tan <tanxin.ctf@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9d983585
    • Taehee Yoo's avatar
      macvlan: fix null dereference in macvlan_device_event() · 72ddf7b1
      Taehee Yoo authored
      [ Upstream commit 4dee15b4 ]
      
      In the macvlan_device_event(), the list_first_entry_or_null() is used.
      This function could return null pointer if there is no node.
      But, the macvlan module doesn't check the null pointer.
      So, null-ptr-deref would occur.
      
            bond0
              |
         +----+-----+
         |          |
      macvlan0   macvlan1
         |          |
       dummy0     dummy1
      
      The problem scenario.
      If dummy1 is removed,
      1. ->dellink() of dummy1 is called.
      2. NETDEV_UNREGISTER of dummy1 notification is sent to macvlan module.
      3. ->dellink() of macvlan1 is called.
      4. NETDEV_UNREGISTER of macvlan1 notification is sent to bond module.
      5. __bond_release_one() is called and it internally calls
         dev_set_mac_address().
      6. dev_set_mac_address() calls the ->ndo_set_mac_address() of macvlan1,
         which is macvlan_set_mac_address().
      7. macvlan_set_mac_address() calls the dev_set_mac_address() with dummy1.
      8. NETDEV_CHANGEADDR of dummy1 is sent to macvlan module.
      9. In the macvlan_device_event(), it calls list_first_entry_or_null().
      At this point, dummy1 and macvlan1 were removed.
      So, list_first_entry_or_null() will return NULL.
      
      Test commands:
          ip netns add nst
          ip netns exec nst ip link add bond0 type bond
          for i in {0..10}
          do
              ip netns exec nst ip link add dummy$i type dummy
      	ip netns exec nst ip link add macvlan$i link dummy$i \
      		type macvlan mode passthru
      	ip netns exec nst ip link set macvlan$i master bond0
          done
          ip netns del nst
      
      Splat looks like:
      [   40.585687][  T146] general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] SMP DEI
      [   40.587249][  T146] KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
      [   40.588342][  T146] CPU: 1 PID: 146 Comm: kworker/u8:2 Not tainted 5.7.0-rc1+ #532
      [   40.589299][  T146] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
      [   40.590469][  T146] Workqueue: netns cleanup_net
      [   40.591045][  T146] RIP: 0010:macvlan_device_event+0x4e2/0x900 [macvlan]
      [   40.591905][  T146] Code: 00 00 00 00 00 fc ff df 80 3c 06 00 0f 85 45 02 00 00 48 89 da 48 b8 00 00 00 00 00 fc ff d2
      [   40.594126][  T146] RSP: 0018:ffff88806116f4a0 EFLAGS: 00010246
      [   40.594783][  T146] RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000000
      [   40.595653][  T146] RDX: 0000000000000000 RSI: ffff88806547ddd8 RDI: ffff8880540f1360
      [   40.596495][  T146] RBP: ffff88804011a808 R08: fffffbfff4fb8421 R09: fffffbfff4fb8421
      [   40.597377][  T146] R10: ffffffffa7dc2107 R11: 0000000000000000 R12: 0000000000000008
      [   40.598186][  T146] R13: ffff88804011a000 R14: ffff8880540f1000 R15: 1ffff1100c22de9a
      [   40.599012][  T146] FS:  0000000000000000(0000) GS:ffff888067800000(0000) knlGS:0000000000000000
      [   40.600004][  T146] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   40.600665][  T146] CR2: 00005572d3a807b8 CR3: 000000005fcf4003 CR4: 00000000000606e0
      [   40.601485][  T146] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [   40.602461][  T146] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [   40.603443][  T146] Call Trace:
      [   40.603871][  T146]  ? nf_tables_dump_setelem+0xa0/0xa0 [nf_tables]
      [   40.604587][  T146]  ? macvlan_uninit+0x100/0x100 [macvlan]
      [   40.605212][  T146]  ? __module_text_address+0x13/0x140
      [   40.605842][  T146]  notifier_call_chain+0x90/0x160
      [   40.606477][  T146]  dev_set_mac_address+0x28e/0x3f0
      [   40.607117][  T146]  ? netdev_notify_peers+0xc0/0xc0
      [   40.607762][  T146]  ? __module_text_address+0x13/0x140
      [   40.608440][  T146]  ? notifier_call_chain+0x90/0x160
      [   40.609097][  T146]  ? dev_set_mac_address+0x1f0/0x3f0
      [   40.609758][  T146]  dev_set_mac_address+0x1f0/0x3f0
      [   40.610402][  T146]  ? __local_bh_enable_ip+0xe9/0x1b0
      [   40.611071][  T146]  ? bond_hw_addr_flush+0x77/0x100 [bonding]
      [   40.611823][  T146]  ? netdev_notify_peers+0xc0/0xc0
      [   40.612461][  T146]  ? bond_hw_addr_flush+0x77/0x100 [bonding]
      [   40.613213][  T146]  ? bond_hw_addr_flush+0x77/0x100 [bonding]
      [   40.613963][  T146]  ? __local_bh_enable_ip+0xe9/0x1b0
      [   40.614631][  T146]  ? bond_time_in_interval.isra.31+0x90/0x90 [bonding]
      [   40.615484][  T146]  ? __bond_release_one+0x9f0/0x12c0 [bonding]
      [   40.616230][  T146]  __bond_release_one+0x9f0/0x12c0 [bonding]
      [   40.616949][  T146]  ? bond_enslave+0x47c0/0x47c0 [bonding]
      [   40.617642][  T146]  ? lock_downgrade+0x730/0x730
      [   40.618218][  T146]  ? check_flags.part.42+0x450/0x450
      [   40.618850][  T146]  ? __mutex_unlock_slowpath+0xd0/0x670
      [   40.619519][  T146]  ? trace_hardirqs_on+0x30/0x180
      [   40.620117][  T146]  ? wait_for_completion+0x250/0x250
      [   40.620754][  T146]  bond_netdev_event+0x822/0x970 [bonding]
      [   40.621460][  T146]  ? __module_text_address+0x13/0x140
      [   40.622097][  T146]  notifier_call_chain+0x90/0x160
      [   40.622806][  T146]  rollback_registered_many+0x660/0xcf0
      [   40.623522][  T146]  ? netif_set_real_num_tx_queues+0x780/0x780
      [   40.624290][  T146]  ? notifier_call_chain+0x90/0x160
      [   40.624957][  T146]  ? netdev_upper_dev_unlink+0x114/0x180
      [   40.625686][  T146]  ? __netdev_adjacent_dev_unlink_neighbour+0x30/0x30
      [   40.626421][  T146]  ? mutex_is_locked+0x13/0x50
      [   40.627016][  T146]  ? unregister_netdevice_queue+0xf2/0x240
      [   40.627663][  T146]  unregister_netdevice_many.part.134+0x13/0x1b0
      [   40.628362][  T146]  default_device_exit_batch+0x2d9/0x390
      [   40.628987][  T146]  ? unregister_netdevice_many+0x40/0x40
      [   40.629615][  T146]  ? dev_change_net_namespace+0xcb0/0xcb0
      [   40.630279][  T146]  ? prepare_to_wait_exclusive+0x2e0/0x2e0
      [   40.630943][  T146]  ? ops_exit_list.isra.9+0x97/0x140
      [   40.631554][  T146]  cleanup_net+0x441/0x890
      [ ... ]
      
      Fixes: e289fd28 ("macvlan: fix the problem when mac address changes for passthru mode")
      Reported-by: syzbot+5035b1f9dc7ea4558d5a@syzkaller.appspotmail.com
      Signed-off-by: default avatarTaehee Yoo <ap420073@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      72ddf7b1
    • Taehee Yoo's avatar
      macsec: avoid to set wrong mtu · e46d5523
      Taehee Yoo authored
      [ Upstream commit 7f327080 ]
      
      When a macsec interface is created, the mtu is calculated with the lower
      interface's mtu value.
      If the mtu of lower interface is lower than the length, which is needed
      by macsec interface, macsec's mtu value will be overflowed.
      So, if the lower interface's mtu is too low, macsec interface's mtu
      should be set to 0.
      
      Test commands:
          ip link add dummy0 mtu 10 type dummy
          ip link add macsec0 link dummy0 type macsec
          ip link show macsec0
      
      Before:
          11: macsec0@dummy0: <BROADCAST,MULTICAST,M-DOWN> mtu 4294967274
      After:
          11: macsec0@dummy0: <BROADCAST,MULTICAST,M-DOWN> mtu 0
      
      Fixes: c09440f7 ("macsec: introduce IEEE 802.1AE driver")
      Signed-off-by: default avatarTaehee Yoo <ap420073@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e46d5523
    • John Haxby's avatar
      ipv6: fix restrict IPV6_ADDRFORM operation · a737ff38
      John Haxby authored
      [ Upstream commit 82c9ae44 ]
      
      Commit b6f61189 ("ipv6: restrict IPV6_ADDRFORM operation") fixed a
      problem found by syzbot an unfortunate logic error meant that it
      also broke IPV6_ADDRFORM.
      
      Rearrange the checks so that the earlier test is just one of the series
      of checks made before moving the socket from IPv6 to IPv4.
      
      Fixes: b6f61189 ("ipv6: restrict IPV6_ADDRFORM operation")
      Signed-off-by: default avatarJohn Haxby <john.haxby@oracle.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a737ff38
    • Heiner Kallweit's avatar
      PCI/ASPM: Allow re-enabling Clock PM · 947a17f2
      Heiner Kallweit authored
      [ Upstream commit 35efea32 ]
      
      Previously Clock PM could not be re-enabled after being disabled by
      pci_disable_link_state() because clkpm_capable was reset.  Change this by
      adding a clkpm_disable field similar to aspm_disable.
      
      Link: https://lore.kernel.org/r/4e8a66db-7d53-4a66-c26c-f0037ffaa705@gmail.comSigned-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      947a17f2
    • Florian Fainelli's avatar
      pwm: bcm2835: Dynamically allocate base · 4c237ff3
      Florian Fainelli authored
      [ Upstream commit 2c25b07e ]
      
      The newer 2711 and 7211 chips have two PWM controllers and failure to
      dynamically allocate the PWM base would prevent the second PWM
      controller instance being probed for succeeding with an -EEXIST error
      from alloc_pwms().
      
      Fixes: e5a06dc5 ("pwm: Add BCM2835 PWM driver")
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Acked-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Reviewed-by: default avatarNicolas Saenz Julienne <nsaenzjulienne@suse.de>
      Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4c237ff3
    • Geert Uytterhoeven's avatar
      pwm: renesas-tpu: Fix late Runtime PM enablement · ba37c3ba
      Geert Uytterhoeven authored
      [ Upstream commit d5a3c7a4 ]
      
      Runtime PM should be enabled before calling pwmchip_add(), as PWM users
      can appear immediately after the PWM chip has been added.
      Likewise, Runtime PM should always be disabled after the removal of the
      PWM chip, even if the latter failed.
      
      Fixes: 99b82abb ("pwm: Add Renesas TPU PWM driver")
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ba37c3ba
    • Cornelia Huck's avatar
      s390/cio: avoid duplicated 'ADD' uevents · fdcb9ada
      Cornelia Huck authored
      [ Upstream commit 05ce3e53 ]
      
      The common I/O layer delays the ADD uevent for subchannels and
      delegates generating this uevent to the individual subchannel
      drivers. The io_subchannel driver will do so when the associated
      ccw_device has been registered -- but unconditionally, so more
      ADD uevents will be generated if a subchannel has been unbound
      from the io_subchannel driver and later rebound.
      
      To fix this, only generate the ADD event if uevents were still
      suppressed for the device.
      
      Fixes: fa1a8c23 ("s390: cio: Delay uevents for subchannels")
      Message-Id: <20200327124503.9794-2-cohuck@redhat.com>
      Reported-by: default avatarBoris Fiuczynski <fiuczy@linux.ibm.com>
      Reviewed-by: default avatarPeter Oberparleiter <oberpar@linux.ibm.com>
      Reviewed-by: default avatarBoris Fiuczynski <fiuczy@linux.ibm.com>
      Signed-off-by: default avatarCornelia Huck <cohuck@redhat.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fdcb9ada
    • Vasily Averin's avatar
      ipc/util.c: sysvipc_find_ipc() should increase position index · 2edb90c2
      Vasily Averin authored
      [ Upstream commit 89163f93 ]
      
      If seq_file .next function does not change position index, read after
      some lseek can generate unexpected output.
      
      https://bugzilla.kernel.org/show_bug.cgi?id=206283Signed-off-by: default avatarVasily Averin <vvs@virtuozzo.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Acked-by: default avatarWaiman Long <longman@redhat.com>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Manfred Spraul <manfred@colorfullife.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: NeilBrown <neilb@suse.com>
      Cc: Peter Oberparleiter <oberpar@linux.ibm.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Link: http://lkml.kernel.org/r/b7a20945-e315-8bb0-21e6-3875c14a8494@virtuozzo.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2edb90c2
    • Vasily Averin's avatar
      kernel/gcov/fs.c: gcov_seq_next() should increase position index · 7526678b
      Vasily Averin authored
      [ Upstream commit f4d74ef6 ]
      
      If seq_file .next function does not change position index, read after
      some lseek can generate unexpected output.
      
      https://bugzilla.kernel.org/show_bug.cgi?id=206283Signed-off-by: default avatarVasily Averin <vvs@virtuozzo.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Acked-by: default avatarPeter Oberparleiter <oberpar@linux.ibm.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Manfred Spraul <manfred@colorfullife.com>
      Cc: NeilBrown <neilb@suse.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Waiman Long <longman@redhat.com>
      Link: http://lkml.kernel.org/r/f65c6ee7-bd00-f910-2f8a-37cc67e4ff88@virtuozzo.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7526678b