1. 01 May, 2017 1 commit
    • Hans de Goede's avatar
      ACPI / power: Delay turning off unused power resources after suspend · 8ece1d83
      Hans de Goede authored
      Commit 660b1113 (ACPI / PM: Fix consistency check for power resources
      during resume) introduced a check for ACPI power resources which have
      been turned on by the BIOS during suspend and turns these back off again.
      
      This is causing problems on a Dell Venue Pro 11 7130 (i5-4300Y) it causes
      the following messages to show up in dmesg:
      
      [  131.014605] ACPI: Waking up from system sleep state S3
      [  131.150271] acpi LNXPOWER:07: Turning OFF
      [  131.150323] acpi LNXPOWER:06: Turning OFF
      [  131.150911] acpi LNXPOWER:00: Turning OFF
      [  131.169014] ACPI : EC: interrupt unblocked
      [  131.181811] xhci_hcd 0000:00:14.0: System wakeup disabled by ACPI
      [  133.535728] pci_raw_set_power_state: 76 callbacks suppressed
      [  133.535735] iwlwifi 0000:01:00.0: Refused to change power state,
                     currently in D3
      [  133.597672] PM: noirq resume of devices complete after 2428.891 msecs
      
      Followed by a bunch of iwlwifi errors later on and the pcie device
      dropping from the bus (acpiphp thinks it has been unplugged).
      
      Disabling the turning off of unused power resources fixes this. Instead
      of adding a quirk for this system, this commit fixes this by moving the
      disabling of unused power resources to later in the resume sequence
      when the iwlwifi card has been moved out of D3 so the ref_count for
      its power resource no longer is 0.
      
      This new behavior seems to match the intend of the original commit which
      commit-msg says: "(... which means that no devices are going to need them
      any time soon) and we should turn them off".
      
      This also avoids power resources which we need when bringing devices out
      of D3 from getting bounced off and then back on again.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      8ece1d83
  2. 21 Apr, 2017 1 commit
  3. 19 Apr, 2017 6 commits
    • Hans de Goede's avatar
      power: supply: axp288_charger: Only wait for INT3496 device if present · 6c4c9a9a
      Hans de Goede authored
      On some devices with an axp288 pmic setting vbus path based on the
      id-pin is handled by an ACPI _AIE interrupt on the gpio and the
      INT3496 device is disabled.
      
      Instead of returning -EPROBE_DEFER on these devices waiting for the
      never to show up INT3496 device, check for its presence and only
      request and monitor the matching extcon if the device is there,
      otherwise let the firmware handle the vbus path control.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarSebastian Reichel <sre@kernel.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      6c4c9a9a
    • Hans de Goede's avatar
      ACPI / AC: Add a blacklist with PMIC ACPI HIDs with a native charger driver · af3ec837
      Hans de Goede authored
      On some systems we have a native PMIC driver which provides Mains
      monitoring, while the ACPI ac driver is broken on these systems
      due to bad DSTDs or because we do not support the proprietary and
      undocumented ACPI opregions these ACPI battery devices rely on
      (e.g. BMOP opregion).
      
      This leads for example to a ADP1 power_supply which reports
      itself as always online even if no mains are connected.
      
      This commit adds a blacklist with PMIC ACPI HIDs for which we've a
      native charger or extcon driver and makes the ACPI ac driver not
      register itself when a PMIC on this list is present.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      af3ec837
    • Hans de Goede's avatar
      ACPI / battery: Add a blacklist with PMIC ACPI HIDs with a native battery driver · dccfae6d
      Hans de Goede authored
      On some systems we have a native PMIC driver which provides battery
      monitoring, while the ACPI battery driver is broken on these systems
      due to bad DSDTs or because we do not support the proprietary and
      undocumented ACPI opregions these ACPI battery devices rely on
      (e.g. BMOP opregion).
      
      This leads to there being 2 battery power_supply-s registed like this:
      
      ~$ acpi
      Battery 0: Charging, 84%, 00:49:39 until charged
      Battery 1: Unknown, 0%, rate information unavailable
      
      Even if the ACPI battery where to function fine (which on systems
      where we have a native PMIC driver it often doesn't) we still do not
      want to export the same battery to userspace twice.
      
      This commit adds a blacklist with PMIC ACPI HIDs for which we've a
      native battery driver and makes the ACPI battery driver not register
      itself when a PMIC on this list is present.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=194811Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      dccfae6d
    • Hans de Goede's avatar
      ACPI / battery: Fix acpi_battery_exit on acpi_battery_init_async errors · bc39fbcf
      Hans de Goede authored
      The acpi_lock_battery_dir() / acpi_bus_register_driver() calls in
      acpi_battery_init_async() may fail.
      
      Check that they succeeded before undoing them.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      bc39fbcf
    • Hans de Goede's avatar
      ACPI / utils: Add new acpi_dev_present helper · 8661423e
      Hans de Goede authored
      acpi_dev_found just iterates over all ACPI-ids and sees if one matches.
      This means that it will return true for devices which are in the DSDT
      but disabled (their _STA method returns 0).
      
      For some drivers it is useful to be able to check if a certain HID
      is not only present in the namespace, but also actually present as in
      acpi_device_is_present() will return true for the device. For example
      because if a certain device is present then the driver will want to use
      an extcon or IIO ADC channel provided by that device.
      
      This commit adds a new acpi_dev_present helper which drivers can use
      to this end.
      
      Like acpi_dev_found, acpi_dev_present take a HID as argument, but
      it also has 2 extra optional arguments to only check for an ACPI
      device with a specific UID and/or HRV value. This makes it more
      generic and allows it to replace custom code doing similar checks
      in several places.
      
      Arguably acpi_dev_present is what acpi_dev_found should have been, but
      there are too many users to just change acpi_dev_found without the risk
      of breaking something.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Reviewed-by: default avatarLukas Wunner <lukas@wunner.de>
      Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      8661423e
    • Arnd Bergmann's avatar
      ACPI / power: Avoid maybe-uninitialized warning · fe8c470a
      Arnd Bergmann authored
      gcc -O2 cannot always prove that the loop in acpi_power_get_inferred_state()
      is enterered at least once, so it assumes that cur_state might not get
      initialized:
      
      drivers/acpi/power.c: In function 'acpi_power_get_inferred_state':
      drivers/acpi/power.c:222:9: error: 'cur_state' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      
      This sets the variable to zero at the start of the loop, to ensure that
      there is well-defined behavior even for an empty list. This gets rid of
      the warning.
      
      The warning first showed up when the -Os flag got removed in a bug fix
      patch in linux-4.11-rc5.
      
      I would suggest merging this addon patch on top of that bug fix to avoid
      introducing a new warning in the stable kernels.
      
      Fixes: 61b79e16 (ACPI: Fix incompatibility with mcount-based function graph tracing)
      Cc: All applicable <stable@vger.kernel.org>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      fe8c470a
  4. 16 Apr, 2017 8 commits
  5. 15 Apr, 2017 9 commits
    • Linus Torvalds's avatar
      Merge branch 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm · d5ff0814
      Linus Torvalds authored
      Pull nvdimm fixes from Dan Williams:
       "A small crop of lockdep, sleeping while atomic, and other fixes /
        band-aids in advance of the full-blown reworks targeting the next
        merge window. The largest change here is "libnvdimm: fix blk free
        space accounting" which deletes a pile of buggy code that better
        testing would have caught before merging. The next change that is
        borderline too big for a late rc is switching the device-dax locking
        from rcu to srcu, I couldn't think of a smaller way to make that fix.
      
        The __copy_user_nocache fix will have a full replacement in 4.12 to
        move those pmem special case considerations into the pmem driver. The
        "libnvdimm: band aid btt vs clear poison locking" commit admits that
        our error clearing support for btt went in broken, so we just disable
        it in 4.11 and -stable. A replacement / full fix is in the pipeline
        for 4.12
      
        Some of these would have been caught earlier had DEBUG_ATOMIC_SLEEP
        been enabled on my development station. I wonder if we should have:
      
            config DEBUG_ATOMIC_SLEEP
              default PROVE_LOCKING
      
        ...since I mistakenly thought I got both with PROVE_LOCKING=y.
      
        These have received a build success notification from the 0day robot,
        and some have appeared in a -next release with no reported issues"
      
      * 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
        x86, pmem: fix broken __copy_user_nocache cache-bypass assumptions
        device-dax: switch to srcu, fix rcu_read_lock() vs pte allocation
        libnvdimm: band aid btt vs clear poison locking
        libnvdimm: fix reconfig_mutex, mmap_sem, and jbd2_handle lockdep splat
        libnvdimm: fix blk free space accounting
        acpi, nfit, libnvdimm: fix interleave set cookie calculation (64-bit comparison)
      d5ff0814
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 403a39f8
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "This is seven small fixes which are all for user visible issues that
        fortunately only occur in rare circumstances.
      
        The most serious is the sr one in which QEMU can cause us to read
        beyond the end of a buffer (I don't think it's exploitable, but just
        in case).
      
        The next is the sd capacity fix which means all non 512 byte sector
        drives greater than 2TB fail to be correctly sized.
      
        The rest are either in new drivers (qedf) or on error legs"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: ipr: do not set DID_PASSTHROUGH on CHECK CONDITION
        scsi: aacraid: fix PCI error recovery path
        scsi: sd: Fix capacity calculation with 32-bit sector_t
        scsi: qla2xxx: Add fix to read correct register value for ISP82xx.
        scsi: qedf: Fix crash due to unsolicited FIP VLAN response.
        scsi: sr: Sanity check returned mode data
        scsi: sd: Consider max_xfer_blocks if opt_xfer_blocks is unusable
      403a39f8
    • Linus Torvalds's avatar
      Merge branch 'parisc-4.11-4' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux · be84a46c
      Linus Torvalds authored
      Pull parisc fix from Helge Deller:
       "Mikulas Patocka fixed a few bugs in our new pa_memcpy() assembler
        function, e.g. one bug made the kernel unbootable if source and
        destination address are the same"
      
      * 'parisc-4.11-4' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
        parisc: fix bugs in pa_memcpy
      be84a46c
    • Martin Brandenburg's avatar
      orangefs: free superblock when mount fails · 1ec1688c
      Martin Brandenburg authored
      Otherwise lockdep says:
      
      [ 1337.483798] ================================================
      [ 1337.483999] [ BUG: lock held when returning to user space! ]
      [ 1337.484252] 4.11.0-rc6 #19 Not tainted
      [ 1337.484423] ------------------------------------------------
      [ 1337.484626] mount/14766 is leaving the kernel with locks still held!
      [ 1337.484841] 1 lock held by mount/14766:
      [ 1337.485017]  #0:  (&type->s_umount_key#33/1){+.+.+.}, at: [<ffffffff8124171f>] sget_userns+0x2af/0x520
      
      Caught by xfstests generic/413 which tried to mount with the unsupported
      mount option dax.  Then xfstests generic/422 ran sync which deadlocks.
      Signed-off-by: default avatarMartin Brandenburg <martin@omnibond.com>
      Acked-by: default avatarMike Marshall <hubcap@omnibond.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1ec1688c
    • Linus Torvalds's avatar
      vfs: don't do RCU lookup of empty pathnames · c0eb027e
      Linus Torvalds authored
      Normal pathname lookup doesn't allow empty pathnames, but using
      AT_EMPTY_PATH (with name_to_handle_at() or fstatat(), for example) you
      can trigger an empty pathname lookup.
      
      And not only is the RCU lookup in that case entirely unnecessary
      (because we'll obviously immediately finalize the end result), it is
      actively wrong.
      
      Why? An empth path is a special case that will return the original
      'dirfd' dentry - and that dentry may not actually be RCU-free'd,
      resulting in a potential use-after-free if we were to initialize the
      path lazily under the RCU read lock and depend on complete_walk()
      finalizing the dentry.
      
      Found by syzkaller and KASAN.
      Reported-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Reported-by: default avatarVegard Nossum <vegard.nossum@gmail.com>
      Acked-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c0eb027e
    • Mikulas Patocka's avatar
      parisc: fix bugs in pa_memcpy · 409c1b25
      Mikulas Patocka authored
      The patch 554bfece ("parisc: Fix access
      fault handling in pa_memcpy()") reimplements the pa_memcpy function.
      Unfortunatelly, it makes the kernel unbootable. The crash happens in the
      function ide_complete_cmd where memcpy is called with the same source
      and destination address.
      
      This patch fixes a few bugs in pa_memcpy:
      
      * When jumping to .Lcopy_loop_16 for the first time, don't skip the
        instruction "ldi 31,t0" (this bug made the kernel unbootable)
      * Use the COND macro when comparing length, so that the comparison is
        64-bit (a theoretical issue, in case the length is greater than
        0xffffffff)
      * Don't use the COND macro after the "extru" instruction (the PA-RISC
        specification says that the upper 32-bits of extru result are undefined,
        although they are set to zero in practice)
      * Fix exception addresses in .Lcopy16_fault and .Lcopy8_fault
      * Rename .Lcopy_loop_4 to .Lcopy_loop_8 (so that it is consistent with
        .Lcopy8_fault)
      
      Cc: <stable@vger.kernel.org> # v4.9+
      Fixes: 554bfece ("parisc: Fix access fault handling in pa_memcpy()")
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      409c1b25
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input · 1bf4b126
      Linus Torvalds authored
      Pull input fixes from Dmitry Torokhov:
       "Just a small update to xpad driver to recognize yet another gamepad,
        and another change making sure userio.h is exported"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
        Input: xpad - add support for Razer Wildcat gamepad
        uapi: add missing install of userio.h
      1bf4b126
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 7e703ecc
      Linus Torvalds authored
      Pull networking fixes from David Miller:
       "Things seem to be settling down as far as networking is concerned,
        let's hope this trend continues...
      
         1) Add iov_iter_revert() and use it to fix the behavior of
            skb_copy_datagram_msg() et al., from Al Viro.
      
         2) Fix the protocol used in the synthetic SKB we cons up for the
            purposes of doing a simulated route lookup for RTM_GETROUTE
            requests. From Florian Larysch.
      
         3) Don't add noop_qdisc to the per-device qdisc hashes, from Cong
            Wang.
      
         4) Don't call netdev_change_features with the team lock held, from
            Xin Long.
      
         5) Revert TCP F-RTO extension to catch more spurious timeouts because
            it interacts very badly with some middle-boxes. From Yuchung
            Cheng.
      
         6) Fix the loss of error values in l2tp {s,g}etsockopt calls, from
            Guillaume Nault.
      
         7) ctnetlink uses bit positions where it should be using bit masks,
            fix from Liping Zhang.
      
         8) Missing RCU locking in netfilter helper code, from Gao Feng.
      
         9) Avoid double frees and use-after-frees in tcp_disconnect(), from
            Eric Dumazet.
      
        10) Don't do a changelink before we register the netdevice in
            bridging, from Ido Schimmel.
      
        11) Lock the ipv6 device address list properly, from Rabin Vincent"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (29 commits)
        netfilter: ipt_CLUSTERIP: Fix wrong conntrack netns refcnt usage
        netfilter: nft_hash: do not dump the auto generated seed
        drivers: net: usb: qmi_wwan: add QMI_QUIRK_SET_DTR for Telit PID 0x1201
        ipv6: Fix idev->addr_list corruption
        net: xdp: don't export dev_change_xdp_fd()
        bridge: netlink: register netdevice before executing changelink
        bridge: implement missing ndo_uninit()
        bpf: reference may_access_skb() from __bpf_prog_run()
        tcp: clear saved_syn in tcp_disconnect()
        netfilter: nf_ct_expect: use proper RCU list traversal/update APIs
        netfilter: ctnetlink: skip dumping expect when nfct_help(ct) is NULL
        netfilter: make it safer during the inet6_dev->addr_list traversal
        netfilter: ctnetlink: make it safer when checking the ct helper name
        netfilter: helper: Add the rcu lock when call __nf_conntrack_helper_find
        netfilter: ctnetlink: using bit to represent the ct event
        netfilter: xt_TCPMSS: add more sanity tests on tcph->doff
        net: tcp: Increase TCP_MIB_OUTRSTS even though fail to alloc skb
        l2tp: don't mask errors in pppol2tp_getsockopt()
        l2tp: don't mask errors in pppol2tp_setsockopt()
        tcp: restrict F-RTO to work-around broken middle-boxes
        ...
      7e703ecc
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 91174391
      Linus Torvalds authored
      Pull x86 fixes from Thomas Gleixner:
       "A set of small fixes for x86:
      
         - fix locking in RDT to prevent memory leaks and freeing in use
           memory
      
         - prevent setting invalid values for vdso32_enabled which cause
           inconsistencies for user space resulting in application crashes.
      
         - plug a race in the vdso32 code between fork and sysctl which causes
           inconsistencies for user space resulting in application crashes.
      
         - make MPX signal delivery work in compat mode
      
         - make the dmesg output of traps and faults readable again"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/intel_rdt: Fix locking in rdtgroup_schemata_write()
        x86/debug: Fix the printk() debug output of signal_fault(), do_trap() and do_general_protection()
        x86/vdso: Plug race between mapping and ELF header setup
        x86/vdso: Ensure vdso32_enabled gets set to valid values only
        x86/signals: Fix lower/upper bound reporting in compat siginfo
      91174391
  6. 14 Apr, 2017 15 commits
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 07c7016d
      Linus Torvalds authored
      Pull perf fixes from Thomas Gleixner:
       "Two small fixes for perf:
      
         - the move to support cross arch annotation introduced per arch
           initialization requirements, fullfill them for s/390 (Christian
           Borntraeger)
      
         - add the missing initialization to the LBR entries to avoid exposing
           random or stale data"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf/x86: Avoid exposing wrong/stale data in intel_pmu_lbr_read_32()
        perf annotate s390: Fix perf annotate error -95 (4.10 regression)
      07c7016d
    • Linus Torvalds's avatar
      Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · d295917a
      Linus Torvalds authored
      Pull irq fixes from Thomas Gleixner:
       "The irq department provides:
      
         - two fixes for the CPU affinity spread infrastructure to prevent
           unbalanced spreading in corner cases which leads to horrible
           performance, because interrupts are rather aggregated than spread
      
         - add a missing spinlock initializer in the imx-gpcv2 init code"
      
      * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        irqchip/irq-imx-gpcv2: Fix spinlock initialization
        irq/affinity: Fix extra vecs calculation
        irq/affinity: Fix CPU spread for unbalanced nodes
      d295917a
    • Linus Torvalds's avatar
      Merge branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · f399ecb4
      Linus Torvalds authored
      Pull EFI fixes from Thomas Gleixner:
       "Three fixes from EFI land:
      
         - prevent accessing a Graphic Output Device (GOP) which the kernel
           does not know to handle
      
         - prevent PCI reconfiguration to modify a BAR which covers the
           framebuffer because that's already in use through the EFI GOP
           interface
      
         - avoid reserving EFI runtime regions as this results in bogus memory
           mappings"
      
      * 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/efi: Don't try to reserve runtime regions
        efi/fb: Avoid reconfiguration of BAR that covers the framebuffer
        efi/libstub: Skip GOP with PIXEL_BLT_ONLY format
      f399ecb4
    • Linus Torvalds's avatar
      Merge branch 'for-linus-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs · 4b31ac48
      Linus Torvalds authored
      Pull btrfs fixes from Chris Mason:
       "Dave Sterba collected a few more fixes for the last rc.
      
        These aren't marked for stable, but I'm putting them in with a batch
        were testing/sending by hand for this release"
      
      * 'for-linus-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
        Btrfs: fix potential use-after-free for cloned bio
        Btrfs: fix segmentation fault when doing dio read
        Btrfs: fix invalid dereference in btrfs_retry_endio
        btrfs: drop the nossd flag when remounting with -o ssd
      4b31ac48
    • Linus Torvalds's avatar
      Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6 · 5466f4df
      Linus Torvalds authored
      Pull more CIFS fixes from Steve French:
       "As promised, here is the remaining set of cifs/smb3 fixes for stable
        (and a fix for one regression) now that they have had additional
        review and testing"
      
      * 'for-next' of git://git.samba.org/sfrench/cifs-2.6:
        CIFS: Fix SMB3 mount without specifying a security mechanism
        CIFS: store results of cifs_reopen_file to avoid infinite wait
        CIFS: remove bad_network_name flag
        CIFS: reconnect thread reschedule itself
        CIFS: handle guest access errors to Windows shares
        CIFS: Fix null pointer deref during read resp processing
      5466f4df
    • Steven Rostedt (VMware)'s avatar
      ftrace: Fix removing of second function probe · 82cc4fc2
      Steven Rostedt (VMware) authored
      When two function probes are added to set_ftrace_filter, and then one of
      them is removed, the update to the function locations is not performed, and
      the record keeping of the function states are corrupted, and causes an
      ftrace_bug() to occur.
      
      This is easily reproducable by adding two probes, removing one, and then
      adding it back again.
      
       # cd /sys/kernel/debug/tracing
       # echo schedule:traceoff > set_ftrace_filter
       # echo do_IRQ:traceoff > set_ftrace_filter
       # echo \!do_IRQ:traceoff > /debug/tracing/set_ftrace_filter
       # echo do_IRQ:traceoff > set_ftrace_filter
      
      Causes:
       ------------[ cut here ]------------
       WARNING: CPU: 2 PID: 1098 at kernel/trace/ftrace.c:2369 ftrace_get_addr_curr+0x143/0x220
       Modules linked in: [...]
       CPU: 2 PID: 1098 Comm: bash Not tainted 4.10.0-test+ #405
       Hardware name: Hewlett-Packard HP Compaq Pro 6300 SFF/339A, BIOS K01 v02.05 05/07/2012
       Call Trace:
        dump_stack+0x68/0x9f
        __warn+0x111/0x130
        ? trace_irq_work_interrupt+0xa0/0xa0
        warn_slowpath_null+0x1d/0x20
        ftrace_get_addr_curr+0x143/0x220
        ? __fentry__+0x10/0x10
        ftrace_replace_code+0xe3/0x4f0
        ? ftrace_int3_handler+0x90/0x90
        ? printk+0x99/0xb5
        ? 0xffffffff81000000
        ftrace_modify_all_code+0x97/0x110
        arch_ftrace_update_code+0x10/0x20
        ftrace_run_update_code+0x1c/0x60
        ftrace_run_modify_code.isra.48.constprop.62+0x8e/0xd0
        register_ftrace_function_probe+0x4b6/0x590
        ? ftrace_startup+0x310/0x310
        ? debug_lockdep_rcu_enabled.part.4+0x1a/0x30
        ? update_stack_state+0x88/0x110
        ? ftrace_regex_write.isra.43.part.44+0x1d3/0x320
        ? preempt_count_sub+0x18/0xd0
        ? mutex_lock_nested+0x104/0x800
        ? ftrace_regex_write.isra.43.part.44+0x1d3/0x320
        ? __unwind_start+0x1c0/0x1c0
        ? _mutex_lock_nest_lock+0x800/0x800
        ftrace_trace_probe_callback.isra.3+0xc0/0x130
        ? func_set_flag+0xe0/0xe0
        ? __lock_acquire+0x642/0x1790
        ? __might_fault+0x1e/0x20
        ? trace_get_user+0x398/0x470
        ? strcmp+0x35/0x60
        ftrace_trace_onoff_callback+0x48/0x70
        ftrace_regex_write.isra.43.part.44+0x251/0x320
        ? match_records+0x420/0x420
        ftrace_filter_write+0x2b/0x30
        __vfs_write+0xd7/0x330
        ? do_loop_readv_writev+0x120/0x120
        ? locks_remove_posix+0x90/0x2f0
        ? do_lock_file_wait+0x160/0x160
        ? __lock_is_held+0x93/0x100
        ? rcu_read_lock_sched_held+0x5c/0xb0
        ? preempt_count_sub+0x18/0xd0
        ? __sb_start_write+0x10a/0x230
        ? vfs_write+0x222/0x240
        vfs_write+0xef/0x240
        SyS_write+0xab/0x130
        ? SyS_read+0x130/0x130
        ? trace_hardirqs_on_caller+0x182/0x280
        ? trace_hardirqs_on_thunk+0x1a/0x1c
        entry_SYSCALL_64_fastpath+0x18/0xad
       RIP: 0033:0x7fe61c157c30
       RSP: 002b:00007ffe87890258 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
       RAX: ffffffffffffffda RBX: ffffffff8114a410 RCX: 00007fe61c157c30
       RDX: 0000000000000010 RSI: 000055814798f5e0 RDI: 0000000000000001
       RBP: ffff8800c9027f98 R08: 00007fe61c422740 R09: 00007fe61ca53700
       R10: 0000000000000073 R11: 0000000000000246 R12: 0000558147a36400
       R13: 00007ffe8788f160 R14: 0000000000000024 R15: 00007ffe8788f15c
        ? trace_hardirqs_off_caller+0xc0/0x110
       ---[ end trace 99fa09b3d9869c2c ]---
       Bad trampoline accounting at: ffffffff81cc3b00 (do_IRQ+0x0/0x150)
      
      Cc: stable@vger.kernel.org
      Fixes: 59df055f ("ftrace: trace different functions with a different tracer")
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      82cc4fc2
    • Ming Lei's avatar
      block: fix bio_will_gap() for first bvec with offset · 5a8d75a1
      Ming Lei authored
      Commit 729204ef("block: relax check on sg gap") allows us to merge
      bios, if both are physically contiguous.  This change can merge a huge
      number of small bios, through mkfs for example, mkfs.ntfs running time
      can be decreased to ~1/10.
      
      But if one rq starts with a non-aligned buffer (the 1st bvec's bv_offset
      is non-zero) and if we allow the merge, it is quite difficult to respect
      sg gap limit, especially the max segment size, or we risk having an
      unaligned virtual boundary.  This patch tries to avoid the issue by
      disallowing a merge, if the req starts with an unaligned buffer.
      
      Also add comments to explain why the merged segment can't end in
      unaligned virt boundary.
      
      Fixes: 729204ef ("block: relax check on sg gap")
      Tested-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
      Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      
      Rewrote parts of the commit message and comments.
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      5a8d75a1
    • Linus Torvalds's avatar
      Merge tag 'fbdev-v4.11-rc6' of git://github.com/bzolnier/linux · 82f1faa8
      Linus Torvalds authored
      Pull fbdev fixes from Bartlomiej Zolnierkiewicz:
      
       - fix probing time checks in omapfb driver (regression fix)
      
       - fix optional VBAT support in ssd1307fb driver (regression fix)
      
       - fix connecting to backend in xen-fbfront driver
      
      * tag 'fbdev-v4.11-rc6' of git://github.com/bzolnier/linux:
        fbdev: omapfb: delete check_required_callbacks()
        xen, fbfront: fix connecting to backend
        fbdev/ssd1307fb: fix optional VBAT support
      82f1faa8
    • Linus Torvalds's avatar
      Merge tag 'pm-4.11-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · e16d8b6e
      Linus Torvalds authored
      Pull power management fixes from Rafael Wysocki:
       "These fix a cpufreq core regression related to CPU online/offline and
        several issues in the turbostat and cpupower utilities.
      
        Specifics:
      
         - Allow CPUs to be put back online even if the cpufreq driver is
           unable to work with them (eg. due to missing information from
           platform firmware), which was the previous behavior expected by
           users, but changed in the 4.9 time frame (Chen Yu).
      
         - Fix a few minor issues in the turbostat utility, introduced mostly
           during the recent update of it (Len Brown, Doug Smythies).
      
         - Fix a cpupower utility bug causing it to report incorrect values
           for turbo frequencies in some cases (Ben Hutchings)"
      
      * tag 'pm-4.11-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        cpupower: Fix turbo frequency reporting for pre-Sandy Bridge cores
        cpufreq: Bring CPUs up even if cpufreq_online() failed
        tools/power turbostat: update version number
        tools/power turbostat: fix impossibly large CPU%c1 value
        tools/power turbostat: turbostat.8 add missing column definitions
        tools/power turbostat: update HWP dump to decimal from hex
        tools/power turbostat: enable package THERM_INTERRUPT dump
        tools/power turbostat: show missing Core and GFX power on SKL and KBL
        tools/power turbostat: bugfix: GFXMHz column not changing
      e16d8b6e
    • Linus Torvalds's avatar
      Merge tag 'acpi-4.11-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 321ae379
      Linus Torvalds authored
      Pull ACPI fixes from Rafael Wysocki:
      
       "These revert a recent ACPICA commit that turned out to be problematic
        and fix a device enumeration breakage from the 4.8 cycle.
      
        Specifics:
      
         - Revert a recent ACPICA commit targeted at catching firmware bugs
           which promptly did that and caused functional problems to appear
           (Rafael Wysocki).
      
         - Fix a device enumeration problem introduced in the 4.8 time frame
           which caused the ACPI docking station driver to report incorrect
           status via sysfs among other things (Rafael Wysocki)"
      
      * tag 'acpi-4.11-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        Revert "ACPICA: Resources: Not a valid resource if buffer length too long"
        ACPI / scan: Set the visited flag for all enumerated devices
      321ae379
    • Linus Torvalds's avatar
      Merge tag 'devmem-v4.11-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · 1882e562
      Linus Torvalds authored
      Pull CONFIG_STRICT_DEVMEM fix from Kees Cook:
       "Fixes /dev/mem to read back zeros for System RAM areas in the 1MB
        exception area on x86 to avoid exposing RAM or tripping hardened
        usercopy"
      
      * tag 'devmem-v4.11-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        mm: Tighten x86 /dev/mem with zeroing reads
      1882e562
    • Linus Torvalds's avatar
      Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost · 78739333
      Linus Torvalds authored
      Pull virtio fixes from Michael S. Tsirkin:
       "virtio oops fixes
      
        The virtio pci rework using shared interrupts caused a lot of issues.
        We tried to fix them but run out of time. Revert for now, and revisit
        the issue for the next kernel.
      
        Luckily we are able to do this without loosing automatic interrupt
        NUMA affinity which was the main motivator for the rework"
      
      * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
        virtio-pci: Remove affinity hint before freeing the interrupt
        Revert "virtio_pci: remove struct virtio_pci_vq_info"
        Revert "virtio_pci: use shared interrupts for virtqueues"
        Revert "virtio_pci: don't duplicate the msix_enable flag in struct pci_dev"
        Revert "virtio_pci: simplify MSI-X setup"
        Revert "virtio_pci: fix out of bound access for msix_names"
        MAINTAINERS: fix virtio file pattern
        virtio_console: fix uninitialized variable use
        virtio_net: clear MTU when out of range
        virtio: allow drivers to validate features
        virtio_net: enable big packets for large MTU values
      78739333
    • David S. Miller's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf · f4c13c8e
      David S. Miller authored
      Pablo Neira Ayuso says:
      
      ====================
      Netfilter fixes for net
      
      The following patchset contains Netfilter fixes for your net tree,
      they are:
      
      1) Missing TCP header sanity check in TCPMSS target, from Eric Dumazet.
      
      2) Incorrect event message type for related conntracks created via
         ctnetlink, from Liping Zhang.
      
      3) Fix incorrect rcu locking when handling helpers from ctnetlink,
         from Gao feng.
      
      4) Fix missing rcu locking when updating helper, from Liping Zhang.
      
      5) Fix missing read_lock_bh when iterating over list of device addresses
         from TPROXY and redirect, also from Liping.
      
      6) Fix crash when trying to dump expectations from conntrack with no
         helper via ctnetlink, from Liping.
      
      7) Missing RCU protection to expecation list update given ctnetlink
         iterates over the list under rcu read lock side, from Liping too.
      
      8) Don't dump autogenerated seed in nft_hash to userspace, this is
         very confusing to the user, again from Liping.
      
      9) Fix wrong conntrack netns module refcount in ipt_CLUSTERIP,
         from Gao feng.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f4c13c8e
    • Aaro Koskinen's avatar
      fbdev: omapfb: delete check_required_callbacks() · e68d490d
      Aaro Koskinen authored
      Commit 561eb9d0 ("fbdev: omap/lcd: Make callbacks optional") made
      panel callbacks optional but forgot to update check_required_callbacks().
      As a result many (all?) OMAP systems using omapfb will crash at boot.
      Fix by deleting the whole function.
      
      Fixes: 561eb9d0 ("fbdev: omap/lcd: Make callbacks optional")
      Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
      Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
      Cc: Lars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
      e68d490d
    • Rafael J. Wysocki's avatar
      Merge branches 'acpi-scan-fixes' and 'acpica-fixes' · f83e13f9
      Rafael J. Wysocki authored
      * acpi-scan-fixes:
        ACPI / scan: Set the visited flag for all enumerated devices
      
      * acpica-fixes:
        Revert "ACPICA: Resources: Not a valid resource if buffer length too long"
      f83e13f9