1. 09 Apr, 2019 2 commits
    • Takashi Iwai's avatar
      ALSA: seq: Use kvmalloc() for cell pools · fd7ae83d
      Takashi Iwai authored
      Use kvmalloc() for allocating cell pools since the pool size can be
      relatively small that may be covered better by slab.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      fd7ae83d
    • Takashi Iwai's avatar
      ALSA: timer: Revert active callback sync check at close · df55531b
      Takashi Iwai authored
      This is essentially a revert of the commit a7588c89 ("ALSA: timer:
      Check ack_list emptiness instead of bit flag").  The intended change
      by the commit turns out to be insufficient, as snd_timer_close*()
      always calls snd_timer_stop() that deletes the ack_list beforehand.
      
      In theory, we can change the behavior of snd_timer_stop() to sync the
      pending ack_list, but this will become a deadlock for the callback
      like sequencer that calls again snd_timer_stop() from itself.  So,
      reverting the change is a more straightforward solution.
      
      Fixes: a7588c89 ("ALSA: timer: Check ack_list emptiness instead of bit flag")
      Reported-by: syzbot+58813d77154713f4de15@syzkaller.appspotmail.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      df55531b
  2. 03 Apr, 2019 1 commit
  3. 28 Mar, 2019 1 commit
  4. 27 Mar, 2019 6 commits
    • Takashi Iwai's avatar
      ALSA: us122l: Use alloc_pages_exact() · 36b8defc
      Takashi Iwai authored
      alloc_pages_exact() is more suitable choice for allocating the sound
      buffers, as it doesn't need to align with power-of-two.  Along with
      the conversion, we can drop __GFP_COMP as well.
      
      The patch also replace the error messages to be more explicit.
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      36b8defc
    • Takashi Iwai's avatar
      ALSA: Replace snd_malloc_pages() and snd_free_pages() with standard helpers, take#2 · 734b5a0b
      Takashi Iwai authored
      snd_malloc_pages() and snd_free_pages() are merely thin wrappers of
      the standard page allocator / free functions.  Even the arguments are
      compatible with some standard helpers, so there is little merit of
      keeping these wrappers.
      
      This patch replaces the all existing callers of snd_malloc_pages() and
      snd_free_pages() with the direct calls of the standard helper
      functions.  In this version, we use a recently introduced one,
      alloc_pages_exact(), which suits better than the old
      snd_malloc_pages() implementation for our purposes.  Then we can avoid
      the waste of pages by alignment to power-of-two.
      
      Since alloc_pages_exact() does split pages, we need no longer
      __GFP_COMP flag; or better to say, we must not pass __GFP_COMP to
      alloc_pages_exact().  So the former unconditional addition of
      __GFP_COMP flag in snd_malloc_pages() is dropped, as well as in most
      other places.
      Reviewed-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      734b5a0b
    • Takashi Iwai's avatar
      ALSA: timer: Make snd_timer_close() really kill pending actions · fe1b26c9
      Takashi Iwai authored
      snd_timer_close() is supposed to close the timer instance and sync
      with the deactivation of pending actions.  However, there are still
      some overlooked cases:
      
      - It calls snd_timer_stop() at the beginning, but some other might
        re-trigger the timer right after that.
      
      - snd_timer_stop() calls del_timer_sync() only when all belonging
        instances are closed.  If multiple instances were assigned to a
        timer object and one is closed, the timer is still running.  Then
        the pending action assigned to this timer might be left.
      
      Actually either of the above is the likely cause of the reported
      syzkaller UAF.
      
      This patch plug these holes by introducing SNDRV_TIMER_IFLG_DEAD
      flag.  This is set at the beginning of snd_timer_close(), and the flag
      is checked at snd_timer_start*() and else, so that no longer new
      action is left after snd_timer_close().
      
      Reported-by: syzbot+d5136d4d3240cbe45a2a@syzkaller.appspotmail.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      fe1b26c9
    • Takashi Iwai's avatar
      ALSA: timer: Check ack_list emptiness instead of bit flag · a7588c89
      Takashi Iwai authored
      For checking the pending timer instance that is still left on the
      timer object that is being closed, we set/clear a bit flag
      SNDRV_TIMER_IFLG_CALLBACK around the call of callbacks.  This can be
      simplified by replace with the list_empty() call for ti->ack_list.
      This covers the existence more comprehensively and safely.
      
      A gratis bonus is that we can get rid of SNDRV_TIMER_IFLG_CALLBACK bit
      flag definition as well.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      a7588c89
    • Takashi Iwai's avatar
      ALSA: timer: Make sure to clear pending ack list · 7bb4a8a2
      Takashi Iwai authored
      When a card is under disconnection, we bail out immediately at each
      timer interrupt or tasklet.  This might leave some items left in ack
      list.  For a better integration of the upcoming change to check
      ack_list emptiness, clear out the whole list upon the emergency exit
      route.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      7bb4a8a2
    • Takashi Iwai's avatar
      ALSA: timer: Unify timer callback process code · 8748b850
      Takashi Iwai authored
      The timer core has two almost identical code for processing callbacks:
      once in snd_timer_interrupt() for fast callbacks and another in
      snd_timer_tasklet() for delayed callbacks.  Let's unify them.
      
      In the new version, the resolution is read from ti->resolution at each
      call, and this must be fine; ti->resolution is set in the preparation
      step in snd_timer_interrupt().
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      8748b850
  5. 26 Mar, 2019 1 commit
    • Takashi Iwai's avatar
      ALSA: emux: Add support of loading GUS-patch · e42dd3ee
      Takashi Iwai authored
      It's a feature request for the ancient sutff, but it's still valid;
      the loading of a GUS-patch isn't available via hwdep device although
      it's supported over OSS sequencer.  The only missing piece is the call
      of snd_soundfont_load_guspatch() in synth emux hwdep code.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      e42dd3ee
  6. 25 Mar, 2019 1 commit
  7. 18 Mar, 2019 5 commits
    • Takashi Sakamoto's avatar
      ALSA: firewire-lib: use 8 byte header for IR context to get isochronous cycle · cc4f8e91
      Takashi Sakamoto authored
      In kernel API of Linux FireWire subsystem, handlers of isochronous
      receive (IR) context can get context headers as an argument of
      callback. When 4 byte header is used, the context header includes
      isochronous packet header for each packet. When 8 byte header is
      used, it includes isochronous cycle as well.
      
      ALSA IEC 61883-1/6 engine uses 4 byte header, and computes isochronous
      cycle from the cycle of interrupt. The usage of 8 byte header can
      obsolete the computation.
      
      Furthermore, this change works well for a case that a series of
      packet in one interrupt includes skipped isochronous cycle,
      
      This commit uses 8 byte header to handle isochronous cycle.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      cc4f8e91
    • Takashi Sakamoto's avatar
      ALSA: firewire-motu: add support MOTU 8pre FireWire · 35033d8c
      Takashi Sakamoto authored
      This commit adds support for MOTU 8pre FireWire, which was shipped 2007
      and nowadays already discontinued. Userspace applications can transmit
      and receive PCM frames and MIDI messages for this model via ALSA PCM
      interface and RawMidi/Sequencer interfaces.
      
      Like the other models of MOTU FireWire series, this model has many
      quirks in its CIP.
      
      At first, data channels for two pairs of optical interfaces. At lower
      sampling transmission frequency, i.e. 44.1 and 48.0 kHz, one pair is
      available for ADAT data, thus 8 data chunks are transferred by CIP.
      At middle sampling transmission frequency, i.e.  88.2 and 96.0 kHz,
      two pairs are available to keep 8 chunks for ADAT data, thus CIP
      still includes 8 data chunks.
      
      Apart from data chunks for optical interface, CIP includes fixed number
      of data chunks. In tx stream, two chunks for status message, eight
      chunks for samples from analog 1-8 input, two chunks for mix-return.
      In rx stream, two chunks for control message, two chunks for main 1-2
      output, two chunks for phone 1-2 output, two chunks for dummy 1-2.
      
      CIP header in tx stream includes quirks for its dbs and dbc fields.
      The value of dbs field is fixed to 0x13, against its actual size.
      The value of dbc field is firstly updated to 0x07 from zero, then
      it's incremented continuously according to actual number of data h
      blocks.
      
      Finally, the model has own bits to disable frame fetch.
      
      This commit uses several options to absorb the above quirks.
      
      $ python2 crpp < /sys/bus/firewire/devices/fw1/config_rom
                     ROM header and bus information block
                     -----------------------------------------------------------------
      400  0410b57d  bus_info_length 4, crc_length 16, crc 46461
      404  31333934  bus_name "1394"
      408  20001000  irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 0, max_rec 1 (4)
      40c  0001f200  company_id 0001f2     |
      410  00083dfb  device_id 0000083dfb  | EUI-64 0001f20000083dfb
      
                     root directory
                     -----------------------------------------------------------------
      414  0004c65c  directory_length 4, crc 50780
      418  030001f2  vendor
      41c  0c0083c0  node capabilities per IEEE 1394
      420  8d000006  --> eui-64 leaf at 438
      424  d1000001  --> unit directory at 428
      
                     unit directory at 428
                     -----------------------------------------------------------------
      428  0003991c  directory_length 3, crc 39196
      42c  120001f2  specifier id
      430  1300000f  version
      434  17103800  model
      
                     eui-64 leaf at 438
                     -----------------------------------------------------------------
      438  00022681  leaf_length 2, crc 9857
      43c  0001f200  company_id 0001f2     |
      440  00083dfb  device_id 0000083dfb  | EUI-64 0001f20000083dfb
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      35033d8c
    • Takashi Iwai's avatar
      Merge branch 'for-linus' into for-next · b3f5c0f3
      Takashi Iwai authored
      Back-merge the current devel branch for further development.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      b3f5c0f3
    • Colin Ian King's avatar
      ALSA: opl3: fix mismatch between snd_opl3_drum_switch definition and declaration · b4748e7a
      Colin Ian King authored
      The function snd_opl3_drum_switch declaration in the header file
      has the order of the two arguments on_off and vel swapped when
      compared to the definition arguments of vel and on_off.  Fix this
      by swapping them around to match the definition.
      
      This error predates the git history, so no idea when this error
      was introduced.
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      b4748e7a
    • Jaroslav Kysela's avatar
      ALSA: hda - add Lenovo IdeaCentre B550 to the power_save_blacklist · 721f1e6c
      Jaroslav Kysela authored
      Another machine which does not like the power saving (noise):
        https://bugzilla.redhat.com/show_bug.cgi?id=1689623
      
      Also, reorder the Lenovo C50 entry to keep the table sorted.
      
      Reported-by: hs.guimaraes@outlook.com
      Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      721f1e6c
  8. 17 Mar, 2019 15 commits
    • Linus Torvalds's avatar
      Linux 5.1-rc1 · 9e98c678
      Linus Torvalds authored
      9e98c678
    • Linus Torvalds's avatar
      Merge tag 'kbuild-v5.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild · 28d747f2
      Linus Torvalds authored
      Pull more Kbuild updates from Masahiro Yamada:
      
       - add more Build-Depends to Debian source package
      
       - prefix header search paths with $(srctree)/
      
       - make modpost show verbose section mismatch warnings
      
       - avoid hard-coded CROSS_COMPILE for h8300
      
       - fix regression for Debian make-kpkg command
      
       - add semantic patch to detect missing put_device()
      
       - fix some warnings of 'make deb-pkg'
      
       - optimize NOSTDINC_FLAGS evaluation
      
       - add warnings about redundant generic-y
      
       - clean up Makefiles and scripts
      
      * tag 'kbuild-v5.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
        kconfig: remove stale lxdialog/.gitignore
        kbuild: force all architectures except um to include mandatory-y
        kbuild: warn redundant generic-y
        Revert "modsign: Abort modules_install when signing fails"
        kbuild: Make NOSTDINC_FLAGS a simply expanded variable
        kbuild: deb-pkg: avoid implicit effects
        coccinelle: semantic code search for missing put_device()
        kbuild: pkg: grep include/config/auto.conf instead of $KCONFIG_CONFIG
        kbuild: deb-pkg: introduce is_enabled and if_enabled_echo to builddeb
        kbuild: deb-pkg: add CONFIG_ prefix to kernel config options
        kbuild: add workaround for Debian make-kpkg
        kbuild: source include/config/auto.conf instead of ${KCONFIG_CONFIG}
        unicore32: simplify linker script generation for decompressor
        h8300: use cc-cross-prefix instead of hardcoding h8300-unknown-linux-
        kbuild: move archive command to scripts/Makefile.lib
        modpost: always show verbose warning for section mismatch
        ia64: prefix header search path with $(srctree)/
        libfdt: prefix header search paths with $(srctree)/
        deb-pkg: generate correct build dependencies
      28d747f2
    • Linus Torvalds's avatar
      Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 80b98e92
      Linus Torvalds authored
      Pull x86 asm updates from Thomas Gleixner:
       "Two cleanup patches removing dead conditionals and unused code"
      
      * 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/asm: Remove unused __constant_c_x_memset() macro and inlines
        x86/asm: Remove dead __GNUC__ conditionals
      80b98e92
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 69ebf9a1
      Linus Torvalds authored
      Pull perf fixes from Thomas Gleixner:
       "Three fixes for the fallout from the TSX errata workaround:
      
         - Prevent memory corruption caused by a unchecked out of bound array
           index.
      
         - Two trivial fixes to address compiler warnings"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf/x86/intel: Make dev_attr_allow_tsx_force_abort static
        perf/x86: Fixup typo in stub functions
        perf/x86/intel: Fix memory corruption
      69ebf9a1
    • Linus Torvalds's avatar
      Merge tag 'for-linus-5.1b-rc1b-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · c5b5138c
      Linus Torvalds authored
      Pull xen fix from Juergen Gross:
       "A fix for a Xen bug introduced by David's series for excluding
        ballooned pages in vmcores"
      
      * tag 'for-linus-5.1b-rc1b-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        xen/balloon: Fix mapping PG_offline pages to user space
      c5b5138c
    • Linus Torvalds's avatar
      Merge tag '9p-for-5.1' of git://github.com/martinetd/linux · db77bef5
      Linus Torvalds authored
      Pull 9p updates from Dominique Martinet:
       "Here is a 9p update for 5.1; there honestly hasn't been much.
      
        Two fixes (leak on invalid mount argument and possible deadlock on
        i_size update on 32bit smp) and a fall-through warning cleanup"
      
      * tag '9p-for-5.1' of git://github.com/martinetd/linux:
        9p/net: fix memory leak in p9_client_create
        9p: use inode->i_lock to protect i_size_write() under 32-bit
        9p: mark expected switch fall-through
      db77bef5
    • kbuild test robot's avatar
      perf/x86/intel: Make dev_attr_allow_tsx_force_abort static · c634dc6b
      kbuild test robot authored
      Fixes: 400816f6 ("perf/x86/intel: Implement support for TSX Force Abort")
      Signed-off-by: default avatarkbuild test robot <lkp@intel.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
      Cc: kbuild-all@01.org
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: stable@vger.kernel.org
      Link: https://lkml.kernel.org/r/20190313184243.GA10820@lkp-sb-ep06
      c634dc6b
    • Takashi Sakamoto's avatar
      ALSA: firewire-motu: use 'version' field of unit directory to identify model · 2d012c65
      Takashi Sakamoto authored
      Current ALSA firewire-motu driver uses the value of 'model' field
      of unit directory in configuration ROM for modalias for MOTU
      FireWire models. However, as long as I checked, Pre8 and
      828mk3(Hybrid) have the same value for the field (=0x100800).
      
      unit            | version   | model
      --------------- | --------- | ----------
      828mkII         | 0x000003  | 0x101800
      Traveler        | 0x000009  | 0x107800
      Pre8            | 0x00000f  | 0x100800 <-
      828mk3(FW)      | 0x000015  | 0x106800
      AudioExpress    | 0x000033  | 0x104800
      828mk3(Hybrid)  | 0x000035  | 0x100800 <-
      
      When updating firmware for MOTU 8pre FireWire from v1.0.0 to v1.0.3,
      I got change of the value from 0x100800 to 0x103800. On the other
      hand, the value of 'version' field is fixed to 0x00000f. As a quick
      glance, the higher 12 bits of the value of 'version' field represent
      firmware version, while the lower 12 bits is unknown.
      
      By induction, the value of 'version' field represents actual model.
      
      This commit changes modalias to match the value of 'version' field,
      instead of 'model' field. For degug, long name of added sound card
      includes hexadecimal value of 'model' field.
      
      Fixes: 6c5e1ac0 ("ALSA: firewire-motu: add support for Motu Traveler")
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Cc: <stable@vger.kernel.org> # v4.19+
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      2d012c65
    • Masahiro Yamada's avatar
      kconfig: remove stale lxdialog/.gitignore · c71bb9f8
      Masahiro Yamada authored
      When this .gitignore was added, lxdialog was an independent hostprogs-y.
      
      Now that all objects in lxdialog/ are directly linked to mconf, the
      lxdialog is no longer generated.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      c71bb9f8
    • Masahiro Yamada's avatar
      kbuild: force all architectures except um to include mandatory-y · 037fc336
      Masahiro Yamada authored
      Currently, every arch/*/include/uapi/asm/Kbuild explicitly includes
      the common Kbuild.asm file. Factor out the duplicated include directives
      to scripts/Makefile.asm-generic so that no architecture would opt out
      of the mandatory-y mechanism.
      
      um is not forced to include mandatory-y since it is a very exceptional
      case which does not support UAPI.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      037fc336
    • Masahiro Yamada's avatar
      kbuild: warn redundant generic-y · 7cbbbb8b
      Masahiro Yamada authored
      The generic-y is redundant under the following condition:
      
       - arch has its own implementation
      
       - the same header is added to generated-y
      
       - the same header is added to mandatory-y
      
      If a redundant generic-y is found, the warning like follows is displayed:
      
        scripts/Makefile.asm-generic:20: redundant generic-y found in arch/arm/include/asm/Kbuild: timex.h
      
      I fixed up arch Kbuild files found by this.
      Suggested-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      7cbbbb8b
    • Douglas Anderson's avatar
      Revert "modsign: Abort modules_install when signing fails" · f84dde10
      Douglas Anderson authored
      This reverts commit caf6fe91.
      
      The commit was fine but is no longer needed as of commit 3a2429e1
      ("kbuild: change if_changed_rule for multi-line recipe").  Let's go
      back to using ";" to be consistent.
      
      For some discussion, see:
      
      https://lkml.kernel.org/r/CAK7LNASde0Q9S5GKeQiWhArfER4S4wL1=R_FW8q0++_X3T5=hQ@mail.gmail.comSigned-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      f84dde10
    • Douglas Anderson's avatar
      kbuild: Make NOSTDINC_FLAGS a simply expanded variable · 0c22be07
      Douglas Anderson authored
      During a simple no-op (nothing changed) build I saw 39 invocations of
      the C compiler with the argument "-print-file-name=include".  We don't
      need to call the C compiler 39 times for this--one time will suffice.
      
      Let's change NOSTDINC_FLAGS to a simply expanded variable to avoid
      this since there doesn't appear to be any reason it should be
      recursively expanded.
      
      On my build this shaved ~400 ms off my "no-op" build.
      
      Note that the recursive expansion seems to date back to the (really
      old) commit e8f5bdb0 ("[PATCH] Makefile include path ordering").
      It's a little unclear to me if the point of that patch was to switch
      the variable to be recursively expanded (which it did) or to avoid
      directly assigning to NOSTDINC_FLAGS (AKA to switch to +=) because
      someone else (out of tree?) was setting it.  I presume later since if
      the only goal was to switch to recursive expansion the patch would
      have just removed the ":".
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      0c22be07
    • Arseny Maslennikov's avatar
      kbuild: deb-pkg: avoid implicit effects · f6d9db63
      Arseny Maslennikov authored
      * The man page for dpkg-source(1) notes:
      
      >      -b, --build directory [format-specific-parameters]
      >             Build  a  source  package  (--build since dpkg 1.17.14).
      >             <...>
      >
      >             dpkg-source will build the source package with the first
      >             format found in this ordered list: the format  indicated
      >             with  the  --format  command  line  option,  the  format
      >             indicated in debian/source/format, “1.0”.  The  fallback
      >             to “1.0” is deprecated and will be removed at some point
      >             in the future, you should always  document  the  desired
      >             source   format  in  debian/source/format.  See  section
      >             SOURCE PACKAGE FORMATS for an extensive  description  of
      >             the various source package formats.
      
        Thus it would be more foolproof to explicitly use 1.0 (as we always
        did) than to rely on dpkg-source's defaults.
      
      * In a similar vein, debian/rules is not made executable by mkdebian,
        and dpkg-source warns about that but still silently fixes the file.
        Let's be explicit once again.
      Signed-off-by: default avatarArseny Maslennikov <ar@cs.msu.ru>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      f6d9db63
    • Wen Yang's avatar
      coccinelle: semantic code search for missing put_device() · da9cfb87
      Wen Yang authored
      The of_find_device_by_node() takes a reference to the underlying device
      structure, we should release that reference.
      The implementation of this semantic code search is:
      In a function, for a local variable returned by calling
      of_find_device_by_node(),
      a, if it is released by a function such as
         put_device()/of_dev_put()/platform_device_put() after the last use,
         it is considered that there is no reference leak;
      b, if it is passed back to the caller via
         dev_get_drvdata()/platform_get_drvdata()/get_device(), etc., the
         reference will be released in other functions, and the current function
         also considers that there is no reference leak;
      c, for the rest of the situation, the current function should release the
         reference by calling put_device, this code search will report the
         corresponding error message.
      
      By using this semantic code search, we have found some object reference leaks,
      such as:
      commit 11907e9d ("ASoC: fsl-asoc-card: fix object reference leaks in
      fsl_asoc_card_probe")
      commit a12085d1 ("mtd: rawnand: atmel: fix possible object reference leak")
      commit 11493f26 ("mtd: rawnand: jz4780: fix possible object reference leak")
      
      There are still dozens of reference leaks in the current kernel code.
      
      Further, for the case of b, the object returned to other functions may also
      have a reference leak, we will continue to develop other cocci scripts to
      further check the reference leak.
      Signed-off-by: default avatarWen Yang <wen.yang99@zte.com.cn>
      Reviewed-by: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
      Reviewed-by: default avatarMarkus Elfring <Markus.Elfring@web.de>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      da9cfb87
  9. 16 Mar, 2019 8 commits
    • Linus Torvalds's avatar
      Merge tag 'pidfd-v5.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux · a9dce667
      Linus Torvalds authored
      Pull pidfd system call from Christian Brauner:
       "This introduces the ability to use file descriptors from /proc/<pid>/
        as stable handles on struct pid. Even if a pid is recycled the handle
        will not change. For a start these fds can be used to send signals to
        the processes they refer to.
      
        With the ability to use /proc/<pid> fds as stable handles on struct
        pid we can fix a long-standing issue where after a process has exited
        its pid can be reused by another process. If a caller sends a signal
        to a reused pid it will end up signaling the wrong process.
      
        With this patchset we enable a variety of use cases. One obvious
        example is that we can now safely delegate an important part of
        process management - sending signals - to processes other than the
        parent of a given process by sending file descriptors around via scm
        rights and not fearing that the given process will have been recycled
        in the meantime. It also allows for easy testing whether a given
        process is still alive or not by sending signal 0 to a pidfd which is
        quite handy.
      
        There has been some interest in this feature e.g. from systems
        management (systemd, glibc) and container managers. I have requested
        and gotten comments from glibc to make sure that this syscall is
        suitable for their needs as well. In the future I expect it to take on
        most other pid-based signal syscalls. But such features are left for
        the future once they are needed.
      
        This has been sitting in linux-next for quite a while and has not
        caused any issues. It comes with selftests which verify basic
        functionality and also test that a recycled pid cannot be signaled via
        a pidfd.
      
        Jon has written about a prior version of this patchset. It should
        cover the basic functionality since not a lot has changed since then:
      
            https://lwn.net/Articles/773459/
      
        The commit message for the syscall itself is extensively documenting
        the syscall, including it's functionality and extensibility"
      
      * tag 'pidfd-v5.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux:
        selftests: add tests for pidfd_send_signal()
        signal: add pidfd_send_signal() syscall
      a9dce667
    • Linus Torvalds's avatar
      Merge tag 'devdax-for-5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm · f67e3fb4
      Linus Torvalds authored
      Pull device-dax updates from Dan Williams:
       "New device-dax infrastructure to allow persistent memory and other
        "reserved" / performance differentiated memories, to be assigned to
        the core-mm as "System RAM".
      
        Some users want to use persistent memory as additional volatile
        memory. They are willing to cope with potential performance
        differences, for example between DRAM and 3D Xpoint, and want to use
        typical Linux memory management apis rather than a userspace memory
        allocator layered over an mmap() of a dax file. The administration
        model is to decide how much Persistent Memory (pmem) to use as System
        RAM, create a device-dax-mode namespace of that size, and then assign
        it to the core-mm. The rationale for device-dax is that it is a
        generic memory-mapping driver that can be layered over any "special
        purpose" memory, not just pmem. On subsequent boots udev rules can be
        used to restore the memory assignment.
      
        One implication of using pmem as RAM is that mlock() no longer keeps
        data off persistent media. For this reason it is recommended to enable
        NVDIMM Security (previously merged for 5.0) to encrypt pmem contents
        at rest. We considered making this recommendation an actively enforced
        requirement, but in the end decided to leave it as a distribution /
        administrator policy to allow for emulation and test environments that
        lack security capable NVDIMMs.
      
        Summary:
      
         - Replace the /sys/class/dax device model with /sys/bus/dax, and
           include a compat driver so distributions can opt-in to the new ABI.
      
         - Allow for an alternative driver for the device-dax address-range
      
         - Introduce the 'kmem' driver to hotplug / assign a device-dax
           address-range to the core-mm.
      
         - Arrange for the device-dax target-node to be onlined so that the
           newly added memory range can be uniquely referenced by numa apis"
      
      NOTE! I'm not entirely happy with the whole "PMEM as RAM" model because
      we currently have special - and very annoying rules in the kernel about
      accessing PMEM only with the "MC safe" accessors, because machine checks
      inside the regular repeat string copy functions can be fatal in some
      (not described) circumstances.
      
      And apparently the PMEM modules can cause that a lot more than regular
      RAM.  The argument is that this happens because PMEM doesn't necessarily
      get scrubbed at boot like RAM does, but that is planned to be added for
      the user space tooling.
      
      Quoting Dan from another email:
       "The exposure can be reduced in the volatile-RAM case by scanning for
        and clearing errors before it is onlined as RAM. The userspace tooling
        for that can be in place before v5.1-final. There's also runtime
        notifications of errors via acpi_nfit_uc_error_notify() from
        background scrubbers on the DIMM devices. With that mechanism the
        kernel could proactively clear newly discovered poison in the volatile
        case, but that would be additional development more suitable for v5.2.
      
        I understand the concern, and the need to highlight this issue by
        tapping the brakes on feature development, but I don't see PMEM as RAM
        making the situation worse when the exposure is also there via DAX in
        the PMEM case. Volatile-RAM is arguably a safer use case since it's
        possible to repair pages where the persistent case needs active
        application coordination"
      
      * tag 'devdax-for-5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
        device-dax: "Hotplug" persistent memory for use like normal RAM
        mm/resource: Let walk_system_ram_range() search child resources
        mm/memory-hotplug: Allow memory resources to be children
        mm/resource: Move HMM pr_debug() deeper into resource code
        mm/resource: Return real error codes from walk failures
        device-dax: Add a 'modalias' attribute to DAX 'bus' devices
        device-dax: Add a 'target_node' attribute
        device-dax: Auto-bind device after successful new_id
        acpi/nfit, device-dax: Identify differentiated memory with a unique numa-node
        device-dax: Add /sys/class/dax backwards compatibility
        device-dax: Add support for a dax override driver
        device-dax: Move resource pinning+mapping into the common driver
        device-dax: Introduce bus + driver model
        device-dax: Start defining a dax bus model
        device-dax: Remove multi-resource infrastructure
        device-dax: Kill dax_region base
        device-dax: Kill dax_region ida
      f67e3fb4
    • Linus Torvalds's avatar
      Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 477558d7
      Linus Torvalds authored
      Pull more SCSI updates from James Bottomley:
       "This is the final round of mostly small fixes and performance
        improvements to our initial submit.
      
        The main regression fix is the ia64 simscsi build failure which was
        missed in the serial number elimination conversion"
      
      * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (24 commits)
        scsi: ia64: simscsi: use request tag instead of serial_number
        scsi: aacraid: Fix performance issue on logical drives
        scsi: lpfc: Fix error codes in lpfc_sli4_pci_mem_setup()
        scsi: libiscsi: Hold back_lock when calling iscsi_complete_task
        scsi: hisi_sas: Change SERDES_CFG init value to increase reliability of HiLink
        scsi: hisi_sas: Send HARD RESET to clear the previous affiliation of STP target port
        scsi: hisi_sas: Set PHY linkrate when disconnected
        scsi: hisi_sas: print PHY RX errors count for later revision of v3 hw
        scsi: hisi_sas: Fix a timeout race of driver internal and SMP IO
        scsi: hisi_sas: Change return variable type in phy_up_v3_hw()
        scsi: qla2xxx: check for kstrtol() failure
        scsi: lpfc: fix 32-bit format string warning
        scsi: lpfc: fix unused variable warning
        scsi: target: tcmu: Switch to bitmap_zalloc()
        scsi: libiscsi: fall back to sendmsg for slab pages
        scsi: qla2xxx: avoid printf format warning
        scsi: lpfc: resolve static checker warning in lpfc_sli4_hba_unset
        scsi: lpfc: Correct __lpfc_sli_issue_iocb_s4 lockdep check
        scsi: ufs: hisi: fix ufs_hba_variant_ops passing
        scsi: qla2xxx: Fix panic in qla_dfs_tgt_counters_show
        ...
      477558d7
    • Linus Torvalds's avatar
      Merge tag 'for-5.1/block-post-20190315' of git://git.kernel.dk/linux-block · 11efae35
      Linus Torvalds authored
      Pull more block layer changes from Jens Axboe:
       "This is a collection of both stragglers, and fixes that came in after
        I finalized the initial pull. This contains:
      
         - An MD pull request from Song, with a few minor fixes
      
         - Set of NVMe patches via Christoph
      
         - Pull request from Konrad, with a few fixes for xen/blkback
      
         - pblk fix IO calculation fix (Javier)
      
         - Segment calculation fix for pass-through (Ming)
      
         - Fallthrough annotation for blkcg (Mathieu)"
      
      * tag 'for-5.1/block-post-20190315' of git://git.kernel.dk/linux-block: (25 commits)
        blkcg: annotate implicit fall through
        nvme-tcp: support C2HData with SUCCESS flag
        nvmet: ignore EOPNOTSUPP for discard
        nvme: add proper write zeroes setup for the multipath device
        nvme: add proper discard setup for the multipath device
        nvme: remove nvme_ns_config_oncs
        nvme: disable Write Zeroes for qemu controllers
        nvmet-fc: bring Disconnect into compliance with FC-NVME spec
        nvmet-fc: fix issues with targetport assoc_list list walking
        nvme-fc: reject reconnect if io queue count is reduced to zero
        nvme-fc: fix numa_node when dev is null
        nvme-fc: use nr_phys_segments to determine existence of sgl
        nvme-loop: init nvmet_ctrl fatal_err_work when allocate
        nvme: update comment to make the code easier to read
        nvme: put ns_head ref if namespace fails allocation
        nvme-trace: fix cdw10 buffer overrun
        nvme: don't warn on block content change effects
        nvme: add get-feature to admin cmds tracer
        md: Fix failed allocation of md_register_thread
        It's wrong to add len to sector_nr in raid10 reshape twice
        ...
      11efae35
    • Linus Torvalds's avatar
      Merge tag 'nfs-for-5.1-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs · 465c209d
      Linus Torvalds authored
      Pull NFS client bugfixes from Trond Myklebust:
       "Highlights include:
      
        Bugfixes:
         - Fix an Oops in SUNRPC back channel tracepoints
         - Fix a SUNRPC client regression when handling oversized replies
         - Fix the minimal size for SUNRPC reply buffer allocation
         - rpc_decode_header() must always return a non-zero value on error
         - Fix a typo in pnfs_update_layout()
      
        Cleanup:
         - Remove redundant check for the reply length in call_decode()"
      
      * tag 'nfs-for-5.1-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
        SUNRPC: Remove redundant check for the reply length in call_decode()
        SUNRPC: Handle the SYSTEM_ERR rpc error
        SUNRPC: rpc_decode_header() must always return a non-zero value on error
        SUNRPC: Use the ENOTCONN error on socket disconnect
        SUNRPC: Fix the minimal size for reply buffer allocation
        SUNRPC: Fix a client regression when handling oversized replies
        pNFS: Fix a typo in pnfs_update_layout
        fix null pointer deref in tracepoints in back channel
      465c209d
    • Linus Torvalds's avatar
      Merge tag 'powerpc-5.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · a9c55d58
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
       "One fix to prevent runtime allocation of 16GB pages when running in a
        VM (as opposed to bare metal), because it doesn't work.
      
        A small fix to our recently added KCOV support to exempt some more
        code from being instrumented.
      
        Plus a few minor build fixes, a small dead code removal and a
        defconfig update.
      
        Thanks to: Alexey Kardashevskiy, Aneesh Kumar K.V, Christophe Leroy,
        Jason Yan, Joel Stanley, Mahesh Salgaonkar, Mathieu Malaterre"
      
      * tag 'powerpc-5.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/64s: Include <asm/nmi.h> header file to fix a warning
        powerpc/powernv: Fix compile without CONFIG_TRACEPOINTS
        powerpc/mm: Disable kcov for SLB routines
        powerpc: remove dead code in head_fsl_booke.S
        powerpc/configs: Sync skiroot defconfig
        powerpc/hugetlb: Don't do runtime allocation of 16G pages in LPAR configuration
      a9c55d58
    • Linus Torvalds's avatar
      Merge branch 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · 92497350
      Linus Torvalds authored
      Pull vfs mount infrastructure fix from Al Viro:
       "Fixup for sysfs braino.
      
        Capabilities checks for sysfs mount do include those on netns, but
        only if CONFIG_NET_NS is enabled. Sorry, should've caught that
        earlier..."
      
      * 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        fix sysfs_init_fs_context() in !CONFIG_NET_NS case
      92497350
    • Al Viro's avatar
      fix sysfs_init_fs_context() in !CONFIG_NET_NS case · ab81dabd
      Al Viro authored
      Permission checks on current's netns should be done only when
      netns are enabled.
      Reported-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
      Fixes: 23bf1b6bSigned-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      ab81dabd