1. 07 Nov, 2020 9 commits
  2. 06 Nov, 2020 31 commits
    • Linus Torvalds's avatar
      Merge branch 'mtd/fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux · bf3e7628
      Linus Torvalds authored
      Pull mtd fixes from Miquel Raynal.
      
      * 'mtd/fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux:
        mtd: rawnand: stm32_fmc2: fix broken ECC
        mtd: spi-nor: Fix address width on flash chips > 16MB
        mtd: spi-nor: Don't copy self-pointing struct around
        mtd: rawnand: ifc: Move the ECC engine initialization to the right place
        mtd: rawnand: mxc: Move the ECC engine initialization to the right place
      bf3e7628
    • Linus Torvalds's avatar
      Merge tag 'spi-fix-v5.10-rc2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi · 44d80621
      Linus Torvalds authored
      Pull spi fix from Mark Brown:
       "This is an additional fix on top of 5e31ba0c ('spi: bcm2835: fix
        gpio cs level inversion') - when sending my prior pull request I had
        misremembred the status of that patch, apologies for the noise here"
      
      * tag 'spi-fix-v5.10-rc2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
        spi: bcm2835: remove use of uninitialized gpio flags variable
      44d80621
    • Linus Torvalds's avatar
      Merge tag 'sound-5.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · bb72bbe8
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "Quite a bunch of small fixes that have been gathered since the last
        pull, including changes like below:
      
         - HD-audio runtime PM fixes and refactoring
      
         - HD-audio and USB-audio quirks
      
         - SOF warning fix
      
         - Various ASoC device-specific fixes for Intel, Qualcomm, etc"
      
      * tag 'sound-5.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (26 commits)
        ALSA: usb-audio: Add implicit feedback quirk for Qu-16
        ASoC: mchp-spdiftx: Do not set Validity bit(s)
        ALSA: usb-audio: Add implicit feedback quirk for MODX
        ALSA: usb-audio: add usb vendor id as DSD-capable for Khadas devices
        ALSA: hda/realtek - Enable headphone for ASUS TM420
        ALSA: hda: prevent undefined shift in snd_hdac_ext_bus_get_link()
        ASoC: qcom: lpass-cpu: Fix clock disable failure
        ASoC: qcom: lpass-sc7180: Fix MI2S bitwidth field bit positions
        ASoC: codecs: wcd9335: Set digital gain range correctly
        ASoC: codecs: wcd934x: Set digital gain range correctly
        ALSA: hda: Reinstate runtime_allow() for all hda controllers
        ALSA: hda: Separate runtime and system suspend
        ALSA: hda: Refactor codec PM to use direct-complete optimization
        ALSA: hda/realtek - Fixed HP headset Mic can't be detected
        ALSA: usb-audio: Add implicit feedback quirk for Zoom UAC-2
        ALSA: make snd_kcontrol_new name a normal string
        ALSA: fix kernel-doc markups
        ASoC: SOF: loader: handle all SOF_IPC_EXT types
        ASoC: cs42l51: manage mclk shutdown delay
        ASoC: qcom: sdm845: set driver name correctly
        ...
      bb72bbe8
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2020-11-06-1' of git://anongit.freedesktop.org/drm/drm · fc7b66ef
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "It's Friday here so that means another installment of drm fixes to
        distract you from the counting process.
      
        Changes all over the place, the amdgpu changes contain support for a
        new GPU that is close to current one already in the tree (Green
        Sardine) so it shouldn't have much side effects.
      
        Otherwise imx has a few cleanup patches and fixes, amdgpu and i915
        have around the usual smattering of fixes, fonts got constified, and
        vc4/panfrost has some minor fixes. All in all a fairly regular rc3.
      
        We have an outstanding nouveau regression, but the author is looking
        into the fix, so should be here next week.
      
        I now return you to counting.
      
        fonts:
         - constify font structures.
      
        MAINTAINERS:
         - Fix path for amdgpu power management
      
        amdgpu:
         - Add support for more navi1x SKUs
         - Fix for suspend on CI dGPUs
         - VCN DPG fix for Picasso
         - Sienna Cichlid fixes
         - Polaris DPM fix
         - Add support for Green Sardine
      
        amdkfd:
         - Fix an allocation failure check
      
        i915:
         - Fix set domain's cache coherency
         - Fixes around breadcrumbs
         - Fix encoder lookup during PSR atomic
         - Hold onto an explicit ref to i915_vma_work.pinned
         - gvt: HWSP reset handling fix
         - gvt: flush workaround
         - gvt: vGPU context pin/unpin
         - gvt: mmio cmd access fix for bxt/apl
      
        imx:
         - drop unused functions and callbacks
         - reuse imx_drm_encoder_parse_of
         - spinlock rework
         - memory leak fix
         - minor cleanups
      
        vc4:
         - resource cleanup fix
      
        panfrost:
         - madvise/shrinker fix"
      
      * tag 'drm-fixes-2020-11-06-1' of git://anongit.freedesktop.org/drm/drm: (55 commits)
        drm/amdgpu/display: remove DRM_AMD_DC_GREEN_SARDINE
        drm/amd/display: Add green_sardine support to DM
        drm/amd/display: Add green_sardine support to DC
        drm/amdgpu: enable vcn support for green_sardine (v2)
        drm/amdgpu: enable green_sardine_asd.bin loading (v2)
        drm/amdgpu/sdma: add sdma engine support for green_sardine (v2)
        drm/amdgpu: add gfx support for green_sardine (v2)
        drm/amdgpu: add soc15 common ip block support for green_sardine (v3)
        drm/amdgpu: add green_sardine support for gpu_info and ip block setting (v2)
        drm/amdgpu: add Green_Sardine APU flag
        drm/amdgpu: resolved ASD loading issue on sienna
        amdkfd: Check kvmalloc return before memcpy
        drm/amdgpu: update golden setting for sienna_cichlid
        amd/amdgpu: Disable VCN DPG mode for Picasso
        drm/amdgpu/swsmu: remove duplicate call to smu_set_default_dpm_table
        drm/i915: Hold onto an explicit ref to i915_vma_work.pinned
        drm/i915/gt: Flush xcs before tgl breadcrumbs
        drm/i915/gt: Expose more parameters for emitting writes into the ring
        drm/i915: Fix encoder lookup during PSR atomic check
        drm/i915/gt: Use the local HWSP offset during submission
        ...
      fc7b66ef
    • Linus Torvalds's avatar
      Merge tag 'tpmdd-next-v5.10-rc4' of... · 28ced768
      Linus Torvalds authored
      Merge tag 'tpmdd-next-v5.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd
      
      Pull tpm fixes from Jarkko Sakkinen:
       "Two critical tpm driver bug fixes"
      
      * tag 'tpmdd-next-v5.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd:
        tpm: efi: Don't create binary_bios_measurements file for an empty log
        tpm_tis: Disable interrupts on ThinkPad T490s
      28ced768
    • Linus Torvalds's avatar
      Merge tag 'iommu-fixes-v5.10-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu · 02a2aa35
      Linus Torvalds authored
      Pull iommu fixes from Joerg Roedel:
      
       - Fix a NULL-ptr dereference in the Intel VT-d driver
      
       - Two fixes for Intel SVM support
      
       - Increase IRQ remapping table size in the AMD IOMMU driver. The old
         number of 128 turned out to be too low for some recent devices.
      
       - Fix a mask check in generic IOMMU code
      
      * tag 'iommu-fixes-v5.10-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
        iommu: Fix a check in iommu_check_bind_data()
        iommu/vt-d: Fix a bug for PDP check in prq_event_thread
        iommu/vt-d: Fix sid not set issue in intel_svm_bind_gpasid()
        iommu/vt-d: Fix kernel NULL pointer dereference in find_domain()
        iommu/amd: Increase interrupt remapping table limit to 512 entries
      02a2aa35
    • Linus Torvalds's avatar
      Merge tag 'vfio-v5.10-rc3' of git://github.com/awilliam/linux-vfio · 1669ecf9
      Linus Torvalds authored
      Pull VFIO fixes from Alex Williamson:
      
       - Remove code by using existing helper (Zenghui Yu)
      
       - fsl-mc copy-user return and underflow fixes (Dan Carpenter)
      
       - fsl-mc static function declaration (Diana Craciun)
      
       - Fix ioeventfd sleeping under spinlock (Alex Williamson)
      
       - Fix pm reference count leak in vfio-platform (Zhang Qilong)
      
       - Allow opening IGD device w/o OpRegion support (Fred Gao)
      
      * tag 'vfio-v5.10-rc3' of git://github.com/awilliam/linux-vfio:
        vfio/pci: Bypass IGD init in case of -ENODEV
        vfio: platform: fix reference leak in vfio_platform_open
        vfio/pci: Implement ioeventfd thread handler for contended memory lock
        vfio/fsl-mc: Make vfio_fsl_mc_irqs_allocate static
        vfio/fsl-mc: prevent underflow in vfio_fsl_mc_mmap()
        vfio/fsl-mc: return -EFAULT if copy_to_user() fails
        vfio/type1: Use the new helper to find vfio_group
      1669ecf9
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · 30f3f68e
      Linus Torvalds authored
      Pull arm64 fixes from Will Deacon:
       "Here's the weekly batch of fixes for arm64. Not an awful lot here, but
        there are still a few unresolved issues relating to CPU hotplug, RCU
        and IRQ tracing that I hope to queue fixes for next week.
      
        Summary:
      
         - Fix early use of kprobes
      
         - Fix kernel placement in kexec_file_load()
      
         - Bump maximum number of NUMA nodes"
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        arm64: kexec_file: try more regions if loading segments fails
        arm64: kprobes: Use BRK instead of single-step when executing instructions out-of-line
        arm64: NUMA: Kconfig: Increase NODES_SHIFT to 4
      30f3f68e
    • Linus Torvalds's avatar
      Merge tag 'arc-5.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc · 4257087e
      Linus Torvalds authored
      Pull ARC fixes from Vineet Gupta:
      
       - Unbork HSDKv1 platform (won't boot) due to memory map issue
      
       - Prevent stack unwinder from infinite looping
      
      * tag 'arc-5.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc:
        ARC: [plat-hsdk] Remap CCMs super early in asm boot trampoline
        ARC: stack unwinding: avoid indefinite looping
      4257087e
    • Linus Torvalds's avatar
      Merge tag 's390-5.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · ee518148
      Linus Torvalds authored
      Pull s390 fixes from Heiko Carstens:
      
       - fix reference counting for ap devices
      
       - fix paes selftest
      
       - fix pmd_deref()/pud_deref() so they can also handle large pages
      
       - remove unused vdso file and defines
      
       - update defconfigs
      
       - call rcu_cpu_starting() early in smp init code to avoid lockdep
         warnings
      
       - fix hotplug of PCI function missing bus
      
      * tag 's390-5.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        s390/pci: fix hot-plug of PCI function missing bus
        s390/smp: move rcu_cpu_starting() earlier
        s390/pkey: fix paes selftest failure with paes and pkey static build
        s390: update defconfigs
        s390/vdso: remove unused constants
        s390/vdso: remove empty unused file
        s390/mm: make pmd/pud_deref() large page aware
        s390/ap: fix ap devices reference counting
      ee518148
    • Linus Torvalds's avatar
      Merge tag 'net-5.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 41f16530
      Linus Torvalds authored
      Pull networking fixes from Jakub Kicinski:
       "Networking fixes for 5.10-rc3, including fixes from wireless, can, and
        netfilter subtrees.
      
        Current merge window - bugs in new features:
      
         - can: isotp: isotp_rcv_cf(): enable RX timeout handling in
           listen-only mode
      
        Previous releases - regressions:
      
         - mac80211:
            - don't require VHT elements for HE on 2.4 GHz
            - fix regression where EAPOL frames were sent in plaintext
      
         - netfilter:
            - ipset: Update byte and packet counters regardless of whether
              they match
      
         - ip_tunnel: fix over-mtu packet send by allowing fragmenting even if
           inner packet has IP_DF (don't fragment) set in its header (when
           TUNNEL_DONT_FRAGMENT flag is not set on the tunnel dev)
      
         - net: fec: fix MDIO probing for some FEC hardware blocks
      
         - ip6_tunnel: set inner ipproto before ip6_tnl_encap to un-break gso
           support
      
         - sctp: Fix COMM_LOST/CANT_STR_ASSOC err reporting on big-endian
           platforms, sparse-related fix used the wrong integer size
      
        Previous releases - always broken:
      
         - netfilter: use actual socket sk rather than skb sk when routing
           harder
      
         - r8169: work around short packet hw bug on RTL8125 by padding frames
      
         - net: ethernet: ti: cpsw: disable PTPv1 hw timestamping
           advertisement, the hardware does not support it
      
         - chelsio/chtls: fix always leaking ctrl_skb and another leak caused
           by a race condition
      
         - fix drivers incorrectly writing into skbs on TX:
            - cadence: force nonlinear buffers to be cloned
            - gianfar: Account for Tx PTP timestamp in the skb headroom
            - gianfar: Replace skb_realloc_headroom with skb_cow_head for PTP
      
         - can: flexcan:
            - remove FLEXCAN_QUIRK_DISABLE_MECR quirk for LS1021A
            - add ECC initialization for VF610 and LX2160A
            - flexcan_remove(): disable wakeup completely
      
         - can: fix packet echo functionality:
            - peak_canfd: fix echo management when loopback is on
            - make sure skbs are not freed in IRQ context in case they need to
              be dropped
            - always clone the skbs to make sure they have a reference on the
              socket, and prevent it from disappearing
            - fix real payload length return value for RTR frames
      
         - can: j1939: return failure on bind if netdev is down, rather than
           waiting indefinitely
      
        Misc:
      
         - IPv6: reply ICMP error if the first fragment don't include all
           headers to improve compliance with RFC 8200"
      
      * tag 'net-5.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (66 commits)
        ionic: check port ptr before use
        r8169: work around short packet hw bug on RTL8125
        net: openvswitch: silence suspicious RCU usage warning
        chelsio/chtls: fix always leaking ctrl_skb
        chelsio/chtls: fix memory leaks caused by a race
        can: flexcan: flexcan_remove(): disable wakeup completely
        can: flexcan: add ECC initialization for VF610
        can: flexcan: add ECC initialization for LX2160A
        can: flexcan: remove FLEXCAN_QUIRK_DISABLE_MECR quirk for LS1021A
        can: mcp251xfd: remove unneeded break
        can: mcp251xfd: mcp251xfd_regmap_nocrc_read(): fix semicolon.cocci warnings
        can: mcp251xfd: mcp251xfd_regmap_crc_read(): increase severity of CRC read error messages
        can: peak_canfd: pucan_handle_can_rx(): fix echo management when loopback is on
        can: peak_usb: peak_usb_get_ts_time(): fix timestamp wrapping
        can: peak_usb: add range checking in decode operations
        can: xilinx_can: handle failure cases of pm_runtime_get_sync
        can: ti_hecc: ti_hecc_probe(): add missed clk_disable_unprepare() in error path
        can: isotp: padlen(): make const array static, makes object smaller
        can: isotp: isotp_rcv_cf(): enable RX timeout handling in listen-only mode
        can: isotp: Explain PDU in CAN_ISOTP help text
        ...
      41f16530
    • Jakub Kicinski's avatar
      Merge branch 'nexthop-add-support-for-nexthop-objects-offload' · 3b4202a4
      Jakub Kicinski authored
      Ido Schimmel says:
      
      ====================
      nexthop: Add support for nexthop objects offload
      
      This patch set adds support for nexthop objects offload with a dummy
      implementation over netdevsim. mlxsw support will be added later.
      
      The general idea is very similar to route offload in that notifications
      are sent whenever nexthop objects are changed. A listener can veto the
      change and the error will be communicated to user space with extack.
      
      To keep listeners as simple as possible, they not only receive
      notifications for the nexthop object that is changed, but also for all
      the other objects affected by this change. For example, when a single
      nexthop is replaced, a replace notification is sent for the single
      nexthop, but also for all the nexthop groups this nexthop is member in.
      This relieves listeners from the need to track such dependencies.
      
      To simplify things further for listeners, the notification info does not
      contain the raw nexthop data structures (e.g., 'struct nexthop'), but
      less complex data structures into which the raw data structures are
      parsed into.
      
      Tested with a new selftest over netdevsim and with fib_nexthops.sh:
      
      Tests passed: 164
      Tests failed:   0
      
      Patch set overview:
      
      Patches #1-#4 introduce the aforementioned data structures and convert
      existing listeners (i.e., the VXLAN driver) to use them.
      
      Patches #5-#6 add a new RTNH_F_TRAP flag and the ability to set it and
      RTNH_F_OFFLOAD on nexthops. This flag is used by netdevsim for testing
      purposes and will also be used by mlxsw. These flags are consistent with
      the existing RTM_F_OFFLOAD and RTM_F_TRAP flags.
      
      Patches #7-#14 gradually add the new nexthop notifications.
      
      Patches #15-#18 add a dummy implementation for nexthop offload over
      netdevsim and a selftest to exercise both good and bad flows.
      
      Changes since RFC [1]:
      
      Patch #1: s/is_encap/has_encap/
      Patch #3: Add a blank line in __nh_notifier_single_info_init()
      Patch #5: Reword commit message
      Patch #6: s/nexthop_hw_flags_set/nexthop_set_hw_flags/
      Patch #7: Reword commit message
      Patch #11: Allocate extack on the stack
      
      Follow-up patch sets:
      
      selftests: forwarding: Add nexthop objects tests
      mlxsw: Preparations for nexthop objects support - part 1/2
      mlxsw: Preparations for nexthop objects support - part 2/2
      mlxsw: Add support for nexthop objects
      mlxsw: Add support for blackhole nexthops
      mlxsw: Update adjacency index more efficiently
      
      [1] https://lore.kernel.org/netdev/20200908091037.2709823-1-idosch@idosch.org/
      ====================
      
      Link: https://lore.kernel.org/r/20201104133040.1125369-1-idosch@idosch.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      3b4202a4
    • Ido Schimmel's avatar
      selftests: netdevsim: Add test for nexthop offload API · 21584e6a
      Ido Schimmel authored
      Test various aspects of the nexthop offload API on top of the netdevsim
      implementation. Both good and bad flows are tested.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      21584e6a
    • Ido Schimmel's avatar
      netdevsim: Allow programming routes with nexthop objects · 66e58bf0
      Ido Schimmel authored
      Previous patches added the ability to program nexthop objects.
      Therefore, no longer forbid the programming of routes that point to such
      objects.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      66e58bf0
    • Ido Schimmel's avatar
      netdevsim: Add dummy implementation for nexthop offload · 8fa84742
      Ido Schimmel authored
      Implement dummy nexthop "offload" in the driver by storing currently
      "programmed" nexthops in a hash table. Each nexthop in the hash table is
      marked with "trap" indication and increments the nexthops resource
      occupancy.
      
      This will later allow us to test the nexthop offload API on top of
      netdevsim.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      8fa84742
    • Ido Schimmel's avatar
      netdevsim: Add devlink resource for nexthops · 35266255
      Ido Schimmel authored
      The Spectrum ASIC has a dedicated table where nexthops (i.e., adjacency
      entries) are populated. The size of this table can be controlled via
      devlink-resource.
      
      Add such a resource to netdevsim so that its occupancy will reflect the
      number of nexthop objects currently programmed to the device.
      
      By limiting the size of the resource, error paths could be exercised and
      tested.
      
      Example output:
      
      # devlink resource show netdevsim/netdevsim10
      netdevsim/netdevsim10:
        name IPv4 size unlimited unit entry size_min 0 size_max unlimited size_gran 1 dpipe_tables none
          resources:
            name fib size unlimited occ 4 unit entry size_min 0 size_max unlimited size_gran 1 dpipe_tables none
            name fib-rules size unlimited occ 3 unit entry size_min 0 size_max unlimited size_gran 1 dpipe_tables none
        name IPv6 size unlimited unit entry size_min 0 size_max unlimited size_gran 1 dpipe_tables none
          resources:
            name fib size unlimited occ 1 unit entry size_min 0 size_max unlimited size_gran 1 dpipe_tables none
            name fib-rules size unlimited occ 2 unit entry size_min 0 size_max unlimited size_gran 1 dpipe_tables none
        name nexthops size unlimited occ 0 unit entry size_min 0 size_max unlimited size_gran 1 dpipe_tables none
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      35266255
    • Ido Schimmel's avatar
      nexthop: Remove in-kernel route notifications when nexthop changes · bbea126c
      Ido Schimmel authored
      Remove in-kernel route notifications when the configuration of their
      nexthop changes.
      
      These notifications are unnecessary because the route still uses the
      same nexthop ID. A separate notification for the nexthop change itself
      is now sent in the nexthop notification chain.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      bbea126c
    • Ido Schimmel's avatar
      nexthop: Replay nexthops when registering a notifier · 975ff7f3
      Ido Schimmel authored
      When registering a new notifier to the nexthop notification chain,
      replay all the existing nexthops to the new notifier so that it will
      have a complete picture of the available nexthops.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      975ff7f3
    • Ido Schimmel's avatar
      nexthop: Pass extack to register_nexthop_notifier() · ce7e9c8a
      Ido Schimmel authored
      This will be used by the next patch which extends the function to replay
      all the existing nexthops to the notifier block being registered.
      
      Device drivers will be able to pass extack to the function since it is
      passed to them upon reload from devlink.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ce7e9c8a
    • Ido Schimmel's avatar
      nexthop: Emit a notification when a nexthop group is reduced · 833a1065
      Ido Schimmel authored
      When a single nexthop is deleted, the configuration of all the groups
      using the nexthop is effectively modified. In this case, emit a
      notification in the nexthop notification chain for each modified group
      so that listeners would not need to keep track of which nexthops are
      member in which groups.
      
      In the rare cases where the notification fails, emit an error to the
      kernel log. This is done by allocating extack on the stack and printing
      the error logged by the listener that rejected the notification.
      
      Changes since RFC:
      * Allocate extack on the stack
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      833a1065
    • Ido Schimmel's avatar
      nexthop: Emit a notification when a nexthop group is modified · f17bc33d
      Ido Schimmel authored
      When a single nexthop is replaced, the configuration of all the groups
      using the nexthop is effectively modified. In this case, emit a
      notification in the nexthop notification chain for each modified group
      so that listeners would not need to keep track of which nexthops are
      member in which groups.
      
      The notification can only be emitted after the new configuration (i.e.,
      'struct nh_info') is pointed at by the old shell (i.e., 'struct
      nexthop'). Before that the configuration of the nexthop groups is still
      the same as before the replacement.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f17bc33d
    • Ido Schimmel's avatar
      nexthop: Emit a notification when a single nexthop is replaced · 8c09c9f9
      Ido Schimmel authored
      The notification is emitted after all the validation checks were
      performed, but before the new configuration (i.e., 'struct nh_info') is
      pointed at by the old shell (i.e., 'struct nexthop'). This prevents the
      need to perform rollback in case the notification is vetoed.
      
      The next patch will also emit a replace notification for all the nexthop
      groups in which the nexthop is used.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      8c09c9f9
    • Ido Schimmel's avatar
      nexthop: Emit a notification when a nexthop group is replaced · d144cc5f
      Ido Schimmel authored
      Emit a notification in the nexthop notification chain when an existing
      nexthop group is replaced.
      
      The notification is emitted after all the validation checks were
      performed, but before the new configuration (i.e., 'struct nh_grp') is
      pointed at by the old shell (i.e., 'struct nexthop'). This prevents the
      need to perform rollback in case the notification is vetoed.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      d144cc5f
    • Ido Schimmel's avatar
      nexthop: Emit a notification when a nexthop is added · 732d167b
      Ido Schimmel authored
      Emit a notification in the nexthop notification chain when a new nexthop
      is added (not replaced). The nexthop can either be a new group or a
      single nexthop.
      
      The notification is sent after the nexthop is inserted into the
      red-black tree, as listeners might need to callback into the nexthop
      code with the nexthop ID in order to mark the nexthop as offloaded.
      
      A 'REPLACE' notification is emitted instead of 'ADD' as the distinction
      between the two is not important for in-kernel listeners. In case the
      listener is not familiar with the encoded nexthop ID, it can simply
      treat it as a new one. This is also consistent with the route offload
      API.
      
      Changes since RFC:
      * Reword commit message
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      732d167b
    • Ido Schimmel's avatar
      nexthop: Allow setting "offload" and "trap" indications on nexthops · e95f2592
      Ido Schimmel authored
      Add a function that can be called by device drivers to set "offload" or
      "trap" indication on nexthops following nexthop notifications.
      
      Changes since RFC:
      * s/nexthop_hw_flags_set/nexthop_set_hw_flags/
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e95f2592
    • Ido Schimmel's avatar
      rtnetlink: Add RTNH_F_TRAP flag · 968a83f8
      Ido Schimmel authored
      The flag indicates to user space that the nexthop is not programmed to
      forward packets in hardware, but rather to trap them to the CPU. This is
      needed, for example, when the MAC of the nexthop neighbour is not
      resolved and packets should reach the CPU to trigger neighbour
      resolution.
      
      The flag will be used in subsequent patches by netdevsim to test nexthop
      objects programming to device drivers and in the future by mlxsw as
      well.
      
      Changes since RFC:
      * Reword commit message
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      968a83f8
    • Ido Schimmel's avatar
      nexthop: vxlan: Convert to new notification info · 1ec69d18
      Ido Schimmel authored
      Convert the sole listener of the nexthop notification chain (the VXLAN
      driver) to the new notification info.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1ec69d18
    • Ido Schimmel's avatar
      nexthop: Prepare new notification info · 5ca474f2
      Ido Schimmel authored
      Prepare the new notification information so that it could be passed to
      listeners in the new patch.
      
      Changes since RFC:
      * Add a blank line in __nh_notifier_single_info_init()
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      5ca474f2
    • Ido Schimmel's avatar
      nexthop: Pass extack to nexthop notifier · 3578d53d
      Ido Schimmel authored
      The next patch will add extack to the notification info. This allows
      listeners to veto notifications and communicate the reason to user space.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      3578d53d
    • Ido Schimmel's avatar
      nexthop: Add nexthop notification data structures · 1c9cac65
      Ido Schimmel authored
      Add data structures that will be used for nexthop replace and delete
      notifications in the previously introduced nexthop notification chain.
      
      New data structures are added instead of passing the existing nexthop
      code structures directly for several reasons.
      
      First, the existing structures encode a lot of bookkeeping information
      which is irrelevant for listeners of the notification chain.
      
      Second, the existing structures can be changed without worrying about
      introducing regressions in listeners since they are not accessed
      directly by them.
      
      Third, listeners of the notification chain do not need to each parse the
      relatively complex nexthop code structures. They are passing the
      required information in a simplified way.
      
      Note that a single 'has_encap' bit is added instead of the actual
      encapsulation information since current listeners do not support such
      nexthops.
      
      Changes since RFC:
      * s/is_encap/has_encap/
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1c9cac65
    • Tyler Hicks's avatar
      tpm: efi: Don't create binary_bios_measurements file for an empty log · 8ffd778a
      Tyler Hicks authored
      Mimic the pre-existing ACPI and Device Tree event log behavior by not
      creating the binary_bios_measurements file when the EFI TPM event log is
      empty.
      
      This fixes the following NULL pointer dereference that can occur when
      reading /sys/kernel/security/tpm0/binary_bios_measurements after the
      kernel received an empty event log from the firmware:
      
       BUG: kernel NULL pointer dereference, address: 000000000000002c
       #PF: supervisor read access in kernel mode
       #PF: error_code(0x0000) - not-present page
       PGD 0 P4D 0
       Oops: 0000 [#1] SMP PTI
       CPU: 2 PID: 3932 Comm: fwupdtpmevlog Not tainted 5.9.0-00003-g629990edad62 #17
       Hardware name: LENOVO 20LCS03L00/20LCS03L00, BIOS N27ET38W (1.24 ) 11/28/2019
       RIP: 0010:tpm2_bios_measurements_start+0x3a/0x550
       Code: 54 53 48 83 ec 68 48 8b 57 70 48 8b 1e 65 48 8b 04 25 28 00 00 00 48 89 45 d0 31 c0 48 8b 82 c0 06 00 00 48 8b 8a c8 06 00 00 <44> 8b 60 1c 48 89 4d a0 4c 89 e2 49 83 c4 20 48 83 fb 00 75 2a 49
       RSP: 0018:ffffa9c901203db0 EFLAGS: 00010246
       RAX: 0000000000000010 RBX: 0000000000000000 RCX: 0000000000000010
       RDX: ffff8ba1eb99c000 RSI: ffff8ba1e4ce8280 RDI: ffff8ba1e4ce8258
       RBP: ffffa9c901203e40 R08: ffffa9c901203dd8 R09: ffff8ba1ec443300
       R10: ffffa9c901203e50 R11: 0000000000000000 R12: ffff8ba1e4ce8280
       R13: ffffa9c901203ef0 R14: ffffa9c901203ef0 R15: ffff8ba1e4ce8258
       FS:  00007f6595460880(0000) GS:ffff8ba1ef880000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 000000000000002c CR3: 00000007d8d18003 CR4: 00000000003706e0
       DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
       DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
       Call Trace:
        ? __kmalloc_node+0x113/0x320
        ? kvmalloc_node+0x31/0x80
        seq_read+0x94/0x420
        vfs_read+0xa7/0x190
        ksys_read+0xa7/0xe0
        __x64_sys_read+0x1a/0x20
        do_syscall_64+0x37/0x80
        entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      In this situation, the bios_event_log pointer in the tpm_bios_log struct
      was not NULL but was equal to the ZERO_SIZE_PTR (0x10) value. This was
      due to the following kmemdup() in tpm_read_log_efi():
      
      int tpm_read_log_efi(struct tpm_chip *chip)
      {
      ...
      	/* malloc EventLog space */
      	log->bios_event_log = kmemdup(log_tbl->log, log_size, GFP_KERNEL);
      	if (!log->bios_event_log) {
      		ret = -ENOMEM;
      		goto out;
      	}
      ...
      }
      
      When log_size is zero, due to an empty event log from firmware,
      ZERO_SIZE_PTR is returned from kmemdup(). Upon a read of the
      binary_bios_measurements file, the tpm2_bios_measurements_start()
      function does not perform a ZERO_OR_NULL_PTR() check on the
      bios_event_log pointer before dereferencing it.
      
      Rather than add a ZERO_OR_NULL_PTR() check in functions that make use of
      the bios_event_log pointer, simply avoid creating the
      binary_bios_measurements_file as is done in other event log retrieval
      backends.
      
      Explicitly ignore all of the events in the final event log when the main
      event log is empty. The list of events in the final event log cannot be
      accurately parsed without referring to the first event in the main event
      log (the event log header) so the final event log is useless in such a
      situation.
      
      Fixes: 58cc1e4f ("tpm: parse TPM event logs based on EFI table")
      Link: https://lore.kernel.org/linux-integrity/E1FDCCCB-CA51-4AEE-AC83-9CDE995EAE52@canonical.com/Reported-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Reported-by: default avatarKenneth R. Crudup <kenny@panix.com>
      Reported-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      Cc: Thiébaud Weksteen <tweek@google.com>
      Cc: Ard Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarTyler Hicks <tyhicks@linux.microsoft.com>
      Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      8ffd778a