1. 25 Mar, 2020 27 commits
  2. 20 Mar, 2020 13 commits
    • Greg Kroah-Hartman's avatar
      Linux 4.19.112 · 14cfdbd3
      Greg Kroah-Hartman authored
      14cfdbd3
    • Matteo Croce's avatar
      ipv4: ensure rcu_read_lock() in cipso_v4_error() · b4176d3b
      Matteo Croce authored
      commit 3e72dfdf upstream.
      
      Similarly to commit c543cb4a ("ipv4: ensure rcu_read_lock() in
      ipv4_link_failure()"), __ip_options_compile() must be called under rcu
      protection.
      
      Fixes: 3da1ed7a ("net: avoid use IPCB in cipso_v4_error")
      Suggested-by: default avatarGuillaume Nault <gnault@redhat.com>
      Signed-off-by: default avatarMatteo Croce <mcroce@redhat.com>
      Acked-by: default avatarPaul Moore <paul@paul-moore.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b4176d3b
    • Waiman Long's avatar
      efi: Fix debugobjects warning on 'efi_rts_work' · a44324b0
      Waiman Long authored
      commit ef1491e7 upstream.
      
      The following commit:
      
        9dbbedaa ("efi: Make efi_rts_work accessible to efi page fault handler")
      
      converted 'efi_rts_work' from an auto variable to a global variable.
      However, when submitting the work, INIT_WORK_ONSTACK() was still used,
      causing the following complaint from debugobjects:
      
        ODEBUG: object 00000000ed27b500 is NOT on stack 00000000c7d38760, but annotated.
      
      Change the macro to just INIT_WORK() to eliminate the warning.
      Signed-off-by: default avatarWaiman Long <longman@redhat.com>
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Acked-by: default avatarSai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Fixes: 9dbbedaa ("efi: Make efi_rts_work accessible to efi page fault handler")
      Link: http://lkml.kernel.org/r/20181114175544.12860-2-ard.biesheuvel@linaro.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a44324b0
    • Chen-Tsung Hsieh's avatar
      HID: google: add moonball USB id · 705d1b54
      Chen-Tsung Hsieh authored
      commit 58322a15 upstream.
      
      Add 1 additional hammer-like device.
      Signed-off-by: default avatarChen-Tsung Hsieh <chentsung@chromium.org>
      Reviewed-by: default avatarNicolas Boichat <drinkcat@chromium.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      705d1b54
    • Jann Horn's avatar
      mm: slub: add missing TID bump in kmem_cache_alloc_bulk() · 30f6cae7
      Jann Horn authored
      commit fd4d9c7d upstream.
      
      When kmem_cache_alloc_bulk() attempts to allocate N objects from a percpu
      freelist of length M, and N > M > 0, it will first remove the M elements
      from the percpu freelist, then call ___slab_alloc() to allocate the next
      element and repopulate the percpu freelist. ___slab_alloc() can re-enable
      IRQs via allocate_slab(), so the TID must be bumped before ___slab_alloc()
      to properly commit the freelist head change.
      
      Fix it by unconditionally bumping c->tid when entering the slowpath.
      
      Cc: stable@vger.kernel.org
      Fixes: ebe909e0 ("slub: improve bulk alloc strategy")
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      30f6cae7
    • Kees Cook's avatar
      ARM: 8958/1: rename missed uaccess .fixup section · c1a9559a
      Kees Cook authored
      commit f87b1c49 upstream.
      
      When the uaccess .fixup section was renamed to .text.fixup, one case was
      missed. Under ld.bfd, the orphaned section was moved close to .text
      (since they share the "ax" bits), so things would work normally on
      uaccess faults. Under ld.lld, the orphaned section was placed outside
      the .text section, making it unreachable.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/282
      Link: https://bugs.chromium.org/p/chromium/issues/detail?id=1020633#c44
      Link: https://lore.kernel.org/r/nycvar.YSQ.7.76.1912032147340.17114@knanqh.ubzr
      Link: https://lore.kernel.org/lkml/202002071754.F5F073F1D@keescook/
      
      Fixes: c4a84ae3 ("ARM: 8322/1: keep .text and .fixup regions closer together")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c1a9559a
    • Florian Fainelli's avatar
      ARM: 8957/1: VDSO: Match ARMv8 timer in cntvct_functional() · 8cf58ea4
      Florian Fainelli authored
      commit 45939ce2 upstream.
      
      It is possible for a system with an ARMv8 timer to run a 32-bit kernel.
      When this happens we will unconditionally have the vDSO code remove the
      __vdso_gettimeofday and __vdso_clock_gettime symbols because
      cntvct_functional() returns false since it does not match that
      compatibility string.
      
      Fixes: ecf99a43 ("ARM: 8331/1: VDSO initialization, mapping, and synchronization")
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8cf58ea4
    • Carl Huang's avatar
      net: qrtr: fix len of skb_put_padto in qrtr_node_enqueue · bc97a345
      Carl Huang authored
      commit ce57785b upstream.
      
      The len used for skb_put_padto is wrong, it need to add len of hdr.
      
      In qrtr_node_enqueue, local variable size_t len is assign with
      skb->len, then skb_push(skb, sizeof(*hdr)) will add skb->len with
      sizeof(*hdr), so local variable size_t len is not same with skb->len
      after skb_push(skb, sizeof(*hdr)).
      
      Then the purpose of skb_put_padto(skb, ALIGN(len, 4)) is to add add
      pad to the end of the skb's data if skb->len is not aligned to 4, but
      unfortunately it use len instead of skb->len, at this line, skb->len
      is 32 bytes(sizeof(*hdr)) more than len, for example, len is 3 bytes,
      then skb->len is 35 bytes(3 + 32), and ALIGN(len, 4) is 4 bytes, so
      __skb_put_padto will do nothing after check size(35) < len(4), the
      correct value should be 36(sizeof(*hdr) + ALIGN(len, 4) = 32 + 4),
      then __skb_put_padto will pass check size(35) < len(36) and add 1 byte
      to the end of skb's data, then logic is correct.
      
      function of skb_push:
      void *skb_push(struct sk_buff *skb, unsigned int len)
      {
      	skb->data -= len;
      	skb->len  += len;
      	if (unlikely(skb->data < skb->head))
      		skb_under_panic(skb, len, __builtin_return_address(0));
      	return skb->data;
      }
      
      function of skb_put_padto
      static inline int skb_put_padto(struct sk_buff *skb, unsigned int len)
      {
      	return __skb_put_padto(skb, len, true);
      }
      
      function of __skb_put_padto
      static inline int __skb_put_padto(struct sk_buff *skb, unsigned int len,
      				  bool free_on_error)
      {
      	unsigned int size = skb->len;
      
      	if (unlikely(size < len)) {
      		len -= size;
      		if (__skb_pad(skb, len, free_on_error))
      			return -ENOMEM;
      		__skb_put(skb, len);
      	}
      	return 0;
      }
      Signed-off-by: default avatarCarl Huang <cjhuang@codeaurora.org>
      Signed-off-by: default avatarWen Gong <wgong@codeaurora.org>
      Cc: Doug Anderson <dianders@chromium.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bc97a345
    • Rafael J. Wysocki's avatar
      driver core: Fix creation of device links with PM-runtime flags · cda3bca0
      Rafael J. Wysocki authored
      commit fb583c8e upstream.
      
      After commit 515db266 ("driver core: Remove device link creation
      limitation"), if PM-runtime flags are passed to device_link_add(), it
      will fail (returning NULL) due to an overly restrictive flags check
      introduced by that commit.
      
      Fix this issue by extending the check in question to cover the
      PM-runtime flags too.
      
      Fixes: 515db266 ("driver core: Remove device link creation limitation")
      Reported-by: default avatarDmitry Osipenko <digetx@gmail.com>
      Tested-by: default avatarJon Hunter <jonathanh@nvidia.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: default avatarDmitry Osipenko <digetx@gmail.com>
      Tested-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
      Link: https://lore.kernel.org/r/7674989.cD04D8YV3U@kreacherSigned-off-by: default avatarSaravana Kannan <saravanak@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cda3bca0
    • Rafael J. Wysocki's avatar
      driver core: Remove device link creation limitation · 53a895ff
      Rafael J. Wysocki authored
      commit 515db266 upstream.
      
      If device_link_add() is called for a consumer/supplier pair with an
      existing device link between them and the existing link's type is
      not in agreement with the flags passed to that function by its
      caller, NULL will be returned.  That is seriously inconvenient,
      because it forces the callers of device_link_add() to worry about
      what others may or may not do even if that is not relevant to them
      for any other reasons.
      
      It turns out, however, that this limitation can be made go away
      relatively easily.
      
      The underlying observation is that if DL_FLAG_STATELESS has been
      passed to device_link_add() in flags for the given consumer/supplier
      pair at least once, calling either device_link_del() or
      device_link_remove() to release the link returned by it should work,
      but there are no other requirements associated with that flag.  In
      turn, if at least one of the callers of device_link_add() for the
      given consumer/supplier pair has not passed DL_FLAG_STATELESS to it
      in flags, the driver core should track the status of the link and act
      on it as appropriate (ie. the link should be treated as "managed").
      This means that DL_FLAG_STATELESS needs to be set for managed device
      links and it should be valid to call device_link_del() or
      device_link_remove() to drop references to them in certain
      sutiations.
      
      To allow that to happen, introduce a new (internal) device link flag
      called DL_FLAG_MANAGED and make device_link_add() set it automatically
      whenever DL_FLAG_STATELESS is not passed to it.  Also make it take
      additional references to existing device links that were previously
      stateless (that is, with DL_FLAG_STATELESS set and DL_FLAG_MANAGED
      unset) and will need to be managed going forward and initialize
      their status (which has been DL_STATE_NONE so far).
      
      Accordingly, when a managed device link is dropped automatically
      by the driver core, make it clear DL_FLAG_MANAGED, reset the link's
      status back to DL_STATE_NONE and drop the reference to it associated
      with DL_FLAG_MANAGED instead of just deleting it right away (to
      allow it to stay around in case it still needs to be released
      explicitly by someone).
      
      With that, since setting DL_FLAG_STATELESS doesn't mean that the
      device link in question is not managed any more, replace all of the
      status-tracking checks against DL_FLAG_STATELESS with analogous
      checks against DL_FLAG_MANAGED and update the documentation to
      reflect these changes.
      
      While at it, make device_link_add() reject flags that it does not
      recognize, including DL_FLAG_MANAGED.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: default avatarSaravana Kannan <saravanak@google.com>
      Tested-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
      Review-by: default avatarSaravana Kannan <saravanak@google.com>
      Link: https://lore.kernel.org/r/2305283.AStDPdUUnE@kreacherSigned-off-by: default avatarSaravana Kannan <saravanak@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      53a895ff
    • Rafael J. Wysocki's avatar
      driver core: Add device link flag DL_FLAG_AUTOPROBE_CONSUMER · 822e87b7
      Rafael J. Wysocki authored
      commit e7dd4010 upstream.
      
      Add a new device link flag, DL_FLAG_AUTOPROBE_CONSUMER, to request the
      driver core to probe for a consumer driver automatically after binding
      a driver to the supplier device on a persistent managed device link.
      
      As unbinding the supplier driver on a managed device link causes the
      consumer driver to be detached from its device automatically, this
      flag provides a complementary mechanism which is needed to address
      some "composite device" use cases.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarSaravana Kannan <saravanak@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      822e87b7
    • Rafael J. Wysocki's avatar
      driver core: Make driver core own stateful device links · 1f5102cb
      Rafael J. Wysocki authored
      commit 72175d4e upstream.
      
      Even though stateful device links are managed by the driver core in
      principle, their creators are allowed and sometimes even expected
      to drop references to them via device_link_del() or
      device_link_remove(), but that doesn't really play well with the
      "persistent" link concept.
      
      If "persistent" managed device links are created from driver
      probe callbacks, device_link_add() called to do that will take a
      new reference on the link each time the callback runs and those
      references will never be dropped, which kind of isn't nice.
      
      This issues arises because of the link reference counting carried
      out by device_link_add() for existing links, but that is only done to
      avoid deleting device links that may still be necessary, which
      shouldn't be a concern for managed (stateful) links.  These device
      links are managed by the driver core and whoever creates one of them
      will need it at least as long as until the consumer driver is detached
      from its device and deleting it may be left to the driver core just
      fine.
      
      For this reason, rework device_link_add() to apply the reference
      counting to stateless links only and make device_link_del() and
      device_link_remove() drop references to stateless links only too.
      After this change, if called to add a stateful device link for
      a consumer-supplier pair for which a stateful device link is
      present already, device_link_add() will return the existing link
      without incrementing its reference counter.  Accordingly,
      device_link_del() and device_link_remove() will WARN() and do
      nothing when called to drop a reference to a stateful link.  Thus,
      effectively, all stateful device links will be owned by the driver
      core.
      
      In addition, clean up the handling of the link management flags,
      DL_FLAG_AUTOREMOVE_CONSUMER and DL_FLAG_AUTOREMOVE_SUPPLIER, so that
      (a) they are never set at the same time and (b) if device_link_add()
      is called for a consumer-supplier pair with an existing stateful link
      between them, the flags of that link will be combined with the flags
      passed to device_link_add() to ensure that the life time of the link
      is sufficient for all of the callers of device_link_add() for the
      same consumer-supplier pair.
      
      Update the device_link_add() kerneldoc comment to reflect the
      above changes.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarSaravana Kannan <saravanak@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1f5102cb
    • Rafael J. Wysocki's avatar
      driver core: Fix adding device links to probing suppliers · 1c89b531
      Rafael J. Wysocki authored
      commit 15cfb094 upstream.
      
      Currently, it is not valid to add a device link from a consumer
      driver ->probe callback to a supplier that is still probing too, but
      generally this is a valid use case.  For example, if the consumer has
      just acquired a resource that can only be available if the supplier
      is functional, adding a device link to that supplier right away
      should be safe (and even desirable arguably), but device_link_add()
      doesn't handle that case correctly and the initial state of the link
      created by it is wrong then.
      
      To address this problem, change the initial state of device links
      added between a probing supplier and a probing consumer to
      DL_STATE_CONSUMER_PROBE and update device_links_driver_bound() to
      skip such links on the supplier side.
      
      With this change, if the supplier probe completes first,
      device_links_driver_bound() called for it will skip the link state
      update and when it is called for the consumer, the link state will
      be updated to "active".  In turn, if the consumer probe completes
      first, device_links_driver_bound() called for it will change the
      state of the link to "active" and when it is called for the
      supplier, the link status update will be skipped.
      
      However, in principle the supplier or consumer probe may still fail
      after the link has been added, so modify device_links_no_driver() to
      change device links in the "active" or "consumer probe" state to
      "dormant" on the supplier side and update __device_links_no_driver()
      to change the link state to "available" only if it is "consumer
      probe" or "active".
      
      Then, if the supplier probe fails first, the leftover link to the
      probing consumer will become "dormant" and device_links_no_driver()
      called for the consumer (when its probe fails) will clean it up.
      In turn, if the consumer probe fails first, it will either drop the
      link, or change its state to "available" and, in the latter case,
      when device_links_no_driver() is called for the supplier, it will
      update the link state to "dormant".  [If the supplier probe fails,
      but the consumer probe succeeds, which should not happen as long as
      the consumer driver is correct, the link still will be around, but
      it will be "dormant" until the supplier is probed again.]
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarSaravana Kannan <saravanak@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1c89b531