1. 24 Apr, 2018 28 commits
  2. 19 Apr, 2018 12 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