1. 06 Aug, 2021 2 commits
    • John Hubbard's avatar
      net: mvvp2: fix short frame size on s390 · 704e624f
      John Hubbard authored
      On s390, the following build warning occurs:
      
      drivers/net/ethernet/marvell/mvpp2/mvpp2.h:844:2: warning: overflow in
      conversion from 'long unsigned int' to 'int' changes value from
      '18446744073709551584' to '-32' [-Woverflow]
      844 |  ((total_size) - MVPP2_SKB_HEADROOM - MVPP2_SKB_SHINFO_SIZE)
      
      This happens because MVPP2_SKB_SHINFO_SIZE, which is 320 bytes (which is
      already 64-byte aligned) on some architectures, actually gets ALIGN'd up
      to 512 bytes in the s390 case.
      
      So then, when this is invoked:
      
          MVPP2_RX_MAX_PKT_SIZE(MVPP2_BM_SHORT_FRAME_SIZE)
      
      ...that turns into:
      
           704 - 224 - 512 == -32
      
      ...which is not a good frame size to end up with! The warning above is a
      bit lucky: it notices a signed/unsigned bad behavior here, which leads
      to the real problem of a frame that is too short for its contents.
      
      Increase MVPP2_BM_SHORT_FRAME_SIZE by 32 (from 704 to 736), which is
      just exactly big enough. (The other values can't readily be changed
      without causing a lot of other problems.)
      
      Fixes: 07dd0a7a ("mvpp2: add basic XDP support")
      Cc: Sven Auhagen <sven.auhagen@voleatech.de>
      Cc: Matteo Croce <mcroce@microsoft.com>
      Cc: David S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      704e624f
    • DENG Qingfang's avatar
      net: dsa: mt7530: add the missing RxUnicast MIB counter · aff51c5d
      DENG Qingfang authored
      Add the missing RxUnicast counter.
      
      Fixes: b8f126a8 ("net-next: dsa: add dsa support for Mediatek MT7530 switch")
      Signed-off-by: default avatarDENG Qingfang <dqfext@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      aff51c5d
  2. 05 Aug, 2021 22 commits
  3. 04 Aug, 2021 16 commits
    • Hui Su's avatar
      scripts/tracing: fix the bug that can't parse raw_trace_func · 1c0cec64
      Hui Su authored
      Since commit 77271ce4 ("tracing: Add irq, preempt-count and need resched info
      to default trace output"), the default trace output format has been changed to:
                <idle>-0       [009] d.h. 22420.068695: _raw_spin_lock_irqsave <-hrtimer_interrupt
                <idle>-0       [000] ..s. 22420.068695: _nohz_idle_balance <-run_rebalance_domains
                <idle>-0       [011] d.h. 22420.068695: account_process_tick <-update_process_times
      
      origin trace output format:(before v3.2.0)
           # tracer: nop
           #
           #           TASK-PID    CPU#    TIMESTAMP  FUNCTION
           #              | |       |          |         |
                migration/0-6     [000]    50.025810: rcu_note_context_switch <-__schedule
                migration/0-6     [000]    50.025812: trace_rcu_utilization <-rcu_note_context_switch
                migration/0-6     [000]    50.025813: rcu_sched_qs <-rcu_note_context_switch
                migration/0-6     [000]    50.025815: rcu_preempt_qs <-rcu_note_context_switch
                migration/0-6     [000]    50.025817: trace_rcu_utilization <-rcu_note_context_switch
                migration/0-6     [000]    50.025818: debug_lockdep_rcu_enabled <-__schedule
                migration/0-6     [000]    50.025820: debug_lockdep_rcu_enabled <-__schedule
      
      The draw_functrace.py(introduced in v2.6.28) can't parse the new version format trace_func,
      So we need modify draw_functrace.py to adapt the new version trace output format.
      
      Link: https://lkml.kernel.org/r/20210611022107.608787-1-suhui@zeku.com
      
      Cc: stable@vger.kernel.org
      Fixes: 77271ce4 tracing: Add irq, preempt-count and need resched info to default trace output
      Signed-off-by: default avatarHui Su <suhui@zeku.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      1c0cec64
    • Nathan Chancellor's avatar
      scripts/recordmcount.pl: Remove check_objcopy() and $can_use_local · b18b851b
      Nathan Chancellor authored
      When building ARCH=riscv allmodconfig with llvm-objcopy, the objcopy
      version warning from this script appears:
      
      WARNING: could not find objcopy version or version is less than 2.17.
              Local function references are disabled.
      
      The check_objcopy() function in scripts/recordmcount.pl is set up to
      parse GNU objcopy's version string, not llvm-objcopy's, which triggers
      the warning.
      
      Commit 799c4341 ("kbuild: thin archives make default for all archs")
      made binutils 2.20 mandatory and commit ba64beb1 ("kbuild: check the
      minimum assembler version in Kconfig") enforces this at configuration
      time so just remove check_objcopy() and $can_use_local instead, assuming
      --globalize-symbol is always available.
      
      llvm-objcopy has supported --globalize-symbol since LLVM 7.0.0 in 2018
      and the minimum version for building the kernel with LLVM is 10.0.1 so
      there is no issue introduced:
      
      Link: https://github.com/llvm/llvm-project/commit/ee5be798dae30d5f9414b01f76ff807edbc881aa
      Link: https://lkml.kernel.org/r/20210802210307.3202472-1-nathan@kernel.orgReviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      b18b851b
    • Masami Hiramatsu's avatar
      tracing: Reject string operand in the histogram expression · a9d10ca4
      Masami Hiramatsu authored
      Since the string type can not be the target of the addition / subtraction
      operation, it must be rejected. Without this fix, the string type silently
      converted to digits.
      
      Link: https://lkml.kernel.org/r/162742654278.290973.1523000673366456634.stgit@devnote2
      
      Cc: stable@vger.kernel.org
      Fixes: 100719dc ("tracing: Add simple expression support to hist triggers")
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      a9d10ca4
    • Steven Rostedt (VMware)'s avatar
      tracing / histogram: Give calculation hist_fields a size · 2c05caa7
      Steven Rostedt (VMware) authored
      When working on my user space applications, I found a bug in the synthetic
      event code where the automated synthetic event field was not matching the
      event field calculation it was attached to. Looking deeper into it, it was
      because the calculation hist_field was not given a size.
      
      The synthetic event fields are matched to their hist_fields either by
      having the field have an identical string type, or if that does not match,
      then the size and signed values are used to match the fields.
      
      The problem arose when I tried to match a calculation where the fields
      were "unsigned int". My tool created a synthetic event of type "u32". But
      it failed to match. The string was:
      
        diff=field1-field2:onmatch(event).trace(synth,$diff)
      
      Adding debugging into the kernel, I found that the size of "diff" was 0.
      And since it was given "unsigned int" as a type, the histogram fallback
      code used size and signed. The signed matched, but the size of u32 (4) did
      not match zero, and the event failed to be created.
      
      This can be worse if the field you want to match is not one of the
      acceptable fields for a synthetic event. As event fields can have any type
      that is supported in Linux, this can cause an issue. For example, if a
      type is an enum. Then there's no way to use that with any calculations.
      
      Have the calculation field simply take on the size of what it is
      calculating.
      
      Link: https://lkml.kernel.org/r/20210730171951.59c7743f@oasis.local.home
      
      Cc: Tom Zanussi <zanussi@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: stable@vger.kernel.org
      Fixes: 100719dc ("tracing: Add simple expression support to hist triggers")
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      2c05caa7
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 251a1524
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "Seven fixes, five in drivers.
      
        The two core changes are a trivial warning removal in scsi_scan.c and
        a change to rescan for capacity when a device makes a user induced
        (via a write to the state variable) offline->running transition to fix
        issues with device mapper"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: core: Fix capacity set to zero after offlinining device
        scsi: sr: Return correct event when media event code is 3
        scsi: ibmvfc: Fix command state accounting and stale response detection
        scsi: core: Avoid printing an error if target_alloc() returns -ENXIO
        scsi: scsi_dh_rdac: Avoid crash during rdac_bus_attach()
        scsi: megaraid_mm: Fix end of loop tests for list_for_each_entry()
        scsi: pm80xx: Fix TMF task completion race condition
      251a1524
    • Linus Torvalds's avatar
      Merge tag 'gpio-updates-for-v5.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux · 0c2e31d2
      Linus Torvalds authored
      Pull gpio fixes from Bartosz Golaszewski:
      
       - revert a patch intruducing breakage in interrupt handling in
         gpio-mpc8xxx
      
       - correctly handle missing IRQs in gpio-tqmx86 by really making them
         optional
      
      * tag 'gpio-updates-for-v5.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
        gpio: tqmx86: really make IRQ optional
        Revert "gpio: mpc8xxx: change the gpio interrupt flags."
      0c2e31d2
    • Maxim Levitsky's avatar
      KVM: selftests: fix hyperv_clock test · 13c2c3cf
      Maxim Levitsky authored
      The test was mistakenly using addr_gpa2hva on a gva and that happened
      to work accidentally.  Commit 106a2e76 ("KVM: selftests: Lower the
      min virtual address for misc page allocations") revealed this bug.
      
      Fixes: 2c7f76b4 ("selftests: kvm: Add basic Hyper-V clocksources tests", 2021-03-18)
      Signed-off-by: default avatarMaxim Levitsky <mlevitsk@redhat.com>
      Message-Id: <20210804112057.409498-1-mlevitsk@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      13c2c3cf
    • Mingwei Zhang's avatar
      KVM: SVM: improve the code readability for ASID management · bb2baeb2
      Mingwei Zhang authored
      KVM SEV code uses bitmaps to manage ASID states. ASID 0 was always skipped
      because it is never used by VM. Thus, in existing code, ASID value and its
      bitmap postion always has an 'offset-by-1' relationship.
      
      Both SEV and SEV-ES shares the ASID space, thus KVM uses a dynamic range
      [min_asid, max_asid] to handle SEV and SEV-ES ASIDs separately.
      
      Existing code mixes the usage of ASID value and its bitmap position by
      using the same variable called 'min_asid'.
      
      Fix the min_asid usage: ensure that its usage is consistent with its name;
      allocate extra size for ASID 0 to ensure that each ASID has the same value
      with its bitmap position. Add comments on ASID bitmap allocation to clarify
      the size change.
      Signed-off-by: default avatarMingwei Zhang <mizhang@google.com>
      Cc: Tom Lendacky <thomas.lendacky@amd.com>
      Cc: Marc Orr <marcorr@google.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Alper Gun <alpergun@google.com>
      Cc: Dionna Glaze <dionnaglaze@google.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Vipin Sharma <vipinsh@google.com>
      Cc: Peter Gonda <pgonda@google.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Message-Id: <20210802180903.159381-1-mizhang@google.com>
      [Fix up sev_asid_free to also index by ASID, as suggested by Sean
       Christopherson, and use nr_asids in sev_cpu_init. - Paolo]
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      bb2baeb2
    • Ivan T. Ivanov's avatar
      net: usb: lan78xx: don't modify phy_device state concurrently · 6b67d4d6
      Ivan T. Ivanov authored
      Currently phy_device state could be left in inconsistent state shown
      by following alert message[1]. This is because phy_read_status could
      be called concurrently from lan78xx_delayedwork, phy_state_machine and
      __ethtool_get_link. Fix this by making sure that phy_device state is
      updated atomically.
      
      [1] lan78xx 1-1.1.1:1.0 eth0: No phy led trigger registered for speed(-1)
      Signed-off-by: default avatarIvan T. Ivanov <iivanov@suse.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6b67d4d6
    • Jakub Kicinski's avatar
      docs: networking: netdevsim rules · 396492b4
      Jakub Kicinski authored
      There are aspects of netdevsim which are commonly
      misunderstood and pointed out in review. Cong
      suggest we document them.
      Suggested-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      396492b4
    • Sean Christopherson's avatar
      KVM: SVM: Fix off-by-one indexing when nullifying last used SEV VMCB · 179c6c27
      Sean Christopherson authored
      Use the raw ASID, not ASID-1, when nullifying the last used VMCB when
      freeing an SEV ASID.  The consumer, pre_sev_run(), indexes the array by
      the raw ASID, thus KVM could get a false negative when checking for a
      different VMCB if KVM manages to reallocate the same ASID+VMCB combo for
      a new VM.
      
      Note, this cannot cause a functional issue _in the current code_, as
      pre_sev_run() also checks which pCPU last did VMRUN for the vCPU, and
      last_vmentry_cpu is initialized to -1 during vCPU creation, i.e. is
      guaranteed to mismatch on the first VMRUN.  However, prior to commit
      8a14fe4f ("kvm: x86: Move last_cpu into kvm_vcpu_arch as
      last_vmentry_cpu"), SVM tracked pCPU on its own and zero-initialized the
      last_cpu variable.  Thus it's theoretically possible that older versions
      of KVM could miss a TLB flush if the first VMRUN is on pCPU0 and the ASID
      and VMCB exactly match those of a prior VM.
      
      Fixes: 70cd94e6 ("KVM: SVM: VMRUN should use associated ASID when SEV is enabled")
      Cc: Tom Lendacky <thomas.lendacky@amd.com>
      Cc: Brijesh Singh <brijesh.singh@amd.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      179c6c27
    • Paolo Bonzini's avatar
      KVM: Do not leak memory for duplicate debugfs directories · 85cd39af
      Paolo Bonzini authored
      KVM creates a debugfs directory for each VM in order to store statistics
      about the virtual machine.  The directory name is built from the process
      pid and a VM fd.  While generally unique, it is possible to keep a
      file descriptor alive in a way that causes duplicate directories, which
      manifests as these messages:
      
        [  471.846235] debugfs: Directory '20245-4' with parent 'kvm' already present!
      
      Even though this should not happen in practice, it is more or less
      expected in the case of KVM for testcases that call KVM_CREATE_VM and
      close the resulting file descriptor repeatedly and in parallel.
      
      When this happens, debugfs_create_dir() returns an error but
      kvm_create_vm_debugfs() goes on to allocate stat data structs which are
      later leaked.  The slow memory leak was spotted by syzkaller, where it
      caused OOM reports.
      
      Since the issue only affects debugfs, do a lookup before calling
      debugfs_create_dir, so that the message is downgraded and rate-limited.
      While at it, ensure kvm->debugfs_dentry is NULL rather than an error
      if it is not created.  This fixes kvm_destroy_vm_debugfs, which was not
      checking IS_ERR_OR_NULL correctly.
      
      Cc: stable@vger.kernel.org
      Fixes: 536a6f88 ("KVM: Create debugfs dir and stat files for each VM")
      Reported-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
      Suggested-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      85cd39af
    • David S. Miller's avatar
      Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec · d00551b4
      David S. Miller authored
      Steffen Klassert says:
      
      ====================
      pull request (net): ipsec 2021-08-04
      
      1) Fix a sysbot reported memory leak in xfrm_user_rcv_msg.
         From Pavel Skripkin.
      
      2) Revert "xfrm: policy: Read seqcount outside of rcu-read side
         in xfrm_policy_lookup_bytype". This commit tried to fix a
         lockin bug, but only cured some of the symptoms. A proper
         fix is applied on top of this revert.
      
      3) Fix a locking bug on xfrm state hash resize. A recent change
         on sequence counters accidentally repaced a spinlock by a mutex.
         Fix from Frederic Weisbecker.
      
      4) Fix possible user-memory-access in xfrm_user_rcv_msg_compat().
         From Dmitry Safonov.
      
      5) Add initialiation sefltest fot xfrm_spdattr_type_t.
         From Dmitry Safonov.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d00551b4
    • David S. Miller's avatar
      Merge branch 'pegasus-errors' · ff0ee9df
      David S. Miller authored
      Petko Manolov says:
      
      ====================
      net: usb: pegasus: better error checking and DRIVER_VERSION removal
      
      v3:
      
      Pavel Skripkin again: make sure -ETIMEDOUT is returned by __mii_op() on timeout
      condition;
      
      v2:
      
      Special thanks to Pavel Skripkin for the review and who caught a few bugs.
      setup_pegasus_II() would not print an erroneous message on the success path.
      
      v1:
      
      Add error checking for get_registers() and derivatives.  If the usb transfer
      fail then just don't use the buffer where the legal data should have been
      returned.
      
      Remove DRIVER_VERSION per Greg KH request.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ff0ee9df
    • Petko Manolov's avatar
      bc65bacf
    • Petko Manolov's avatar
      net: usb: pegasus: Check the return value of get_geristers() and friends; · 8a160e2e
      Petko Manolov authored
      Certain call sites of get_geristers() did not do proper error handling.  This
      could be a problem as get_geristers() typically return the data via pointer to a
      buffer.  If an error occurred the code is carelessly manipulating the wrong data.
      Signed-off-by: default avatarPetko Manolov <petkan@nucleusys.com>
      Reviewed-by: default avatarPavel Skripkin <paskripkin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8a160e2e