1. 09 Sep, 2018 23 commits
    • Lars-Peter Clausen's avatar
      iio: ad9523: Fix displayed phase · 4e834c73
      Lars-Peter Clausen authored
      commit 5a4e33c1 upstream.
      
      Fix the displayed phase for the ad9523 driver. Currently the most
      significant decimal place is dropped and all other digits are shifted one
      to the left. This is due to a multiplication by 10, which is not necessary,
      so remove it.
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarAlexandru Ardelean <alexandru.ardelean@analog.com>
      Fixes: cd1678f9 ("iio: frequency: New driver for AD9523 SPI Low Jitter Clock Generator")
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4e834c73
    • Tycho Andersen's avatar
      uart: fix race between uart_put_char() and uart_shutdown() · e5147bbf
      Tycho Andersen authored
      commit a5ba1d95 upstream.
      
      We have reports of the following crash:
      
          PID: 7 TASK: ffff88085c6d61c0 CPU: 1 COMMAND: "kworker/u25:0"
          #0 [ffff88085c6db710] machine_kexec at ffffffff81046239
          #1 [ffff88085c6db760] crash_kexec at ffffffff810fc248
          #2 [ffff88085c6db830] oops_end at ffffffff81008ae7
          #3 [ffff88085c6db860] no_context at ffffffff81050b8f
          #4 [ffff88085c6db8b0] __bad_area_nosemaphore at ffffffff81050d75
          #5 [ffff88085c6db900] bad_area_nosemaphore at ffffffff81050e83
          #6 [ffff88085c6db910] __do_page_fault at ffffffff8105132e
          #7 [ffff88085c6db9b0] do_page_fault at ffffffff8105152c
          #8 [ffff88085c6db9c0] page_fault at ffffffff81a3f122
          [exception RIP: uart_put_char+149]
          RIP: ffffffff814b67b5 RSP: ffff88085c6dba78 RFLAGS: 00010006
          RAX: 0000000000000292 RBX: ffffffff827c5120 RCX: 0000000000000081
          RDX: 0000000000000000 RSI: 000000000000005f RDI: ffffffff827c5120
          RBP: ffff88085c6dba98 R8: 000000000000012c R9: ffffffff822ea320
          R10: ffff88085fe4db04 R11: 0000000000000001 R12: ffff881059f9c000
          R13: 0000000000000001 R14: 000000000000005f R15: 0000000000000fba
          ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018
          #9 [ffff88085c6dbaa0] tty_put_char at ffffffff81497544
          #10 [ffff88085c6dbac0] do_output_char at ffffffff8149c91c
          #11 [ffff88085c6dbae0] __process_echoes at ffffffff8149cb8b
          #12 [ffff88085c6dbb30] commit_echoes at ffffffff8149cdc2
          #13 [ffff88085c6dbb60] n_tty_receive_buf_fast at ffffffff8149e49b
          #14 [ffff88085c6dbbc0] __receive_buf at ffffffff8149ef5a
          #15 [ffff88085c6dbc20] n_tty_receive_buf_common at ffffffff8149f016
          #16 [ffff88085c6dbca0] n_tty_receive_buf2 at ffffffff8149f194
          #17 [ffff88085c6dbcb0] flush_to_ldisc at ffffffff814a238a
          #18 [ffff88085c6dbd50] process_one_work at ffffffff81090be2
          #19 [ffff88085c6dbe20] worker_thread at ffffffff81091b4d
          #20 [ffff88085c6dbeb0] kthread at ffffffff81096384
          #21 [ffff88085c6dbf50] ret_from_fork at ffffffff81a3d69f​
      
      after slogging through some dissasembly:
      
      ffffffff814b6720 <uart_put_char>:
      ffffffff814b6720:	55                   	push   %rbp
      ffffffff814b6721:	48 89 e5             	mov    %rsp,%rbp
      ffffffff814b6724:	48 83 ec 20          	sub    $0x20,%rsp
      ffffffff814b6728:	48 89 1c 24          	mov    %rbx,(%rsp)
      ffffffff814b672c:	4c 89 64 24 08       	mov    %r12,0x8(%rsp)
      ffffffff814b6731:	4c 89 6c 24 10       	mov    %r13,0x10(%rsp)
      ffffffff814b6736:	4c 89 74 24 18       	mov    %r14,0x18(%rsp)
      ffffffff814b673b:	e8 b0 8e 58 00       	callq  ffffffff81a3f5f0 <mcount>
      ffffffff814b6740:	4c 8b a7 88 02 00 00 	mov    0x288(%rdi),%r12
      ffffffff814b6747:	45 31 ed             	xor    %r13d,%r13d
      ffffffff814b674a:	41 89 f6             	mov    %esi,%r14d
      ffffffff814b674d:	49 83 bc 24 70 01 00 	cmpq   $0x0,0x170(%r12)
      ffffffff814b6754:	00 00
      ffffffff814b6756:	49 8b 9c 24 80 01 00 	mov    0x180(%r12),%rbx
      ffffffff814b675d:	00
      ffffffff814b675e:	74 2f                	je     ffffffff814b678f <uart_put_char+0x6f>
      ffffffff814b6760:	48 89 df             	mov    %rbx,%rdi
      ffffffff814b6763:	e8 a8 67 58 00       	callq  ffffffff81a3cf10 <_raw_spin_lock_irqsave>
      ffffffff814b6768:	41 8b 8c 24 78 01 00 	mov    0x178(%r12),%ecx
      ffffffff814b676f:	00
      ffffffff814b6770:	89 ca                	mov    %ecx,%edx
      ffffffff814b6772:	f7 d2                	not    %edx
      ffffffff814b6774:	41 03 94 24 7c 01 00 	add    0x17c(%r12),%edx
      ffffffff814b677b:	00
      ffffffff814b677c:	81 e2 ff 0f 00 00    	and    $0xfff,%edx
      ffffffff814b6782:	75 23                	jne    ffffffff814b67a7 <uart_put_char+0x87>
      ffffffff814b6784:	48 89 c6             	mov    %rax,%rsi
      ffffffff814b6787:	48 89 df             	mov    %rbx,%rdi
      ffffffff814b678a:	e8 e1 64 58 00       	callq  ffffffff81a3cc70 <_raw_spin_unlock_irqrestore>
      ffffffff814b678f:	44 89 e8             	mov    %r13d,%eax
      ffffffff814b6792:	48 8b 1c 24          	mov    (%rsp),%rbx
      ffffffff814b6796:	4c 8b 64 24 08       	mov    0x8(%rsp),%r12
      ffffffff814b679b:	4c 8b 6c 24 10       	mov    0x10(%rsp),%r13
      ffffffff814b67a0:	4c 8b 74 24 18       	mov    0x18(%rsp),%r14
      ffffffff814b67a5:	c9                   	leaveq
      ffffffff814b67a6:	c3                   	retq
      ffffffff814b67a7:	49 8b 94 24 70 01 00 	mov    0x170(%r12),%rdx
      ffffffff814b67ae:	00
      ffffffff814b67af:	48 63 c9             	movslq %ecx,%rcx
      ffffffff814b67b2:	41 b5 01             	mov    $0x1,%r13b
      ffffffff814b67b5:	44 88 34 0a          	mov    %r14b,(%rdx,%rcx,1)
      ffffffff814b67b9:	41 8b 94 24 78 01 00 	mov    0x178(%r12),%edx
      ffffffff814b67c0:	00
      ffffffff814b67c1:	83 c2 01             	add    $0x1,%edx
      ffffffff814b67c4:	81 e2 ff 0f 00 00    	and    $0xfff,%edx
      ffffffff814b67ca:	41 89 94 24 78 01 00 	mov    %edx,0x178(%r12)
      ffffffff814b67d1:	00
      ffffffff814b67d2:	eb b0                	jmp    ffffffff814b6784 <uart_put_char+0x64>
      ffffffff814b67d4:	66 66 66 2e 0f 1f 84 	data32 data32 nopw %cs:0x0(%rax,%rax,1)
      ffffffff814b67db:	00 00 00 00 00
      
      for our build, this is crashing at:
      
          circ->buf[circ->head] = c;
      
      Looking in uart_port_startup(), it seems that circ->buf (state->xmit.buf)
      protected by the "per-port mutex", which based on uart_port_check() is
      state->port.mutex. Indeed, the lock acquired in uart_put_char() is
      uport->lock, i.e. not the same lock.
      
      Anyway, since the lock is not acquired, if uart_shutdown() is called, the
      last chunk of that function may release state->xmit.buf before its assigned
      to null, and cause the race above.
      
      To fix it, let's lock uport->lock when allocating/deallocating
      state->xmit.buf in addition to the per-port mutex.
      
      v2: switch to locking uport->lock on allocation/deallocation instead of
          locking the per-port mutex in uart_put_char. Note that since
          uport->lock is a spin lock, we have to switch the allocation to
          GFP_ATOMIC.
      v3: move the allocation outside the lock, so we can switch back to
          GFP_KERNEL
      Signed-off-by: default avatarTycho Andersen <tycho@tycho.ws>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e5147bbf
    • Mike Snitzer's avatar
      dm cache metadata: save in-core policy_hint_size to on-disk superblock · d08b58b5
      Mike Snitzer authored
      commit fd2fa954 upstream.
      
      policy_hint_size starts as 0 during __write_initial_superblock().  It
      isn't until the policy is loaded that policy_hint_size is set in-core
      (cmd->policy_hint_size).  But it never got recorded in the on-disk
      superblock because __commit_transaction() didn't deal with transfering
      the in-core cmd->policy_hint_size to the on-disk superblock.
      
      The in-core cmd->policy_hint_size gets initialized by metadata_open()'s
      __begin_transaction_flags() which re-reads all superblock fields.
      Because the superblock's policy_hint_size was never properly stored, when
      the cache was created, hints_array_available() would always return false
      when re-activating a previously created cache.  This means
      __load_mappings() always considered the hints invalid and never made use
      of the hints (these hints served to optimize).
      
      Another detremental side-effect of this oversight is the cache_check
      utility would fail with: "invalid hint width: 0"
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d08b58b5
    • Hou Tao's avatar
      dm thin: stop no_space_timeout worker when switching to write-mode · 9a3f8fd5
      Hou Tao authored
      commit 75294442 upstream.
      
      Now both check_for_space() and do_no_space_timeout() will read & write
      pool->pf.error_if_no_space.  If these functions run concurrently, as
      shown in the following case, the default setting of "queue_if_no_space"
      can get lost.
      
      precondition:
          * error_if_no_space = false (aka "queue_if_no_space")
          * pool is in Out-of-Data-Space (OODS) mode
          * no_space_timeout worker has been queued
      
      CPU 0:                          CPU 1:
      // delete a thin device
      process_delete_mesg()
      // check_for_space() invoked by commit()
      set_pool_mode(pool, PM_WRITE)
          pool->pf.error_if_no_space = \
           pt->requested_pf.error_if_no_space
      
      				// timeout, pool is still in OODS mode
      				do_no_space_timeout
      				    // "queue_if_no_space" config is lost
      				    pool->pf.error_if_no_space = true
          pool->pf.mode = new_mode
      
      Fix it by stopping no_space_timeout worker when switching to write mode.
      
      Fixes: bcc696fa ("dm thin: stay in out-of-data-space mode once no_space_timeout expires")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHou Tao <houtao1@huawei.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9a3f8fd5
    • Tomas Bortoli's avatar
      net/9p/trans_fd.c: fix race-condition by flushing workqueue before the kfree() · 35c740d1
      Tomas Bortoli authored
      commit 430ac66e upstream.
      
      The patch adds the flush in p9_mux_poll_stop() as it the function used by
      p9_conn_destroy(), in turn called by p9_fd_close() to stop the async
      polling associated with the data regarding the connection.
      
      Link: http://lkml.kernel.org/r/20180720092730.27104-1-tomasbortoli@gmail.comSigned-off-by: default avatarTomas Bortoli <tomasbortoli@gmail.com>
      Reported-by: syzbot+39749ed7d9ef6dfb23f6@syzkaller.appspotmail.com
      To: Eric Van Hensbergen <ericvh@gmail.com>
      To: Ron Minnich <rminnich@sandia.gov>
      To: Latchesar Ionkov <lucho@ionkov.net>
      Cc: Yiwen Jiang <jiangyiwen@huwei.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDominique Martinet <dominique.martinet@cea.fr>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      35c740d1
    • Tomas Bortoli's avatar
      net/9p/client.c: version pointer uninitialized · c53310d0
      Tomas Bortoli authored
      commit 7913690d upstream.
      
      The p9_client_version() does not initialize the version pointer. If the
      call to p9pdu_readf() returns an error and version has not been allocated
      in p9pdu_readf(), then the program will jump to the "error" label and will
      try to free the version pointer. If version is not initialized, free()
      will be called with uninitialized, garbage data and will provoke a crash.
      
      Link: http://lkml.kernel.org/r/20180709222943.19503-1-tomasbortoli@gmail.comSigned-off-by: default avatarTomas Bortoli <tomasbortoli@gmail.com>
      Reported-by: syzbot+65c6b72f284a39d416b4@syzkaller.appspotmail.com
      Reviewed-by: default avatarJun Piao <piaojun@huawei.com>
      Reviewed-by: default avatarYiwen Jiang <jiangyiwen@huawei.com>
      Cc: Eric Van Hensbergen <ericvh@gmail.com>
      Cc: Ron Minnich <rminnich@sandia.gov>
      Cc: Latchesar Ionkov <lucho@ionkov.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDominique Martinet <dominique.martinet@cea.fr>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c53310d0
    • jiangyiwen's avatar
      9p/virtio: fix off-by-one error in sg list bounds check · b69ef7c9
      jiangyiwen authored
      commit 23cba9cb upstream.
      
      Because the value of limit is VIRTQUEUE_NUM, if index is equal to
      limit, it will cause sg array out of bounds, so correct the judgement
      of BUG_ON.
      
      Link: http://lkml.kernel.org/r/5B63D5F6.6080109@huawei.comSigned-off-by: default avatarYiwen Jiang <jiangyiwen@huawei.com>
      Reported-By: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: default avatarJun Piao <piaojun@huawei.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDominique Martinet <dominique.martinet@cea.fr>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b69ef7c9
    • piaojun's avatar
      fs/9p/xattr.c: catch the error of p9_client_clunk when setting xattr failed · 684f5d9a
      piaojun authored
      commit 3111784b upstream.
      
      In my testing, v9fs_fid_xattr_set will return successfully even if the
      backend ext4 filesystem has no space to store xattr key-value. That will
      cause inconsistent behavior between front end and back end. The reason is
      that lsetxattr will be triggered by p9_client_clunk, and unfortunately we
      did not catch the error. This patch will catch the error to notify upper
      caller.
      
      p9_client_clunk (in 9p)
        p9_client_rpc(clnt, P9_TCLUNK, "d", fid->fid);
          v9fs_clunk (in qemu)
            put_fid
              free_fid
                v9fs_xattr_fid_clunk
                  v9fs_co_lsetxattr
                    s->ops->lsetxattr
                      ext4_xattr_user_set (in host ext4 filesystem)
      
      Link: http://lkml.kernel.org/r/5B57EACC.2060900@huawei.comSigned-off-by: default avatarJun Piao <piaojun@huawei.com>
      Cc: Eric Van Hensbergen <ericvh@gmail.com>
      Cc: Ron Minnich <rminnich@sandia.gov>
      Cc: Latchesar Ionkov <lucho@ionkov.net>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDominique Martinet <dominique.martinet@cea.fr>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      684f5d9a
    • Bart Van Assche's avatar
      RDMA/rxe: Set wqe->status correctly if an unexpected response is received · e4f53121
      Bart Van Assche authored
      commit 61b717d0 upstream.
      
      Every function that returns COMPST_ERROR must set wqe->status to another
      value than IB_WC_SUCCESS before returning COMPST_ERROR. Fix the only code
      path for which this is not yet the case.
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
      Cc: <stable@vger.kernel.org>
      Reviewed-by: default avatarYuval Shaia <yuval.shaia@oracle.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e4f53121
    • Bart Van Assche's avatar
      ib_srpt: Fix a use-after-free in srpt_close_ch() · 2c3c284b
      Bart Van Assche authored
      commit 99525095 upstream.
      
      Avoid that KASAN reports the following:
      
      BUG: KASAN: use-after-free in srpt_close_ch+0x4f/0x1b0 [ib_srpt]
      Read of size 4 at addr ffff880151180cb8 by task check/4681
      
      CPU: 15 PID: 4681 Comm: check Not tainted 4.18.0-rc2-dbg+ #4
      Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014
      Call Trace:
       dump_stack+0xa4/0xf5
       print_address_description+0x6f/0x270
       kasan_report+0x241/0x360
       __asan_load4+0x78/0x80
       srpt_close_ch+0x4f/0x1b0 [ib_srpt]
       srpt_set_enabled+0xf7/0x1e0 [ib_srpt]
       srpt_tpg_enable_store+0xb8/0x120 [ib_srpt]
       configfs_write_file+0x14e/0x1d0 [configfs]
       __vfs_write+0xd2/0x3b0
       vfs_write+0x101/0x270
       ksys_write+0xab/0x120
       __x64_sys_write+0x43/0x50
       do_syscall_64+0x77/0x230
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      Fixes: aaf45bd8 ("IB/srpt: Detect session shutdown reliably")
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2c3c284b
    • Vaibhav Jain's avatar
      cxl: Fix wrong comparison in cxl_adapter_context_get() · 6f329f27
      Vaibhav Jain authored
      commit ef6cb5f1 upstream.
      
      Function atomic_inc_unless_negative() returns a bool to indicate
      success/failure. However cxl_adapter_context_get() wrongly compares
      the return value against '>=0' which will always be true. The patch
      fixes this comparison to '==0' there by also fixing this compile time
      warning:
      
      	drivers/misc/cxl/main.c:290 cxl_adapter_context_get()
      	warn: 'atomic_inc_unless_negative(&adapter->contexts_num)' is unsigned
      
      Fixes: 70b565bb ("cxl: Prevent adapter reset if an active context exists")
      Cc: stable@vger.kernel.org # v4.9+
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarVaibhav Jain <vaibhav@linux.ibm.com>
      Acked-by: default avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
      Acked-by: default avatarFrederic Barrat <fbarrat@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6f329f27
    • Benjamin Herrenschmidt's avatar
      powerpc/powernv/pci: Work around races in PCI bridge enabling · f8700e03
      Benjamin Herrenschmidt authored
      commit db217319 upstream.
      
      The generic code is racy when multiple children of a PCI bridge try to
      enable it simultaneously.
      
      This leads to drivers trying to access a device through a
      not-yet-enabled bridge, and this EEH errors under various
      circumstances when using parallel driver probing.
      
      There is work going on to fix that properly in the PCI core but it
      will take some time.
      
      x86 gets away with it because (outside of hotplug), the BIOS enables
      all the bridges at boot time.
      
      This patch does the same thing on powernv by enabling all bridges that
      have child devices at boot time, thus avoiding subsequent races. It's
      suitable for backporting to stable and distros, while the proper PCI
      fix will probably be significantly more invasive.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f8700e03
    • Frederick Lawler's avatar
      PCI: Add wrappers for dev_printk() · 0eb725c1
      Frederick Lawler authored
      commit 7506dc79 upstream.
      
      Add PCI-specific dev_printk() wrappers and use them to simplify the code
      slightly.  No functional change intended.
      Signed-off-by: default avatarFrederick Lawler <fred@fredlawl.com>
      [bhelgaas: squash into one patch]
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      [only take the pci.h portion of this patch, to make backporting stuff
      easier over time - gregkh]
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0eb725c1
    • Mahesh Salgaonkar's avatar
      powerpc/pseries: Fix endianness while restoring of r3 in MCE handler. · 89bdde28
      Mahesh Salgaonkar authored
      commit cd813e1c upstream.
      
      During Machine Check interrupt on pseries platform, register r3 points
      RTAS extended event log passed by hypervisor. Since hypervisor uses r3
      to pass pointer to rtas log, it stores the original r3 value at the
      start of the memory (first 8 bytes) pointed by r3. Since hypervisor
      stores this info and rtas log is in BE format, linux should make
      sure to restore r3 value in correct endian format.
      
      Without this patch when MCE handler, after recovery, returns to code that
      that caused the MCE may end up with Data SLB access interrupt for invalid
      address followed by kernel panic or hang.
      
        Severe Machine check interrupt [Recovered]
          NIP [d00000000ca301b8]: init_module+0x1b8/0x338 [bork_kernel]
          Initiator: CPU
          Error type: SLB [Multihit]
            Effective address: d00000000ca70000
        cpu 0xa: Vector: 380 (Data SLB Access) at [c0000000fc7775b0]
            pc: c0000000009694c0: vsnprintf+0x80/0x480
            lr: c0000000009698e0: vscnprintf+0x20/0x60
            sp: c0000000fc777830
           msr: 8000000002009033
           dar: a803a30c000000d0
          current = 0xc00000000bc9ef00
          paca    = 0xc00000001eca5c00	 softe: 3	 irq_happened: 0x01
            pid   = 8860, comm = insmod
        vscnprintf+0x20/0x60
        vprintk_emit+0xb4/0x4b0
        vprintk_func+0x5c/0xd0
        printk+0x38/0x4c
        init_module+0x1c0/0x338 [bork_kernel]
        do_one_initcall+0x54/0x230
        do_init_module+0x8c/0x248
        load_module+0x12b8/0x15b0
        sys_finit_module+0xa8/0x110
        system_call+0x58/0x6c
        --- Exception: c00 (System Call) at 00007fff8bda0644
        SP (7fffdfbfe980) is in userspace
      
      This patch fixes this issue.
      
      Fixes: a08a53ea ("powerpc/le: Enable RTAS events support")
      Cc: stable@vger.kernel.org # v3.15+
      Reviewed-by: default avatarNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: default avatarMahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      89bdde28
    • Hari Bathini's avatar
      powerpc/fadump: handle crash memory ranges array index overflow · 1ae3174f
      Hari Bathini authored
      commit 1bd6a1c4 upstream.
      
      Crash memory ranges is an array of memory ranges of the crashing kernel
      to be exported as a dump via /proc/vmcore file. The size of the array
      is set based on INIT_MEMBLOCK_REGIONS, which works alright in most cases
      where memblock memory regions count is less than INIT_MEMBLOCK_REGIONS
      value. But this count can grow beyond INIT_MEMBLOCK_REGIONS value since
      commit 142b45a7 ("memblock: Add array resizing support").
      
      On large memory systems with a few DLPAR operations, the memblock memory
      regions count could be larger than INIT_MEMBLOCK_REGIONS value. On such
      systems, registering fadump results in crash or other system failures
      like below:
      
        task: c00007f39a290010 ti: c00000000b738000 task.ti: c00000000b738000
        NIP: c000000000047df4 LR: c0000000000f9e58 CTR: c00000000010f180
        REGS: c00000000b73b570 TRAP: 0300   Tainted: G          L   X  (4.4.140+)
        MSR: 8000000000009033 <SF,EE,ME,IR,DR,RI,LE>  CR: 22004484  XER: 20000000
        CFAR: c000000000008500 DAR: 000007a450000000 DSISR: 40000000 SOFTE: 0
        ...
        NIP [c000000000047df4] smp_send_reschedule+0x24/0x80
        LR [c0000000000f9e58] resched_curr+0x138/0x160
        Call Trace:
          resched_curr+0x138/0x160 (unreliable)
          check_preempt_curr+0xc8/0xf0
          ttwu_do_wakeup+0x38/0x150
          try_to_wake_up+0x224/0x4d0
          __wake_up_common+0x94/0x100
          ep_poll_callback+0xac/0x1c0
          __wake_up_common+0x94/0x100
          __wake_up_sync_key+0x70/0xa0
          sock_def_readable+0x58/0xa0
          unix_stream_sendmsg+0x2dc/0x4c0
          sock_sendmsg+0x68/0xa0
          ___sys_sendmsg+0x2cc/0x2e0
          __sys_sendmsg+0x5c/0xc0
          SyS_socketcall+0x36c/0x3f0
          system_call+0x3c/0x100
      
      as array index overflow is not checked for while setting up crash memory
      ranges causing memory corruption. To resolve this issue, dynamically
      allocate memory for crash memory ranges and resize it incrementally,
      in units of pagesize, on hitting array size limit.
      
      Fixes: 2df173d9 ("fadump: Initialize elfcore header and add PT_LOAD program headers.")
      Cc: stable@vger.kernel.org # v3.4+
      Signed-off-by: default avatarHari Bathini <hbathini@linux.ibm.com>
      Reviewed-by: default avatarMahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
      [mpe: Just use PAGE_SIZE directly, fixup variable placement]
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1ae3174f
    • Gustavo A. R. Silva's avatar
      mailbox: xgene-slimpro: Fix potential NULL pointer dereference · 0fdb739a
      Gustavo A. R. Silva authored
      commit 3512a18c upstream.
      
      There is a potential execution path in which function
      platform_get_resource() returns NULL. If this happens,
      we will end up having a NULL pointer dereference.
      
      Fix this by replacing devm_ioremap with devm_ioremap_resource,
      which has the NULL check and the memory region request.
      
      This code was detected with the help of Coccinelle.
      
      Cc: stable@vger.kernel.org
      Fixes: f700e84f ("mailbox: Add support for APM X-Gene platform mailbox driver")
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: default avatarJassi Brar <jaswinder.singh@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0fdb739a
    • Daniel Mack's avatar
      libertas: fix suspend and resume for SDIO connected cards · 64a2af0e
      Daniel Mack authored
      commit 7444a809 upstream.
      
      Prior to commit 573185cc ("mmc: core: Invoke sdio func driver's PM
      callbacks from the sdio bus"), the MMC core used to call into the power
      management functions of SDIO clients itself and removed the card if the
      return code was non-zero. IOW, the mmc handled errors gracefully and didn't
      upchain them to the pm core.
      
      Since this change, the mmc core relies on generic power management
      functions which treat all errors as a reason to cancel the suspend
      immediately. This causes suspend attempts to fail when the libertas
      driver is loaded.
      
      To fix this, power down the card explicitly in if_sdio_suspend() when we
      know we're about to lose power and return success. Also set a flag in these
      cases, and power up the card again in if_sdio_resume().
      
      Fixes: 573185cc ("mmc: core: Invoke sdio func driver's PM callbacks from the sdio bus")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarDaniel Mack <daniel@zonque.org>
      Reviewed-by: default avatarChris Ball <chris@printf.net>
      Reviewed-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      64a2af0e
    • Matthew Auld's avatar
      drm/i915/userptr: reject zero user_size · f916daa6
      Matthew Auld authored
      commit c11c7bfd upstream.
      
      Operating on a zero sized GEM userptr object will lead to explosions.
      
      Fixes: 5cc9ed4b ("drm/i915: Introduce mapping of user pages into video memory (userptr) ioctl")
      Testcase: igt/gem_userptr_blits/input-checking
      Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180502195021.30900-1-matthew.auld@intel.com
      Cc: Loic <hackurx@opensec.fr>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f916daa6
    • Krzysztof Kozlowski's avatar
      spi: spi-fsl-dspi: Fix imprecise abort on VF500 during probe · 9f16a87f
      Krzysztof Kozlowski authored
      commit d8ffee2f upstream.
      
      Registers of DSPI should not be accessed before enabling its clock.  On
      Toradex Colibri VF50 on Iris carrier board this could be seen during
      bootup as imprecise abort:
      
          Unhandled fault: imprecise external abort (0x1c06) at 0x00000000
          Internal error: : 1c06 [#1] ARM
          Modules linked in:
          CPU: 0 PID: 1 Comm: swapper Not tainted 4.14.39-dirty #97
          Hardware name: Freescale Vybrid VF5xx/VF6xx (Device Tree)
          Backtrace:
          [<804166a8>] (regmap_write) from [<80466b5c>] (dspi_probe+0x1f0/0x8dc)
          [<8046696c>] (dspi_probe) from [<8040107c>] (platform_drv_probe+0x54/0xb8)
          [<80401028>] (platform_drv_probe) from [<803ff53c>] (driver_probe_device+0x280/0x2f8)
          [<803ff2bc>] (driver_probe_device) from [<803ff674>] (__driver_attach+0xc0/0xc4)
          [<803ff5b4>] (__driver_attach) from [<803fd818>] (bus_for_each_dev+0x70/0xa4)
          [<803fd7a8>] (bus_for_each_dev) from [<803fee74>] (driver_attach+0x24/0x28)
          [<803fee50>] (driver_attach) from [<803fe980>] (bus_add_driver+0x1a0/0x218)
          [<803fe7e0>] (bus_add_driver) from [<803fffe8>] (driver_register+0x80/0x100)
          [<803fff68>] (driver_register) from [<80400fdc>] (__platform_driver_register+0x48/0x50)
          [<80400f94>] (__platform_driver_register) from [<8091cf7c>] (fsl_dspi_driver_init+0x1c/0x20)
          [<8091cf60>] (fsl_dspi_driver_init) from [<8010195c>] (do_one_initcall+0x4c/0x174)
          [<80101910>] (do_one_initcall) from [<80900e8c>] (kernel_init_freeable+0x144/0x1d8)
          [<80900d48>] (kernel_init_freeable) from [<805ff6a8>] (kernel_init+0x10/0x114)
          [<805ff698>] (kernel_init) from [<80107be8>] (ret_from_fork+0x14/0x2c)
      
      Cc: <stable@vger.kernel.org>
      Fixes: 5ee67b58 ("spi: dspi: clear SPI_SR before enable interrupt")
      Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9f16a87f
    • Bartosz Golaszewski's avatar
      spi: davinci: fix a NULL pointer dereference · ae8f22ed
      Bartosz Golaszewski authored
      commit 563a53f3 upstream.
      
      On non-OF systems spi->controlled_data may be NULL. This causes a NULL
      pointer derefence on dm365-evm.
      Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ae8f22ed
    • Chirantan Ekbote's avatar
      9p/net: Fix zero-copy path in the 9p virtio transport · 5c451549
      Chirantan Ekbote authored
      commit d28c756c upstream.
      
      The zero-copy optimization when reading or writing large chunks of data
      is quite useful.  However, the 9p messages created through the zero-copy
      write path have an incorrect message size: it should be the size of the
      header + size of the data being written but instead it's just the size
      of the header.
      
      This only works if the server ignores the size field of the message and
      otherwise breaks the framing of the protocol. Fix this by re-writing the
      message size field with the correct value.
      
      Tested by running `dd if=/dev/zero of=out bs=4k count=1` inside a
      virtio-9p mount.
      
      Link: http://lkml.kernel.org/r/20180717003529.114368-1-chirantan@chromium.orgSigned-off-by: default avatarChirantan Ekbote <chirantan@chromium.org>
      Reviewed-by: default avatarGreg Kurz <groug@kaod.org>
      Tested-by: default avatarGreg Kurz <groug@kaod.org>
      Cc: Dylan Reid <dgreid@chromium.org>
      Cc: Guenter Roeck <groeck@chromium.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDominique Martinet <dominique.martinet@cea.fr>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5c451549
    • Alexander Aring's avatar
      net: mac802154: tx: expand tailroom if necessary · 41b2e6ef
      Alexander Aring authored
      commit f9c52831 upstream.
      
      This patch is necessary if case of AF_PACKET or other socket interface
      which I am aware of it and didn't allocated the necessary room.
      Reported-by: default avatarDavid Palma <david.palma@ntnu.no>
      Reported-by: default avatarRabi Narayan Sahoo <rabinarayans0828@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAlexander Aring <aring@mojatatu.com>
      Signed-off-by: default avatarStefan Schmidt <stefan@datenfreihafen.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      41b2e6ef
    • Alexander Aring's avatar
      net: 6lowpan: fix reserved space for single frames · 6aa4a723
      Alexander Aring authored
      commit ac74f87c upstream.
      
      This patch fixes patch add handling to take care tail and headroom for
      single 6lowpan frames. We need to be sure we have a skb with the right
      head and tailroom for single frames. This patch do it by using
      skb_copy_expand() if head and tailroom is not enough allocated by upper
      layer.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=195059Reported-by: default avatarDavid Palma <david.palma@ntnu.no>
      Reported-by: default avatarRabi Narayan Sahoo <rabinarayans0828@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAlexander Aring <aring@mojatatu.com>
      Signed-off-by: default avatarStefan Schmidt <stefan@datenfreihafen.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6aa4a723
  2. 05 Sep, 2018 17 commits