1. 03 Feb, 2018 6 commits
    • Linus Walleij's avatar
      gpio: Fix kernel stack leak to userspace · c5845e02
      Linus Walleij authored
      commit 24bd3efc upstream.
      
      The GPIO event descriptor was leaking kernel stack to
      userspace because we don't zero the variable before
      use. Ooops. Fix this.
      Reported-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
      Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c5845e02
    • Patrice Chotard's avatar
      gpio: stmpe: i2c transfer are forbiden in atomic context · 460c5b97
      Patrice Chotard authored
      commit b888fb6f upstream.
      
      Move the workaround from stmpe_gpio_irq_unmask() which is executed
      in atomic context to stmpe_gpio_irq_sync_unlock() which is not.
      
      It fixes the following issue:
      
      [    1.500000] BUG: scheduling while atomic: swapper/1/0x00000002
      [    1.500000] CPU: 0 PID: 1 Comm: swapper Not tainted 4.15.0-rc2-00020-gbd4301f-dirty #28
      [    1.520000] Hardware name: STM32 (Device Tree Support)
      [    1.520000] [<0000bfc9>] (unwind_backtrace) from [<0000b347>] (show_stack+0xb/0xc)
      [    1.530000] [<0000b347>] (show_stack) from [<0001fc49>] (__schedule_bug+0x39/0x58)
      [    1.530000] [<0001fc49>] (__schedule_bug) from [<00168211>] (__schedule+0x23/0x2b2)
      [    1.550000] [<00168211>] (__schedule) from [<001684f7>] (schedule+0x57/0x64)
      [    1.550000] [<001684f7>] (schedule) from [<0016a513>] (schedule_timeout+0x137/0x164)
      [    1.550000] [<0016a513>] (schedule_timeout) from [<00168b91>] (wait_for_common+0x8d/0xfc)
      [    1.570000] [<00168b91>] (wait_for_common) from [<00139753>] (stm32f4_i2c_xfer+0xe9/0xfe)
      [    1.580000] [<00139753>] (stm32f4_i2c_xfer) from [<00138545>] (__i2c_transfer+0x111/0x148)
      [    1.590000] [<00138545>] (__i2c_transfer) from [<001385cf>] (i2c_transfer+0x53/0x70)
      [    1.590000] [<001385cf>] (i2c_transfer) from [<001388a5>] (i2c_smbus_xfer+0x12f/0x36e)
      [    1.600000] [<001388a5>] (i2c_smbus_xfer) from [<00138b49>] (i2c_smbus_read_byte_data+0x1f/0x2a)
      [    1.610000] [<00138b49>] (i2c_smbus_read_byte_data) from [<00124fdd>] (__stmpe_reg_read+0xd/0x24)
      [    1.620000] [<00124fdd>] (__stmpe_reg_read) from [<001252b3>] (stmpe_reg_read+0x19/0x24)
      [    1.630000] [<001252b3>] (stmpe_reg_read) from [<0002c4d1>] (unmask_irq+0x17/0x22)
      [    1.640000] [<0002c4d1>] (unmask_irq) from [<0002c57f>] (irq_startup+0x6f/0x78)
      [    1.650000] [<0002c57f>] (irq_startup) from [<0002b7a1>] (__setup_irq+0x319/0x47c)
      [    1.650000] [<0002b7a1>] (__setup_irq) from [<0002bad3>] (request_threaded_irq+0x6b/0xe8)
      [    1.660000] [<0002bad3>] (request_threaded_irq) from [<0002d0b9>] (devm_request_threaded_irq+0x3b/0x6a)
      [    1.670000] [<0002d0b9>] (devm_request_threaded_irq) from [<001446e7>] (mmc_gpiod_request_cd_irq+0x49/0x8a)
      [    1.680000] [<001446e7>] (mmc_gpiod_request_cd_irq) from [<0013d45d>] (mmc_start_host+0x49/0x60)
      [    1.690000] [<0013d45d>] (mmc_start_host) from [<0013e40b>] (mmc_add_host+0x3b/0x54)
      [    1.700000] [<0013e40b>] (mmc_add_host) from [<00148119>] (mmci_probe+0x4d1/0x60c)
      [    1.710000] [<00148119>] (mmci_probe) from [<000f903b>] (amba_probe+0x7b/0xbe)
      [    1.720000] [<000f903b>] (amba_probe) from [<001170e5>] (driver_probe_device+0x169/0x1f8)
      [    1.730000] [<001170e5>] (driver_probe_device) from [<001171b7>] (__driver_attach+0x43/0x5c)
      [    1.740000] [<001171b7>] (__driver_attach) from [<0011618d>] (bus_for_each_dev+0x3d/0x46)
      [    1.740000] [<0011618d>] (bus_for_each_dev) from [<001165cd>] (bus_add_driver+0xcd/0x124)
      [    1.740000] [<001165cd>] (bus_add_driver) from [<00117713>] (driver_register+0x4d/0x7a)
      [    1.760000] [<00117713>] (driver_register) from [<001fc765>] (do_one_initcall+0xbd/0xe8)
      [    1.770000] [<001fc765>] (do_one_initcall) from [<001fc88b>] (kernel_init_freeable+0xfb/0x134)
      [    1.780000] [<001fc88b>] (kernel_init_freeable) from [<00167ee3>] (kernel_init+0x7/0x9c)
      [    1.790000] [<00167ee3>] (kernel_init) from [<00009b65>] (ret_from_fork+0x11/0x2c)
      Signed-off-by: default avatarAlexandre TORGUE <alexandre.torgue@st.com>
      Signed-off-by: default avatarPatrice Chotard <patrice.chotard@st.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      460c5b97
    • Joel Stanley's avatar
      tools/gpio: Fix build error with musl libc · 636124c8
      Joel Stanley authored
      commit 1696784e upstream.
      
      The GPIO tools build fails when using a buildroot toolchain that uses musl
      as it's C library:
      
      arm-broomstick-linux-musleabi-gcc -Wp,-MD,./.gpio-event-mon.o.d \
       -Wp,-MT,gpio-event-mon.o -O2 -Wall -g -D_GNU_SOURCE \
       -Iinclude -D"BUILD_STR(s)=#s" -c -o gpio-event-mon.o gpio-event-mon.c
      gpio-event-mon.c:30:6: error: unknown type name ‘u_int32_t’; did you mean ‘uint32_t’?
            u_int32_t handleflags,
            ^~~~~~~~~
            uint32_t
      
      The glibc headers installed on my laptop include sys/types.h in
      unistd.h, but it appears that musl does not.
      
      Fixes: 97f69747 ("tools/gpio: add the gpio-event-mon tool")
      Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      636124c8
    • Janakarajan Natarajan's avatar
      KVM: x86: Fix CPUID function for word 6 (80000001_ECX) · 00251aed
      Janakarajan Natarajan authored
      commit 50a671d4 upstream.
      
      The function for CPUID 80000001 ECX is set to 0xc0000001. Set it to
      0x80000001.
      Signed-off-by: default avatarJanakarajan Natarajan <Janakarajan.Natarajan@amd.com>
      Reviewed-by: default avatarJim Mattson <jmattson@google.com>
      Reviewed-by: default avatarKrish Sadhukhan <krish.sadhukhan@oracle.com>
      Reviewed-by: default avatarBorislav Petkov <bp@suse.de>
      Fixes: d6321d49 ("KVM: x86: generalize guest_cpuid_has_ helpers")
      Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      00251aed
    • Linus Torvalds's avatar
      loop: fix concurrent lo_open/lo_release · d5e06a18
      Linus Torvalds authored
      commit ae665016 upstream.
      
      范龙飞 reports that KASAN can report a use-after-free in __lock_acquire.
      The reason is due to insufficient serialization in lo_release(), which
      will continue to use the loop device even after it has decremented the
      lo_refcnt to zero.
      
      In the meantime, another process can come in, open the loop device
      again as it is being shut down. Confusion ensues.
      Reported-by: default avatar范龙飞 <long7573@126.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Cc: Ben Hutchings <ben.hutchings@codethink.co.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d5e06a18
    • Peter Zijlstra's avatar
      futex: Fix OWNER_DEAD fixup · d383a427
      Peter Zijlstra authored
      commit a97cb0e7 upstream.
      
      Both Geert and DaveJ reported that the recent futex commit:
      
        c1e2f0ea ("futex: Avoid violating the 10th rule of futex")
      
      introduced a problem with setting OWNER_DEAD. We set the bit on an
      uninitialized variable and then entirely optimize it away as a
      dead-store.
      
      Move the setting of the bit to where it is more useful.
      Reported-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Reported-by: default avatarDave Jones <davej@codemonkey.org.uk>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Paul E. McKenney <paulmck@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Fixes: c1e2f0ea ("futex: Avoid violating the 10th rule of futex")
      Link: http://lkml.kernel.org/r/20180122103947.GD2228@hirez.programming.kicks-ass.netSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Cc: Ozkan Sezer <sezeroz@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d383a427
  2. 31 Jan, 2018 34 commits