1. 03 Nov, 2017 6 commits
  2. 02 Nov, 2017 15 commits
    • Linus Torvalds's avatar
      Kbuild: don't pass "-C" to preprocessor when processing linker scripts · 5cb0512c
      Linus Torvalds authored
      For some odd historical reason, we preprocessed the linker scripts with
      "-C", which keeps comments around.  That makes no sense, since the
      comments are not meaningful for the build anyway.
      
      And it actually breaks things, since linker scripts can't have C++ style
      "//" comments in them, so keeping comments after preprocessing now
      limits us in odd and surprising ways in our header files for no good
      reason.
      
      The -C option goes back to pre-git and pre-bitkeeper times, but seems to
      have been historically used (along with "-traditional") for some
      odd-ball architectures (ia64, MIPS and SH).  It probably didn't matter
      back then either, but might possibly have been used to minimize the
      difference between the original file and the pre-processed result.
      
      The reason for this may be lost in time, but let's not perpetuate it
      only because we can't remember why we did this crazy thing.
      
      This was triggered by the recent addition of SPDX lines to the source
      tree, where people apparently were confused about why header files
      couldn't use the C++ comment format.
      
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Greg KH <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5cb0512c
    • Linus Torvalds's avatar
      Revert "x86: do not use cpufreq_quick_get() for /proc/cpuinfo "cpu MHz"" · 890da9cf
      Linus Torvalds authored
      This reverts commit 51204e06.
      
      There wasn't really any good reason for it, and people are complaining
      (rightly) that it broke existing practice.
      
      Cc: Len Brown <len.brown@intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      890da9cf
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · 6daa0839
      Linus Torvalds authored
      Pull arm64 fix from Catalin Marinas:
       "Check addr_limit in arm64 __dump_instr()"
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        arm64: ensure __dump_instr() checks addr_limit
      6daa0839
    • Mark Rutland's avatar
      arm64: ensure __dump_instr() checks addr_limit · 7a7003b1
      Mark Rutland authored
      It's possible for a user to deliberately trigger __dump_instr with a
      chosen kernel address.
      
      Let's avoid problems resulting from this by using get_user() rather than
      __get_user(), ensuring that we don't erroneously access kernel memory.
      
      Where we use __dump_instr() on kernel text, we already switch to
      KERNEL_DS, so this shouldn't adversely affect those cases.
      
      Fixes: 60ffc30d ("arm64: Exception handling")
      Cc: stable@vger.kernel.org
      Acked-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      7a7003b1
    • Linus Torvalds's avatar
      Merge tag 'spdx_identifiers-4.14-rc8' of... · ead75150
      Linus Torvalds authored
      Merge tag 'spdx_identifiers-4.14-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
      
      Pull initial SPDX identifiers from Greg KH:
       "License cleanup: add SPDX license identifiers to some files
      
        Many source files in the tree are missing licensing information, which
        makes it harder for compliance tools to determine the correct license.
      
        By default all files without license information are under the default
        license of the kernel, which is GPL version 2.
      
        Update the files which contain no license information with the
        'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally
        binding shorthand, which can be used instead of the full boiler plate
        text.
      
        This patch is based on work done by Thomas Gleixner and Kate Stewart
        and Philippe Ombredanne.
      
        How this work was done:
      
        Patches were generated and checked against linux-4.14-rc6 for a subset
        of the use cases:
      
         - file had no licensing information it it.
      
         - file was a */uapi/* one with no licensing information in it,
      
         - file was a */uapi/* one with existing licensing information,
      
        Further patches will be generated in subsequent months to fix up cases
        where non-standard license headers were used, and references to
        license had to be inferred by heuristics based on keywords.
      
        The analysis to determine which SPDX License Identifier to be applied
        to a file was done in a spreadsheet of side by side results from of
        the output of two independent scanners (ScanCode & Windriver)
        producing SPDX tag:value files created by Philippe Ombredanne.
        Philippe prepared the base worksheet, and did an initial spot review
        of a few 1000 files.
      
        The 4.13 kernel was the starting point of the analysis with 60,537
        files assessed. Kate Stewart did a file by file comparison of the
        scanner results in the spreadsheet to determine which SPDX license
        identifier(s) to be applied to the file. She confirmed any
        determination that was not immediately clear with lawyers working with
        the Linux Foundation.
      
        Criteria used to select files for SPDX license identifier tagging was:
      
         - Files considered eligible had to be source code files.
      
         - Make and config files were included as candidates if they contained
           >5 lines of source
      
         - File already had some variant of a license header in it (even if <5
           lines).
      
        All documentation files were explicitly excluded.
      
        The following heuristics were used to determine which SPDX license
        identifiers to apply.
      
         - when both scanners couldn't find any license traces, file was
           considered to have no license information in it, and the top level
           COPYING file license applied.
      
           For non */uapi/* files that summary was:
      
             SPDX license identifier                            # files
             ---------------------------------------------------|-------
             GPL-2.0                                              11139
      
           and resulted in the first patch in this series.
      
           If that file was a */uapi/* path one, it was "GPL-2.0 WITH
           Linux-syscall-note" otherwise it was "GPL-2.0". Results of that
           was:
      
             SPDX license identifier                            # files
             ---------------------------------------------------|-------
             GPL-2.0 WITH Linux-syscall-note                        930
      
           and resulted in the second patch in this series.
      
         - if a file had some form of licensing information in it, and was one
           of the */uapi/* ones, it was denoted with the Linux-syscall-note if
           any GPL family license was found in the file or had no licensing in
           it (per prior point). Results summary:
      
             SPDX license identifier                            # files
             ---------------------------------------------------|------
             GPL-2.0 WITH Linux-syscall-note                       270
             GPL-2.0+ WITH Linux-syscall-note                      169
             ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
             ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
             LGPL-2.1+ WITH Linux-syscall-note                      15
             GPL-1.0+ WITH Linux-syscall-note                       14
             ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
             LGPL-2.0+ WITH Linux-syscall-note                       4
             LGPL-2.1 WITH Linux-syscall-note                        3
             ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
             ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
           and that resulted in the third patch in this series.
      
         - when the two scanners agreed on the detected license(s), that
           became the concluded license(s).
      
         - when there was disagreement between the two scanners (one detected
           a license but the other didn't, or they both detected different
           licenses) a manual inspection of the file occurred.
      
         - In most cases a manual inspection of the information in the file
           resulted in a clear resolution of the license that should apply
           (and which scanner probably needed to revisit its heuristics).
      
         - When it was not immediately clear, the license identifier was
           confirmed with lawyers working with the Linux Foundation.
      
         - If there was any question as to the appropriate license identifier,
           the file was flagged for further research and to be revisited later
           in time.
      
        In total, over 70 hours of logged manual review was done on the
        spreadsheet to determine the SPDX license identifiers to apply to the
        source files by Kate, Philippe, Thomas and, in some cases,
        confirmation by lawyers working with the Linux Foundation.
      
        Kate also obtained a third independent scan of the 4.13 code base from
        FOSSology, and compared selected files where the other two scanners
        disagreed against that SPDX file, to see if there was new insights.
        The Windriver scanner is based on an older version of FOSSology in
        part, so they are related.
      
        Thomas did random spot checks in about 500 files from the spreadsheets
        for the uapi headers and agreed with SPDX license identifier in the
        files he inspected. For the non-uapi files Thomas did random spot
        checks in about 15000 files.
      
        In initial set of patches against 4.14-rc6, 3 files were found to have
        copy/paste license identifier errors, and have been fixed to reflect
        the correct identifier.
      
        Additionally Philippe spent 10 hours this week doing a detailed manual
        inspection and review of the 12,461 patched files from the initial
        patch version early this week with:
      
         - a full scancode scan run, collecting the matched texts, detected
           license ids and scores
      
         - reviewing anything where there was a license detected (about 500+
           files) to ensure that the applied SPDX license was correct
      
         - reviewing anything where there was no detection but the patch
           license was not GPL-2.0 WITH Linux-syscall-note to ensure that the
           applied SPDX license was correct
      
        This produced a worksheet with 20 files needing minor correction. This
        worksheet was then exported into 3 different .csv files for the
        different types of files to be modified.
      
        These .csv files were then reviewed by Greg. Thomas wrote a script to
        parse the csv files and add the proper SPDX tag to the file, in the
        format that the file expected. This script was further refined by Greg
        based on the output to detect more types of files automatically and to
        distinguish between header and source .c files (which need different
        comment types.) Finally Greg ran the script using the .csv files to
        generate the patches.
      Reviewed-by: default avatarKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: default avatarPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
        Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
      
      * tag 'spdx_identifiers-4.14-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
        License cleanup: add SPDX license identifier to uapi header files with a license
        License cleanup: add SPDX license identifier to uapi header files with no license
        License cleanup: add SPDX GPL-2.0 license identifier to files with no license
      ead75150
    • Linus Torvalds's avatar
      Merge tag 'linux-kselftest-4.14-rc7' of... · fdebad11
      Linus Torvalds authored
      Merge tag 'linux-kselftest-4.14-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull kselftest fix from Shuah Khan:
       "This consists of a single fix to a regression to printing individual
        test results to the console. An earlier commit changed it to printing
        just the summary of results, which will negatively impact users that
        rely on console log to look at the individual test failures.
      
        This fix makes it optional to print summary and by default results get
        printed to the console"
      
      * tag 'linux-kselftest-4.14-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
        selftests: lib.mk: print individual test results to console by default
      fdebad11
    • Linus Torvalds's avatar
      Merge tag 'sound-4.14-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 0f07e10f
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "Unfortunately we still have received a significant amount of changes
        at the late stage, but at least all are small and clear fixes.
      
        There are two fixes for ALSA core stuff, yet another timer race fix
        and sequencer lockdep annotation fix. Both are spotted by syzkaller,
        and not too serious but better to paper over quickly.
      
        All other commits are about ASoC drivers, most notably, a revert of
        RT5514 hotword control that was included in 4.14-rc (due to a kind of
        abuse of kctl TLV ABI), together with topology API fixes and other
        device-specific small fixes that should go for stable, too"
      
      * tag 'sound-4.14-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: seq: Fix nested rwsem annotation for lockdep splat
        ALSA: timer: Add missing mutex lock for compat ioctls
        ASoC: rt5616: fix 0x91 default value
        ASoC: rt5659: connect LOUT Amp with Charge Pump
        ASoC: rt5659: register power bit of LOUT Amp
        ASoC: rt5663: Change the dev getting function in rt5663_irq
        ASoC: rt5514: Revert Hotword Model control
        ASoC: topology: Fix a potential memory leak in 'soc_tplg_dapm_widget_denum_create()'
        ASoC: topology: Fix a potential NULL pointer dereference in 'soc_tplg_dapm_widget_denum_create()'
        ASoC: rt5514-spi: check irq status to schedule data copy
        ASoC: adau17x1: Workaround for noise bug in ADC
      0f07e10f
    • Linus Torvalds's avatar
      Merge branch 'fixes-v4.14-rc7' of... · 6965f1aa
      Linus Torvalds authored
      Merge branch 'fixes-v4.14-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
      
      Pull key handling fixes from James Morris:
       "Fixes for the Keys subsystem by Eric Biggers"
      
      * 'fixes-v4.14-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
        KEYS: fix out-of-bounds read during ASN.1 parsing
        KEYS: trusted: fix writing past end of buffer in trusted_read()
        KEYS: return full count in keyring_read() if buffer is too small
      6965f1aa
    • Jiri Slaby's avatar
      futex: futex_wake_op, do not fail on invalid op · e78c38f6
      Jiri Slaby authored
      In commit 30d6e0a4 ("futex: Remove duplicated code and fix undefined
      behaviour"), I let FUTEX_WAKE_OP to fail on invalid op.  Namely when op
      should be considered as shift and the shift is out of range (< 0 or > 31).
      
      But strace's test suite does this madness:
      
        futex(0x7fabd78bcffc, 0x5, 0xfacefeed, 0xb, 0x7fabd78bcffc, 0xa0caffee);
        futex(0x7fabd78bcffc, 0x5, 0xfacefeed, 0xb, 0x7fabd78bcffc, 0xbadfaced);
        futex(0x7fabd78bcffc, 0x5, 0xfacefeed, 0xb, 0x7fabd78bcffc, 0xffffffff);
      
      When I pick the first 0xa0caffee, it decodes as:
      
        0x80000000 & 0xa0caffee: oparg is shift
        0x70000000 & 0xa0caffee: op is FUTEX_OP_OR
        0x0f000000 & 0xa0caffee: cmp is FUTEX_OP_CMP_EQ
        0x00fff000 & 0xa0caffee: oparg is sign-extended 0xcaf = -849
        0x00000fff & 0xa0caffee: cmparg is sign-extended 0xfee = -18
      
      That means the op tries to do this:
      
        (futex |= (1 << (-849))) == -18
      
      which is completely bogus. The new check of op in the code is:
      
              if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) {
                      if (oparg < 0 || oparg > 31)
                              return -EINVAL;
                      oparg = 1 << oparg;
              }
      
      which results obviously in the "Invalid argument" errno:
      
        FAIL: futex
        ===========
      
        futex(0x7fabd78bcffc, 0x5, 0xfacefeed, 0xb, 0x7fabd78bcffc, 0xa0caffee) = -1: Invalid argument
        futex.test: failed test: ../futex failed with code 1
      
      So let us soften the failure to print only a (ratelimited) message, crop
      the value and continue as if it were right.  When userspace keeps up, we
      can switch this to return -EINVAL again.
      
      [v2] Do not return 0 immediatelly, proceed with the cropped value.
      
      Fixes: 30d6e0a4 ("futex: Remove duplicated code and fix undefined behaviour")
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Darren Hart <dvhart@infradead.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e78c38f6
    • Greg Kroah-Hartman's avatar
      License cleanup: add SPDX license identifier to uapi header files with a license · e2be04c7
      Greg Kroah-Hartman authored
      Many user space API headers have licensing information, which is either
      incomplete, badly formatted or just a shorthand for referring to the
      license under which the file is supposed to be.  This makes it hard for
      compliance tools to determine the correct license.
      
      Update these files with an SPDX license identifier.  The identifier was
      chosen based on the license information in the file.
      
      GPL/LGPL licensed headers get the matching GPL/LGPL SPDX license
      identifier with the added 'WITH Linux-syscall-note' exception, which is
      the officially assigned exception identifier for the kernel syscall
      exception:
      
         NOTE! This copyright does *not* cover user programs that use kernel
         services by normal system calls - this is merely considered normal use
         of the kernel, and does *not* fall under the heading of "derived work".
      
      This exception makes it possible to include GPL headers into non GPL
      code, without confusing license compliance tools.
      
      Headers which have either explicit dual licensing or are just licensed
      under a non GPL license are updated with the corresponding SPDX
      identifier and the GPLv2 with syscall exception identifier.  The format
      is:
              ((GPL-2.0 WITH Linux-syscall-note) OR SPDX-ID-OF-OTHER-LICENSE)
      
      SPDX license identifiers are a legally binding shorthand, which can be
      used instead of the full boiler plate text.  The update does not remove
      existing license information as this has to be done on a case by case
      basis and the copyright holders might have to be consulted. This will
      happen in a separate step.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.  See the previous patch in this series for the
      methodology of how this patch was researched.
      Reviewed-by: default avatarKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: default avatarPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e2be04c7
    • Greg Kroah-Hartman's avatar
      License cleanup: add SPDX license identifier to uapi header files with no license · 6f52b16c
      Greg Kroah-Hartman authored
      Many user space API headers are missing licensing information, which
      makes it hard for compliance tools to determine the correct license.
      
      By default are files without license information under the default
      license of the kernel, which is GPLV2.  Marking them GPLV2 would exclude
      them from being included in non GPLV2 code, which is obviously not
      intended. The user space API headers fall under the syscall exception
      which is in the kernels COPYING file:
      
         NOTE! This copyright does *not* cover user programs that use kernel
         services by normal system calls - this is merely considered normal use
         of the kernel, and does *not* fall under the heading of "derived work".
      
      otherwise syscall usage would not be possible.
      
      Update the files which contain no license information with an SPDX
      license identifier.  The chosen identifier is 'GPL-2.0 WITH
      Linux-syscall-note' which is the officially assigned identifier for the
      Linux syscall exception.  SPDX license identifiers are a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.  See the previous patch in this series for the
      methodology of how this patch was researched.
      Reviewed-by: default avatarKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: default avatarPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6f52b16c
    • Greg Kroah-Hartman's avatar
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman authored
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: default avatarKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: default avatarPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
    • Eric Biggers's avatar
      KEYS: fix out-of-bounds read during ASN.1 parsing · 2eb9eabf
      Eric Biggers authored
      syzkaller with KASAN reported an out-of-bounds read in
      asn1_ber_decoder().  It can be reproduced by the following command,
      assuming CONFIG_X509_CERTIFICATE_PARSER=y and CONFIG_KASAN=y:
      
          keyctl add asymmetric desc $'\x30\x30' @s
      
      The bug is that the length of an ASN.1 data value isn't validated in the
      case where it is encoded using the short form, causing the decoder to
      read past the end of the input buffer.  Fix it by validating the length.
      
      The bug report was:
      
          BUG: KASAN: slab-out-of-bounds in asn1_ber_decoder+0x10cb/0x1730 lib/asn1_decoder.c:233
          Read of size 1 at addr ffff88003cccfa02 by task syz-executor0/6818
      
          CPU: 1 PID: 6818 Comm: syz-executor0 Not tainted 4.14.0-rc7-00008-g5f479447 #2
          Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
          Call Trace:
           __dump_stack lib/dump_stack.c:16 [inline]
           dump_stack+0xb3/0x10b lib/dump_stack.c:52
           print_address_description+0x79/0x2a0 mm/kasan/report.c:252
           kasan_report_error mm/kasan/report.c:351 [inline]
           kasan_report+0x236/0x340 mm/kasan/report.c:409
           __asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:427
           asn1_ber_decoder+0x10cb/0x1730 lib/asn1_decoder.c:233
           x509_cert_parse+0x1db/0x650 crypto/asymmetric_keys/x509_cert_parser.c:89
           x509_key_preparse+0x64/0x7a0 crypto/asymmetric_keys/x509_public_key.c:174
           asymmetric_key_preparse+0xcb/0x1a0 crypto/asymmetric_keys/asymmetric_type.c:388
           key_create_or_update+0x347/0xb20 security/keys/key.c:855
           SYSC_add_key security/keys/keyctl.c:122 [inline]
           SyS_add_key+0x1cd/0x340 security/keys/keyctl.c:62
           entry_SYSCALL_64_fastpath+0x1f/0xbe
          RIP: 0033:0x447c89
          RSP: 002b:00007fca7a5d3bd8 EFLAGS: 00000246 ORIG_RAX: 00000000000000f8
          RAX: ffffffffffffffda RBX: 00007fca7a5d46cc RCX: 0000000000447c89
          RDX: 0000000020006f4a RSI: 0000000020006000 RDI: 0000000020001ff5
          RBP: 0000000000000046 R08: fffffffffffffffd R09: 0000000000000000
          R10: 0000000000000002 R11: 0000000000000246 R12: 0000000000000000
          R13: 0000000000000000 R14: 00007fca7a5d49c0 R15: 00007fca7a5d4700
      
      Fixes: 42d5ec27 ("X.509: Add an ASN.1 decoder")
      Cc: <stable@vger.kernel.org> # v3.7+
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarJames Morris <james.l.morris@oracle.com>
      2eb9eabf
    • Eric Biggers's avatar
      KEYS: trusted: fix writing past end of buffer in trusted_read() · a3c812f7
      Eric Biggers authored
      When calling keyctl_read() on a key of type "trusted", if the
      user-supplied buffer was too small, the kernel ignored the buffer length
      and just wrote past the end of the buffer, potentially corrupting
      userspace memory.  Fix it by instead returning the size required, as per
      the documentation for keyctl_read().
      
      We also don't even fill the buffer at all in this case, as this is
      slightly easier to implement than doing a short read, and either
      behavior appears to be permitted.  It also makes it match the behavior
      of the "encrypted" key type.
      
      Fixes: d00a1c72 ("keys: add new trusted key-type")
      Reported-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Cc: <stable@vger.kernel.org> # v2.6.38+
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarMimi Zohar <zohar@linux.vnet.ibm.com>
      Reviewed-by: default avatarJames Morris <james.l.morris@oracle.com>
      Signed-off-by: default avatarJames Morris <james.l.morris@oracle.com>
      a3c812f7
    • Eric Biggers's avatar
      KEYS: return full count in keyring_read() if buffer is too small · 3239b6f2
      Eric Biggers authored
      Commit e645016a ("KEYS: fix writing past end of user-supplied buffer
      in keyring_read()") made keyring_read() stop corrupting userspace memory
      when the user-supplied buffer is too small.  However it also made the
      return value in that case be the short buffer size rather than the size
      required, yet keyctl_read() is actually documented to return the size
      required.  Therefore, switch it over to the documented behavior.
      
      Note that for now we continue to have it fill the short buffer, since it
      did that before (pre-v3.13) and dump_key_tree_aux() in keyutils arguably
      relies on it.
      
      Fixes: e645016a ("KEYS: fix writing past end of user-supplied buffer in keyring_read()")
      Reported-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Cc: <stable@vger.kernel.org> # v3.13+
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJames Morris <james.l.morris@oracle.com>
      Signed-off-by: default avatarJames Morris <james.l.morris@oracle.com>
      3239b6f2
  3. 01 Nov, 2017 19 commits
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace · 3a99df9a
      Linus Torvalds authored
      Pull signal bugfix from Eric Biederman:
       "When making the generic support for SIGEMT conditional on the presence
        of SIGEMT I made a typo that causes it to fail to activate. It was
        noticed comparatively quickly but the bug report just made it to me
        today"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace:
        signal: Fix name of SIGEMT in #if defined() check
      3a99df9a
    • Andrew Clayton's avatar
      signal: Fix name of SIGEMT in #if defined() check · c3aff086
      Andrew Clayton authored
      Commit cc731525 ("signal: Remove kernel interal si_code magic")
      added a check for SIGMET and NSIGEMT being defined. That SIGMET should
      in fact be SIGEMT, with SIGEMT being defined in
      arch/{alpha,mips,sparc}/include/uapi/asm/signal.h
      
      This was actually pointed out by BenHutchings in a lwn.net comment
      here https://lwn.net/Comments/734608/
      
      Fixes: cc731525 ("signal: Remove kernel interal si_code magic")
      Signed-off-by: default avatarAndrew Clayton <andrew@digital-domain.net>
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      c3aff086
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.dk/linux-block · 1cc15701
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
       "A few fixes that should go into this series:
      
         - Regression fix for ide-cd, ensuring that a request is fully
           initialized. From Hongxu.
      
         - Ditto fix for virtio_blk, from Bart.
      
         - NVMe fix from Keith, ensuring that we set the right block size on
           revalidation. If the block size changed, we'd be in trouble without
           it.
      
         - NVMe rdma fix from Sagi, fixing a potential hang while the
           controller is being removed"
      
      * 'for-linus' of git://git.kernel.dk/linux-block:
        ide:ide-cd: fix kernel panic resulting from missing scsi_req_init
        nvme: Fix setting logical block format when revalidating
        virtio_blk: Fix an SG_IO regression
        nvme-rdma: fix possible hang when issuing commands during ctrl removal
      1cc15701
    • Takashi Iwai's avatar
      Merge tag 'asoc-fix-v4.14-rc7' of... · a53a0ab8
      Takashi Iwai authored
      Merge tag 'asoc-fix-v4.14-rc7' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
      
      ASoC: Fixes for v4.14
      
      A bunch of fixes here, mostly device specific ones (the biggest one
      being the revert of the hotword support for rt5514), with a couple of
      core fixes for potential issues with corrupted or otherwise invalid
      topology files.
      a53a0ab8
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 4f2ba5dc
      Linus Torvalds authored
      Pull networking fixes from David Miller:
      
       1) Fix refcounting in xfrm_bundle_lookup() when using a dummy bundle,
          from Steffen Klassert.
      
       2) Fix crypto header handling in rx data frames in ath10k driver, from
          Vasanthakumar Thiagarajan.
      
       3) Fix use after free of qdisc when we defer tcp_chain_flush() to a
          workqueue. From Cong Wang.
      
       4) Fix double free in lapbether driver, from Pan Bian.
      
       5) Sanitize TUNSETSNDBUF values, from Craig Gallek.
      
       6) Fix refcounting when addrconf_permanent_addr() calls
          ipv6_del_addr(). From Eric Dumazet.
      
       7) Fix MTU probing bug in TCP that goes back to 2007, from Eric
          Dumazet.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net:
        tcp: fix tcp_mtu_probe() vs highest_sack
        ipv6: addrconf: increment ifp refcount before ipv6_del_addr()
        tun/tap: sanitize TUNSETSNDBUF input
        mlxsw: i2c: Fix buffer increment counter for write transaction
        mlxsw: reg: Add high and low temperature thresholds
        MAINTAINERS: Remove Yotam from mlxfw
        MAINTAINERS: Update Yotam's E-mail
        net: hns: set correct return value
        net: lapbether: fix double free
        bpf: remove SK_REDIRECT from UAPI
        net: phy: marvell: Only configure RGMII delays when using RGMII
        xfrm: Fix GSO for IPsec with GRE tunnel.
        tc-testing: fix arg to ip command: -s -> -n
        net_sched: remove tcf_block_put_deferred()
        l2tp: hold tunnel in pppol2tp_connect()
        Revert "ath10k: fix napi_poll budget overflow"
        ath10k: rebuild crypto header in rx data frames
        wcn36xx: Remove unnecessary rcu_read_unlock in wcn36xx_bss_info_changed
        xfrm: Clear sk_dst_cache when applying per-socket policy.
        xfrm: Fix xfrm_dst_cache memleak
      4f2ba5dc
    • Vlastimil Babka's avatar
      x86/mm: fix use-after-free of vma during userfaultfd fault · cb0631fd
      Vlastimil Babka authored
      Syzkaller with KASAN has reported a use-after-free of vma->vm_flags in
      __do_page_fault() with the following reproducer:
      
        mmap(&(0x7f0000000000/0xfff000)=nil, 0xfff000, 0x3, 0x32, 0xffffffffffffffff, 0x0)
        mmap(&(0x7f0000011000/0x3000)=nil, 0x3000, 0x1, 0x32, 0xffffffffffffffff, 0x0)
        r0 = userfaultfd(0x0)
        ioctl$UFFDIO_API(r0, 0xc018aa3f, &(0x7f0000002000-0x18)={0xaa, 0x0, 0x0})
        ioctl$UFFDIO_REGISTER(r0, 0xc020aa00, &(0x7f0000019000)={{&(0x7f0000012000/0x2000)=nil, 0x2000}, 0x1, 0x0})
        r1 = gettid()
        syz_open_dev$evdev(&(0x7f0000013000-0x12)="2f6465762f696e7075742f6576656e742300", 0x0, 0x0)
        tkill(r1, 0x7)
      
      The vma should be pinned by mmap_sem, but handle_userfault() might (in a
      return to userspace scenario) release it and then acquire again, so when
      we return to __do_page_fault() (with other result than VM_FAULT_RETRY),
      the vma might be gone.
      
      Specifically, per Andrea the scenario is
       "A return to userland to repeat the page fault later with a
        VM_FAULT_NOPAGE retval (potentially after handling any pending signal
        during the return to userland). The return to userland is identified
        whenever FAULT_FLAG_USER|FAULT_FLAG_KILLABLE are both set in
        vmf->flags"
      
      However, since commit a3c4fb7c ("x86/mm: Fix fault error path using
      unsafe vma pointer") there is a vma_pkey() read of vma->vm_flags after
      that point, which can thus become use-after-free.  Fix this by moving
      the read before calling handle_mm_fault().
      Reported-by: default avatarsyzbot <bot+6a5269ce759a7bb12754ed9622076dc93f65a1f6@syzkaller.appspotmail.com>
      Reported-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Suggested-by: default avatarKirill A. Shutemov <kirill@shutemov.name>
      Fixes: 3c4fb7c9c2e ("x86/mm: Fix fault error path using unsafe vma pointer")
      Reviewed-by: default avatarAndrea Arcangeli <aarcange@redhat.com>
      Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cb0631fd
    • Linus Torvalds's avatar
      Merge tag 'smb3-file-name-too-long-fix' of git://git.samba.org/sfrench/cifs-2.6 · 89db69d6
      Linus Torvalds authored
      Pull cifs fix from Steve French:
       "smb3 file name too long fix"
      
      * tag 'smb3-file-name-too-long-fix' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: check MaxPathNameComponentLength != 0 before using it
      89db69d6
    • Hongxu Jia's avatar
      ide:ide-cd: fix kernel panic resulting from missing scsi_req_init · 79d73346
      Hongxu Jia authored
      Since we split the scsi_request out of struct request, while the
      standard prep_rq_fn builds 10 byte cmds, it missed to invoke
      scsi_req_init() to initialize certain fields of a scsi_request
      structure (.__cmd[], .cmd, .cmd_len and .sense_len but no other
      members of struct scsi_request).
      
      An example panic on virtual machines (qemu/virtualbox) to boot
      from IDE cdrom:
      ...
      [    8.754381] Call Trace:
      [    8.755419]  blk_peek_request+0x182/0x2e0
      [    8.755863]  blk_fetch_request+0x1c/0x40
      [    8.756148]  ? ktime_get+0x40/0xa0
      [    8.756385]  do_ide_request+0x37d/0x660
      [    8.756704]  ? cfq_group_service_tree_add+0x98/0xc0
      [    8.757011]  ? cfq_service_tree_add+0x1e5/0x2c0
      [    8.757313]  ? ktime_get+0x40/0xa0
      [    8.757544]  __blk_run_queue+0x3d/0x60
      [    8.757837]  queue_unplugged+0x2f/0xc0
      [    8.758088]  blk_flush_plug_list+0x1f4/0x240
      [    8.758362]  blk_finish_plug+0x2c/0x40
      ...
      [    8.770906] RIP: ide_cdrom_prep_fn+0x63/0x180 RSP: ffff92aec018bae8
      [    8.772329] ---[ end trace 6408481e551a85c9 ]---
      ...
      
      Fixes: 82ed4db4 ("block: split scsi_request out of struct request")
      Signed-off-by: default avatarHongxu Jia <hongxu.jia@windriver.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      79d73346
    • Mark Brown's avatar
      Merge remote-tracking branches 'asoc/fix/topology', 'asoc/fix/adau17x1',... · b817d936
      Mark Brown authored
      Merge remote-tracking branches 'asoc/fix/topology', 'asoc/fix/adau17x1', 'asoc/fix/rt5514', 'asoc/fix/rt5616', 'asoc/fix/rt5659' and 'asoc/fix/rt5663' into tmp
      b817d936
    • Eric Dumazet's avatar
      tcp: fix tcp_mtu_probe() vs highest_sack · 2b7cda9c
      Eric Dumazet authored
      Based on SNMP values provided by Roman, Yuchung made the observation
      that some crashes in tcp_sacktag_walk() might be caused by MTU probing.
      
      Looking at tcp_mtu_probe(), I found that when a new skb was placed
      in front of the write queue, we were not updating tcp highest sack.
      
      If one skb is freed because all its content was copied to the new skb
      (for MTU probing), then tp->highest_sack could point to a now freed skb.
      
      Bad things would then happen, including infinite loops.
      
      This patch renames tcp_highest_sack_combine() and uses it
      from tcp_mtu_probe() to fix the bug.
      
      Note that I also removed one test against tp->sacked_out,
      since we want to replace tp->highest_sack regardless of whatever
      condition, since keeping a stale pointer to freed skb is a recipe
      for disaster.
      
      Fixes: a47e5a98 ("[TCP]: Convert highest_sack to sk_buff to allow direct access")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarAlexei Starovoitov <alexei.starovoitov@gmail.com>
      Reported-by: default avatarRoman Gushchin <guro@fb.com>
      Reported-by: default avatarOleksandr Natalenko <oleksandr@natalenko.name>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Acked-by: default avatarNeal Cardwell <ncardwell@google.com>
      Acked-by: default avatarYuchung Cheng <ycheng@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2b7cda9c
    • Eric Dumazet's avatar
      ipv6: addrconf: increment ifp refcount before ipv6_del_addr() · e669b869
      Eric Dumazet authored
      In the (unlikely) event fixup_permanent_addr() returns a failure,
      addrconf_permanent_addr() calls ipv6_del_addr() without the
      mandatory call to in6_ifa_hold(), leading to a refcount error,
      spotted by syzkaller :
      
      WARNING: CPU: 1 PID: 3142 at lib/refcount.c:227 refcount_dec+0x4c/0x50
      lib/refcount.c:227
      Kernel panic - not syncing: panic_on_warn set ...
      
      CPU: 1 PID: 3142 Comm: ip Not tainted 4.14.0-rc4-next-20171009+ #33
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
      Google 01/01/2011
      Call Trace:
       __dump_stack lib/dump_stack.c:16 [inline]
       dump_stack+0x194/0x257 lib/dump_stack.c:52
       panic+0x1e4/0x41c kernel/panic.c:181
       __warn+0x1c4/0x1e0 kernel/panic.c:544
       report_bug+0x211/0x2d0 lib/bug.c:183
       fixup_bug+0x40/0x90 arch/x86/kernel/traps.c:178
       do_trap_no_signal arch/x86/kernel/traps.c:212 [inline]
       do_trap+0x260/0x390 arch/x86/kernel/traps.c:261
       do_error_trap+0x120/0x390 arch/x86/kernel/traps.c:298
       do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:311
       invalid_op+0x18/0x20 arch/x86/entry/entry_64.S:905
      RIP: 0010:refcount_dec+0x4c/0x50 lib/refcount.c:227
      RSP: 0018:ffff8801ca49e680 EFLAGS: 00010286
      RAX: 000000000000002c RBX: ffff8801d07cfcdc RCX: 0000000000000000
      RDX: 000000000000002c RSI: 1ffff10039493c90 RDI: ffffed0039493cc4
      RBP: ffff8801ca49e688 R08: ffff8801ca49dd70 R09: 0000000000000000
      R10: ffff8801ca49df58 R11: 0000000000000000 R12: 1ffff10039493cd9
      R13: ffff8801ca49e6e8 R14: ffff8801ca49e7e8 R15: ffff8801d07cfcdc
       __in6_ifa_put include/net/addrconf.h:369 [inline]
       ipv6_del_addr+0x42b/0xb60 net/ipv6/addrconf.c:1208
       addrconf_permanent_addr net/ipv6/addrconf.c:3327 [inline]
       addrconf_notify+0x1c66/0x2190 net/ipv6/addrconf.c:3393
       notifier_call_chain+0x136/0x2c0 kernel/notifier.c:93
       __raw_notifier_call_chain kernel/notifier.c:394 [inline]
       raw_notifier_call_chain+0x2d/0x40 kernel/notifier.c:401
       call_netdevice_notifiers_info+0x32/0x60 net/core/dev.c:1697
       call_netdevice_notifiers net/core/dev.c:1715 [inline]
       __dev_notify_flags+0x15d/0x430 net/core/dev.c:6843
       dev_change_flags+0xf5/0x140 net/core/dev.c:6879
       do_setlink+0xa1b/0x38e0 net/core/rtnetlink.c:2113
       rtnl_newlink+0xf0d/0x1a40 net/core/rtnetlink.c:2661
       rtnetlink_rcv_msg+0x733/0x1090 net/core/rtnetlink.c:4301
       netlink_rcv_skb+0x216/0x440 net/netlink/af_netlink.c:2408
       rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:4313
       netlink_unicast_kernel net/netlink/af_netlink.c:1273 [inline]
       netlink_unicast+0x4e8/0x6f0 net/netlink/af_netlink.c:1299
       netlink_sendmsg+0xa4a/0xe70 net/netlink/af_netlink.c:1862
       sock_sendmsg_nosec net/socket.c:633 [inline]
       sock_sendmsg+0xca/0x110 net/socket.c:643
       ___sys_sendmsg+0x75b/0x8a0 net/socket.c:2049
       __sys_sendmsg+0xe5/0x210 net/socket.c:2083
       SYSC_sendmsg net/socket.c:2094 [inline]
       SyS_sendmsg+0x2d/0x50 net/socket.c:2090
       entry_SYSCALL_64_fastpath+0x1f/0xbe
      RIP: 0033:0x7fa9174d3320
      RSP: 002b:00007ffe302ae9e8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
      RAX: ffffffffffffffda RBX: 00007ffe302b2ae0 RCX: 00007fa9174d3320
      RDX: 0000000000000000 RSI: 00007ffe302aea20 RDI: 0000000000000016
      RBP: 0000000000000082 R08: 0000000000000000 R09: 000000000000000f
      R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffe302b32a0
      R13: 0000000000000000 R14: 00007ffe302b2ab8 R15: 00007ffe302b32b8
      
      Fixes: f1705ec1 ("net: ipv6: Make address flushing on ifdown optional")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: David Ahern <dsahern@gmail.com>
      Acked-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e669b869
    • Craig Gallek's avatar
      tun/tap: sanitize TUNSETSNDBUF input · 93161922
      Craig Gallek authored
      Syzkaller found several variants of the lockup below by setting negative
      values with the TUNSETSNDBUF ioctl.  This patch adds a sanity check
      to both the tun and tap versions of this ioctl.
      
        watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [repro:2389]
        Modules linked in:
        irq event stamp: 329692056
        hardirqs last  enabled at (329692055): [<ffffffff824b8381>] _raw_spin_unlock_irqrestore+0x31/0x75
        hardirqs last disabled at (329692056): [<ffffffff824b9e58>] apic_timer_interrupt+0x98/0xb0
        softirqs last  enabled at (35659740): [<ffffffff824bc958>] __do_softirq+0x328/0x48c
        softirqs last disabled at (35659731): [<ffffffff811c796c>] irq_exit+0xbc/0xd0
        CPU: 0 PID: 2389 Comm: repro Not tainted 4.14.0-rc7 #23
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
        task: ffff880009452140 task.stack: ffff880006a20000
        RIP: 0010:_raw_spin_lock_irqsave+0x11/0x80
        RSP: 0018:ffff880006a27c50 EFLAGS: 00000282 ORIG_RAX: ffffffffffffff10
        RAX: ffff880009ac68d0 RBX: ffff880006a27ce0 RCX: 0000000000000000
        RDX: 0000000000000001 RSI: ffff880006a27ce0 RDI: ffff880009ac6900
        RBP: ffff880006a27c60 R08: 0000000000000000 R09: 0000000000000000
        R10: 0000000000000001 R11: 000000000063ff00 R12: ffff880009ac6900
        R13: ffff880006a27cf8 R14: 0000000000000001 R15: ffff880006a27cf8
        FS:  00007f4be4838700(0000) GS:ffff88000cc00000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 0000000020101000 CR3: 0000000009616000 CR4: 00000000000006f0
        Call Trace:
         prepare_to_wait+0x26/0xc0
         sock_alloc_send_pskb+0x14e/0x270
         ? remove_wait_queue+0x60/0x60
         tun_get_user+0x2cc/0x19d0
         ? __tun_get+0x60/0x1b0
         tun_chr_write_iter+0x57/0x86
         __vfs_write+0x156/0x1e0
         vfs_write+0xf7/0x230
         SyS_write+0x57/0xd0
         entry_SYSCALL_64_fastpath+0x1f/0xbe
        RIP: 0033:0x7f4be4356df9
        RSP: 002b:00007ffc18101c08 EFLAGS: 00000293 ORIG_RAX: 0000000000000001
        RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f4be4356df9
        RDX: 0000000000000046 RSI: 0000000020101000 RDI: 0000000000000005
        RBP: 00007ffc18101c40 R08: 0000000000000001 R09: 0000000000000001
        R10: 0000000000000001 R11: 0000000000000293 R12: 0000559c75f64780
        R13: 00007ffc18101d30 R14: 0000000000000000 R15: 0000000000000000
      
      Fixes: 33dccbb0 ("tun: Limit amount of queued packets per device")
      Fixes: 20d29d7a ("net: macvtap driver")
      Signed-off-by: default avatarCraig Gallek <kraig@google.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      93161922
    • Vadim Pasternak's avatar
      mlxsw: i2c: Fix buffer increment counter for write transaction · d70eaa38
      Vadim Pasternak authored
      It fixes a problem for the last chunk where 'chunk_size' is smaller than
      MLXSW_I2C_BLK_MAX and data is copied to the wrong offset, overriding
      previous data.
      
      Fixes: 6882b0ae ("mlxsw: Introduce support for I2C bus")
      Signed-off-by: default avatarVadim Pasternak <vadimp@mellanox.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d70eaa38
    • David S. Miller's avatar
      Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec · 122f00cd
      David S. Miller authored
      Steffen Klassert says:
      
      ====================
      pull request (net): ipsec 2017-11-01
      
      1) Fix a memleak when a packet matches a policy
         without a matching state.
      
      2) Reset the socket cached dst_entry when inserting
         a socket policy, otherwise the policy might be
         ignored. From Jonathan Basseri.
      
      3) Fix GSO for a IPsec, GRE tunnel combination.
         We reset the encapsulation field at the skb
         too erly, as a result GRE does not segment
         GSO packets. Fix this by resetting the the
         encapsulation field right before the
         transformation where the inner headers get
         invalid.
      
      Please pull or let me know if there are problems.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      122f00cd
    • Ido Schimmel's avatar
      mlxsw: reg: Add high and low temperature thresholds · 62b0e924
      Ido Schimmel authored
      The ASIC has the ability to generate events whenever a sensor indicates
      the temperature goes above or below its high or low thresholds,
      respectively.
      
      In new firmware versions the firmware enforces a minimum of 5
      degrees Celsius difference between both thresholds. Make the driver
      conform to this requirement.
      
      Note that this is required even when the events are disabled, as in
      certain systems interrupts are generated via GPIO based on these
      thresholds.
      
      Fixes: 85926f87 ("mlxsw: reg: Add definition of temperature management registers")
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      62b0e924
    • Yuval Mintz's avatar
      MAINTAINERS: Remove Yotam from mlxfw · 1cf098b7
      Yuval Mintz authored
      Provide a mailing list for maintenance of the module instead.
      Signed-off-by: default avatarYuval Mintz <yuvalm@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1cf098b7
    • Yotam Gigi's avatar
      MAINTAINERS: Update Yotam's E-mail · f1fd20c3
      Yotam Gigi authored
      For the time being I will be available in my private mail. Update both the
      MAINTAINERS file and the individual modules MODULE_AUTHOR directive with
      the new address.
      Signed-off-by: default avatarYotam Gigi <yotam.gi@gmail.com>
      Signed-off-by: default avatarYuval Mintz <yuvalm@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f1fd20c3
    • Pan Bian's avatar
      net: hns: set correct return value · d2083d0e
      Pan Bian authored
      The function of_parse_phandle() returns a NULL pointer if it cannot
      resolve a phandle property to a device_node pointer. In function
      hns_nic_dev_probe(), its return value is passed to PTR_ERR to extract
      the error code. However, in this case, the extracted error code will
      always be zero, which is unexpected.
      Signed-off-by: default avatarPan Bian <bianpan2016@163.com>
      Reviewed-by: default avatarTobias Klauser <tklauser@distanz.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d2083d0e
    • Pan Bian's avatar
      net: lapbether: fix double free · 7db8874a
      Pan Bian authored
      The function netdev_priv() returns the private data of the device. The
      memory to store the private data is allocated in alloc_netdev() and is
      released in netdev_free(). Calling kfree() on the return value of
      netdev_priv() after netdev_free() results in a double free bug.
      Signed-off-by: default avatarPan Bian <bianpan2016@163.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7db8874a