05 Mar, 2020

40 commits

  • commit 9951ebfcdf2b97dbb28a5d930458424341e61aa2 upstream.

    If nl80211_parse_he_obss_pd() fails, we leak the previously
    allocated ACL memory. Free it in this case.

    Fixes: 796e90f42b7e ("cfg80211: add support for parsing OBBS_PD attributes")
    Signed-off-by: Johannes Berg
    Link: https://lore.kernel.org/r/20200221104142.835aba4cdd14.I1923b55ba9989c57e13978f91f40bfdc45e60cbd@changeid
    Signed-off-by: Johannes Berg
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     
  • commit 3eb55e6f753a379e293395de8d5f3be28351a7f8 upstream.

    ALL_ENGINES reset doesn't clobber display with the current gvt-g
    supported platforms. Thus ALL_ENGINES reset shouldn't reset the
    display engine registers emulated by gvt-g.

    This fixes guest warning like

    [ 14.622026] [drm] Initialized i915 1.6.0 20200114 for 0000:00:03.0 on minor 0
    [ 14.967917] fbcon: i915drmfb (fb0) is primary device
    [ 25.100188] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] E RROR [CRTC:51:pipe A] flip_done timed out
    [ 25.100860] -----------[ cut here ]-----------
    [ 25.100861] pll on state mismatch (expected 0, found 1)
    [ 25.101024] WARNING: CPU: 1 PID: 30 at drivers/gpu/drm/i915/display/intel_dis play.c:14382 verify_single_dpll_state.isra.115+0x28f/0x320 [i915]
    [ 25.101025] Modules linked in: intel_rapl_msr intel_rapl_common kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel i915 aesni_intel cr ypto_simd cryptd glue_helper cec rc_core video drm_kms_helper joydev drm input_l eds i2c_algo_bit serio_raw fb_sys_fops syscopyarea sysfillrect sysimgblt mac_hid qemu_fw_cfg sch_fq_codel parport_pc ppdev lp parport ip_tables x_tables autofs4 e1000 psmouse i2c_piix4 pata_acpi floppy
    [ 25.101052] CPU: 1 PID: 30 Comm: kworker/u4:1 Not tainted 5.5.0+ #1
    [ 25.101053] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1 .12.1-0-ga5cab58 04/01/2014
    [ 25.101055] Workqueue: events_unbound async_run_entry_fn
    [ 25.101092] RIP: 0010:verify_single_dpll_state.isra.115+0x28f/0x320 [i915]
    [ 25.101093] Code: e0 d9 ff e9 a3 fe ff ff 80 3d e9 c2 11 00 00 44 89 f6 48 c7 c7 c0 9d 88 c0 75 3b e8 eb df d9 ff e9 c7 fe ff ff e8 d1 e0 ae c4 0b e9 7a fe ff ff 80 3d c0 c2 11 00 00 8d 71 41 89 c2 48 c7 c7
    [ 25.101093] RSP: 0018:ffffb1de80107878 EFLAGS: 00010286
    [ 25.101094] RAX: 0000000000000000 RBX: ffffb1de80107884 RCX: 0000000000000007
    [ 25.101095] RDX: 0000000000000000 RSI: 0000000000000002 RDI: ffff94fdfdd19740
    [ 25.101095] RBP: ffffb1de80107938 R08: 0000000d6bfdc7b4 R09: 000000000000002b
    [ 25.101096] R10: ffff94fdf82dc000 R11: 0000000000000225 R12: 00000000000001f8
    [ 25.101096] R13: ffff94fdb3ca6a90 R14: ffff94fdb3ca0000 R15: 0000000000000000
    [ 25.101097] FS: 0000000000000000(0000) GS:ffff94fdfdd00000(0000) knlGS:00000 00000000000
    [ 25.101098] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 25.101098] CR2: 00007fbc3e2be9c8 CR3: 000000003339a003 CR4: 0000000000360ee0
    [ 25.101101] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    [ 25.101101] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    [ 25.101102] Call Trace:
    [ 25.101139] intel_atomic_commit_tail+0xde4/0x1520 [i915]
    [ 25.101141] ? flush_workqueue_prep_pwqs+0xfa/0x130
    [ 25.101142] ? flush_workqueue+0x198/0x3c0
    [ 25.101174] intel_atomic_commit+0x2ad/0x320 [i915]
    [ 25.101209] drm_atomic_commit+0x4a/0x50 [drm]
    [ 25.101220] drm_client_modeset_commit_atomic+0x1c4/0x200 [drm]
    [ 25.101231] drm_client_modeset_commit_force+0x47/0x170 [drm]
    [ 25.101250] drm_fb_helper_restore_fbdev_mode_unlocked+0x4e/0xa0 [drm_kms_hel per]
    [ 25.101255] drm_fb_helper_set_par+0x2d/0x60 [drm_kms_helper]
    [ 25.101287] intel_fbdev_set_par+0x1a/0x40 [i915]
    [ 25.101289] ? con_is_visible+0x2e/0x60
    [ 25.101290] fbcon_init+0x378/0x600
    [ 25.101292] visual_init+0xd5/0x130
    [ 25.101296] do_bind_con_driver+0x217/0x430
    [ 25.101297] do_take_over_console+0x7d/0x1b0
    [ 25.101298] do_fbcon_takeover+0x5c/0xb0
    [ 25.101299] fbcon_fb_registered+0x199/0x1a0
    [ 25.101301] register_framebuffer+0x22c/0x330
    [ 25.101306] __drm_fb_helper_initial_config_and_unlock+0x31a/0x520 [drm_kms_h elper]
    [ 25.101311] drm_fb_helper_initial_config+0x35/0x40 [drm_kms_helper]
    [ 25.101341] intel_fbdev_initial_config+0x18/0x30 [i915]
    [ 25.101342] async_run_entry_fn+0x3c/0x150
    [ 25.101343] process_one_work+0x1fd/0x3f0
    [ 25.101344] worker_thread+0x34/0x410
    [ 25.101346] kthread+0x121/0x140
    [ 25.101346] ? process_one_work+0x3f0/0x3f0
    [ 25.101347] ? kthread_park+0x90/0x90
    [ 25.101350] ret_from_fork+0x35/0x40
    [ 25.101351] --[ end trace b5b47d44cd998ba1 ]--

    Fixes: 6294b61ba769 ("drm/i915/gvt: add missing display part reset for vGPU reset")
    Signed-off-by: Tina Zhang
    Reviewed-by: Zhenyu Wang
    Signed-off-by: Zhenyu Wang
    Link: http://patchwork.freedesktop.org/patch/msgid/20200221023234.28635-1-tina.zhang@intel.com
    Signed-off-by: Greg Kroah-Hartman

    Tina Zhang
     
  • commit b549c252b1292aea959cd9b83537fcb9384a6112 upstream.

    Deleting dmabuf item's list head after releasing its container can lead
    to KASAN-reported issue:

    BUG: KASAN: use-after-free in __list_del_entry_valid+0x15/0xf0
    Read of size 8 at addr ffff88818a4598a8 by task kworker/u8:3/13119

    So fix this issue by puting deleting dmabuf_objs ahead of releasing its
    container.

    Fixes: dfb6ae4e14bd6 ("drm/i915/gvt: Handle orphan dmabuf_objs")
    Signed-off-by: Tina Zhang
    Reviewed-by: Zhenyu Wang
    Signed-off-by: Zhenyu Wang
    Link: http://patchwork.freedesktop.org/patch/msgid/20200225053527.8336-2-tina.zhang@intel.com
    Signed-off-by: Greg Kroah-Hartman

    Tina Zhang
     
  • commit 9e661cedcc0a072d91a32cb88e0515ea26e35711 upstream.

    The printout for txabrt is way too talkative and is highly annoying with
    scanning programs like 'i2cdetect'. Reduce it to the minimum, the rest
    can be gained by I2C core debugging and datasheet information. Also,
    make it a debug printout, it won't help the regular user.

    Fixes: ba92222ed63a ("i2c: jz4780: Add i2c bus controller driver for Ingenic JZ4780")
    Reported-by: H. Nikolaus Schaller
    Tested-by: H. Nikolaus Schaller
    Signed-off-by: Wolfram Sang
    Signed-off-by: Greg Kroah-Hartman

    Wolfram Sang
     
  • commit 54498e8070e19e74498a72c7331348143e7e1f8c upstream.

    Factor out 100 from the equation and do 32-bit arithmetic (3 * clk_mhz / 10)
    instead of 64-bit.

    Notice that clk_mhz is MHz, so the multiplication will never wrap 32 bits
    and there is no need for div_u64().

    Addresses-Coverity: 1458369 ("Unintentional integer overflow")
    Fixes: 0560ad576268 ("i2c: altera: Add Altera I2C Controller driver")
    Suggested-by: David Laight
    Signed-off-by: Gustavo A. R. Silva
    Reviewed-by: Thor Thayer
    Signed-off-by: Wolfram Sang
    Signed-off-by: Greg Kroah-Hartman

    Gustavo A. R. Silva
     
  • commit bef8e2dfceed6daeb6ca3e8d33f9c9d43b926580 upstream.

    Pointer on the memory allocated by 'alloc_progmem()' is stored in
    'v->load_addr'. So this is this memory that should be freed by
    'release_progmem()'.

    'release_progmem()' is only a call to 'kfree()'.

    With the current code, there is both a double free and a memory leak.
    Fix it by passing the correct pointer to 'release_progmem()'.

    Fixes: e01402b115ccc ("More AP / SP bits for the 34K, the Malta bits and things. Still wants")
    Signed-off-by: Christophe JAILLET
    Signed-off-by: Paul Burton
    Cc: ralf@linux-mips.org
    Cc: linux-mips@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Cc: kernel-janitors@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Christophe JAILLET
     
  • commit 5c02c447eaeda29d3da121a2e17b97ccaf579b51 upstream.

    Syzbot reports that "hiddev" is used after it's free in hiddev_disconnect().
    The hiddev_disconnect() function sets "hiddev->exist = 0;" so
    hiddev_release() can free it as soon as we drop the "existancelock"
    lock. This patch moves the mutex_unlock(&hiddev->existancelock) until
    after we have finished using it.

    Reported-by: syzbot+784ccb935f9900cc7c9e@syzkaller.appspotmail.com
    Fixes: 7f77897ef2b6 ("HID: hiddev: fix potential use-after-free")
    Suggested-by: Alan Stern
    Signed-off-by: Dan Carpenter
    Signed-off-by: Jiri Kosina
    Signed-off-by: Greg Kroah-Hartman

    dan.carpenter@oracle.com
     
  • commit 8d2e77b39b8fecb794e19cd006a12f90b14dd077 upstream.

    They are issues:
    - if 'input_allocate_device()' fails and return NULL, there is no need
    to free anything and 'input_free_device()' call is a no-op. It can
    be axed.
    - 'ret' is known to be 0 at this point, so we must set it to a
    meaningful value before returning

    Fixes: 2562756dde55 ("HID: add Alps I2C HID Touchpad-Stick support")
    Signed-off-by: Christophe JAILLET
    Signed-off-by: Jiri Kosina
    Signed-off-by: Greg Kroah-Hartman

    Christophe JAILLET
     
  • commit c4a3922d2d20c710f827d3a115ee338e8d0467df upstream.

    It is unnecessary to hold hashlimit_mutex for htable_destroy()
    as it is already removed from the global hashtable and its
    refcount is already zero.

    Also, switch hinfo->use to refcount_t so that we don't have
    to hold the mutex until it reaches zero in htable_put().

    Reported-and-tested-by: syzbot+adf6c6c2be1c3a718121@syzkaller.appspotmail.com
    Acked-by: Florian Westphal
    Signed-off-by: Cong Wang
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Greg Kroah-Hartman

    Cong Wang
     
  • commit 8af1c6fbd9239877998c7f5a591cb2c88d41fb66 upstream.

    When the forceadd option is enabled, the hash:* types should find and replace
    the first entry in the bucket with the new one if there are no reuseable
    (deleted or timed out) entries. However, the position index was just not set
    to zero and remained the invalid -1 if there were no reuseable entries.

    Reported-by: syzbot+6a86565c74ebe30aea18@syzkaller.appspotmail.com
    Fixes: 23c42a403a9c ("netfilter: ipset: Introduction of new commands and protocol version 7")
    Signed-off-by: Jozsef Kadlecsik
    Signed-off-by: Greg Kroah-Hartman

    Jozsef Kadlecsik
     
  • commit 42d84c8490f9f0931786f1623191fcab397c3d64 upstream.

    Doing so, we save one call to get data we already have in the struct.

    Also, since there is no guarantee that getname use sockaddr_ll
    parameter beyond its size, we add a little bit of security here.
    It should do not do beyond MAX_ADDR_LEN, but syzbot found that
    ax25_getname writes more (72 bytes, the size of full_sockaddr_ax25,
    versus 20 + 32 bytes of sockaddr_ll + MAX_ADDR_LEN in syzbot repro).

    Fixes: 3a4d5c94e9593 ("vhost_net: a kernel-level virtio server")
    Reported-by: syzbot+f2a62d07a5198c819c7b@syzkaller.appspotmail.com
    Signed-off-by: Eugenio Pérez
    Acked-by: Michael S. Tsirkin
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Eugenio Pérez
     
  • commit 67f562e3e147750a02b2a91d21a163fc44a1d13e upstream.

    SMC does not work together with FASTOPEN. If sendmsg() is called with
    flag MSG_FASTOPEN in SMC_INIT state, the SMC-socket switches to
    fallback mode. To handle the previous ioctl FIOASYNC call correctly
    in this case, it is necessary to transfer the socket wait queue
    fasync_list to the internal TCP socket.

    Reported-by: syzbot+4b1fe8105f8044a26162@syzkaller.appspotmail.com
    Fixes: ee9dfbef02d18 ("net/smc: handle sockopts forcing fallback")
    Signed-off-by: Ursula Braun
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Ursula Braun
     
  • commit f66ee0410b1c3481ee75e5db9b34547b4d582465 upstream.

    In the case of huge hash:* types of sets, due to the single spinlock of
    a set the processing of the whole set under spinlock protection could take
    too long.

    There were four places where the whole hash table of the set was processed
    from bucket to bucket under holding the spinlock:

    - During resizing a set, the original set was locked to exclude kernel side
    add/del element operations (userspace add/del is excluded by the
    nfnetlink mutex). The original set is actually just read during the
    resize, so the spinlocking is replaced with rcu locking of regions.
    However, thus there can be parallel kernel side add/del of entries.
    In order not to loose those operations a backlog is added and replayed
    after the successful resize.
    - Garbage collection of timed out entries was also protected by the spinlock.
    In order not to lock too long, region locking is introduced and a single
    region is processed in one gc go. Also, the simple timer based gc running
    is replaced with a workqueue based solution. The internal book-keeping
    (number of elements, size of extensions) is moved to region level due to
    the region locking.
    - Adding elements: when the max number of the elements is reached, the gc
    was called to evict the timed out entries. The new approach is that the gc
    is called just for the matching region, assuming that if the region
    (proportionally) seems to be full, then the whole set does. We could scan
    the other regions to check every entry under rcu locking, but for huge
    sets it'd mean a slowdown at adding elements.
    - Listing the set header data: when the set was defined with timeout
    support, the garbage collector was called to clean up timed out entries
    to get the correct element numbers and set size values. Now the set is
    scanned to check non-timed out entries, without actually calling the gc
    for the whole set.

    Thanks to Florian Westphal for helping me to solve the SOFTIRQ-safe ->
    SOFTIRQ-unsafe lock order issues during working on the patch.

    Reported-by: syzbot+4b0e9d4ff3cf117837e5@syzkaller.appspotmail.com
    Reported-by: syzbot+c27b8d5010f45c666ed1@syzkaller.appspotmail.com
    Reported-by: syzbot+68a806795ac89df3aa1c@syzkaller.appspotmail.com
    Fixes: 23c42a403a9c ("netfilter: ipset: Introduction of new commands and protocol version 7")
    Signed-off-by: Jozsef Kadlecsik
    Signed-off-by: Greg Kroah-Hartman

    Jozsef Kadlecsik
     
  • commit d876836204897b6d7d911f942084f69a1e9d5c4d upstream.

    We must set MSG_CMSG_COMPAT if we're in compatability mode, otherwise
    the iovec import for these commands will not do the right thing and fail
    the command with -EINVAL.

    Found by running the test suite compiled as 32-bit.

    Cc: stable@vger.kernel.org
    Fixes: aa1fa28fc73e ("io_uring: add support for recvmsg()")
    Fixes: 0fa03c624d8f ("io_uring: add support for sendmsg()")
    Signed-off-by: Jens Axboe
    Signed-off-by: Greg Kroah-Hartman

    Jens Axboe
     
  • commit f5739cb0b56590d68d8df8a44659893b6d0084c3 upstream.

    Before commit 1e4f63aecb53 ("cpufreq: Avoid creating excessively
    large stack frames") the initial value of the policy field in struct
    cpufreq_policy set by the driver's ->init() callback was implicitly
    passed from cpufreq_init_policy() to cpufreq_set_policy() if the
    default governor was neither "performance" nor "powersave". After
    that commit, however, cpufreq_init_policy() must take that case into
    consideration explicitly and handle it as appropriate, so make that
    happen.

    Fixes: 1e4f63aecb53 ("cpufreq: Avoid creating excessively large stack frames")
    Link: https://lore.kernel.org/linux-pm/39fb762880c27da110086741315ca8b111d781cd.camel@gmail.com/
    Reported-by: Artem Bityutskiy
    Cc: 5.4+ # 5.4+
    Signed-off-by: Rafael J. Wysocki
    Acked-by: Viresh Kumar
    Signed-off-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     
  • commit a3ed353cf8015ba84a0407a5dc3ffee038166ab0 upstream.

    fixes S3 issue with IOMMU + S/G enabled @ 64M VRAM.

    Suggested-by: Alex Deucher
    Signed-off-by: Shirish S
    Reviewed-by: Alex Deucher
    Signed-off-by: Alex Deucher
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Shirish S
     
  • commit 66d0e797bf095d407479c89952d42b1d96ef0a7f upstream.

    This reverts commit 4585fbcb5331fc910b7e553ad3efd0dd7b320d14.

    The name changing as devfreq(X) breaks some user space applications,
    such as Android HAL from Unisoc and Hikey [1].
    The device name will be changed unexpectly after every boot depending
    on module init sequence. It will make trouble to setup some system
    configuration like selinux for Android.

    So we'd like to revert it back to old naming rule before any better
    way being found.

    [1] https://lkml.org/lkml/2018/5/8/1042

    Cc: John Stultz
    Cc: Greg Kroah-Hartman
    Cc: stable@vger.kernel.org
    Signed-off-by: Orson Zhai
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Chanwoo Choi
    Signed-off-by: Greg Kroah-Hartman

    Orson Zhai
     
  • commit 78041c0c9e935d9ce4086feeff6c569ed88ddfd4 upstream.

    The tracing seftests checks various aspects of the tracing infrastructure,
    and one is filtering. If trace_printk() is active during a self test, it can
    cause the filtering to fail, which will disable that part of the trace.

    To keep the selftests from failing because of trace_printk() calls,
    trace_printk() checks the variable tracing_selftest_running, and if set, it
    does not write to the tracing buffer.

    As some tracers were registered earlier in boot, the selftest they triggered
    would fail because not all the infrastructure was set up for the full
    selftest. Thus, some of the tests were post poned to when their
    infrastructure was ready (namely file system code). The postpone code did
    not set the tracing_seftest_running variable, and could fail if a
    trace_printk() was added and executed during their run.

    Cc: stable@vger.kernel.org
    Fixes: 9afecfbb95198 ("tracing: Postpone tracer start-up tests till the system is more robust")
    Signed-off-by: Steven Rostedt (VMware)
    Signed-off-by: Greg Kroah-Hartman

    Steven Rostedt (VMware)
     
  • commit 38b17afb0ebb9ecd41418d3c08bcf9198af4349d upstream.

    Removing attach_adapter from this driver caused a regression for at
    least some machines. Those machines had the sensors described in their
    DT, too, so they didn't need manual creation of the sensor devices. The
    old code worked, though, because manual creation came first. Creation of
    DT devices then failed later and caused error logs, but the sensors
    worked nonetheless because of the manually created devices.

    When removing attach_adaper, manual creation now comes later and loses
    the race. The sensor devices were already registered via DT, yet with
    another binding, so the driver could not be bound to it.

    This fix refactors the code to remove the race and only manually creates
    devices if there are no DT nodes present. Also, the DT binding is updated
    to match both, the DT and manually created devices. Because we don't
    know which device creation will be used at runtime, the code to start
    the kthread is moved to do_probe() which will be called by both methods.

    Fixes: 3e7bed52719d ("macintosh: therm_windtunnel: drop using attach_adapter")
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=201723
    Reported-by: Erhard Furtner
    Tested-by: Erhard Furtner
    Acked-by: Michael Ellerman (powerpc)
    Signed-off-by: Wolfram Sang
    Cc: stable@kernel.org # v4.19+
    Signed-off-by: Greg Kroah-Hartman

    Wolfram Sang
     
  • commit eb12c957735b582607e5842a06d1f4c62e185c1d upstream.

    It's the last user, and more importantly, it's the last non-legacy
    user of anything in drm_pci.c.

    The only tricky bit is the agp initialization. But a close look shows
    that radeon does not use the drm_agp midlayer (the main use of that is
    drm_bufs for legacy drivers), and instead could use the agp subsystem
    directly (like nouveau does already). Hence we can just pull this in
    too.

    A further step would be to entirely drop the use of drm_device->agp,
    but feels like too much churn just for this patch.

    Signed-off-by: Daniel Vetter
    Cc: Alex Deucher
    Cc: "Christian König"
    Cc: "David (ChunMing) Zhou"
    Cc: amd-gfx@lists.freedesktop.org
    Reviewed-by: Alex Deucher
    Reviewed-by: Emil Velikov
    Signed-off-by: Alex Deucher
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Daniel Vetter
     
  • commit 8a3bddf67ce88b96531fb22c5a75d7f4dc41d155 upstream.

    This doesn't do anything except auto-init drm_agp support when you
    call drm_get_pci_dev(). Which amdgpu stopped doing with

    commit b58c11314a1706bf094c489ef5cb28f76478c704
    Author: Alex Deucher
    Date: Fri Jun 2 17:16:31 2017 -0400

    drm/amdgpu: drop deprecated drm_get_pci_dev and drm_put_dev

    No idea whether this was intentional or accidental breakage, but I
    guess anyone who manages to boot a this modern gpu behind an agp
    bridge deserves a price. A price I never expect anyone to ever collect
    :-)

    Cc: Alex Deucher
    Cc: "Christian König"
    Cc: Hawking Zhang
    Cc: Xiaojie Yuan
    Cc: Evan Quan
    Cc: "Tianci.Yin"
    Cc: "Marek Olšák"
    Cc: Hans de Goede
    Reviewed-by: Emil Velikov
    Reviewed-by: Alex Deucher
    Signed-off-by: Daniel Vetter
    Signed-off-by: Alex Deucher
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Daniel Vetter
     
  • commit 84a4062632462c4320704fcdf8e99e89e94c0aba upstream.

    We have a HID touch device that reports its opens and shorts test
    results in HID buffers of size 8184 bytes. The maximum size of the HID
    buffer is currently set to 4096 bytes, causing probe of this device to
    fail. With this patch we increase the maximum size of the HID buffer to
    8192 bytes, making device probe and acquisition of said buffers succeed.

    Signed-off-by: Johan Korsnes
    Cc: Alan Stern
    Cc: Armando Visconti
    Cc: Jiri Kosina
    Signed-off-by: Jiri Kosina
    Signed-off-by: Greg Kroah-Hartman

    Johan Korsnes
     
  • commit 5ebdffd25098898aff1249ae2f7dbfddd76d8f8f upstream.

    In case a report is greater than HID_MAX_BUFFER_SIZE, it is truncated,
    but the report-number byte is not correctly handled. This results in a
    off-by-one in the following memset, causing a kernel Oops and ensuing
    system crash.

    Note: With commit 8ec321e96e05 ("HID: Fix slab-out-of-bounds read in
    hid_field_extract") I no longer hit the kernel Oops as we instead fail
    "controlled" at probe if there is a report too long in the HID
    report-descriptor. hid_report_raw_event() is an exported symbol, so
    presumabely we cannot always rely on this being the case.

    Fixes: 966922f26c7f ("HID: fix a crash in hid_report_raw_event()
    function.")
    Signed-off-by: Johan Korsnes
    Cc: Armando Visconti
    Cc: Jiri Kosina
    Cc: Alan Stern
    Signed-off-by: Jiri Kosina
    Signed-off-by: Greg Kroah-Hartman

    Johan Korsnes
     
  • commit beae56192a2570578ae45050e73c5ff9254f63e6 upstream.

    Commit 8f18eca9ebc5 ("HID: ite: Add USB id match for Acer SW5-012 keyboard
    dock") added the USB id for the Acer SW5-012's keyboard dock to the
    hid-ite driver to fix the rfkill driver not working.

    Most keyboard docks with an ITE 8595 keyboard/touchpad controller have the
    "Wireless Radio Control" bits which need the special hid-ite driver on the
    second USB interface (the mouse interface) and their touchpad only supports
    mouse emulation, so using generic hid-input handling for anything but
    the "Wireless Radio Control" bits is fine. On these devices we simply bind
    to all USB interfaces.

    But unlike other ITE8595 using keyboard docks, the Acer Aspire Switch 10
    (SW5-012)'s touchpad not only does mouse emulation it also supports
    HID-multitouch and all the keys including the "Wireless Radio Control"
    bits have been moved to the first USB interface (the keyboard intf).

    So we need hid-ite to handle the first (keyboard) USB interface and have
    it NOT bind to the second (mouse) USB interface so that that can be
    handled by hid-multitouch.c and we get proper multi-touch support.

    This commit changes the hid_device_id for the SW5-012 keyboard dock to
    only match on hid devices from the HID_GROUP_GENERIC group, this way
    hid-ite will not bind the the mouse/multi-touch interface which has
    HID_GROUP_MULTITOUCH_WIN_8 as group.
    This fixes the regression to mouse-emulation mode introduced by adding
    the keyboard dock USB id.

    Cc: stable@vger.kernel.org
    Fixes: 8f18eca9ebc5 ("HID: ite: Add USB id match for Acer SW5-012 keyboard dock")
    Reported-by: Zdeněk Rampas
    Signed-off-by: Hans de Goede
    Signed-off-by: Benjamin Tissoires
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     
  • commit 86f7e90ce840aa1db407d3ea6e9b3a52b2ce923c upstream.

    KVM emulates UMIP on hardware that doesn't support it by setting the
    'descriptor table exiting' VM-execution control and performing
    instruction emulation. When running nested, this emulation is broken as
    KVM refuses to emulate L2 instructions by default.

    Correct this regression by allowing the emulation of descriptor table
    instructions if L1 hasn't requested 'descriptor table exiting'.

    Fixes: 07721feee46b ("KVM: nVMX: Don't emulate instructions in guest mode")
    Reported-by: Jan Kiszka
    Cc: stable@vger.kernel.org
    Cc: Paolo Bonzini
    Cc: Jim Mattson
    Signed-off-by: Oliver Upton
    Signed-off-by: Paolo Bonzini
    Signed-off-by: Greg Kroah-Hartman

    Oliver Upton
     
  • commit 2ba33a4e9e22ac4dda928d3e9b5978a3a2ded4e0 upstream.

    ACPI Generic Address Structure (GAS) access_width field is not in bytes
    as the driver seems to expect in few places so fix this by using the
    newly introduced macro ACPI_ACCESS_BYTE_WIDTH().

    Fixes: b1abf6fc4982 ("ACPI / watchdog: Fix off-by-one error at resource assignment")
    Fixes: 058dfc767008 ("ACPI / watchdog: Add support for WDAT hardware watchdog")
    Reported-by: Jean Delvare
    Signed-off-by: Mika Westerberg
    Reviewed-by: Jean Delvare
    Cc: 4.16+ # 4.16+
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Mika Westerberg
     
  • commit 1dade3a7048ccfc675650cd2cf13d578b095e5fb upstream.

    Sometimes it is useful to find the access_width field value in bytes and
    not in bits so add a helper that can be used for this purpose.

    Suggested-by: Jean Delvare
    Signed-off-by: Mika Westerberg
    Reviewed-by: Jean Delvare
    Cc: 4.16+ # 4.16+
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Mika Westerberg
     
  • commit 756125289285f6e55a03861bf4b6257aa3d19a93 upstream.

    This patch ensures that we always check the netlink payload length
    in audit_receive_msg() before we take any action on the payload
    itself.

    Cc: stable@vger.kernel.org
    Reported-by: syzbot+399c44bf1f43b8747403@syzkaller.appspotmail.com
    Reported-by: syzbot+e4b12d8d202701f08b6d@syzkaller.appspotmail.com
    Signed-off-by: Paul Moore
    Signed-off-by: Greg Kroah-Hartman

    Paul Moore
     
  • commit 2ad3e17ebf94b7b7f3f64c050ff168f9915345eb upstream.

    Commit 219ca39427bf ("audit: use union for audit_field values since
    they are mutually exclusive") combined a number of separate fields in
    the audit_field struct into a single union. Generally this worked
    just fine because they are generally mutually exclusive.
    Unfortunately in audit_data_to_entry() the overlap can be a problem
    when a specific error case is triggered that causes the error path
    code to attempt to cleanup an audit_field struct and the cleanup
    involves attempting to free a stored LSM string (the lsm_str field).
    Currently the code always has a non-NULL value in the
    audit_field.lsm_str field as the top of the for-loop transfers a
    value into audit_field.val (both .lsm_str and .val are part of the
    same union); if audit_data_to_entry() fails and the audit_field
    struct is specified to contain a LSM string, but the
    audit_field.lsm_str has not yet been properly set, the error handling
    code will attempt to free the bogus audit_field.lsm_str value that
    was set with audit_field.val at the top of the for-loop.

    This patch corrects this by ensuring that the audit_field.val is only
    set when needed (it is cleared when the audit_field struct is
    allocated with kcalloc()). It also corrects a few other issues to
    ensure that in case of error the proper error code is returned.

    Cc: stable@vger.kernel.org
    Fixes: 219ca39427bf ("audit: use union for audit_field values since they are mutually exclusive")
    Reported-by: syzbot+1f4d90ead370d72e450b@syzkaller.appspotmail.com
    Signed-off-by: Paul Moore
    Signed-off-by: Greg Kroah-Hartman

    Paul Moore
     
  • commit 37b0b6b8b99c0e1c1f11abbe7cf49b6d03795b3f upstream.

    If sbi->s_flex_groups_allocated is zero and the first allocation fails
    then this code will crash. The problem is that "i--" will set "i" to
    -1 but when we compare "i >= sbi->s_flex_groups_allocated" then the -1
    is type promoted to unsigned and becomes UINT_MAX. Since UINT_MAX
    is more than zero, the condition is true so we call kvfree(new_groups[-1]).
    The loop will carry on freeing invalid memory until it crashes.

    Fixes: 7c990728b99e ("ext4: fix potential race between s_flex_groups online resizing and access")
    Reviewed-by: Suraj Jitindar Singh
    Signed-off-by: Dan Carpenter
    Cc: stable@kernel.org
    Link: https://lore.kernel.org/r/20200228092142.7irbc44yaz3by7nb@kili.mountain
    Signed-off-by: Theodore Ts'o
    Signed-off-by: Greg Kroah-Hartman

    Dan Carpenter
     
  • [ Upstream commit fa46c6fb5d61b1f17b06d7c6ef75478b576304c7 ]

    Many users have reported nvme triggered irq_startup() warnings during
    shutdown. The driver uses the nvme queue's irq to synchronize scanning
    for completions, and enabling an interrupt affined to only offline CPUs
    triggers the alarming warning.

    Move the final CQE check to after disabling the device and all
    registered interrupts have been torn down so that we do not have any
    IRQ to synchronize.

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=206509
    Reviewed-by: Sagi Grimberg
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Keith Busch
    Signed-off-by: Jens Axboe
    Signed-off-by: Sasha Levin

    Keith Busch
     
  • [ Upstream commit 97b2512ad000a409b4073dd1a71e4157d76675cb ]

    Delayed keep alive work is queued on system workqueue and may be cancelled
    via nvme_stop_keep_alive from nvme_reset_wq, nvme_fc_wq or nvme_wq.

    Check_flush_dependency detects mismatched attributes between the work-queue
    context used to cancel the keep alive work and system-wq. Specifically
    system-wq does not have the WQ_MEM_RECLAIM flag, whereas the contexts used
    to cancel keep alive work have WQ_MEM_RECLAIM flag.

    Example warning:

    workqueue: WQ_MEM_RECLAIM nvme-reset-wq:nvme_fc_reset_ctrl_work [nvme_fc]
    is flushing !WQ_MEM_RECLAIM events:nvme_keep_alive_work [nvme_core]

    To avoid the flags mismatch, delayed keep alive work is queued on nvme_wq.

    However this creates a secondary concern where work and a request to cancel
    that work may be in the same work queue - namely err_work in the rdma and
    tcp transports, which will want to flush/cancel the keep alive work which
    will now be on nvme_wq.

    After reviewing the transports, it looks like err_work can be moved to
    nvme_reset_wq. In fact that aligns them better with transition into
    RESETTING and performing related reset work in nvme_reset_wq.

    Change nvme-rdma and nvme-tcp to perform err_work in nvme_reset_wq.

    Signed-off-by: Nigel Kirkland
    Signed-off-by: James Smart
    Reviewed-by: Sagi Grimberg
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Keith Busch
    Signed-off-by: Jens Axboe
    Signed-off-by: Sasha Levin

    Nigel Kirkland
     
  • [ Upstream commit 2d570a7c0251c594489a2c16b82b14ae30345c03 ]

    When nvme_tcp_io_work() fails to send to socket due to
    connection close/reset, error_recovery work is triggered
    from nvme_tcp_state_change() socket callback.
    This cancels all the active requests in the tagset,
    which requeues them.

    The failed request, however, was ended and thus requeued
    individually as well unless send returned -EPIPE.
    Another return code to be treated the same way is -ECONNRESET.

    Double requeue caused BUG_ON(blk_queued_rq(rq))
    in blk_mq_requeue_request() from either the individual requeue
    of the failed request or the bulk requeue from
    blk_mq_tagset_busy_iter(, nvme_cancel_request, );

    Signed-off-by: Anton Eidelman
    Reviewed-by: Sagi Grimberg
    Signed-off-by: Keith Busch
    Signed-off-by: Jens Axboe
    Signed-off-by: Sasha Levin

    Anton Eidelman
     
  • [ Upstream commit 47327c9315b2f3ae4ab659457977a26669631f20 ]

    The IPv6 address defined in struct in6_addr is specified as
    big endian, but there is no specified endian in struct
    hclge_fd_rule_tuples, so it will cause a problem if directly
    use memcpy() to copy ipv6 address between these two structures
    since this field in struct hclge_fd_rule_tuples is little endian.

    This patch fixes this problem by using be32_to_cpu() to convert
    endian of IPv6 address of struct in6_addr before copying.

    Fixes: d93ed94fbeaf ("net: hns3: add aRFS support for PF")
    Signed-off-by: Guangbin Huang
    Signed-off-by: Huazhong Tan
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Guangbin Huang
     
  • [ Upstream commit d0db7ed397517c8b2be24a0d1abfa15df776908e ]

    In the current process, the management table is missing after the
    IMP reset. This patch adds the management table to the reset process.

    Fixes: f5aac71c0327 ("net: hns3: add manager table initialization for hardware")
    Signed-off-by: Yufeng Mo
    Signed-off-by: Huazhong Tan
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Yufeng Mo
     
  • [ Upstream commit 33181ea7f5a62a17fbe55f0f73428ecb5e686be8 ]

    Before this patch, STA's would set new width of 160/80+80 MHz based on AP capability only.
    This is wrong because STA may not support > 80MHz BW.
    Fix is to verify STA has 160/80+80 MHz capability before increasing its width to > 80MHz.

    The "support_80_80" and "support_160" setting is based on:
    "Table 9-272 — Setting of the Supported Channel Width Set subfield and Extended NSS BW
    Support subfield at a STA transmitting the VHT Capabilities Information field"
    From "Draft P802.11REVmd_D3.0.pdf"

    Signed-off-by: Aviad Brikman
    Signed-off-by: Shay Bar
    Link: https://lore.kernel.org/r/20200210130728.23674-1-shay.bar@celeno.com
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin

    Shay Bar
     
  • [ Upstream commit ea75080110a4c1fa011b0a73cb8f42227143ee3e ]

    The nl80211_policy is missing for NL80211_ATTR_STATUS_CODE attribute.
    As a result, for strictly validated commands, it's assumed to not be
    supported.

    Signed-off-by: Sergey Matyukevich
    Link: https://lore.kernel.org/r/20200213131608.10541-2-sergey.matyukevich.os@quantenna.com
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin

    Sergey Matyukevich
     
  • [ Upstream commit f52aa79df43c4509146140de0241bc21a4a3b4c7 ]

    A number of the debug statements output file or directory mode
    in hex. Change these to print using octal.

    Signed-off-by: Frank Sorenson
    Signed-off-by: Steve French
    Signed-off-by: Sasha Levin

    Frank Sorenson
     
  • [ Upstream commit cf8fc2a0863f9ff27ebd2efcdb1f7d378b9fb8a6 ]

    After a reset the Unit Load Status bits in the GLNVM_ULD register to check
    for completion should be 0x7FF before continuing. Update the mask to check
    (minus the three reserved bits that are always set).

    Signed-off-by: Bruce Allan
    Signed-off-by: Tony Nguyen
    Tested-by: Andrew Bowers
    Signed-off-by: Jeff Kirsher
    Signed-off-by: Sasha Levin

    Bruce Allan
     
  • [ Upstream commit c207979f5ae10ed70aff1bb13f39f0736973de99 ]

    comp_ctx can be NULL in a very rare case when an admin command is executed
    during the execution of ena_remove().

    The bug scenario is as follows:

    * ena_destroy_device() sets the comp_ctx to be NULL
    * An admin command is executed before executing unregister_netdev(),
    this can still happen because our device can still receive callbacks
    from the netdev infrastructure such as ethtool commands.
    * When attempting to access the comp_ctx, the bug occurs since it's set
    to NULL

    Fix:
    Added a check that comp_ctx is not NULL

    Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)")
    Signed-off-by: Sameeh Jubran
    Signed-off-by: Arthur Kiyanovski
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Arthur Kiyanovski