1. 14 Dec, 2017 40 commits
    • Xin Long's avatar
      sctp: use the right sk after waking up from wait_buf sleep · 0c7e787b
      Xin Long authored
      
      [ Upstream commit cea0cc80 ]
      
      Commit dfcb9f4f ("sctp: deny peeloff operation on asocs with threads
      sleeping on it") fixed the race between peeloff and wait sndbuf by
      checking waitqueue_active(&asoc->wait) in sctp_do_peeloff().
      
      But it actually doesn't work, as even if waitqueue_active returns false
      the waiting sndbuf thread may still not yet hold sk lock. After asoc is
      peeled off, sk is not asoc->base.sk any more, then to hold the old sk
      lock couldn't make assoc safe to access.
      
      This patch is to fix this by changing to hold the new sk lock if sk is
      not asoc->base.sk, meanwhile, also set the sk in sctp_sendmsg with the
      new sk.
      
      With this fix, there is no more race between peeloff and waitbuf, the
      check 'waitqueue_active' in sctp_do_peeloff can be removed.
      
      Thanks Marcelo and Neil for making this clear.
      
      v1->v2:
        fix it by changing to lock the new sock instead of adding a flag in asoc.
      Suggested-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0c7e787b
    • Xin Long's avatar
      sctp: do not free asoc when it is already dead in sctp_sendmsg · 191d9612
      Xin Long authored
      
      [ Upstream commit ca3af4dd ]
      
      Now in sctp_sendmsg sctp_wait_for_sndbuf could schedule out without
      holding sock sk. It means the current asoc can be freed elsewhere,
      like when receiving an abort packet.
      
      If the asoc is just created in sctp_sendmsg and sctp_wait_for_sndbuf
      returns err, the asoc will be freed again due to new_asoc is not nil.
      An use-after-free issue would be triggered by this.
      
      This patch is to fix it by setting new_asoc with nil if the asoc is
      already dead when cpu schedules back, so that it will not be freed
      again in sctp_sendmsg.
      
      v1->v2:
        set new_asoc as nil in sctp_sendmsg instead of sctp_wait_for_sndbuf.
      Suggested-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Reported-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      191d9612
    • Miles Chen's avatar
      slub: fix sysfs duplicate filename creation when slub_debug=O · 5ca94e03
      Miles Chen authored
      
      [ Upstream commit 11066386 ]
      
      When slub_debug=O is set.  It is possible to clear debug flags for an
      "unmergeable" slab cache in kmem_cache_open().  It makes the "unmergeable"
      cache became "mergeable" in sysfs_slab_add().
      
      These caches will generate their "unique IDs" by create_unique_id(), but
      it is possible to create identical unique IDs.  In my experiment,
      sgpool-128, names_cache, biovec-256 generate the same ID ":Ft-0004096" and
      the kernel reports "sysfs: cannot create duplicate filename
      '/kernel/slab/:Ft-0004096'".
      
      To repeat my experiment, set disable_higher_order_debug=1,
      CONFIG_SLUB_DEBUG_ON=y in kernel-4.14.
      
      Fix this issue by setting unmergeable=1 if slub_debug=O and the the
      default slub_debug contains any no-merge flags.
      
      call path:
      kmem_cache_create()
        __kmem_cache_alias()	-> we set SLAB_NEVER_MERGE flags here
        create_cache()
          __kmem_cache_create()
            kmem_cache_open()	-> clear DEBUG_METADATA_FLAGS
            sysfs_slab_add()	-> the slab cache is mergeable now
      
        sysfs: cannot create duplicate filename '/kernel/slab/:Ft-0004096'
        ------------[ cut here ]------------
        WARNING: CPU: 0 PID: 1 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x60/0x7c
        Modules linked in:
        CPU: 0 PID: 1 Comm: swapper/0 Tainted: G        W       4.14.0-rc7ajb-00131-gd4c2e9fc-dirty #123
        Hardware name: linux,dummy-virt (DT)
        task: ffffffc07d4e0080 task.stack: ffffff8008008000
        PC is at sysfs_warn_dup+0x60/0x7c
        LR is at sysfs_warn_dup+0x60/0x7c
        pc :  lr :  pstate: 60000145
        Call trace:
         sysfs_warn_dup+0x60/0x7c
         sysfs_create_dir_ns+0x98/0xa0
         kobject_add_internal+0xa0/0x294
         kobject_init_and_add+0x90/0xb4
         sysfs_slab_add+0x90/0x200
         __kmem_cache_create+0x26c/0x438
         kmem_cache_create+0x164/0x1f4
         sg_pool_init+0x60/0x100
         do_one_initcall+0x38/0x12c
         kernel_init_freeable+0x138/0x1d4
         kernel_init+0x10/0xfc
         ret_from_fork+0x10/0x18
      
      Link: http://lkml.kernel.org/r/1510365805-5155-1-git-send-email-miles.chen@mediatek.comSigned-off-by: default avatarMiles Chen <miles.chen@mediatek.com>
      Acked-by: default avatarChristoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5ca94e03
    • Sergey Senozhatsky's avatar
      zsmalloc: calling zs_map_object() from irq is a bug · 12383340
      Sergey Senozhatsky authored
      
      [ Upstream commit 1aedcafb ]
      
      Use BUG_ON(in_interrupt()) in zs_map_object().  This is not a new
      BUG_ON(), it's always been there, but was recently changed to
      VM_BUG_ON().  There are several problems there.  First, we use use
      per-CPU mappings both in zsmalloc and in zram, and interrupt may easily
      corrupt those buffers.  Second, and more importantly, we believe it's
      possible to start leaking sensitive information.  Consider the following
      case:
      
      -> process P
      	swap out
      	 zram
      	  per-cpu mapping CPU1
      	   compress page A
      -> IRQ
      
      	swap out
      	 zram
      	  per-cpu mapping CPU1
      	   compress page B
      	    write page from per-cpu mapping CPU1 to zsmalloc pool
      	iret
      
      -> process P
      	    write page from per-cpu mapping CPU1 to zsmalloc pool  [*]
      	return
      
      * so we store overwritten data that actually belongs to another
        page (task) and potentially contains sensitive data. And when
        process P will page fault it's going to read (swap in) that
        other task's data.
      
      Link: http://lkml.kernel.org/r/20170929045140.4055-1-sergey.senozhatsky@gmail.comSigned-off-by: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Acked-by: default avatarMinchan Kim <minchan@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 avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      12383340
    • Pavel Tatashin's avatar
      sparc64/mm: set fields in deferred pages · 99dac8af
      Pavel Tatashin authored
      
      [ Upstream commit 2a20aa17 ]
      
      Without deferred struct page feature (CONFIG_DEFERRED_STRUCT_PAGE_INIT),
      flags and other fields in "struct page"es are never changed prior to
      first initializing struct pages by going through __init_single_page().
      
      With deferred struct page feature enabled there is a case where we set
      some fields prior to initializing:
      
      mem_init() {
           register_page_bootmem_info();
           free_all_bootmem();
           ...
      }
      
      When register_page_bootmem_info() is called only non-deferred struct
      pages are initialized.  But, this function goes through some reserved
      pages which might be part of the deferred, and thus are not yet
      initialized.
      
      mem_init
      register_page_bootmem_info
      register_page_bootmem_info_node
       get_page_bootmem
        .. setting fields here ..
        such as: page->freelist = (void *)type;
      
      free_all_bootmem()
      free_low_memory_core_early()
       for_each_reserved_mem_region()
        reserve_bootmem_region()
         init_reserved_page() <- Only if this is deferred reserved page
          __init_single_pfn()
           __init_single_page()
            memset(0) <-- Loose the set fields here
      
      We end up with similar issue as in the previous patch, where currently
      we do not observe problem as memory is zeroed.  But, if flag asserts are
      changed we can start hitting issues.
      
      Also, because in this patch series we will stop zeroing struct page
      memory during allocation, we must make sure that struct pages are
      properly initialized prior to using them.
      
      The deferred-reserved pages are initialized in free_all_bootmem().
      Therefore, the fix is to switch the above calls.
      
      Link: http://lkml.kernel.org/r/20171013173214.27300-4-pasha.tatashin@oracle.comSigned-off-by: default avatarPavel Tatashin <pasha.tatashin@oracle.com>
      Reviewed-by: default avatarSteven Sistare <steven.sistare@oracle.com>
      Reviewed-by: default avatarDaniel Jordan <daniel.m.jordan@oracle.com>
      Reviewed-by: default avatarBob Picco <bob.picco@oracle.com>
      Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      99dac8af
    • Ming Lei's avatar
      block: wake up all tasks blocked in get_request() · 60bed713
      Ming Lei authored
      
      [ Upstream commit 34d9715a ]
      
      Once blk_set_queue_dying() is done in blk_cleanup_queue(), we call
      blk_freeze_queue() and wait for q->q_usage_counter becoming zero. But
      if there are tasks blocked in get_request(), q->q_usage_counter can
      never become zero. So we have to wake up all these tasks in
      blk_set_queue_dying() first.
      
      Fixes: 3ef28e83 ("block: generic request_queue reference counting")
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      60bed713
    • Johan Hovold's avatar
      dt-bindings: usb: fix reg-property port-number range · 84e0b87e
      Johan Hovold authored
      
      [ Upstream commit f42ae7b0 ]
      
      The USB hub port-number range for USB 2.0 is 1-255 and not 1-31 which
      reflects an arbitrary limit set by the current Linux implementation.
      
      Note that for USB 3.1 hubs the valid range is 1-15.
      
      Increase the documented valid range in the binding to 255, which is the
      maximum allowed by the specifications.
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      84e0b87e
    • Darrick J. Wong's avatar
      xfs: fix forgotten rcu read unlock when skipping inode reclaim · f4da9e07
      Darrick J. Wong authored
      
      [ Upstream commit 962cc1ad ]
      
      In commit f2e9ad21 ("xfs: check for race with xfs_reclaim_inode"), we
      skip an inode if we're racing with freeing the inode via
      xfs_reclaim_inode, but we forgot to release the rcu read lock when
      dumping the inode, with the result that we exit to userspace with a lock
      held.  Don't do that; generic/320 with a 1k block size fails this
      very occasionally.
      
      ================================================
      WARNING: lock held when returning to user space!
      4.14.0-rc6-djwong #4 Tainted: G        W
      ------------------------------------------------
      rm/30466 is leaving the kernel with locks still held!
      1 lock held by rm/30466:
       #0:  (rcu_read_lock){....}, at: [<ffffffffa01364d3>] xfs_ifree_cluster.isra.17+0x2c3/0x6f0 [xfs]
      ------------[ cut here ]------------
      WARNING: CPU: 1 PID: 30466 at kernel/rcu/tree_plugin.h:329 rcu_note_context_switch+0x71/0x700
      Modules linked in: deadline_iosched dm_snapshot dm_bufio ext4 mbcache jbd2 dm_flakey xfs libcrc32c dax_pmem device_dax nd_pmem sch_fq_codel af_packet [last unloaded: scsi_debug]
      CPU: 1 PID: 30466 Comm: rm Tainted: G        W       4.14.0-rc6-djwong #4
      Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.10.2-1ubuntu1djwong0 04/01/2014
      task: ffff880037680000 task.stack: ffffc90001064000
      RIP: 0010:rcu_note_context_switch+0x71/0x700
      RSP: 0000:ffffc90001067e50 EFLAGS: 00010002
      RAX: 0000000000000001 RBX: ffff880037680000 RCX: ffff88003e73d200
      RDX: 0000000000000002 RSI: ffffffff819e53e9 RDI: ffffffff819f4375
      RBP: 0000000000000000 R08: 0000000000000000 R09: ffff880062c900d0
      R10: 0000000000000000 R11: 0000000000000000 R12: ffff880037680000
      R13: 0000000000000000 R14: ffffc90001067eb8 R15: ffff880037680690
      FS:  00007fa3b8ce8700(0000) GS:ffff88003ec00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007f69bf77c000 CR3: 000000002450a000 CR4: 00000000000006e0
      Call Trace:
       __schedule+0xb8/0xb10
       schedule+0x40/0x90
       exit_to_usermode_loop+0x6b/0xa0
       prepare_exit_to_usermode+0x7a/0x90
       retint_user+0x8/0x20
      RIP: 0033:0x7fa3b87fda87
      RSP: 002b:00007ffe41206568 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff02
      RAX: 0000000000000000 RBX: 00000000010e88c0 RCX: 00007fa3b87fda87
      RDX: 0000000000000000 RSI: 00000000010e89c8 RDI: 0000000000000005
      RBP: 0000000000000000 R08: 0000000000000003 R09: 0000000000000000
      R10: 000000000000015e R11: 0000000000000246 R12: 00000000010c8060
      R13: 00007ffe41206690 R14: 0000000000000000 R15: 0000000000000000
      ---[ end trace e88f83bf0cfbd07d ]---
      
      Fixes: f2e9ad21
      Cc: Omar Sandoval <osandov@fb.com>
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarOmar Sandoval <osandov@fb.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f4da9e07
    • Pieter Jansen van Vuuren's avatar
      nfp: fix flower offload metadata flag usage · 1cb98be5
      Pieter Jansen van Vuuren authored
      
      [ Upstream commit 6c3ab204 ]
      
      Hardware has no notion of new or last mask id, instead it makes use of the
      message type (i.e. add flow or del flow) in combination with a single bit
      in metadata flags to determine when to add or delete a mask id. Previously
      we made use of the new or last flags to indicate that a new mask should be
      allocated or deallocated, respectively. This incorrect behaviour is fixed
      by making use single bit in metadata flags to indicate mask allocation or
      deallocation.
      
      Fixes: 43f84b72 ("nfp: add metadata to each flow offload")
      Signed-off-by: default avatarPieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
      Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1cb98be5
    • Dirk van der Merwe's avatar
      nfp: inherit the max_mtu from the PF netdev · cfcbc4f3
      Dirk van der Merwe authored
      
      [ Upstream commit 743ba5b4 ]
      
      The PF netdev is used for data transfer for reprs, so reprs inherit the
      maximum MTU settings of the PF netdev.
      
      Fixes: 5de73ee4 ("nfp: general representor implementation")
      Signed-off-by: default avatarDirk van der Merwe <dirk.vandermerwe@netronome.com>
      Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cfcbc4f3
    • Chuck Lever's avatar
      sunrpc: Fix rpc_task_begin trace point · 94d6b7fa
      Chuck Lever authored
      
      [ Upstream commit b2bfe591 ]
      
      The rpc_task_begin trace point always display a task ID of zero.
      Move the trace point call site so that it picks up the new task ID.
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      94d6b7fa
    • Trond Myklebust's avatar
      NFS: Fix a typo in nfs_rename() · 57f94fd1
      Trond Myklebust authored
      
      [ Upstream commit d803224c ]
      
      On successful rename, the "old_dentry" is retained and is attached to
      the "new_dir", so we need to call nfs_set_verifier() accordingly.
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
      Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      57f94fd1
    • Randy Dunlap's avatar
      dynamic-debug-howto: fix optional/omitted ending line number to be LARGE instead of 0 · 8cb22e07
      Randy Dunlap authored
      
      [ Upstream commit 1f3c790b ]
      
      line-range is supposed to treat "1-" as "1-endoffile", so
      handle the special case by setting last_lineno to UINT_MAX.
      
      Fixes this error:
      
        dynamic_debug:ddebug_parse_query: last-line:0 < 1st-line:1
        dynamic_debug:ddebug_exec_query: query parse failed
      
      Link: http://lkml.kernel.org/r/10a6a101-e2be-209f-1f41-54637824788e@infradead.orgSigned-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Acked-by: default avatarJason Baron <jbaron@akamai.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8cb22e07
    • Stephen Bates's avatar
      lib/genalloc.c: make the avail variable an atomic_long_t · 346008fe
      Stephen Bates authored
      
      [ Upstream commit 36a3d1dd ]
      
      If the amount of resources allocated to a gen_pool exceeds 2^32 then the
      avail atomic overflows and this causes problems when clients try and
      borrow resources from the pool.  This is only expected to be an issue on
      64 bit systems.
      
      Add the <linux/atomic.h> header to pull in atomic_long* operations.  So
      that 32 bit systems continue to use atomic32_t but 64 bit systems can
      use atomic64_t.
      
      Link: http://lkml.kernel.org/r/1509033843-25667-1-git-send-email-sbates@raithlin.comSigned-off-by: default avatarStephen Bates <sbates@raithlin.com>
      Reviewed-by: default avatarLogan Gunthorpe <logang@deltatee.com>
      Reviewed-by: default avatarMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Reviewed-by: default avatarDaniel Mentz <danielmentz@google.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      346008fe
    • Joe Lawrence's avatar
      pipe: match pipe_max_size data type with procfs · 30c2f774
      Joe Lawrence authored
      
      [ Upstream commit 98159d97 ]
      
      Patch series "A few round_pipe_size() and pipe-max-size fixups", v3.
      
      While backporting Michael's "pipe: fix limit handling" patchset to a
      distro-kernel, Mikulas noticed that current upstream pipe limit handling
      contains a few problems:
      
        1 - procfs signed wrap: echo'ing a large number into
            /proc/sys/fs/pipe-max-size and then cat'ing it back out shows a
            negative value.
      
        2 - round_pipe_size() nr_pages overflow on 32bit:  this would
            subsequently try roundup_pow_of_two(0), which is undefined.
      
        3 - visible non-rounded pipe-max-size value: there is no mutual
            exclusion or protection between the time pipe_max_size is assigned
            a raw value from proc_dointvec_minmax() and when it is rounded.
      
        4 - unsigned long -> unsigned int conversion makes for potential odd
            return errors from do_proc_douintvec_minmax_conv() and
            do_proc_dopipe_max_size_conv().
      
      This version underwent the same testing as v1:
      https://marc.info/?l=linux-kernel&m=150643571406022&w=2
      
      This patch (of 4):
      
      pipe_max_size is defined as an unsigned int:
      
        unsigned int pipe_max_size = 1048576;
      
      but its procfs/sysctl representation is an integer:
      
        static struct ctl_table fs_table[] = {
                ...
                {
                        .procname       = "pipe-max-size",
                        .data           = &pipe_max_size,
                        .maxlen         = sizeof(int),
                        .mode           = 0644,
                        .proc_handler   = &pipe_proc_fn,
                        .extra1         = &pipe_min_size,
                },
                ...
      
      that is signed:
      
        int pipe_proc_fn(struct ctl_table *table, int write, void __user *buf,
                         size_t *lenp, loff_t *ppos)
        {
                ...
                ret = proc_dointvec_minmax(table, write, buf, lenp, ppos)
      
      This leads to signed results via procfs for large values of pipe_max_size:
      
        % echo 2147483647 >/proc/sys/fs/pipe-max-size
        % cat /proc/sys/fs/pipe-max-size
        -2147483648
      
      Use unsigned operations on this variable to avoid such negative values.
      
      Link: http://lkml.kernel.org/r/1507658689-11669-2-git-send-email-joe.lawrence@redhat.comSigned-off-by: default avatarJoe Lawrence <joe.lawrence@redhat.com>
      Reported-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Reviewed-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      30c2f774
    • Christophe JAILLET's avatar
      drivers/rapidio/devices/rio_mport_cdev.c: fix resource leak in error handling... · 65c4767b
      Christophe JAILLET authored
      drivers/rapidio/devices/rio_mport_cdev.c: fix resource leak in error handling path in 'rio_dma_transfer()'
      
      
      [ Upstream commit b1402dcb ]
      
      If 'dma_map_sg()', we should branch to the existing error handling path
      to free some resources before returning.
      
      Link: http://lkml.kernel.org/r/61292a4f369229eee03394247385e955027283f8.1505687047.git.christophe.jaillet@wanadoo.frSigned-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Reviewed-by: default avatarLogan Gunthorpe <logang@deltatee.com>
      Cc: Matt Porter <mporter@kernel.crashing.org>
      Cc: Alexandre Bounine <alexandre.bounine@idt.com>
      Cc: Lorenzo Stoakes <lstoakes@gmail.com>
      Cc: Jesper Nilsson <jesper.nilsson@axis.com>
      Cc: Christian K_nig <christian.koenig@amd.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      65c4767b
    • Colin Ian King's avatar
      rsi: fix memory leak on buf and usb_reg_buf · f52688ce
      Colin Ian King authored
      
      [ Upstream commit d35ef8f8 ]
      
      In the cases where len is too long, the error return path fails to
      kfree allocated buffers buf and usb_reg_buf.  The simplest fix is to
      perform the sanity check on len before the allocations to avoid having
      to do the kfree'ing in the first place.
      
      Detected by CoverityScan, CID#1452258,1452259 ("Resource Leak")
      
      Fixes: 59f73e2a ("rsi: check length before USB read/write register")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f52688ce
    • Xin Long's avatar
      route: update fnhe_expires for redirect when the fnhe exists · ad199b18
      Xin Long authored
      
      [ Upstream commit e39d5246 ]
      
      Now when creating fnhe for redirect, it sets fnhe_expires for this
      new route cache. But when updating the exist one, it doesn't do it.
      It will cause this fnhe never to be expired.
      
      Paolo already noticed it before, in Jianlin's test case, it became
      even worse:
      
      When ip route flush cache, the old fnhe is not to be removed, but
      only clean it's members. When redirect comes again, this fnhe will
      be found and updated, but never be expired due to fnhe_expires not
      being set.
      
      So fix it by simply updating fnhe_expires even it's for redirect.
      
      Fixes: aee06da6 ("ipv4: use seqlock for nh_exceptions")
      Reported-by: default avatarJianlin Shi <jishi@redhat.com>
      Acked-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ad199b18
    • Xin Long's avatar
      route: also update fnhe_genid when updating a route cache · 407de7d9
      Xin Long authored
      
      [ Upstream commit cebe84c6 ]
      
      Now when ip route flush cache and it turn out all fnhe_genid != genid.
      If a redirect/pmtu icmp packet comes and the old fnhe is found and all
      it's members but fnhe_genid will be updated.
      
      Then next time when it looks up route and tries to rebind this fnhe to
      the new dst, the fnhe will be flushed due to fnhe_genid != genid. It
      causes this redirect/pmtu icmp packet acutally not to be applied.
      
      This patch is to also reset fnhe_genid when updating a route cache.
      
      Fixes: 5aad1de5 ("ipv4: use separate genid for next hop exceptions")
      Acked-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      407de7d9
    • Alexey Kodanev's avatar
      gre6: use log_ecn_error module parameter in ip6_tnl_rcv() · ffe6293d
      Alexey Kodanev authored
      
      [ Upstream commit 981542c5 ]
      
      After commit 308edfdf ("gre6: Cleanup GREv6 receive path, call
      common GRE functions") it's not used anywhere in the module, but
      previously was used in ip6gre_rcv().
      
      Fixes: 308edfdf ("gre6: Cleanup GREv6 receive path, call common GRE functions")
      Signed-off-by: default avatarAlexey Kodanev <alexey.kodanev@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ffe6293d
    • Ben Hutchings's avatar
      mac80211_hwsim: Fix memory leak in hwsim_new_radio_nl() · 266fd762
      Ben Hutchings authored
      
      [ Upstream commit 67bd5238 ]
      
      hwsim_new_radio_nl() now copies the name attribute in order to add a
      null-terminator.  mac80211_hwsim_new_radio() (indirectly) copies it
      again into the net_device structure, so the first copy is not used or
      freed later.  Free the first copy before returning.
      
      Fixes: ff4dd73d ("mac80211_hwsim: check HWSIM_ATTR_RADIO_NAME length")
      Signed-off-by: default avatarBen Hutchings <ben.hutchings@codethink.co.uk>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      266fd762
    • Dave Hansen's avatar
      x86/mpx/selftests: Fix up weird arrays · ad7acca1
      Dave Hansen authored
      
      [ Upstream commit a6400120 ]
      
      The MPX hardware data structurse are defined in a weird way: they define
      their size in bytes and then union that with the type with which we want
      to access them.
      
      Yes, this is weird, but it does work.  But, new GCC's complain that we
      are accessing the array out of bounds.  Just make it a zero-sized array
      so gcc will stop complaining.  There was not really a bug here.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20171111001229.58A7933D@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ad7acca1
    • John Johansen's avatar
      apparmor: fix leak of null profile name if profile allocation fails · 89708892
      John Johansen authored
      
      [ Upstream commit 4633307e ]
      
      Fixes: d07881d2 ("apparmor: move new_null_profile to after profile lookup fns()")
      Reported-by: default avatarSeth Arnold <seth.arnold@canonical.com>
      Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      89708892
    • Madhavan Srinivasan's avatar
      powerpc/perf: Fix pmu_count to count only nest imc pmus · 86d1d015
      Madhavan Srinivasan authored
      
      [ Upstream commit de34787f ]
      
      "pmu_count" in opal_imc_counters_probe() is intended to hold
      the number of successful nest imc pmu registerations. But
      current code also counts other imc units like core_imc and
      thread_imc. Patch add a check to count only nest imc pmus.
      Signed-off-by: default avatarMadhavan Srinivasan <maddy@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      86d1d015
    • Masahiro Yamada's avatar
      coccinelle: fix parallel build with CHECK=scripts/coccicheck · 394d0c93
      Masahiro Yamada authored
      
      [ Upstream commit d7059ca0 ]
      
      The command "make -j8 C=1 CHECK=scripts/coccicheck" produces
      lots of "coccicheck failed" error messages.
      
      Julia Lawall explained the Coccinelle behavior as follows:
      "The problem on the Coccinelle side is that it uses a subdirectory
      with the name of the semantic patch to store standard output and
      standard error for the different threads.  I didn't want to use a
      name with the pid, so that one could easily find this information
      while Coccinelle is running.  Normally the subdirectory is cleaned
      up when Coccinelle completes, so there is only one of them at a time.
      Maybe it is best to just add the pid.  There is the risk that these
      subdirectories will accumulate if Coccinelle crashes in a way such
      that they don't get cleaned up, but Coccinelle could print a warning
      if it detects this case, rather than failing."
      
      When scripts/coccicheck is used as CHECK tool and -j option is given
      to Make, the whole of build process runs in parallel.  So, multiple
      processes try to get access to the same subdirectory.
      
      I notice spatch creates the subdirectory only when it runs in parallel
      (i.e. --jobs <N> is given and <N> is greater than 1).
      
      Setting NPROC=1 is a reasonable solution; spatch does not create the
      subdirectory.  Besides, ONLINE=1 mode takes a single file input for
      each spatch invocation, so there is no reason to parallelize it in
      the first place.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      394d0c93
    • Masahiro Yamada's avatar
      kbuild: pkg: use --transform option to prefix paths in tar · 54a13eb7
      Masahiro Yamada authored
      
      [ Upstream commit 2dbc644a ]
      
      For rpm-pkg and deb-pkg, a source tar file is created.  All paths in
      the archive must be prefixed with the base name of the tar so that
      everything is contained in the directory when you extract it.
      
      Currently, scripts/package/Makefile uses a symlink for that, and
      removes it after the tar is created.
      
      If you terminate the build during the tar creation, the symlink is
      left over.  Then, at the next package build, you will see a warning
      like follows:
      
        ln: '.' and 'kernel-4.14.0+/.' are the same file
      
      It is possible to fix it by adding -n (--no-dereference) option to
      the "ln" command, but a cleaner way is to use --transform option
      of "tar" command.  This option is GNU extension, but it should not
      hurt to use it in the Linux build system.
      
      The 'S' flag is needed to exclude symlinks from the path fixup.
      Without it, symlinks in the kernel are broken.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      54a13eb7
    • Ursula Braun's avatar
      net/smc: use sk_rcvbuf as start for rmb creation · 4d0d1bc6
      Ursula Braun authored
      
      [ Upstream commit 4e1061f4 ]
      
      Commit 3e034725 ("net/smc: common functions for RMBs and send buffers")
      merged handling of SMC receive and send buffers. It introduced sk_buf_size
      as merged start value for size determination. But since sk_buf_size is not
      used at all, sk_sndbuf is erroneously used as start for rmb creation.
      This patch makes sure, sk_buf_size is really used as intended, and
      sk_rcvbuf is used as start value for rmb creation.
      
      Fixes: 3e034725 ("net/smc: common functions for RMBs and send buffers")
      Signed-off-by: default avatarUrsula Braun <ubraun@linux.vnet.ibm.com>
      Reviewed-by: default avatarHans Wippel <hwippel@linux.vnet.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4d0d1bc6
    • Colin Ian King's avatar
      irqchip/qcom: Fix u32 comparison with value less than zero · f0d56423
      Colin Ian King authored
      
      [ Upstream commit e9990d70 ]
      
      The comparison of u32 nregs being less than zero is never true since
      nregs is unsigned. Fix this by making nregs a signed integer.
      
      Fixes: f20cc9b0 ("irqchip/qcom: Add IRQ combiner driver")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: kernel-janitors@vger.kernel.org
      Cc: Jason Cooper <jason@lakedaemon.net>
      Link: https://lkml.kernel.org/r/20171117183553.2739-1-colin.king@canonical.comSigned-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f0d56423
    • Russell King's avatar
      ARM: avoid faulting on qemu · 14f13c9d
      Russell King authored
      commit 3aaf33be upstream.
      
      When qemu starts a kernel in a bare environment, the default SCR has
      the AW and FW bits clear, which means that the kernel can't modify
      the PSR A or PSR F bits, and means that FIQs and imprecise aborts are
      always masked.
      
      When running uboot under qemu, the AW and FW SCR bits are set, and the
      kernel functions normally - and this is how real hardware behaves.
      
      Fix this for qemu by ignoring the FIQ bit.
      
      Fixes: 8bafae20 ("ARM: BUG if jumping to usermode address in kernel mode")
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Cc: Alex Shi <alex.shi@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      14f13c9d
    • Russell King's avatar
      ARM: BUG if jumping to usermode address in kernel mode · 21e1e619
      Russell King authored
      commit 8bafae20 upstream.
      
      Detect if we are returning to usermode via the normal kernel exit paths
      but the saved PSR value indicates that we are in kernel mode.  This
      could occur due to corrupted stack state, which has been observed with
      "ftracetest".
      
      This ensures that we catch the problem case before we get to user code.
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Cc: Alex Shi <alex.shi@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      21e1e619
    • LEROY Christophe's avatar
      crypto: talitos - fix ctr-aes-talitos · 077415ef
      LEROY Christophe authored
      commit 70d355cc upstream.
      
      ctr-aes-talitos test fails as follows on SEC2
      
      [    0.837427] alg: skcipher: Test 1 failed (invalid result) on encryption for ctr-aes-talitos
      [    0.845763] 00000000: 16 36 d5 ee 34 f8 06 25 d7 7f 8e 56 ca 88 43 45
      [    0.852345] 00000010: f9 3f f7 17 2a b2 12 23 30 43 09 15 82 dd e1 97
      [    0.858940] 00000020: a7 f7 32 b5 eb 25 06 13 9a ec f5 29 25 f8 4d 66
      [    0.865366] 00000030: b0 03 5b 8e aa 9a 42 b6 19 33 8a e2 9d 65 96 95
      
      This patch fixes the descriptor type which is special for CTR AES
      
      Fixes: 5e75ae1b ("crypto: talitos - add new crypto modes")
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      077415ef
    • LEROY Christophe's avatar
      crypto: talitos - fix use of sg_link_tbl_len · 2040f8e8
      LEROY Christophe authored
      commit fbb22137 upstream.
      
      sg_link_tbl_len shall be used instead of cryptlen, otherwise
      SECs which perform HW CICV verification will fail.
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2040f8e8
    • LEROY Christophe's avatar
      crypto: talitos - fix AEAD for sha224 on non sha224 capable chips · a2d93ada
      LEROY Christophe authored
      commit 6cda075a upstream.
      
      sha224 AEAD test fails with:
      
      [    2.803125] talitos ff020000.crypto: DEUISR 0x00000000_00000000
      [    2.808743] talitos ff020000.crypto: MDEUISR 0x80100000_00000000
      [    2.814678] talitos ff020000.crypto: DESCBUF 0x20731f21_00000018
      [    2.820616] talitos ff020000.crypto: DESCBUF 0x0628d64c_00000010
      [    2.826554] talitos ff020000.crypto: DESCBUF 0x0631005c_00000018
      [    2.832492] talitos ff020000.crypto: DESCBUF 0x0628d664_00000008
      [    2.838430] talitos ff020000.crypto: DESCBUF 0x061b13a0_00000080
      [    2.844369] talitos ff020000.crypto: DESCBUF 0x0631006c_00000080
      [    2.850307] talitos ff020000.crypto: DESCBUF 0x0631006c_00000018
      [    2.856245] talitos ff020000.crypto: DESCBUF 0x063100ec_00000000
      [    2.884972] talitos ff020000.crypto: failed to reset channel 0
      [    2.890503] talitos ff020000.crypto: done overflow, internal time out, or rngu error: ISR 0x20000000_00020000
      [    2.900652] alg: aead: encryption failed on test 1 for authenc-hmac-sha224-cbc-3des-talitos: ret=22
      
      This is due to SHA224 not being supported by the HW. Allthough for
      hash we are able to init the hash context by SW, it is not
      possible for AEAD. Therefore SHA224 AEAD has to be deactivated.
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a2d93ada
    • LEROY Christophe's avatar
      crypto: talitos - fix setkey to check key weakness · 62744eba
      LEROY Christophe authored
      commit f384cdc4 upstream.
      
      Crypto manager test report the following failures:
      [    3.061081] alg: skcipher: setkey failed on test 5 for ecb-des-talitos: flags=100
      [    3.069342] alg: skcipher-ddst: setkey failed on test 5 for ecb-des-talitos: flags=100
      [    3.077754] alg: skcipher-ddst: setkey failed on test 5 for ecb-des-talitos: flags=100
      
      This is due to setkey being expected to detect weak keys.
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      62744eba
    • LEROY Christophe's avatar
      crypto: talitos - fix memory corruption on SEC2 · 68b42647
      LEROY Christophe authored
      commit e04a61be upstream.
      
      On SEC2, when using the old descriptors type (hmac snoop no afeu)
      for doing IPsec, the CICV out pointeur points out of the allocated
      memory.
      
      [    2.502554] =============================================================================
      [    2.510740] BUG dma-kmalloc-256 (Not tainted): Redzone overwritten
      [    2.516907] -----------------------------------------------------------------------------
      [    2.516907]
      [    2.526535] Disabling lock debugging due to kernel taint
      [    2.531845] INFO: 0xde858108-0xde85810b. First byte 0xf8 instead of 0xcc
      [    2.538549] INFO: Allocated in 0x806181a9 age=0 cpu=0 pid=58
      [    2.544229] 	__kmalloc+0x374/0x564
      [    2.547649] 	talitos_edesc_alloc+0x17c/0x48c
      [    2.551929] 	aead_edesc_alloc+0x80/0x154
      [    2.555863] 	aead_encrypt+0x30/0xe0
      [    2.559368] 	__test_aead+0x5a0/0x1f3c
      [    2.563042] 	test_aead+0x2c/0x110
      [    2.566371] 	alg_test_aead+0x5c/0xf4
      [    2.569958] 	alg_test+0x1dc/0x5a0
      [    2.573305] 	cryptomgr_test+0x50/0x70
      [    2.576984] 	kthread+0xd8/0x134
      [    2.580155] 	ret_from_kernel_thread+0x5c/0x64
      [    2.584534] INFO: Freed in ipsec_esp_encrypt_done+0x130/0x240 age=6 cpu=0 pid=0
      [    2.591839] 	ipsec_esp_encrypt_done+0x130/0x240
      [    2.596395] 	flush_channel+0x1dc/0x488
      [    2.600161] 	talitos2_done_4ch+0x30/0x200
      [    2.604185] 	tasklet_action+0xa0/0x13c
      [    2.607948] 	__do_softirq+0x148/0x6cc
      [    2.611623] 	irq_exit+0xc0/0x124
      [    2.614869] 	call_do_irq+0x24/0x3c
      [    2.618292] 	do_IRQ+0x78/0x108
      [    2.621369] 	ret_from_except+0x0/0x14
      [    2.625055] 	finish_task_switch+0x58/0x350
      [    2.629165] 	schedule+0x80/0x134
      [    2.632409] 	schedule_preempt_disabled+0x38/0xc8
      [    2.637042] 	cpu_startup_entry+0xe4/0x190
      [    2.641074] 	start_kernel+0x3f4/0x408
      [    2.644741] 	0x3438
      [    2.646857] INFO: Slab 0xdffbdb00 objects=9 used=1 fp=0xde8581c0 flags=0x0080
      [    2.653978] INFO: Object 0xde858008 @offset=8 fp=0xca4395df
      [    2.653978]
      [    2.661032] Redzone de858000: cc cc cc cc cc cc cc cc                          ........
      [    2.669029] Object de858008: 00 00 00 02 00 00 00 02 00 6b 6b 6b 1e 83 ea 28  .........kkk...(
      [    2.677628] Object de858018: 00 00 00 70 1e 85 80 64 ff 73 1d 21 6b 6b 6b 6b  ...p...d.s.!kkkk
      [    2.686228] Object de858028: 00 20 00 00 1e 84 17 24 00 10 00 00 1e 85 70 00  . .....$......p.
      [    2.694829] Object de858038: 00 18 00 00 1e 84 17 44 00 08 00 00 1e 83 ea 28  .......D.......(
      [    2.703430] Object de858048: 00 80 00 00 1e 84 f0 00 00 80 00 00 1e 85 70 10  ..............p.
      [    2.712030] Object de858058: 00 20 6b 00 1e 85 80 f4 6b 6b 6b 6b 00 80 02 00  . k.....kkkk....
      [    2.720629] Object de858068: 1e 84 f0 00 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  ....kkkkkkkkkkkk
      [    2.729230] Object de858078: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
      [    2.737830] Object de858088: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
      [    2.746429] Object de858098: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
      [    2.755029] Object de8580a8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
      [    2.763628] Object de8580b8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
      [    2.772229] Object de8580c8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
      [    2.780829] Object de8580d8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
      [    2.789430] Object de8580e8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 73 b0 ea 9f  kkkkkkkkkkkks...
      [    2.798030] Object de8580f8: e8 18 80 d6 56 38 44 c0 db e3 4f 71 f7 ce d1 d3  ....V8D...Oq....
      [    2.806629] Redzone de858108: f8 bd 3e 4f                                      ..>O
      [    2.814279] Padding de8581b0: 5a 5a 5a 5a 5a 5a 5a 5a                          ZZZZZZZZ
      [    2.822283] CPU: 0 PID: 0 Comm: swapper Tainted: G    B           4.9.50-g995be12679 #179
      [    2.831819] Call Trace:
      [    2.834301] [dffefd20] [c01aa9a8] check_bytes_and_report+0x100/0x194 (unreliable)
      [    2.841801] [dffefd50] [c01aac3c] check_object+0x200/0x530
      [    2.847306] [dffefd80] [c01ae584] free_debug_processing+0x290/0x690
      [    2.853585] [dffefde0] [c01aec8c] __slab_free+0x308/0x628
      [    2.859000] [dffefe80] [c05057f4] ipsec_esp_encrypt_done+0x130/0x240
      [    2.865378] [dffefeb0] [c05002c4] flush_channel+0x1dc/0x488
      [    2.870968] [dffeff10] [c05007a8] talitos2_done_4ch+0x30/0x200
      [    2.876814] [dffeff30] [c002fe38] tasklet_action+0xa0/0x13c
      [    2.882399] [dffeff60] [c002f118] __do_softirq+0x148/0x6cc
      [    2.887896] [dffeffd0] [c002f954] irq_exit+0xc0/0x124
      [    2.892968] [dffefff0] [c0013adc] call_do_irq+0x24/0x3c
      [    2.898213] [c0d4be00] [c000757c] do_IRQ+0x78/0x108
      [    2.903113] [c0d4be30] [c0015c08] ret_from_except+0x0/0x14
      [    2.908634] --- interrupt: 501 at finish_task_switch+0x70/0x350
      [    2.908634]     LR = finish_task_switch+0x58/0x350
      [    2.919327] [c0d4bf20] [c085e1d4] schedule+0x80/0x134
      [    2.924398] [c0d4bf50] [c085e2c0] schedule_preempt_disabled+0x38/0xc8
      [    2.930853] [c0d4bf60] [c007f064] cpu_startup_entry+0xe4/0x190
      [    2.936707] [c0d4bfb0] [c096c434] start_kernel+0x3f4/0x408
      [    2.942198] [c0d4bff0] [00003438] 0x3438
      [    2.946137] FIX dma-kmalloc-256: Restoring 0xde858108-0xde85810b=0xcc
      [    2.946137]
      [    2.954158] FIX dma-kmalloc-256: Object at 0xde858008 not freed
      
      This patch reworks the handling of the CICV out in order
      to properly handle all cases.
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      68b42647
    • LEROY Christophe's avatar
      crypto: talitos - fix AEAD test failures · 7b9cf144
      LEROY Christophe authored
      commit ec8c7d14 upstream.
      
      AEAD tests fail when destination SG list has more than 1 element.
      
      [    2.058752] alg: aead: Test 1 failed on encryption for authenc-hmac-sha1-cbc-aes-talitos
      [    2.066965] 00000000: 53 69 6e 67 6c 65 20 62 6c 6f 63 6b 20 6d 73 67
      00000010: c0 43 ff 74 c0 43 ff e0 de 83 d1 20 de 84 8e 54
      00000020: de 83 d7 c4
      [    2.082138] alg: aead: Test 1 failed on encryption for authenc-hmac-sha1-cbc-aes-talitos
      [    2.090435] 00000000: 53 69 6e 67 6c 65 20 62 6c 6f 63 6b 20 6d 73 67
      00000010: de 84 ea 58 c0 93 1a 24 de 84 e8 59 de 84 f1 20
      00000020: 00 00 00 00
      [    2.105721] alg: aead: Test 1 failed on encryption for authenc-hmac-sha1-cbc-3des-talitos
      [    2.114259] 00000000: 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72 73 74
      00000010: 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63 74 65
      00000020: 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72
      00000030: 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63
      00000040: 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65
      00000050: 65 72 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53
      00000060: 72 63 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20
      00000070: 63 65 65 72 73 74 54 20 6f 6f 4d 20 6e 61 0a 79
      00000080: c0 50 f1 ac c0 50 f3 38 c0 50 f3 94 c0 50 f5 30
      00000090: c0 99 74 3c
      [    2.166410] alg: aead: Test 1 failed on encryption for authenc-hmac-sha1-cbc-3des-talitos
      [    2.174794] 00000000: 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72 73 74
      00000010: 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63 74 65
      00000020: 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72
      00000030: 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63
      00000040: 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65
      00000050: 65 72 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53
      00000060: 72 63 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20
      00000070: 63 65 65 72 73 74 54 20 6f 6f 4d 20 6e 61 0a 79
      00000080: c0 50 f1 ac c0 50 f3 38 c0 50 f3 94 c0 50 f5 30
      00000090: c0 99 74 3c
      [    2.226486] alg: No test for authenc(hmac(sha224),cbc(aes)) (authenc-hmac-sha224-cbc-aes-talitos)
      [    2.236459] alg: No test for authenc(hmac(sha224),cbc(aes)) (authenc-hmac-sha224-cbc-aes-talitos)
      [    2.247196] alg: aead: Test 1 failed on encryption for authenc-hmac-sha224-cbc-3des-talitos
      [    2.255555] 00000000: 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72 73 74
      00000010: 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63 74 65
      00000020: 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72
      00000030: 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63
      00000040: 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65
      00000050: 65 72 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53
      00000060: 72 63 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20
      00000070: 63 65 65 72 73 74 54 20 6f 6f 4d 20 6e 61 0a 79
      00000080: c0 50 f1 ac c0 50 f3 38 c0 50 f3 94 c0 50 f5 30
      00000090: c0 99 74 3c c0 96 e5 b8
      [    2.309004] alg: aead: Test 1 failed on encryption for authenc-hmac-sha224-cbc-3des-talitos
      [    2.317562] 00000000: 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72 73 74
      00000010: 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63 74 65
      00000020: 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72
      00000030: 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63
      00000040: 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65
      00000050: 65 72 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53
      00000060: 72 63 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20
      00000070: 63 65 65 72 73 74 54 20 6f 6f 4d 20 6e 61 0a 79
      00000080: c0 50 f1 ac c0 50 f3 38 c0 50 f3 94 c0 50 f5 30
      00000090: c0 99 74 3c c0 96 e5 b8
      [    2.370710] alg: aead: Test 1 failed on encryption for authenc-hmac-sha256-cbc-aes-talitos
      [    2.379177] 00000000: 53 69 6e 67 6c 65 20 62 6c 6f 63 6b 20 6d 73 67
      00000010: 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63 74 65
      00000020: 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72
      [    2.397863] alg: aead: Test 1 failed on encryption for authenc-hmac-sha256-cbc-aes-talitos
      [    2.406134] 00000000: 53 69 6e 67 6c 65 20 62 6c 6f 63 6b 20 6d 73 67
      00000010: 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63 74 65
      00000020: 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72
      [    2.424789] alg: aead: Test 1 failed on encryption for authenc-hmac-sha256-cbc-3des-talitos
      [    2.433491] 00000000: 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72 73 74
      00000010: 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63 74 65
      00000020: 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72
      00000030: 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63
      00000040: 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65
      00000050: 65 72 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53
      00000060: 72 63 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20
      00000070: 63 65 65 72 73 74 54 20 6f 6f 4d 20 6e 61 0a 79
      00000080: c0 50 f1 ac c0 50 f3 38 c0 50 f3 94 c0 50 f5 30
      00000090: c0 99 74 3c c0 96 e5 b8 c0 96 e9 20 c0 00 3d dc
      [    2.488832] alg: aead: Test 1 failed on encryption for authenc-hmac-sha256-cbc-3des-talitos
      [    2.497387] 00000000: 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72 73 74
      00000010: 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63 74 65
      00000020: 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72
      00000030: 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63
      00000040: 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65
      00000050: 65 72 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53
      00000060: 72 63 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20
      00000070: 63 65 65 72 73 74 54 20 6f 6f 4d 20 6e 61 0a 79
      00000080: c0 50 f1 ac c0 50 f3 38 c0 50 f3 94 c0 50 f5 30
      00000090: c0 99 74 3c c0 96 e5 b8 c0 96 e9 20 c0 00 3d dc
      
      This patch fixes that.
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7b9cf144
    • Daniel Jurgens's avatar
      IB/core: Only enforce security for InfiniBand · 796c9d1e
      Daniel Jurgens authored
      commit 315d160c upstream.
      
      For now the only LSM security enforcement mechanism available is
      specific to InfiniBand. Bypass enforcement for non-IB link types.
      
      This fixes a regression where modify_qp fails for iWARP because
      querying the PKEY returns -EINVAL.
      
      Cc: Paul Moore <paul@paul-moore.com>
      Cc: Don Dutile <ddutile@redhat.com>
      Reported-by: default avatarPotnuri Bharat Teja <bharat@chelsio.com>
      Fixes: d291f1a6("IB/core: Enforce PKey security on QPs")
      Fixes: 47a2b338("IB/core: Enforce security on management datagrams")
      Signed-off-by: default avatarDaniel Jurgens <danielj@mellanox.com>
      Reviewed-by: default avatarParav Pandit <parav@mellanox.com>
      Tested-by: default avatarPotnuri Bharat Teja <bharat@chelsio.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      796c9d1e
    • Parav Pandit's avatar
      IB/core: Avoid unnecessary return value check · 45f846ca
      Parav Pandit authored
      commit 2e4c85c6 upstream.
      
      Since there is nothing done with non zero return value, such check is
      avoided.
      Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
      Reviewed-by: default avatarDaniel Jurgens <danielj@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      45f846ca
    • Kim Phillips's avatar
      bus: arm-ccn: fix module unloading Error: Removing state 147 which has instances left. · 1cef55be
      Kim Phillips authored
      commit b69f63eb upstream.
      
      Unregistering the driver before calling cpuhp_remove_multi_state() removes
      any remaining hotplug cpu instances so __cpuhp_remove_state_cpuslocked()
      doesn't emit this warning:
      
      [  268.748362] Error: Removing state 147 which has instances left.
      [  268.748373] ------------[ cut here ]------------
      [  268.748386] WARNING: CPU: 2 PID: 5476 at kernel/cpu.c:1734 __cpuhp_remove_state_cpuslocked+0x454/0x4f0
      [  268.748389] Modules linked in: arm_ccn(-) [last unloaded: arm_ccn]
      [  268.748403] CPU: 2 PID: 5476 Comm: rmmod Tainted: G        W       4.14.0-rc4+ #3
      [  268.748406] Hardware name: AMD Seattle/Seattle, BIOS 10:18:39 Dec  8 2016
      [  268.748410] task: ffff8001a18ca000 task.stack: ffff80019c120000
      [  268.748416] PC is at __cpuhp_remove_state_cpuslocked+0x454/0x4f0
      [  268.748421] LR is at __cpuhp_remove_state_cpuslocked+0x448/0x4f0
      [  268.748425] pc : [<ffff2000081729ec>] lr : [<ffff2000081729e0>] pstate: 60000145
      [  268.748427] sp : ffff80019c127d30
      [  268.748430] x29: ffff80019c127d30 x28: ffff8001a18ca000
      [  268.748437] x27: ffff20000c2cb000 x26: 1fffe4000042d490
      [  268.748443] x25: ffff20000216a480 x24: 0000000000000000
      [  268.748449] x23: ffff20000b08e000 x22: 0000000000000001
      [  268.748455] x21: 0000000000000093 x20: 00000000000016f8
      [  268.748460] x19: ffff20000c2cbb80 x18: 0000ffffb5fe7c58
      [  268.748466] x17: 00000000004402d0 x16: 1fffe40001864f01
      [  268.748472] x15: ffff20000c4bf8b0 x14: 0000000000000000
      [  268.748477] x13: 0000000000007032 x12: ffff20000829ae48
      [  268.748483] x11: ffff20000c4bf000 x10: 0000000000000004
      [  268.748488] x9 : 0000000000006fbc x8 : ffff20000c318a40
      [  268.748494] x7 : 0000000000000000 x6 : ffff040001864f02
      [  268.748500] x5 : 0000000000000000 x4 : 0000000000000000
      [  268.748505] x3 : 0000000000000007 x2 : dfff200000000000
      [  268.748510] x1 : 000000000000ad3d x0 : 00000000000001f0
      [  268.748516] Call trace:
      [  268.748521] Exception stack(0xffff80019c127bf0 to 0xffff80019c127d30)
      [  268.748526] 7be0:                                   00000000000001f0 000000000000ad3d
      [  268.748531] 7c00: dfff200000000000 0000000000000007 0000000000000000 0000000000000000
      [  268.748535] 7c20: ffff040001864f02 0000000000000000 ffff20000c318a40 0000000000006fbc
      [  268.748539] 7c40: 0000000000000004 ffff20000c4bf000 ffff20000829ae48 0000000000007032
      [  268.748544] 7c60: 0000000000000000 ffff20000c4bf8b0 1fffe40001864f01 00000000004402d0
      [  268.748548] 7c80: 0000ffffb5fe7c58 ffff20000c2cbb80 00000000000016f8 0000000000000093
      [  268.748553] 7ca0: 0000000000000001 ffff20000b08e000 0000000000000000 ffff20000216a480
      [  268.748557] 7cc0: 1fffe4000042d490 ffff20000c2cb000 ffff8001a18ca000 ffff80019c127d30
      [  268.748562] 7ce0: ffff2000081729e0 ffff80019c127d30 ffff2000081729ec 0000000060000145
      [  268.748566] 7d00: 00000000000001f0 0000000000000000 0001000000000000 0000000000000000
      [  268.748569] 7d20: ffff80019c127d30 ffff2000081729ec
      [  268.748575] [<ffff2000081729ec>] __cpuhp_remove_state_cpuslocked+0x454/0x4f0
      [  268.748580] [<ffff200008172adc>] __cpuhp_remove_state+0x54/0x80
      [  268.748597] [<ffff20000215dd84>] arm_ccn_exit+0x2c/0x70 [arm_ccn]
      [  268.748604] [<ffff20000834cfbc>] SyS_delete_module+0x5a4/0x708
      [  268.748607] Exception stack(0xffff80019c127ec0 to 0xffff80019c128000)
      [  268.748612] 7ec0: 0000000019bb7258 0000000000000800 ba64d0fb3d26a800 00000000000000da
      [  268.748616] 7ee0: 0000ffffb6144e28 0000ffffcd95b409 fefefefefefefeff 7f7f7f7f7f7f7f7f
      [  268.748621] 7f00: 000000000000006a 1999999999999999 0000ffffb6179000 0000000000bbcc6d
      [  268.748625] 7f20: 0000ffffb6176b98 0000ffffcd95c2d0 0000ffffb5fe7b58 0000ffffb6163000
      [  268.748630] 7f40: 0000ffffb60ad3e0 00000000004402d0 0000ffffb5fe7c58 0000000019bb71f0
      [  268.748634] 7f60: 0000ffffcd95c740 0000000000000000 0000000019bb71f0 0000000000416700
      [  268.748639] 7f80: 0000000000000000 00000000004402e8 0000000019bb6010 0000ffffcd95c748
      [  268.748643] 7fa0: 0000000000000000 0000ffffcd95c460 00000000004113a8 0000ffffcd95c460
      [  268.748648] 7fc0: 0000ffffb60ad3e8 0000000080000000 0000000019bb7258 000000000000006a
      [  268.748652] 7fe0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
      [  268.748657] [<ffff200008084f9c>] __sys_trace_return+0x0/0x4
      [  268.748661] ---[ end trace a996d358dcaa7f9c ]---
      
      Fixes: 8df03872 ("bus/arm-ccn: Use cpu-hp's multi instance support instead custom list")
      Signed-off-by: default avatarKim Phillips <kim.phillips@arm.com>
      Acked-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1cef55be
    • Marc Zyngier's avatar
      bus: arm-ccn: Fix use of smp_processor_id() in preemptible context · 8741b5ab
      Marc Zyngier authored
      commit b18c2b94 upstream.
      
      Booting a DEBUG_PREEMPT enabled kernel on a CCN-based system
      results in the following splat:
      
      [...]
      arm-ccn e8000000.ccn: No access to interrupts, using timer.
      BUG: using smp_processor_id() in preemptible [00000000] code: swapper/0/1
      caller is debug_smp_processor_id+0x1c/0x28
      CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.13.0 #6111
      Hardware name: AMD Seattle/Seattle, BIOS 17:08:23 Jun 26 2017
      Call trace:
      [<ffff000008089e78>] dump_backtrace+0x0/0x278
      [<ffff00000808a22c>] show_stack+0x24/0x30
      [<ffff000008bc3bc4>] dump_stack+0x8c/0xb0
      [<ffff00000852b534>] check_preemption_disabled+0xfc/0x100
      [<ffff00000852b554>] debug_smp_processor_id+0x1c/0x28
      [<ffff000008551bd8>] arm_ccn_probe+0x358/0x4f0
      [...]
      
      as we use smp_processor_id() in the wrong context.
      
      Turn this into a get_cpu()/put_cpu() that extends over the CPU hotplug
      registration, making sure that we don't race against a CPU down operation.
      Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8741b5ab