1. 20 Mar, 2015 2 commits
    • Rafael J. Wysocki's avatar
      Merge branches 'pm-cpuidle', 'powercap', 'irq-pm' and 'acpi-resources' · 9c86286a
      Rafael J. Wysocki authored
      * pm-cpuidle:
        cpuidle: mvebu: Update cpuidle thresholds for Armada XP SOCs
        cpuidle: mvebu: Fix the CPU PM notifier usage
      
      * powercap:
        powercap / RAPL: handle domains with different energy units
      
      * irq-pm:
        rtc: at91rm9200: double locking bug in at91_rtc_interrupt()
      
      * acpi-resources:
        Revert "x86/PCI: Refine the way to release PCI IRQ resources"
      9c86286a
    • Rafael J. Wysocki's avatar
      Revert "x86/PCI: Refine the way to release PCI IRQ resources" · 9e8ce4b9
      Rafael J. Wysocki authored
      Commit b4b55cda (Refine the way to release PCI IRQ resources)
      introduced a regression in the PCI IRQ resource management by causing
      the IRQ resource of a device, established when pci_enabled_device()
      is called on a fully disabled device, to be released when the driver
      is unbound from the device, regardless of the enable_cnt.
      
      This leads to the situation that an ill-behaved driver can now make a
      device unusable to subsequent drivers by an imbalance in their use of
      pci_enable/disable_device().  That is a serious problem for secondary
      drivers like vfio-pci, which are innocent of the transgressions of
      the previous driver.
      
      Since the solution of this problem is not immediate and requires
      further discussion, revert commit b4b55cda and the issue it was
      supposed to address (a bug related to xen-pciback) will be taken
      care of in a different way going forward.
      Reported-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      9e8ce4b9
  2. 18 Mar, 2015 1 commit
  3. 16 Mar, 2015 1 commit
  4. 15 Mar, 2015 6 commits
    • Linus Torvalds's avatar
      Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux · 08352086
      Linus Torvalds authored
      Pull drm fix from Dave Airlie:
       "An oops snuck in in an -rc3 patch, this fixes it"
      
      * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
        [PATCH] drm/mm: Fix support 4 GiB and larger ranges
      08352086
    • Linus Torvalds's avatar
      Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux · 1ee89c51
      Linus Torvalds authored
      Pull clock framework fixes from Michael Turquette:
       "The clk fixes for 4.0-rc4 comprise three themes.
      
        First are the usual driver fixes for new regressions since v3.19.
      
        Second are fixes to the common clock divider type caused by recent
        changes to how we round clock rates.  This affects many clock drivers
        that use this common code.
      
        Finally there are fixes for drivers that improperly compared struct
        clk pointers (drivers must not deref these pointers).  While some of
        these drivers have done this for a long time, this did not cause a
        problem until we started generating unique struct clk pointers for
        every consumer.  A new function, clk_is_match was introduced to get
        these drivers working again and they are fixed up to no longer deref
        the pointers themselves"
      
      * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
        ASoC: kirkwood: fix struct clk pointer comparing
        ASoC: fsl_spdif: fix struct clk pointer comparing
        ARM: imx: fix struct clk pointer comparing
        clk: introduce clk_is_match
        clk: don't export static symbol
        clk: divider: fix calculation of initial best divider when rounding to closest
        clk: divider: fix selection of divider when rounding to closest
        clk: divider: fix calculation of maximal parent rate for a given divider
        clk: divider: return real rate instead of divider value
        clk: qcom: fix platform_no_drv_owner.cocci warnings
        clk: qcom: fix platform_no_drv_owner.cocci warnings
        clk: qcom: Add PLL4 vote clock
        clk: qcom: lcc-msm8960: Fix PLL rate detection
        clk: qcom: Fix slimbus n and m val offsets
        clk: ti: Fix FAPLL parent enable bit handling
      1ee89c51
    • Krzysztof Kolasa's avatar
      [PATCH] drm/mm: Fix support 4 GiB and larger ranges · 046d669c
      Krzysztof Kolasa authored
      bad argument if(tmp)... in check_free_hole
      
      fix oops: kernel BUG at drivers/gpu/drm/drm_mm.c:305!
      
      [airlied: excellent, this was my task for today].
      Signed-off-by: default avatarKrzysztof Kolasa <kkolasa@winsoft.pl>
      Reviewed-by: default avatarChris wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      046d669c
    • Linus Torvalds's avatar
      Merge tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc · 6981e2af
      Linus Torvalds authored
      Pull ARM SoC fixes from Arnd Bergmann:
       "This is a rather unpleasantly large set of bug fixes for arm-soc, Most
        of them because of cross-tree dependencies for Exynos where we should
        have figured out the right path to merge things before the merge
        window, and then the maintainer being unable to sort things out in
        time during a business trip.
      
        The other changes contained here are the usual collection:
      
        MAINTAINERS file updates
         - Gregory Clement is now a co-maintainer for the legacy Marvell EBU
           platforms
         - A MAINTAINERS entry for the Freescale Vybrid platform that was
           added last year
         - Matt Porter no longer works as a maintainer on Broadcom SoCs
      
        Build-time issues
         - A compile-time error for at91
         - Several minor DT fixes on at91, imx, exynos, socfpga, and omap
         - The new digicolor platform was not correctly enabled at all
      
        Configuration issues
         - Two defconfig fix for regressions using USB on versatile express
           and on OMAP3
         - Enabling all 8 CPUs on Allwinner/SUNxi
         - Enabling the new STiH410 platform to be usable
      
        Bug fixes in platform code
         - A missing barrier for socfpga
         - Fixing LPDDR1 self-refresh mode on at91
         - Fixing RTC interrupt numbers on Exynos3250
         - Fixing a cache-coherency issues in CPU power-down on Exynos5
         - Multiple small OMAP power management fixes"
      
      * tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (69 commits)
        MAINTAINERS: Add myself as co-maintainer to the legacy support of the mvebu SoCs
        ARM: at91: pm_slowclock: fix the compilation error
        ARM: at91/dt: fix USB high-speed clock to select UTMI
        ARM: at91/dt: fix at91 udc compatible strings
        ARM: at91/dt: declare matrix node as a syscon device
        ARM: vexpress: update CONFIG_USB_ISP1760 option
        ARM: digicolor: add the machine directory to Makefile
        ARM: STi: Add STiH410 SoC support
        MAINTAINERS: add Freescale Vybrid SoC
        MAINTAINERS: Remove self as ARM mach-bcm co-maintainer
        ARM: imx6sl-evk: set swbst_reg as vbus's parent reg
        ARM: imx6qdl-sabresd: set swbst_reg as vbus's parent reg
        ARM: at91/dt: at91sam9261: fix clocks and clock-names in udc definition
        ARM: OMAP2+: Fix wl12xx on dm3730-evm with mainline u-boot
        ARM: OMAP: enable TWL4030_USB in omap2plus_defconfig
        ARM: dts: dra7x-evm: avoid possible contention while muxing on CAN lines
        ARM: dts: dra7x-evm: Don't use dcan1_rx.gpio1_15 in DCAN pinctrl
        ARM: dts: am43xx: fix SLEWCTRL_FAST pinctrl binding
        ARM: dts: am33xx: fix SLEWCTRL_FAST pinctrl binding
        ARM: dts: OMAP5: fix polling intervals for thermal zones
        ...
      6981e2af
    • Linus Torvalds's avatar
      Merge tag 'irqchip-fixes-4.0' of git://git.infradead.org/users/jcooper/linux · 71c87bd0
      Linus Torvalds authored
      Pull irqchip fixes from Jason Cooper:
       "armada-370-xp:
         - Chained per-cpu interrupts
      
        gic{,-v3,v3-its}"
         - Various fixes for safer operation"
      
      * tag 'irqchip-fixes-4.0' of git://git.infradead.org/users/jcooper/linux:
        irqchip: gicv3-its: Support safe initialization
        irqchip: gicv3-its: Define macros for GITS_CTLR fields
        irqchip: gicv3-its: Add limitation to page order
        irqchip: gicv3-its: Use 64KB page as default granule
        irqchip: gicv3-its: Zero itt before handling to hardware
        irqchip: gic-v3: Fix out of bounds access to cpu_logical_map
        irqchip: gic: Fix unsafe locking reported by lockdep
        irqchip: gicv3-its: Fix unsafe locking reported by lockdep
        irqchip: gicv3-its: Iterate over PCI aliases to generate ITS configuration
        irqchip: gicv3-its: Allocate enough memory for the full range of DeviceID
        irqchip: gicv3-its: Fix ITS CPU init
        irqchip: armada-370-xp: Fix chained per-cpu interrupts
      71c87bd0
    • Jason Cooper's avatar
      aaa95f74
  5. 14 Mar, 2015 10 commits
  6. 13 Mar, 2015 20 commits
    • Jacob Pan's avatar
      powercap / RAPL: handle domains with different energy units · d474a4d3
      Jacob Pan authored
      The current driver assumes all RAPL domains within a CPU package
      have the same energy unit. This is no longer true for HSW server
      CPUs since DRAM domain has is own fixed energy unit which can be
      different than the package energy unit enumerated by package
      power MSR. In fact, the default HSW EP package power unit is 61uJ
      whereas DRAM domain unit is 15.3uJ. The result is that DRAM power
      consumption is counted 4x more than real power reported by energy
      counters, similarly for max_energy_range_uj of DRAM domain.
      
      This patch adds domain specific energy unit per cpu type, it allows
      domain energy unit to override package energy unit if non zero.
      
      Please see this document for details.
      "Intel Xeon Processor E5-1600 and E5-2600 v3 Product Families, Volume 2 of 2.
       Datasheet, September 2014, Reference Number: 330784-001 "
      Signed-off-by: default avatarJacob Pan <jacob.jun.pan@linux.intel.com>
      Cc: 3.10+ <stable@vger.kernel.org> # 3.10+
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      d474a4d3
    • Linus Torvalds's avatar
      Merge tag 'pm+acpi-4.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 5fb0f7fa
      Linus Torvalds authored
      Pull power management and ACPI fixes from Rafael Wysocki:
       "Just two fixes, one for an ACPI LPSS driver issue introduced during
        the 3.17 cycle and one revert of a recent commit that sort of broke
        the cpupower tool.
      
        Specifics:
      
         - Fix an ACPI LPSS (Low-Power Subsystem) driver issue causing the
           8250_dw driver to confuse an LPSS clock with another one it is
           supposed to handle due to the lack of identification allowing it to
           tell those clocks apart (Heikki Krogerus).
      
         - Revert a recent commit that was supposed to improve the usability
           of the cpupower tool, but clearly did the opposite (Josh Boyer)"
      
      * tag 'pm+acpi-4.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        Revert "cpupower Makefile change to help run the tool without 'make install'"
        ACPI / LPSS: provide con_id for the clkdev
      5fb0f7fa
    • Rafael J. Wysocki's avatar
      Merge branch 'cpuidle/4.0-fixes' of... · a01b8605
      Rafael J. Wysocki authored
      Merge branch 'cpuidle/4.0-fixes' of http://git.linaro.org/people/daniel.lezcano/linux into pm-cpuidle
      
      Pull ARM cpuidle fixes for v4.0 from Daniel Lezcano.
      
      * 'cpuidle/4.0-fixes' of http://git.linaro.org/people/daniel.lezcano/linux:
        cpuidle: mvebu: Update cpuidle thresholds for Armada XP SOCs
        cpuidle: mvebu: Fix the CPU PM notifier usage
      a01b8605
    • Gregory CLEMENT's avatar
      MAINTAINERS: Add myself as co-maintainer to the legacy support of the mvebu SoCs · bfda4031
      Gregory CLEMENT authored
      I will also take care of the legacy support(not fully converted to DT)
      of the mvebu SoCs.
      Signed-off-by: default avatarGregory CLEMENT <gregory.clement@free-electrons.com>
      Acked-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Acked-by: default avatarJason Cooper <jason@lakedaemon.net>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      bfda4031
    • Rafael J. Wysocki's avatar
      Merge branch 'pm-tools' · b1760233
      Rafael J. Wysocki authored
      * pm-tools:
        Revert "cpupower Makefile change to help run the tool without 'make install'"
      b1760233
    • Linus Torvalds's avatar
      Merge tag 'stable/for-linus-4.0-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · f47e3310
      Linus Torvalds authored
      Pull xen bug fixes from David Vrabel:
      
       - fix a PV regression in 3.19.
      
       - fix a dom0 crash on hosts with large numbers of PIRQs.
      
       - prevent pcifront from disabling memory or I/O port access, which may
         trigger host crashes.
      
      * tag 'stable/for-linus-4.0-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        xen-pciback: limit guest control of command register
        xen/events: avoid NULL pointer dereference in dom0 on large machines
        xen: Remove trailing semicolon from xenbus_register_frontend() definition
        x86/xen: correct bug in p2m list initialization
      f47e3310
    • Linus Torvalds's avatar
      Merge tag 'sound-4.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · bbc54a00
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "This is a round of HD-audio fixes: there are a long-standing
        regression fix and a few more device/codec-specific quirks.
      
        In addition, a couple of FireWire regression fixes, a USB-audio quirk
        for Roland UA-22 and a sanity check in API for user-defined control
        elements"
      
      * tag 'sound-4.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: hda - Don't access stereo amps for mono channel widgets
        ALSA: hda - Add workaround for MacBook Air 5,2 built-in mic
        ALSA: hda - Set single_adc_amp flag for CS420x codecs
        ALSA: snd-usb: add quirks for Roland UA-22
        ALSA: control: Add sanity checks for user ctl id name string
        ALSA: hda - Fix built-in mic on Compaq Presario CQ60
        ALSA: firewire-lib: leave unit reference counting completely
        Revert "ALSA: dice: fix wrong offsets for Dice interface"
        ALSA: hda - Fix regression of HD-audio controller fallback modes
      bbc54a00
    • Linus Torvalds's avatar
      Merge tag 'devicetree-fixes-for-4.0' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux · 3d52c5bd
      Linus Torvalds authored
      Pull DeviceTree fixes from Rob Herring:
      
       - fix for stdout-path option parsing with added unittest
      
       - fix for stdout-path interaction with earlycon
      
       - several DT unittest fixes
      
       - fix Sparc allmodconfig build error on of_platform_register_reconfig_notifier
      
       - several DT overlay kconfig and build warning fixes
      
       - several DT binding documentation updates
      
      * tag 'devicetree-fixes-for-4.0' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
        of/platform: Fix sparc:allmodconfig build
        of: unittest: Add options string testcase variants
        of: fix handling of '/' in options for of_find_node_by_path()
        of/unittest: Fix the wrong expected value in of_selftest_property_string
        of/unittest: remove the duplicate of_changeset_init
        dt: submitting-patches: clarify that DT maintainers are to be cced on bindings
        of: unittest: fix I2C dependency
        of/overlay: Remove unused variable
        Documentation: DT: Renamed of-serial.txt to 8250.txt
        of: Fix premature bootconsole disable with 'stdout-path'
        serial: add device tree binding documentation for ETRAX FS UART
        of/overlay: Directly include idr.h
        of: Drop superfluous dependance for OF_OVERLAY
        of: Add vendor prefix for Arasan
        of: Add prompt for OF_OVERLAY config
      3d52c5bd
    • Linus Torvalds's avatar
      Merge branch 'gadget' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · f788baad
      Linus Torvalds authored
      Pull gadgetfs fixes from Al Viro:
       "Assorted fixes around AIO on gadgetfs: leaks, use-after-free, troubles
        caused by ->f_op flipping"
      
      * 'gadget' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        gadgetfs: really get rid of switching ->f_op
        gadgetfs: get rid of flipping ->f_op in ep_config()
        gadget: switch ep_io_operations to ->read_iter/->write_iter
        gadgetfs: use-after-free in ->aio_read()
        gadget/function/f_fs.c: switch to ->{read,write}_iter()
        gadget/function/f_fs.c: use put iov_iter into io_data
        gadget/function/f_fs.c: close leaks
        move iov_iter.c from mm/ to lib/
        new helper: dup_iter()
      f788baad
    • Sebastien Rannou's avatar
      cpuidle: mvebu: Update cpuidle thresholds for Armada XP SOCs · ce6031c8
      Sebastien Rannou authored
      Originally, the thresholds used in the cpuidle driver for Armada SOCs
      were temporarily chosen, leaving room for improvements.
      
      This commit updates the thresholds for the Armada XP SOCs with values
      that positively impact performances:
      
                                      without patch  with patch   vendor kernel
       - iperf localhost (gbit/sec)   ~3.7           ~6.4         ~5.4
       - ioping tmpfs (iops)          ~163k          ~206k        ~179k
       - ioping tmpfs (mib/s)         ~636           ~805         ~699
      
      The idle power consumption is negatively impacted (proportionally less
      than the performance gain), and we are still performing better than
      the vendor kernel here:
      
                                      without patch   with patch  vendor kernel
       - power consumption idle (W)   ~2.4            ~3.2        ~4.4
       - power consumption busy (W)   ~8.6            ~8.3        ~8.6
      
      There is still room for improvement regarding the value of these
      thresholds, they were chosen to mimic the vendor kernel.
      
      This patch only impacts Armada XP SOCs and was tested on Online Labs
      C1 boards. A similar approach can be taken to improve the performances
      of the Armada 370 and Armada 38x SOCs.
      
      Thanks a lot to Thomas Petazzoni, Gregory Clement and Willy Tarreau
      for the discussions and tips around this topic.
      Signed-off-by: default avatarSebastien Rannou <mxs@sbrk.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      Acked-by: default avatarGregory CLEMENT <gregory.clement@free-electrons.com>
      ce6031c8
    • Gregory CLEMENT's avatar
      cpuidle: mvebu: Fix the CPU PM notifier usage · 43b68879
      Gregory CLEMENT authored
      As stated in kernel/cpu_pm.c, "Platform is responsible for ensuring
      that cpu_pm_enter is not called twice on the same CPU before
      cpu_pm_exit is called.". In the current code in case of failure when
      calling mvebu_v7_cpu_suspend, the function cpu_pm_exit() is never
      called whereas cpu_pm_enter() was called just before.
      
      This patch moves the cpu_pm_exit() in order to balance the
      cpu_pm_enter() calls.
      
      Cc: stable@vger.kernel.org
      Reported-by: default avatarFulvio Benini <fbf@libero.it>
      Signed-off-by: default avatarGregory CLEMENT <gregory.clement@free-electrons.com>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      43b68879
    • Guenter Roeck's avatar
      of/platform: Fix sparc:allmodconfig build · a697c2ef
      Guenter Roeck authored
      sparc:allmodconfig fails to build with:
      
      drivers/built-in.o: In function `platform_bus_init':
      (.init.text+0x3684): undefined reference to `of_platform_register_reconfig_notifier'
      
      of_platform_register_reconfig_notifier is only declared if both OF_ADDRESS
      and OF_DYNAMIC are configured. Yet, the include file only declares a dummy
      function if OF_DYNAMIC is not configured. The sparc architecture does not
      configure OF_ADDRESS, but does configure OF_DYNAMIC, causing above error.
      
      Fixes: 801d728c ("of/reconfig: Add OF_DYNAMIC notifier for platform_bus_type")
      Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      a697c2ef
    • Takashi Iwai's avatar
      ALSA: hda - Don't access stereo amps for mono channel widgets · ef403edb
      Takashi Iwai authored
      The current HDA generic parser initializes / modifies the amp values
      always in stereo, but this seems causing the problem on ALC3229 codec
      that has a few mono channel widgets: namely, these mono widgets react
      to actions for both channels equally.
      
      In the driver code, we do care the mono channel and create a control
      only for the left channel (as defined in HD-audio spec) for such a
      node.  When the control is updated, only the left channel value is
      changed.  However, in the resume, the right channel value is also
      restored from the initial value we took as stereo, and this overwrites
      the left channel value.  This ends up being the silent output as the
      right channel has been never touched and remains muted.
      
      This patch covers the places where unconditional stereo amp accesses
      are done and converts to the conditional accesses.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=94581
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      ef403edb
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · c202baf0
      Linus Torvalds authored
      Merge misc fixes from Andrew Morton:
       "13 fixes"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        memcg: disable hierarchy support if bound to the legacy cgroup hierarchy
        mm: reorder can_do_mlock to fix audit denial
        kasan, module: move MODULE_ALIGN macro into <linux/moduleloader.h>
        kasan, module, vmalloc: rework shadow allocation for modules
        fanotify: fix event filtering with FAN_ONDIR set
        mm/nommu.c: export symbol max_mapnr
        arch/c6x/include/asm/pgtable.h: define dummy pgprot_writecombine for !MMU
        nilfs2: fix deadlock of segment constructor during recovery
        mm: cma: fix CMA aligned offset calculation
        mm, hugetlb: close race when setting PageTail for gigantic pages
        mm, oom: do not fail __GFP_NOFAIL allocation if oom killer is disabled
        drivers/rtc/rtc-s3c.c: add .needs_src_clk to s3c6410 RTC data
        ocfs2: make append_dio an incompat feature
      c202baf0
    • Vladimir Davydov's avatar
      memcg: disable hierarchy support if bound to the legacy cgroup hierarchy · 7feee590
      Vladimir Davydov authored
      If the memory cgroup controller is initially mounted in the scope of the
      default cgroup hierarchy and then remounted to a legacy hierarchy, it will
      still have hierarchy support enabled, which is incorrect.  We should
      disable hierarchy support if bound to the legacy cgroup hierarchy.
      Signed-off-by: default avatarVladimir Davydov <vdavydov@parallels.com>
      Signed-off-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Acked-by: default avatarMichal Hocko <mhocko@suse.cz>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7feee590
    • Jeff Vander Stoep's avatar
      mm: reorder can_do_mlock to fix audit denial · a5a6579d
      Jeff Vander Stoep authored
      A userspace call to mmap(MAP_LOCKED) may result in the successful locking
      of memory while also producing a confusing audit log denial.  can_do_mlock
      checks capable and rlimit.  If either of these return positive
      can_do_mlock returns true.  The capable check leads to an LSM hook used by
      apparmour and selinux which produce the audit denial.  Reordering so
      rlimit is checked first eliminates the denial on success, only recording a
      denial when the lock is unsuccessful as a result of the denial.
      Signed-off-by: default avatarJeff Vander Stoep <jeffv@google.com>
      Acked-by: default avatarNick Kralevich <nnk@google.com>
      Cc: Jeff Vander Stoep <jeffv@google.com>
      Cc: Sasha Levin <sasha.levin@oracle.com>
      Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Paul Cassella <cassella@cray.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a5a6579d
    • Andrey Ryabinin's avatar
      kasan, module: move MODULE_ALIGN macro into <linux/moduleloader.h> · d3733e5c
      Andrey Ryabinin authored
      include/linux/moduleloader.h is more suitable place for this macro.
      Also change alignment to PAGE_SIZE for CONFIG_KASAN=n as such
      alignment already assumed in several places.
      Signed-off-by: default avatarAndrey Ryabinin <a.ryabinin@samsung.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Acked-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d3733e5c
    • Andrey Ryabinin's avatar
      kasan, module, vmalloc: rework shadow allocation for modules · a5af5aa8
      Andrey Ryabinin authored
      Current approach in handling shadow memory for modules is broken.
      
      Shadow memory could be freed only after memory shadow corresponds it is no
      longer used.  vfree() called from interrupt context could use memory its
      freeing to store 'struct llist_node' in it:
      
          void vfree(const void *addr)
          {
          ...
              if (unlikely(in_interrupt())) {
                  struct vfree_deferred *p = this_cpu_ptr(&vfree_deferred);
                  if (llist_add((struct llist_node *)addr, &p->list))
                          schedule_work(&p->wq);
      
      Later this list node used in free_work() which actually frees memory.
      Currently module_memfree() called in interrupt context will free shadow
      before freeing module's memory which could provoke kernel crash.
      
      So shadow memory should be freed after module's memory.  However, such
      deallocation order could race with kasan_module_alloc() in module_alloc().
      
      Free shadow right before releasing vm area.  At this point vfree()'d
      memory is not used anymore and yet not available for other allocations.
      New VM_KASAN flag used to indicate that vm area has dynamically allocated
      shadow memory so kasan frees shadow only if it was previously allocated.
      Signed-off-by: default avatarAndrey Ryabinin <a.ryabinin@samsung.com>
      Acked-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a5af5aa8
    • Suzuki K. Poulose's avatar
      fanotify: fix event filtering with FAN_ONDIR set · b3c1030d
      Suzuki K. Poulose authored
      With FAN_ONDIR set, the user can end up getting events, which it hasn't
      marked.  This was revealed with fanotify04 testcase failure on
      Linux-4.0-rc1, and is a regression from 3.19, revealed with 66ba93c0
      ("fanotify: don't set FAN_ONDIR implicitly on a marks ignored mask").
      
         # /opt/ltp/testcases/bin/fanotify04
         [ ... ]
        fanotify04    7  TPASS  :  event generated properly for type 100000
        fanotify04    8  TFAIL  :  fanotify04.c:147: got unexpected event 30
        fanotify04    9  TPASS  :  No event as expected
      
      The testcase sets the adds the following marks : FAN_OPEN | FAN_ONDIR for
      a fanotify on a dir.  Then does an open(), followed by close() of the
      directory and expects to see an event FAN_OPEN(0x20).  However, the
      fanotify returns (FAN_OPEN|FAN_CLOSE_NOWRITE(0x10)).  This happens due to
      the flaw in the check for event_mask in fanotify_should_send_event() which
      does:
      
      	if (event_mask & marks_mask & ~marks_ignored_mask)
      		return true;
      
      where, event_mask == (FAN_ONDIR | FAN_CLOSE_NOWRITE),
             marks_mask == (FAN_ONDIR | FAN_OPEN),
             marks_ignored_mask == 0
      
      Fix this by masking the outgoing events to the user, as we already take
      care of FAN_ONDIR and FAN_EVENT_ON_CHILD.
      Signed-off-by: default avatarSuzuki K. Poulose <suzuki.poulose@arm.com>
      Tested-by: default avatarLino Sanfilippo <LinoSanfilippo@gmx.de>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Cc: Eric Paris <eparis@redhat.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b3c1030d
    • gchen gchen's avatar
      mm/nommu.c: export symbol max_mapnr · 5b8bf307
      gchen gchen authored
      Several modules may need max_mapnr, so export, the related error with
      allmodconfig under c6x:
      
        MODPOST 3327 modules
        ERROR: "max_mapnr" [fs/pstore/ramoops.ko] undefined!
        ERROR: "max_mapnr" [drivers/media/v4l2-core/videobuf2-dma-contig.ko] undefined!
      Signed-off-by: default avatarChen Gang <gang.chen.5i5j@gmail.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5b8bf307