1. 24 Apr, 2018 16 commits
  2. 19 Apr, 2018 24 commits
    • Greg Kroah-Hartman's avatar
      Linux 4.14.35 · 672f07d8
      Greg Kroah-Hartman authored
      672f07d8
    • J. Bruce Fields's avatar
      nfsd: fix incorrect umasks · 9a0a5098
      J. Bruce Fields authored
      commit 880a3a53 upstream.
      
      We're neglecting to clear the umask after it's set, which can cause a
      later unrelated rpc to (incorrectly) use the same umask if it happens to
      be processed by the same thread.
      
      There's a more subtle problem here too:
      
      An NFSv4 compound request is decoded all in one pass before any
      operations are executed.
      
      Currently we're setting current->fs->umask at the time we decode the
      compound.  In theory a single compound could contain multiple creates
      each setting a umask.  In that case we'd end up using whichever umask
      was passed in the *last* operation as the umask for all the creates,
      whether that was correct or not.
      
      So, we should just be saving the umask at decode time and waiting to set
      it until we actually process the corresponding operation.
      
      In practice it's unlikely any client would do multiple creates in a
      single compound.  And even if it did they'd likely be from the same
      process (hence carry the same umask).  So this is a little academic, but
      we should get it right anyway.
      
      Fixes: 47057abd (nfsd: add support for the umask attribute)
      Cc: stable@vger.kernel.org
      Reported-by: default avatarLucash Stach <l.stach@pengutronix.de>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9a0a5098
    • Mike Kravetz's avatar
      hugetlbfs: fix bug in pgoff overflow checking · 61534984
      Mike Kravetz authored
      commit 5df63c2a upstream.
      
      This is a fix for a regression in 32 bit kernels caused by an invalid
      check for pgoff overflow in hugetlbfs mmap setup.  The check incorrectly
      specified that the size of a loff_t was the same as the size of a long.
      The regression prevents mapping hugetlbfs files at offsets greater than
      4GB on 32 bit kernels.
      
      On 32 bit kernels conversion from a page based unsigned long can not
      overflow a loff_t byte offset.  Therefore, skip this check if
      sizeof(unsigned long) != sizeof(loff_t).
      
      Link: http://lkml.kernel.org/r/20180330145402.5053-1-mike.kravetz@oracle.com
      Fixes: 63489f8e ("hugetlbfs: check for pgoff value overflow")
      Reported-by: default avatarDan Rue <dan.rue@linaro.org>
      Signed-off-by: default avatarMike Kravetz <mike.kravetz@oracle.com>
      Tested-by: default avatarAnders Roxell <anders.roxell@linaro.org>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Yisheng Xie <xieyisheng1@huawei.com>
      Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: Nic Losby <blurbdust@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      61534984
    • Simon Gaiser's avatar
      xen: xenbus_dev_frontend: Fix XS_TRANSACTION_END handling · 0319ce67
      Simon Gaiser authored
      commit 2a22ee6c upstream.
      
      Commit fd8aa909 ("xen: optimize xenbus driver for multiple
      concurrent xenstore accesses") made a subtle change to the semantic of
      xenbus_dev_request_and_reply() and xenbus_transaction_end().
      
      Before on an error response to XS_TRANSACTION_END
      xenbus_dev_request_and_reply() would not decrement the active
      transaction counter. But xenbus_transaction_end() has always counted the
      transaction as finished regardless of the response.
      
      The new behavior is that xenbus_dev_request_and_reply() and
      xenbus_transaction_end() will always count the transaction as finished
      regardless the response code (handled in xs_request_exit()).
      
      But xenbus_dev_frontend tries to end a transaction on closing of the
      device if the XS_TRANSACTION_END failed before. Trying to close the
      transaction twice corrupts the reference count. So fix this by also
      considering a transaction closed if we have sent XS_TRANSACTION_END once
      regardless of the return code.
      
      Cc: <stable@vger.kernel.org> # 4.11
      Fixes: fd8aa909 ("xen: optimize xenbus driver for multiple concurrent xenstore accesses")
      Signed-off-by: default avatarSimon Gaiser <simon@invisiblethingslab.com>
      Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0319ce67
    • Amir Goldstein's avatar
      ovl: fix lookup with middle layer opaque dir and absolute path redirects · 80f509d4
      Amir Goldstein authored
      commit 3ec9b3fa upstream.
      
      As of now if we encounter an opaque dir while looking for a dentry, we set
      d->last=true. This means that there is no need to look further in any of
      the lower layers. This works fine as long as there are no redirets or
      relative redircts. But what if there is an absolute redirect on the
      children dentry of opaque directory. We still need to continue to look into
      next lower layer. This patch fixes it.
      
      Here is an example to demonstrate the issue. Say you have following setup.
      
      upper:  /redirect (redirect=/a/b/c)
      lower1: /a/[b]/c       ([b] is opaque) (c has absolute redirect=/a/b/d/)
      lower0: /a/b/d/foo
      
      Now "redirect" dir should merge with lower1:/a/b/c/ and lower0:/a/b/d.
      Note, despite the fact lower1:/a/[b] is opaque, we need to continue to look
      into lower0 because children c has an absolute redirect.
      
      Following is a reproducer.
      
      Watch me make foo disappear:
      
       $ mkdir lower middle upper work work2 merged
       $ mkdir lower/origin
       $ touch lower/origin/foo
       $ mount -t overlay none merged/ \
               -olowerdir=lower,upperdir=middle,workdir=work2
       $ mkdir merged/pure
       $ mv merged/origin merged/pure/redirect
       $ umount merged
       $ mount -t overlay none merged/ \
               -olowerdir=middle:lower,upperdir=upper,workdir=work
       $ mv merged/pure/redirect merged/redirect
      
      Now you see foo inside a twice redirected merged dir:
      
       $ ls merged/redirect
       foo
       $ umount merged
       $ mount -t overlay none merged/ \
               -olowerdir=middle:lower,upperdir=upper,workdir=work
      
      After mount cycle you don't see foo inside the same dir:
      
       $ ls merged/redirect
      
      During middle layer lookup, the opaqueness of middle/pure is left in
      the lookup state and then middle/pure/redirect is wrongly treated as
      opaque.
      
      Fixes: 02b69b28 ("ovl: lookup redirects")
      Cc: <stable@vger.kernel.org> #v4.10
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarVivek Goyal <vgoyal@redhat.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      80f509d4
    • Ming Lei's avatar
      blk-mq: don't keep offline CPUs mapped to hctx 0 · 5ee935da
      Ming Lei authored
      commit bffa9909 upstream.
      
      From commit 4b855ad3 ("blk-mq: Create hctx for each present CPU),
      blk-mq doesn't remap queue after CPU topo is changed, that said when
      some of these offline CPUs become online, they are still mapped to
      hctx 0, then hctx 0 may become the bottleneck of IO dispatch and
      completion.
      
      This patch sets up the mapping from the beginning, and aligns to
      queue mapping for PCI device (blk_mq_pci_map_queues()).
      
      Cc: Stefan Haberland <sth@linux.vnet.ibm.com>
      Cc: Keith Busch <keith.busch@intel.com>
      Cc: stable@vger.kernel.org
      Fixes: 4b855ad3 ("blk-mq: Create hctx for each present CPU)
      Tested-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5ee935da
    • Yury Norov's avatar
      lib: fix stall in __bitmap_parselist() · a333a284
      Yury Norov authored
      commit 8351760f upstream.
      
      syzbot is catching stalls at __bitmap_parselist()
      (https://syzkaller.appspot.com/bug?id=ad7e0351fbc90535558514a71cd3edc11681997a).
      The trigger is
      
        unsigned long v = 0;
        bitmap_parselist("7:,", &v, BITS_PER_LONG);
      
      which results in hitting infinite loop at
      
          while (a <= b) {
      	    off = min(b - a + 1, used_size);
      	    bitmap_set(maskp, a, off);
      	    a += group_size;
          }
      
      due to used_size == group_size == 0.
      
      Link: http://lkml.kernel.org/r/20180404162647.15763-1-ynorov@caviumnetworks.com
      Fixes: 0a5ce083 ("lib/bitmap.c: make bitmap_parselist() thread-safe and much faster")
      Signed-off-by: default avatarYury Norov <ynorov@caviumnetworks.com>
      Reported-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Reported-by: default avatarsyzbot <syzbot+6887cbb011c8054e8a3d@syzkaller.appspotmail.com>
      Cc: Noam Camus <noamca@mellanox.com>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Matthew Wilcox <mawilcox@microsoft.com>
      Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a333a284
    • Yunlong Song's avatar
      f2fs: fix heap mode to reset it back · f9e66750
      Yunlong Song authored
      commit b94929d9 upstream.
      
      Commit 7a20b8a6 ("f2fs: allocate node
      and hot data in the beginning of partition") introduces another mount
      option, heap, to reset it back. But it does not do anything for heap
      mode, so fix it.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarYunlong Song <yunlong.song@huawei.com>
      Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f9e66750
    • Eric Biggers's avatar
      sunrpc: remove incorrect HMAC request initialization · e4fa275b
      Eric Biggers authored
      commit f3aefb6a upstream.
      
      make_checksum_hmac_md5() is allocating an HMAC transform and doing
      crypto API calls in the following order:
      
          crypto_ahash_init()
          crypto_ahash_setkey()
          crypto_ahash_digest()
      
      This is wrong because it makes no sense to init() the request before a
      key has been set, given that the initial state depends on the key.  And
      digest() is short for init() + update() + final(), so in this case
      there's no need to explicitly call init() at all.
      
      Before commit 9fa68f62 ("crypto: hash - prevent using keyed hashes
      without setting key") the extra init() had no real effect, at least for
      the software HMAC implementation.  (There are also hardware drivers that
      implement HMAC-MD5, and it's not immediately obvious how gracefully they
      handle init() before setkey().)  But now the crypto API detects this
      incorrect initialization and returns -ENOKEY.  This is breaking NFS
      mounts in some cases.
      
      Fix it by removing the incorrect call to crypto_ahash_init().
      Reported-by: default avatarMichael Young <m.a.young@durham.ac.uk>
      Fixes: 9fa68f62 ("crypto: hash - prevent using keyed hashes without setting key")
      Fixes: fffdaef2 ("gss_krb5: Add support for rc4-hmac encryption")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e4fa275b
    • Toke Høiland-Jørgensen's avatar
      ath9k: Protect queue draining by rcu_read_lock() · 3d065356
      Toke Høiland-Jørgensen authored
      commit 182b1917 upstream.
      
      When ath9k was switched over to use the mac80211 intermediate queues,
      node cleanup now drains the mac80211 queues. However, this call path is
      not protected by rcu_read_lock() as it was previously entirely internal
      to the driver which uses its own locking.
      
      This leads to a possible rcu_dereference() without holding
      rcu_read_lock(); but only if a station is cleaned up while having
      packets queued on the TXQ. Fix this by adding the rcu_read_lock() to the
      caller in ath9k.
      
      Fixes: 50f08edf ("ath9k: Switch to using mac80211 intermediate software queues.")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarBen Greear <greearb@candelatech.com>
      Signed-off-by: default avatarToke Høiland-Jørgensen <toke@toke.dk>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3d065356
    • Marek Szyprowski's avatar
      hwmon: (ina2xx) Fix access to uninitialized mutex · aa3bfa29
      Marek Szyprowski authored
      commit 0c4c5860 upstream.
      
      Initialize data->config_lock mutex before it is used by the driver code.
      
      This fixes following warning on Odroid XU3 boards:
      
      INFO: trying to register non-static key.
      the code is fine but needs lockdep annotation.
      turning off the locking correctness validator.
      CPU: 5 PID: 1 Comm: swapper/0 Not tainted 4.15.0-rc7-next-20180115-00001-gb75575dee3f2 #107
      Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
      [<c0111504>] (unwind_backtrace) from [<c010dbec>] (show_stack+0x10/0x14)
      [<c010dbec>] (show_stack) from [<c09b3f74>] (dump_stack+0x90/0xc8)
      [<c09b3f74>] (dump_stack) from [<c0179528>] (register_lock_class+0x1c0/0x59c)
      [<c0179528>] (register_lock_class) from [<c017bd1c>] (__lock_acquire+0x78/0x1850)
      [<c017bd1c>] (__lock_acquire) from [<c017de30>] (lock_acquire+0xc8/0x2b8)
      [<c017de30>] (lock_acquire) from [<c09ca59c>] (__mutex_lock+0x60/0xa0c)
      [<c09ca59c>] (__mutex_lock) from [<c09cafd0>] (mutex_lock_nested+0x1c/0x24)
      [<c09cafd0>] (mutex_lock_nested) from [<c068b0d0>] (ina2xx_set_shunt+0x70/0xb0)
      [<c068b0d0>] (ina2xx_set_shunt) from [<c068b218>] (ina2xx_probe+0x88/0x1b0)
      [<c068b218>] (ina2xx_probe) from [<c0673d90>] (i2c_device_probe+0x1e0/0x2d0)
      [<c0673d90>] (i2c_device_probe) from [<c053a268>] (driver_probe_device+0x2b8/0x4a0)
      [<c053a268>] (driver_probe_device) from [<c053a54c>] (__driver_attach+0xfc/0x120)
      [<c053a54c>] (__driver_attach) from [<c05384cc>] (bus_for_each_dev+0x58/0x7c)
      [<c05384cc>] (bus_for_each_dev) from [<c0539590>] (bus_add_driver+0x174/0x250)
      [<c0539590>] (bus_add_driver) from [<c053b5e0>] (driver_register+0x78/0xf4)
      [<c053b5e0>] (driver_register) from [<c0675ef0>] (i2c_register_driver+0x38/0xa8)
      [<c0675ef0>] (i2c_register_driver) from [<c0102b40>] (do_one_initcall+0x48/0x18c)
      [<c0102b40>] (do_one_initcall) from [<c0e00df0>] (kernel_init_freeable+0x110/0x1d4)
      [<c0e00df0>] (kernel_init_freeable) from [<c09c8120>] (kernel_init+0x8/0x114)
      [<c09c8120>] (kernel_init) from [<c01010b4>] (ret_from_fork+0x14/0x20)
      
      Fixes: 5d389b12 ("hwmon: (ina2xx) Make calibration register value fixed")
      Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aa3bfa29
    • Yazen Ghannam's avatar
      x86/mce/AMD: Get address from already initialized block · 360ecf51
      Yazen Ghannam authored
      commit 27bd5950 upstream.
      
      The block address is saved after the block is initialized when
      threshold_init_device() is called.
      
      Use the saved block address, if available, rather than trying to
      rediscover it.
      
      This will avoid a call trace, when resuming from suspend, due to the
      rdmsr_safe_on_cpu() call in get_block_address(). The rdmsr_safe_on_cpu()
      call issues an IPI but we're running with interrupts disabled. This
      triggers:
      
          WARNING: CPU: 0 PID: 11523 at kernel/smp.c:291 smp_call_function_single+0xdc/0xe0
      Signed-off-by: default avatarYazen Ghannam <yazen.ghannam@amd.com>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: <stable@vger.kernel.org> # 4.14.x
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: linux-edac <linux-edac@vger.kernel.org>
      Link: http://lkml.kernel.org/r/20180221101900.10326-8-bp@alien8.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      360ecf51
    • Yazen Ghannam's avatar
      x86/mce/AMD, EDAC/mce_amd: Enumerate Reserved SMCA bank type · c81968e9
      Yazen Ghannam authored
      commit 68627a69 upstream.
      
      Currently, bank 4 is reserved on Fam17h, so we chose not to initialize
      bank 4 in the smca_banks array. This means that when we check if a bank
      is initialized, like during boot or resume, we will see that bank 4 is
      not initialized and try to initialize it.
      
      This will cause a call trace, when resuming from suspend, due to
      rdmsr_*on_cpu() calls in the init path. The rdmsr_*on_cpu() calls issue
      an IPI but we're running with interrupts disabled. This triggers:
      
        WARNING: CPU: 0 PID: 11523 at kernel/smp.c:291 smp_call_function_single+0xdc/0xe0
        ...
      
      Reserved banks will be read-as-zero, so their MCA_IPID register will be
      zero. So, like the smca_banks array, the threshold_banks array will not
      have an entry for a reserved bank since all its MCA_MISC* registers will
      be zero.
      
      Enumerate a "Reserved" bank type that matches on a HWID_MCATYPE of 0,0.
      
      Use the "Reserved" type when checking if a bank is reserved. It's
      possible that other bank numbers may be reserved on future systems.
      
      Don't try to find the block address on reserved banks.
      Signed-off-by: default avatarYazen Ghannam <yazen.ghannam@amd.com>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: <stable@vger.kernel.org> # 4.14.x
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: linux-edac <linux-edac@vger.kernel.org>
      Link: http://lkml.kernel.org/r/20180221101900.10326-7-bp@alien8.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c81968e9
    • Yazen Ghannam's avatar
      x86/mce/AMD: Pass the bank number to smca_get_bank_type() · 0ee4f316
      Yazen Ghannam authored
      commit e5d6a126 upstream.
      
      Pass the bank number to smca_get_bank_type() since that's all we need.
      
      Also, we should compare the bank number to MAX_NR_BANKS (size of the
      smca_banks array) not the number of bank types. Bank types are reused
      for multiple banks, so the number of types can be different from the
      number of banks in a system and thus we could return an invalid bank
      type.
      Signed-off-by: default avatarYazen Ghannam <yazen.ghannam@amd.com>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: <stable@vger.kernel.org> # 4.14.x
      Cc: <stable@vger.kernel.org> # 4.14.x: 11cf8877 x86/MCE/AMD: Define a function to get SMCA bank type
      Cc: <stable@vger.kernel.org> # 4.14.x: c6708d50 x86/MCE: Report only DRAM ECC as memory errors on AMD systems
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: linux-edac <linux-edac@vger.kernel.org>
      Link: http://lkml.kernel.org/r/20180221101900.10326-6-bp@alien8.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0ee4f316
    • Yazen Ghannam's avatar
      x86/MCE: Report only DRAM ECC as memory errors on AMD systems · 99971efd
      Yazen Ghannam authored
      commit c6708d50 upstream.
      
      The MCA_STATUS[ErrorCodeExt] field is very bank type specific.
      We currently check if the ErrorCodeExt value is 0x0 or 0x8 in
      mce_is_memory_error(), but we don't check the bank number. This means
      that we could flag non-memory errors as memory errors.
      
      We know that we want to flag DRAM ECC errors as memory errors, so let's do
      those cases first. We can add more cases later when needed.
      
      Define a wrapper function in mce_amd.c so we can use SMCA enums.
      
      [ bp: Remove brackets around return statements. ]
      Signed-off-by: default avatarYazen Ghannam <yazen.ghannam@amd.com>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20171207203955.118171-2-Yazen.Ghannam@amd.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      99971efd
    • Sudhir Sreedharan's avatar
      rtl8187: Fix NULL pointer dereference in priv->conf_mutex · a2813b4c
      Sudhir Sreedharan authored
      commit 7972326a upstream.
      
      This can be reproduced by bind/unbind the driver multiple times
      in AM3517 board.
      
      Analysis revealed that rtl8187_start() was invoked before probe
      finishes(ie. before the mutex is initialized).
      
       INFO: trying to register non-static key.
       the code is fine but needs lockdep annotation.
       turning off the locking correctness validator.
       CPU: 0 PID: 821 Comm: wpa_supplicant Not tainted 4.9.80-dirty #250
       Hardware name: Generic AM3517 (Flattened Device Tree)
       [<c010e0d8>] (unwind_backtrace) from [<c010beac>] (show_stack+0x10/0x14)
       [<c010beac>] (show_stack) from [<c017401c>] (register_lock_class+0x4f4/0x55c)
       [<c017401c>] (register_lock_class) from [<c0176fe0>] (__lock_acquire+0x74/0x1938)
       [<c0176fe0>] (__lock_acquire) from [<c0178cfc>] (lock_acquire+0xfc/0x23c)
       [<c0178cfc>] (lock_acquire) from [<c08aa2f8>] (mutex_lock_nested+0x50/0x3b0)
       [<c08aa2f8>] (mutex_lock_nested) from [<c05f5bf8>] (rtl8187_start+0x2c/0xd54)
       [<c05f5bf8>] (rtl8187_start) from [<c082dea0>] (drv_start+0xa8/0x320)
       [<c082dea0>] (drv_start) from [<c084d1d4>] (ieee80211_do_open+0x2bc/0x8e4)
       [<c084d1d4>] (ieee80211_do_open) from [<c069be94>] (__dev_open+0xb8/0x120)
       [<c069be94>] (__dev_open) from [<c069c11c>] (__dev_change_flags+0x88/0x14c)
       [<c069c11c>] (__dev_change_flags) from [<c069c1f8>] (dev_change_flags+0x18/0x48)
       [<c069c1f8>] (dev_change_flags) from [<c0710b08>] (devinet_ioctl+0x738/0x840)
       [<c0710b08>] (devinet_ioctl) from [<c067925c>] (sock_ioctl+0x164/0x2f4)
       [<c067925c>] (sock_ioctl) from [<c02883f8>] (do_vfs_ioctl+0x8c/0x9d0)
       [<c02883f8>] (do_vfs_ioctl) from [<c0288da8>] (SyS_ioctl+0x6c/0x7c)
       [<c0288da8>] (SyS_ioctl) from [<c0107760>] (ret_fast_syscall+0x0/0x1c)
       Unable to handle kernel NULL pointer dereference at virtual address 00000000
       pgd = cd1ec000
       [00000000] *pgd=8d1de831, *pte=00000000, *ppte=00000000
       Internal error: Oops: 817 [#1] PREEMPT ARM
       Modules linked in:
       CPU: 0 PID: 821 Comm: wpa_supplicant Not tainted 4.9.80-dirty #250
       Hardware name: Generic AM3517 (Flattened Device Tree)
       task: ce73eec0 task.stack: cd1ea000
       PC is at mutex_lock_nested+0xe8/0x3b0
       LR is at mutex_lock_nested+0xd0/0x3b0
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSudhir Sreedharan <ssreedharan@mvista.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a2813b4c
    • Hans de Goede's avatar
      Bluetooth: hci_bcm: Treat Interrupt ACPI resources as always being active-low · 9e483bc2
      Hans de Goede authored
      commit bb5208b3 upstream.
      
      Older devices with a serdev attached bcm bt hci, use an Interrupt ACPI
      resource to describe the IRQ (rather then a GpioInt resource).
      
      These device seem to all claim the IRQ is active-high and seem to all need
      a DMI quirk to treat it as active-low. Instead simply always assume that
      Interrupt resource specified IRQs are always active-low.
      
      This fixes the bt device not being able to wake the host from runtime-
      suspend on the: Asus T100TAM, Asus T200TA, Lenovo Yoga2 and the Toshiba
      Encore, without the need to add 4 new DMI quirks for these models.
      
      This also allows us to remove 2 DMI quirks for the Asus T100TA and Asus
      T100CHI series. Likely the 2 remaining quirks can also be removed but I
      could not find a DSDT of these devices to verify this.
      
      Cc: stable@vger.kernel.org
      Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=198953
      Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1554835Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9e483bc2
    • Szymon Janc's avatar
      Bluetooth: Fix connection if directed advertising and privacy is used · f58ef38e
      Szymon Janc authored
      commit 082f2300 upstream.
      
      Local random address needs to be updated before creating connection if
      RPA from LE Direct Advertising Report was resolved in host. Otherwise
      remote device might ignore connection request due to address mismatch.
      
      This was affecting following qualification test cases:
      GAP/CONN/SCEP/BV-03-C, GAP/CONN/GCEP/BV-05-C, GAP/CONN/DCEP/BV-05-C
      
      Before patch:
      < HCI Command: LE Set Random Address (0x08|0x0005) plen 6          #11350 [hci0] 84680.231216
              Address: 56:BC:E8:24:11:68 (Resolvable)
                Identity type: Random (0x01)
                Identity: F2:F1:06:3D:9C:42 (Static)
      > HCI Event: Command Complete (0x0e) plen 4                        #11351 [hci0] 84680.246022
            LE Set Random Address (0x08|0x0005) ncmd 1
              Status: Success (0x00)
      < HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7         #11352 [hci0] 84680.246417
              Type: Passive (0x00)
              Interval: 60.000 msec (0x0060)
              Window: 30.000 msec (0x0030)
              Own address type: Random (0x01)
              Filter policy: Accept all advertisement, inc. directed unresolved RPA (0x02)
      > HCI Event: Command Complete (0x0e) plen 4                        #11353 [hci0] 84680.248854
            LE Set Scan Parameters (0x08|0x000b) ncmd 1
              Status: Success (0x00)
      < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2             #11354 [hci0] 84680.249466
              Scanning: Enabled (0x01)
              Filter duplicates: Enabled (0x01)
      > HCI Event: Command Complete (0x0e) plen 4                        #11355 [hci0] 84680.253222
            LE Set Scan Enable (0x08|0x000c) ncmd 1
              Status: Success (0x00)
      > HCI Event: LE Meta Event (0x3e) plen 18                          #11356 [hci0] 84680.458387
            LE Direct Advertising Report (0x0b)
              Num reports: 1
              Event type: Connectable directed - ADV_DIRECT_IND (0x01)
              Address type: Random (0x01)
              Address: 53:38:DA:46:8C:45 (Resolvable)
                Identity type: Public (0x00)
                Identity: 11:22:33:44:55:66 (OUI 11-22-33)
              Direct address type: Random (0x01)
              Direct address: 7C:D6:76:8C:DF:82 (Resolvable)
                Identity type: Random (0x01)
                Identity: F2:F1:06:3D:9C:42 (Static)
              RSSI: -74 dBm (0xb6)
      < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2             #11357 [hci0] 84680.458737
              Scanning: Disabled (0x00)
              Filter duplicates: Disabled (0x00)
      > HCI Event: Command Complete (0x0e) plen 4                        #11358 [hci0] 84680.469982
            LE Set Scan Enable (0x08|0x000c) ncmd 1
              Status: Success (0x00)
      < HCI Command: LE Create Connection (0x08|0x000d) plen 25          #11359 [hci0] 84680.470444
              Scan interval: 60.000 msec (0x0060)
              Scan window: 60.000 msec (0x0060)
              Filter policy: White list is not used (0x00)
              Peer address type: Random (0x01)
              Peer address: 53:38:DA:46:8C:45 (Resolvable)
                Identity type: Public (0x00)
                Identity: 11:22:33:44:55:66 (OUI 11-22-33)
              Own address type: Random (0x01)
              Min connection interval: 30.00 msec (0x0018)
              Max connection interval: 50.00 msec (0x0028)
              Connection latency: 0 (0x0000)
              Supervision timeout: 420 msec (0x002a)
              Min connection length: 0.000 msec (0x0000)
              Max connection length: 0.000 msec (0x0000)
      > HCI Event: Command Status (0x0f) plen 4                          #11360 [hci0] 84680.474971
            LE Create Connection (0x08|0x000d) ncmd 1
              Status: Success (0x00)
      < HCI Command: LE Create Connection Cancel (0x08|0x000e) plen 0    #11361 [hci0] 84682.545385
      > HCI Event: Command Complete (0x0e) plen 4                        #11362 [hci0] 84682.551014
            LE Create Connection Cancel (0x08|0x000e) ncmd 1
              Status: Success (0x00)
      > HCI Event: LE Meta Event (0x3e) plen 19                          #11363 [hci0] 84682.551074
            LE Connection Complete (0x01)
              Status: Unknown Connection Identifier (0x02)
              Handle: 0
              Role: Master (0x00)
              Peer address type: Public (0x00)
              Peer address: 00:00:00:00:00:00 (OUI 00-00-00)
              Connection interval: 0.00 msec (0x0000)
              Connection latency: 0 (0x0000)
              Supervision timeout: 0 msec (0x0000)
              Master clock accuracy: 0x00
      
      After patch:
      < HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7    #210 [hci0] 667.152459
              Type: Passive (0x00)
              Interval: 60.000 msec (0x0060)
              Window: 30.000 msec (0x0030)
              Own address type: Random (0x01)
              Filter policy: Accept all advertisement, inc. directed unresolved RPA (0x02)
      > HCI Event: Command Complete (0x0e) plen 4                   #211 [hci0] 667.153613
            LE Set Scan Parameters (0x08|0x000b) ncmd 1
              Status: Success (0x00)
      < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2        #212 [hci0] 667.153704
              Scanning: Enabled (0x01)
              Filter duplicates: Enabled (0x01)
      > HCI Event: Command Complete (0x0e) plen 4                   #213 [hci0] 667.154584
            LE Set Scan Enable (0x08|0x000c) ncmd 1
              Status: Success (0x00)
      > HCI Event: LE Meta Event (0x3e) plen 18                     #214 [hci0] 667.182619
            LE Direct Advertising Report (0x0b)
              Num reports: 1
              Event type: Connectable directed - ADV_DIRECT_IND (0x01)
              Address type: Random (0x01)
              Address: 50:52:D9:A6:48:A0 (Resolvable)
                Identity type: Public (0x00)
                Identity: 11:22:33:44:55:66 (OUI 11-22-33)
              Direct address type: Random (0x01)
              Direct address: 7C:C1:57:A5:B7:A8 (Resolvable)
                Identity type: Random (0x01)
                Identity: F4:28:73:5D:38:B0 (Static)
              RSSI: -70 dBm (0xba)
      < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2       #215 [hci0] 667.182704
              Scanning: Disabled (0x00)
              Filter duplicates: Disabled (0x00)
      > HCI Event: Command Complete (0x0e) plen 4                  #216 [hci0] 667.183599
            LE Set Scan Enable (0x08|0x000c) ncmd 1
              Status: Success (0x00)
      < HCI Command: LE Set Random Address (0x08|0x0005) plen 6    #217 [hci0] 667.183645
              Address: 7C:C1:57:A5:B7:A8 (Resolvable)
                Identity type: Random (0x01)
                Identity: F4:28:73:5D:38:B0 (Static)
      > HCI Event: Command Complete (0x0e) plen 4                  #218 [hci0] 667.184590
            LE Set Random Address (0x08|0x0005) ncmd 1
              Status: Success (0x00)
      < HCI Command: LE Create Connection (0x08|0x000d) plen 25    #219 [hci0] 667.184613
              Scan interval: 60.000 msec (0x0060)
              Scan window: 60.000 msec (0x0060)
              Filter policy: White list is not used (0x00)
              Peer address type: Random (0x01)
              Peer address: 50:52:D9:A6:48:A0 (Resolvable)
                Identity type: Public (0x00)
                Identity: 11:22:33:44:55:66 (OUI 11-22-33)
              Own address type: Random (0x01)
              Min connection interval: 30.00 msec (0x0018)
              Max connection interval: 50.00 msec (0x0028)
              Connection latency: 0 (0x0000)
              Supervision timeout: 420 msec (0x002a)
              Min connection length: 0.000 msec (0x0000)
              Max connection length: 0.000 msec (0x0000)
      > HCI Event: Command Status (0x0f) plen 4                    #220 [hci0] 667.186558
            LE Create Connection (0x08|0x000d) ncmd 1
              Status: Success (0x00)
      > HCI Event: LE Meta Event (0x3e) plen 19                    #221 [hci0] 667.485824
            LE Connection Complete (0x01)
              Status: Success (0x00)
              Handle: 0
              Role: Master (0x00)
              Peer address type: Random (0x01)
              Peer address: 50:52:D9:A6:48:A0 (Resolvable)
                Identity type: Public (0x00)
                Identity: 11:22:33:44:55:66 (OUI 11-22-33)
              Connection interval: 50.00 msec (0x0028)
              Connection latency: 0 (0x0000)
              Supervision timeout: 420 msec (0x002a)
              Master clock accuracy: 0x07
      @ MGMT Event: Device Connected (0x000b) plen 13          {0x0002} [hci0] 667.485996
              LE Address: 11:22:33:44:55:66 (OUI 11-22-33)
              Flags: 0x00000000
              Data length: 0
      Signed-off-by: default avatarSzymon Janc <szymon.janc@codecoup.pl>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f58ef38e
    • Al Viro's avatar
      getname_kernel() needs to make sure that ->name != ->iname in long case · c3efeaa3
      Al Viro authored
      commit 30ce4d19 upstream.
      
      missed it in "kill struct filename.separate" several years ago.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c3efeaa3
    • Michael S. Tsirkin's avatar
      get_user_pages_fast(): return -EFAULT on access_ok failure · adea72f0
      Michael S. Tsirkin authored
      commit c61611f7 upstream.
      
      get_user_pages_fast is supposed to be a faster drop-in equivalent of
      get_user_pages.  As such, callers expect it to return a negative return
      code when passed an invalid address, and never expect it to return 0
      when passed a positive number of pages, since its documentation says:
      
       * Returns number of pages pinned. This may be fewer than the number
       * requested. If nr_pages is 0 or negative, returns 0. If no pages
       * were pinned, returns -errno.
      
      When get_user_pages_fast fall back on get_user_pages this is exactly
      what happens.  Unfortunately the implementation is inconsistent: it
      returns 0 if passed a kernel address, confusing callers: for example,
      the following is pretty common but does not appear to do the right thing
      with a kernel address:
      
              ret = get_user_pages_fast(addr, 1, writeable, &page);
              if (ret < 0)
                      return ret;
      
      Change get_user_pages_fast to return -EFAULT when supplied a kernel
      address to make it match expectations.
      
      All callers have been audited for consistency with the documented
      semantics.
      
      Link: http://lkml.kernel.org/r/1522962072-182137-4-git-send-email-mst@redhat.com
      Fixes: 5b65c467 ("mm, x86/mm: Fix performance regression in get_user_pages_fast()")
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Reported-by: syzbot+6304bf97ef436580fede@syzkaller.appspotmail.com
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Huang Ying <ying.huang@intel.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thorsten Leemhuis <regressions@leemhuis.info>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      adea72f0
    • Vasily Gorbik's avatar
      s390/ipl: ensure loadparm valid flag is set · 3da5723b
      Vasily Gorbik authored
      commit 15deb080 upstream.
      
      When loadparm is set in reipl parm block, the kernel should also set
      DIAG308_FLAGS_LP_VALID flag.
      
      This fixes loadparm ignoring during z/VM fcp -> ccw reipl and kvm direct
      boot -> ccw reipl.
      
      Cc: <stable@vger.kernel.org>
      Reviewed-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3da5723b
    • Julian Wiedmann's avatar
      s390/qdio: don't merge ERROR output buffers · c6c8e420
      Julian Wiedmann authored
      commit 0cf1e051 upstream.
      
      On an Output queue, both EMPTY and PENDING buffer states imply that the
      buffer is ready for completion-processing by the upper-layer drivers.
      
      So for a non-QEBSM Output queue, get_buf_states() merges mixed
      batches of PENDING and EMPTY buffers into one large batch of EMPTY
      buffers. The upper-layer driver (ie. qeth) later distuingishes PENDING
      from EMPTY by inspecting the slsb_state for
      QDIO_OUTBUF_STATE_FLAG_PENDING.
      
      But the merge logic in get_buf_states() contains a bug that causes us to
      erronously also merge ERROR buffers into such a batch of EMPTY buffers
      (ERROR is 0xaf, EMPTY is 0xa1; so ERROR & EMPTY == EMPTY).
      Effectively, most outbound ERROR buffers are currently discarded
      silently and processed as if they had succeeded.
      
      Note that this affects _all_ non-QEBSM device types, not just IQD with CQ.
      
      Fix it by explicitly spelling out the exact conditions for merging.
      
      For extracting the "get initial state" part out of the loop, this relies
      on the fact that get_buf_states() is never called with a count of 0. The
      QEBSM path already strictly requires this, and the two callers with
      variable 'count' make sure of it.
      
      Fixes: 104ea556 ("qdio: support asynchronous delivery of storage blocks")
      Cc: <stable@vger.kernel.org> #v3.2+
      Signed-off-by: default avatarJulian Wiedmann <jwi@linux.vnet.ibm.com>
      Reviewed-by: default avatarUrsula Braun <ubraun@linux.vnet.ibm.com>
      Reviewed-by: default avatarBenjamin Block <bblock@linux.vnet.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c6c8e420
    • Julian Wiedmann's avatar
      s390/qdio: don't retry EQBS after CCQ 96 · b6366b15
      Julian Wiedmann authored
      commit dae55b6f upstream.
      
      Immediate retry of EQBS after CCQ 96 means that we potentially misreport
      the state of buffers inspected during the first EQBS call.
      
      This occurs when
      1. the first EQBS finds all inspected buffers still in the initial state
         set by the driver (ie INPUT EMPTY or OUTPUT PRIMED),
      2. the EQBS terminates early with CCQ 96, and
      3. by the time that the second EQBS comes around, the state of those
         previously inspected buffers has changed.
      
      If the state reported by the second EQBS is 'driver-owned', all we know
      is that the previous buffers are driver-owned now as well. But we can't
      tell if they all have the same state. So for instance
      - the second EQBS reports OUTPUT EMPTY, but any number of the previous
        buffers could be OUTPUT ERROR by now,
      - the second EQBS reports OUTPUT ERROR, but any number of the previous
        buffers could be OUTPUT EMPTY by now.
      
      Effectively, this can result in both over- and underreporting of errors.
      
      If the state reported by the second EQBS is 'HW-owned', that doesn't
      guarantee that the previous buffers have not been switched to
      driver-owned in the mean time. So for instance
      - the second EQBS reports INPUT EMPTY, but any number of the previous
        buffers could be INPUT PRIMED (or INPUT ERROR) by now.
      
      This would result in failure to process pending work on the queue. If
      it's the final check before yielding initiative, this can cause
      a (temporary) queue stall due to IRQ avoidance.
      
      Fixes: 25f269f1 ("[S390] qdio: EQBS retry after CCQ 96")
      Cc: <stable@vger.kernel.org> #v3.2+
      Signed-off-by: default avatarJulian Wiedmann <jwi@linux.vnet.ibm.com>
      Reviewed-by: default avatarBenjamin Block <bblock@linux.vnet.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b6366b15
    • Dan Williams's avatar
      nfit: fix region registration vs block-data-window ranges · 3a6771e2
      Dan Williams authored
      commit 8d0d8ed3 upstream.
      
      Commit 1cf03c00 "nfit: scrub and register regions in a workqueue"
      mistakenly attempts to register a region per BLK aperture. There is
      nothing to register for individual apertures as they belong as a set to
      a BLK aperture group that are registered with a corresponding
      DIMM-control-region. Filter them for registration to prevent some
      needless devm_kzalloc() allocations.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 1cf03c00 ("nfit: scrub and register regions in a workqueue")
      Reviewed-by: default avatarDave Jiang <dave.jiang@intel.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3a6771e2