1. 09 Mar, 2018 1 commit
    • Boqun Feng's avatar
      rtmutex: Make rt_mutex_futex_unlock() safe for irq-off callsites · 6b0ef92f
      Boqun Feng authored
      When running rcutorture with TREE03 config, CONFIG_PROVE_LOCKING=y, and
      kernel cmdline argument "rcutorture.gp_exp=1", lockdep reports a
      HARDIRQ-safe->HARDIRQ-unsafe deadlock:
      
       ================================
       WARNING: inconsistent lock state
       4.16.0-rc4+ #1 Not tainted
       --------------------------------
       inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
       takes:
       __schedule+0xbe/0xaf0
       {IN-HARDIRQ-W} state was registered at:
         _raw_spin_lock+0x2a/0x40
         scheduler_tick+0x47/0xf0
      ...
       other info that might help us debug this:
        Possible unsafe locking scenario:
              CPU0
              ----
         lock(&rq->lock);
         <Interrupt>
           lock(&rq->lock);
        *** DEADLOCK ***
       1 lock held by rcu_torture_rea/724:
       rcu_torture_read_lock+0x0/0x70
       stack backtrace:
       CPU: 2 PID: 724 Comm: rcu_torture_rea Not tainted 4.16.0-rc4+ #1
       Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-20171110_100015-anatol 04/01/2014
       Call Trace:
        lock_acquire+0x90/0x200
        ? __schedule+0xbe/0xaf0
        _raw_spin_lock+0x2a/0x40
        ? __schedule+0xbe/0xaf0
        __schedule+0xbe/0xaf0
        preempt_schedule_irq+0x2f/0x60
        retint_kernel+0x1b/0x2d
       RIP: 0010:rcu_read_unlock_special+0x0/0x680
        ? rcu_torture_read_unlock+0x60/0x60
        __rcu_read_unlock+0x64/0x70
        rcu_torture_read_unlock+0x17/0x60
        rcu_torture_reader+0x275/0x450
        ? rcutorture_booster_init+0x110/0x110
        ? rcu_torture_stall+0x230/0x230
        ? kthread+0x10e/0x130
        kthread+0x10e/0x130
        ? kthread_create_worker_on_cpu+0x70/0x70
        ? call_usermodehelper_exec_async+0x11a/0x150
        ret_from_fork+0x3a/0x50
      
      This happens with the following even sequence:
      
      	preempt_schedule_irq();
      	  local_irq_enable();
      	  __schedule():
      	    local_irq_disable(); // irq off
      	    ...
      	    rcu_note_context_switch():
      	      rcu_note_preempt_context_switch():
      	        rcu_read_unlock_special():
      	          local_irq_save(flags);
      	          ...
      		  raw_spin_unlock_irqrestore(...,flags); // irq remains off
      	          rt_mutex_futex_unlock():
      	            raw_spin_lock_irq();
      	            ...
      	            raw_spin_unlock_irq(); // accidentally set irq on
      
      	    <return to __schedule()>
      	    rq_lock():
      	      raw_spin_lock(); // acquiring rq->lock with irq on
      
      which means rq->lock becomes a HARDIRQ-unsafe lock, which can cause
      deadlocks in scheduler code.
      
      This problem was introduced by commit 02a7c234 ("rcu: Suppress
      lockdep false-positive ->boost_mtx complaints"). That brought the user
      of rt_mutex_futex_unlock() with irq off.
      
      To fix this, replace the *lock_irq() in rt_mutex_futex_unlock() with
      *lock_irq{save,restore}() to make it safe to call rt_mutex_futex_unlock()
      with irq off.
      
      Fixes: 02a7c234 ("rcu: Suppress lockdep false-positive ->boost_mtx complaints")
      Signed-off-by: default avatarBoqun Feng <boqun.feng@gmail.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Lai Jiangshan <jiangshanlai@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Josh Triplett <josh@joshtriplett.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
      Link: https://lkml.kernel.org/r/20180309065630.8283-1-boqun.feng@gmail.com
      6b0ef92f
  2. 08 Mar, 2018 2 commits
  3. 07 Mar, 2018 7 commits
    • Arkadiusz Hiler's avatar
      Revert "Input: synaptics - Lenovo Thinkpad T460p devices should use RMI" · 5444a992
      Arkadiusz Hiler authored
      This reverts commit 48282969 which
      caused the following issues:
      
      1. On T460p with BIOS version 2.22 touchpad and trackpoint stop working
      after suspend-resume cycle. Due to strange state of the device another
      suspend is impossible.
      
      The following dmesg errors can be observed:
      thinkpad_acpi: EC reports that Thermal Table has changed
      rmi4_smbus 7-002c: failed to get SMBus version number!
      rmi4_physical rmi4-00: rmi_driver_reset_handler: Failed to read current IRQ mask.
      rmi4_f01 rmi4-00.fn01: Failed to restore normal operation: -16.
      rmi4_f01 rmi4-00.fn01: Resume failed with code -16.
      rmi4_physical rmi4-00: Failed to suspend functions: -16
      rmi4_smbus 7-002c: Failed to resume device: -16
      PM: resume devices took 0.640 seconds
      rmi4_f03 rmi4-00.fn03: rmi_f03_pt_write: Failed to write to F03 TX register (-16).
      rmi4_physical rmi4-00: rmi_driver_clear_irq_bits: Failed to change enabled interrupts!
      rmi4_physical rmi4-00: rmi_driver_set_irq_bits: Failed to change enabled interrupts!
      psmouse: probe of serio3 failed with error -1
      
      2. On another T460p with BIOS version 2.15 two finger scrolling gesture
      on the touchpad stops working after suspend-resume cycle (about 75%
      reproducibility, when it still works, the scrolling gesture becomes
      laggy). Nothing suspicious appears in the dmesg.
      
      Analysis form Richard Schütz:
      
      "RMI is unreliable on the ThinkPad T460p because the device is affected
      by the firmware behavior addressed in a7ae8195 ("i2c: i801: Allow
      ACPI SystemIO OpRegion to conflict with PCI BAR")."
      
      The affected devices often show:
      
      i801_smbus 0000:00:1f.4: BIOS is accessing SMBus registers
      i801_smbus 0000:00:1f.4: Driver SMBus register access inhibited
      Reported-by: default avatarRichard Schütz <rschuetz@uni-koblenz.de>
      Signed-off-by: default avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
      Tested-by: default avatarMartin Peres <martin.peres@linux.intel.com>
      Tested-by: default avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      5444a992
    • Linus Torvalds's avatar
      Merge tag 'gfs2-4.16.rc4.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2 · ea9b5ee3
      Linus Torvalds authored
      Pull gfs2 fix from Bob Peterson:
       "An additional patch from Andreas Gruenbacher that fixes another
        unfortunate GFS2 regression"
      
      * tag 'gfs2-4.16.rc4.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2:
        gfs2: Fixes to "Implement iomap for block_map" (2)
      ea9b5ee3
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · 69f39c57
      Linus Torvalds authored
      Pull s390 fixes from Martin Schwidefsky:
       "Nine bug fixes for s390:
      
         - Three fixes for the expoline code, one of them is strictly speaking
           a cleanup but as it relates to code added with 4.16 I would like to
           include the patch.
      
         - Three timer related fixes in the common I/O layer
      
         - A fix for the handling of internal DASD request which could cause
           panics.
      
         - One correction in regard to the accounting of pud page tables vs.
           compat tasks.
      
         - The register scrubbing in entry.S caused spurious crashes, this is
           fixed now as well"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        s390/entry.S: fix spurious zeroing of r0
        s390: Fix runtime warning about negative pgtables_bytes
        s390: do not bypass BPENTER for interrupt system calls
        s390/cio: clear timer when terminating driver I/O
        s390/cio: fix return code after missing interrupt
        s390/cio: fix ccw_device_start_timeout API
        s390/clean-up: use CFI_* macros in entry.S
        s390: Replace IS_ENABLED(EXPOLINE_*) with IS_ENABLED(CONFIG_EXPOLINE_*)
        s390/dasd: fix handling of internal requests
      69f39c57
    • Linus Torvalds's avatar
      Merge tag 'regulator-fix-v4.16-rc4' of... · b910a918
      Linus Torvalds authored
      Merge tag 'regulator-fix-v4.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
      
      Pull regulator fixes from Mark Brown:
       "A couple of fixes here:
      
         - another half of the supend to idle fix from Geert that went in
           earlier, both he and I are confused as to why he didn't notice that
           this was missing when his earlier fix was merged.
      
         - a simple fix for a test done the wrong way round in the
           stm32-vrefbuf driver"
      
      * tag 'regulator-fix-v4.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
        regulator: Fix resume from suspend to idle
        regulator: stm32-vrefbuf: fix check on ready flag
      b910a918
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · be75b1b8
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "This is mostly fixes for driver specific issues (nine of them) and the
        storvsc performance improvement with interrupt handling which was
        dropped from the previous fixes pull request.
      
        We also have two regressions: one is a double call_rcu() in ATA error
        handling and the other is a missed conversion to BLK_STS_OK in
        __scsi_error_from_host_byte()"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: qedi: Fix kernel crash during port toggle
        scsi: qla2xxx: Fix FC-NVMe LUN discovery
        scsi: core: return BLK_STS_OK for DID_OK in __scsi_error_from_host_byte()
        scsi: core: Avoid that ATA error handling can trigger a kernel hang or oops
        scsi: qla2xxx: ensure async flags are reset correctly
        scsi: qla2xxx: do not check login_state if no loop id is assigned
        scsi: qla2xxx: Fixup locking for session deletion
        scsi: qla2xxx: Fix NULL pointer crash due to active timer for ABTS
        scsi: mpt3sas: wait for and flush running commands on shutdown/unload
        scsi: mpt3sas: fix oops in error handlers after shutdown/unload
        scsi: storvsc: Spread interrupts when picking a channel for I/O requests
        scsi: megaraid_sas: Do not use 32-bit atomic request descriptor for Ventura controllers
      be75b1b8
    • Andreas Gruenbacher's avatar
      gfs2: Fixes to "Implement iomap for block_map" (2) · 3b5da96e
      Andreas Gruenbacher authored
      It turns out that commit 3229c18c0d6b2 'Fixes to "Implement iomap for
      block_map"' introduced another bug in gfs2_iomap_begin that can cause
      gfs2_block_map to set bh->b_size of an actual buffer to 0.  This can
      lead to arbitrary incorrect behavior including crashes or disk
      corruption.  Revert the incorrect part of that commit.
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      3b5da96e
    • Mark Brown's avatar
      Merge remote-tracking branches 'regulator/fix/resume' and... · 82a917c5
      Mark Brown authored
      Merge remote-tracking branches 'regulator/fix/resume' and 'regulator/fix/stm32-vfrefbuf' into regulator-linus
      82a917c5
  4. 06 Mar, 2018 5 commits
  5. 05 Mar, 2018 18 commits
  6. 04 Mar, 2018 7 commits
    • Guillaume Nault's avatar
      ppp: prevent unregistered channels from connecting to PPP units · 77f840e3
      Guillaume Nault authored
      PPP units don't hold any reference on the channels connected to it.
      It is the channel's responsibility to ensure that it disconnects from
      its unit before being destroyed.
      In practice, this is ensured by ppp_unregister_channel() disconnecting
      the channel from the unit before dropping a reference on the channel.
      
      However, it is possible for an unregistered channel to connect to a PPP
      unit: register a channel with ppp_register_net_channel(), attach a
      /dev/ppp file to it with ioctl(PPPIOCATTCHAN), unregister the channel
      with ppp_unregister_channel() and finally connect the /dev/ppp file to
      a PPP unit with ioctl(PPPIOCCONNECT).
      
      Once in this situation, the channel is only held by the /dev/ppp file,
      which can be released at anytime and free the channel without letting
      the parent PPP unit know. Then the ppp structure ends up with dangling
      pointers in its ->channels list.
      
      Prevent this scenario by forbidding unregistered channels from
      connecting to PPP units. This maintains the code logic by keeping
      ppp_unregister_channel() responsible from disconnecting the channel if
      necessary and avoids modification on the reference counting mechanism.
      
      This issue seems to predate git history (successfully reproduced on
      Linux 2.6.26 and earlier PPP commits are unrelated).
      Signed-off-by: default avatarGuillaume Nault <g.nault@alphalink.fr>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      77f840e3
    • Davide Caratti's avatar
      tc-testing: skbmod: fix match value of ethertype · 79f3a8e6
      Davide Caratti authored
      iproute2 print_skbmod() prints the configured ethertype using format 0x%X:
      therefore, test 9aa8 systematically fails, because it configures action #4
      using ethertype 0x0031, and expects 0x0031 when it reads it back. Changing
      the expected value to 0x31 lets the test result 'not ok' become 'ok'.
      
      tested with:
       # ./tdc.py -e 9aa8
       Test 9aa8: Get a single skbmod action from a list
       All test results:
      
       1..1
       ok 1 9aa8 Get a single skbmod action from a list
      
      Fixes: cf797ac4 ("tc-testing: Add test cases for police and skbmod")
      Signed-off-by: default avatarDavide Caratti <dcaratti@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      79f3a8e6
    • Shalom Toledo's avatar
      mlxsw: spectrum_switchdev: Check success of FDB add operation · 0a8a1bf1
      Shalom Toledo authored
      Until now, we assumed that in case of error when adding FDB entries, the
      write operation will fail, but this is not the case. Instead, we need to
      check that the number of entries reported in the response is equal to
      the number of entries specified in the request.
      
      Fixes: 56ade8fe ("mlxsw: spectrum: Add initial support for Spectrum ASIC")
      Reported-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarShalom Toledo <shalomt@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>
      0a8a1bf1
    • Linus Torvalds's avatar
      Linux 4.16-rc4 · 661e50bc
      Linus Torvalds authored
      661e50bc
    • David S. Miller's avatar
      Merge branch 'GSO_BY_FRAGS-correctness-improvements' · 19f6484f
      David S. Miller authored
      Daniel Axtens says:
      
      ====================
      GSO_BY_FRAGS correctness improvements
      
      As requested [1], I went through and had a look at users of gso_size to
      see if there were things that need to be fixed to consider
      GSO_BY_FRAGS, and I have tried to improve our helper functions to deal
      with this case.
      
      I found a few. This fixes bugs relating to the use of
      skb_gso_*_seglen() where GSO_BY_FRAGS is not considered.
      
      Patch 1 renames skb_gso_validate_mtu to skb_gso_validate_network_len.
      This is follow-up to my earlier patch 2b16f048 ("net: create
      skb_gso_validate_mac_len()"), and just makes everything a bit clearer.
      
      Patches 2 and 3 replace the final users of skb_gso_network_seglen() -
      which doesn't consider GSO_BY_FRAGS - with
      skb_gso_validate_network_len(), which does. This allows me to make the
      skb_gso_*_seglen functions private in patch 4 - now future users won't
      accidentally do the wrong comparison.
      
      Two things remain. One is qdisc_pkt_len_init, which is discussed at
      [2] - it's caught up in the GSO_DODGY mess. I don't have any expertise
      in GSO_DODGY, and it looks like a good clean fix will involve
      unpicking the whole validation mess, so I have left it for now.
      
      Secondly, there are 3 eBPF opcodes that change the gso_size of an SKB
      and don't consider GSO_BY_FRAGS. This is going through the bpf tree.
      
      Regards,
      Daniel
      
      [1] https://patchwork.ozlabs.org/comment/1852414/
      [2] https://www.spinics.net/lists/netdev/msg482397.html
      
      PS: This is all in the core networking stack. For a driver to be
      affected by this it would need to support NETIF_F_GSO_SCTP /
      NETIF_F_GSO_SOFTWARE and then either use gso_size or not be a purely
      virtual device. (Many drivers look at gso_size, but do not support
      SCTP segmentation, so the core network will segment an SCTP gso before
      it hits them.) Based on that, the only driver that may be affected is
      sunvnet, but I have no way of testing it, so I haven't looked at it.
      
      v2: split out bpf stuff
          fix review comments from Dave Miller
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      19f6484f
    • Daniel Axtens's avatar
      net: make skb_gso_*_seglen functions private · a4a77718
      Daniel Axtens authored
      They're very hard to use properly as they do not consider the
      GSO_BY_FRAGS case. Code should use skb_gso_validate_network_len
      and skb_gso_validate_mac_len as they do consider this case.
      
      Make the seglen functions static, which stops people using them
      outside of skbuff.c
      Signed-off-by: default avatarDaniel Axtens <dja@axtens.net>
      Reviewed-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a4a77718
    • Daniel Axtens's avatar
      net: xfrm: use skb_gso_validate_network_len() to check gso sizes · 80f5974d
      Daniel Axtens authored
      Replace skb_gso_network_seglen() with
      skb_gso_validate_network_len(), as it considers the GSO_BY_FRAGS
      case.
      Signed-off-by: default avatarDaniel Axtens <dja@axtens.net>
      Reviewed-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      80f5974d