Commit graph

1268123 commits

Author SHA1 Message Date
Linus Torvalds 92d503011f Fix possible (but unlikely) out-of-bounds access in
the timer migration per-CPU-init code.
 
 Signed-off-by: Ingo Molnar <mingo@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmY+AJMRHG1pbmdvQGtl
 cm5lbC5vcmcACgkQEnMQ0APhK1goog/+PiUBrrONN97ZPcHAVcUfu7+9oAFGdMx8
 VbkfD/uPH+etxzkfr2aIakOt+JnM88YwvMcTpdT1NzNZbTYBSM2IYktTYdvXQsCX
 F/Ca0BvyyAqlL/cNbgvfEaQues6HclrLw1JIMJhxzlFJKqXVQDoCX3yESR/0Xs3U
 Mm+BhbfTWQEKBQ8BfdKZEBmGnuyGGFPb14g+IkFAdM6g3KFCPupGhn2wkXlN2PmM
 p5nftL39/ph4mClwYGs98VXaRL6v/jHSo/cwfhqVSAZcGw7z6seAbofCH2av9rD4
 SiNjAyYLb0am+e2izt5o4V3z+T8BM3EfdWC0G9W2Nt/Uq3gvTfEK2uCq25r/CyV6
 P8uS1KUoVrcWKrnr73k8aL2c9Db8PH/F0GL4WwAXjNmDZmgrIjE4gGgaH3j4micw
 PV3Ebse7+X2PWDTKj+e0i0ruqxPlko/rcDnoH6dzcMKb0A82w0IWSehlzWHag7QW
 NZmHNwVA1awzmWyxOPLARmlVpjeHtXzAh+QtprzfVMZfKWCZ4xjKvA+nNjqRyHDb
 apjNLkz+7OAAEICoVrIjV8S92EWDrLn27H7utOeqeqg1MFZuQPtpuYY34QQHwOZu
 7m9KgnNppc6dOY4TPWN28Vy2aaTmEEPJvS67BgjH//WKkCSINW7xY2hMt5SxnQgW
 IqL+v4gVWmk=
 =Wb1D
 -----END PGP SIGNATURE-----

Merge tag 'timers-urgent-2024-05-10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer fix from Ingo Molnar:
 "Fix possible (but unlikely) out-of-bounds access in the timer
  migration per-CPU-init code"

* tag 'timers-urgent-2024-05-10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  timers/migration: Prevent out of bounds access on failure
2024-05-10 10:15:58 -07:00
Linus Torvalds 98957025cf IOMMU Fixes for Linux v6.9-rc7:
Including:
 
 	- Fix offset miscalculation on ARM-SMMU driver
 
 	- AMD IOMMU fix for initializing state of untrusted devices
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEr9jSbILcajRFYWYyK/BELZcBGuMFAmY9+5wACgkQK/BELZcB
 GuPzQg/9EwElcc9Vtdcnoiyl0VgdmlAF3IxLIL8LbM+WEm/PXMK+LnYDBdclLQIo
 lW9v4ZGzm+DKqRF1ksC78/yKWcbfJ31rzkE7Ztf57yzHkVxB1qWe7/ksrpkn0Fjx
 32Y6lhhaw6WACXA1gSvz/TXiL+Zr8F/T++R5Cxc1gCFo11W1A/jrXOKjNgNtNx/U
 O9/uDpIFHdQvvOBmAPpFQi43P7TPb4PylEjPzsJQP239ZTFT7h25vZZHdA3PfyPU
 +nSisgibpOMfyMbqY25q4Qg4+Ek0BvdG3yi8+mlUK9MRKwvebCIBhIsSh2HWSSGu
 jyq0xzPc5Av7ufWNKA9L3jbxgAtnODrc8cUlUQ7lXNNB7hPz10QiDfvMmVXrvcwW
 B8K4agYf2wfK64lJuMpbjbh3qFXbAoWKjQMx7xwji7LVhukdA0ndbERg1YKN3nLO
 39KLatEDgTLqHsKclIbCdwwd8FfYQTFrUTT4nHsVW4YFhtUd8yNuh4bdmOFgHaNg
 /9VhII864BAwWy6P4pYur921rRBorHAQ20PyeOsNOMESFtA7VQOX504zbCayiknf
 dYeoQGUnS202a1gjicpMMWMF5IzZE681Z8YLbndrNyjpiQ5pi8IWDDGstdHqmhtX
 vcc0S0WIMHBlZPbkAATu/A7A3bwymImmbJ1n9y7S6RHbtu/mKGo=
 =zdMj
 -----END PGP SIGNATURE-----

Merge tag 'iommu-fixes-v6.9-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu

Pull iommu fixes from Joerg Roedel:

 - Fix offset miscalculation on ARM-SMMU driver

 - AMD IOMMU fix for initializing state of untrusted devices

* tag 'iommu-fixes-v6.9-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
  iommu/arm-smmu: Use the correct type in nvidia_smmu_context_fault()
  iommu/amd: Enhance def_domain_type to handle untrusted device
2024-05-10 10:10:21 -07:00
Michel Dänzer 8d2c930735 drm/amdgpu: Fix comparison in amdgpu_res_cpu_visible
It incorrectly claimed a resource isn't CPU visible if it's located at
the very end of CPU visible VRAM.

Fixes: a6ff969fe9 ("drm/amdgpu: fix visible VRAM handling during faults")
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3343
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reported-and-Tested-by: Jeremy Day <jsday@noreason.ca>
Signed-off-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
CC: stable@vger.kernel.org
2024-05-10 13:05:13 -04:00
Alex Deucher be4a2a81b6 drm/amdkfd: don't allow mapping the MMIO HDP page with large pages
We don't get the right offset in that case.  The GPU has
an unused 4K area of the register BAR space into which you can
remap registers.  We remap the HDP flush registers into this
space to allow userspace (CPU or GPU) to flush the HDP when it
updates VRAM.  However, on systems with >4K pages, we end up
exposing PAGE_SIZE of MMIO space.

Fixes: d8e408a827 ("drm/amdkfd: Expose HDP registers to user space")
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
2024-05-10 13:05:13 -04:00
Thomas Gleixner 5754ace3c3 x86/topology/amd: Ensure that LLC ID is initialized
The original topology evaluation code initialized cpu_data::topo::llc_id
with the die ID initialy and then eventually overwrite it with information
gathered from a CPUID leaf.

The conversion analysis failed to spot that particular detail and omitted
this initial assignment under the assumption that each topology evaluation
path will set it up. That assumption is mostly correct, but turns out to be
wrong in case that the CPUID leaf 0x80000006 does not provide a LLC ID.

In that case, LLC ID is invalid and as a consequence the setup of the
scheduling domain CPU masks is incorrect which subsequently causes the
scheduler core to complain about it during CPU hotplug:

  BUG: arch topology borken
       the CLS domain not a subset of the MC domain

Cure it by reusing legacy_set_llc() and assigning the die ID if the LLC ID
is invalid after all possible parsers have been tried.

Fixes: f7fb3b2dd9 ("x86/cpu: Provide an AMD/HYGON specific topology parser")
Reported-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Tested-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Link: https://lore.kernel.org/r/PUZPR04MB63168AC442C12627E827368581292@PUZPR04MB6316.apcprd04.prod.outlook.com
2024-05-10 17:42:50 +02:00
Kent Gibson ee0166b637 gpiolib: cdev: fix uninitialised kfifo
If a line is requested with debounce, and that results in debouncing
in software, and the line is subsequently reconfigured to enable edge
detection then the allocation of the kfifo to contain edge events is
overlooked.  This results in events being written to and read from an
uninitialised kfifo.  Read events are returned to userspace.

Initialise the kfifo in the case where the software debounce is
already active.

Fixes: 65cff70464 ("gpiolib: cdev: support setting debounce")
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240510065342.36191-1-warthog618@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-05-10 16:38:27 +02:00
Daniel Danzberger 78b08cf631 arm64: defconfig: enable Airoha platform
Enables the ARCH_AIROHA config by default.

Signed-off-by: Daniel Danzberger <dd@embedd.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/65737ca5506371ef84c3a055e68d280f314e3b41.1709975956.git.lorenzo@kernel.org
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-05-10 15:56:33 +02:00
Daniel Danzberger 428ae88ef5 arm64: add Airoha EN7581 platform
Introduce the Kconfig entry for the Airoha EN7581 multicore architecture
available in the Airoha EN7581 evaluation board.

Signed-off-by: Daniel Danzberger <dd@embedd.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/d52d95db313e6a58ba997ba2181faf78a1014bcc.1709975956.git.lorenzo@kernel.org
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-05-10 15:56:20 +02:00
Shyam Sundar S K 0e640f0a47 x86/amd_nb: Add new PCI IDs for AMD family 0x1a
Add the new PCI Device IDs to the MISC IDs list to support new
generation of AMD 1Ah family 70h Models of processors.

  [ bp: Massage commit message. ]

Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20240510111829.969501-1-Shyam-sundar.S-k@amd.com
2024-05-10 14:52:46 +02:00
Jason Gunthorpe 65ade5653f iommu/arm-smmu: Use the correct type in nvidia_smmu_context_fault()
This was missed because of the function pointer indirection.

nvidia_smmu_context_fault() is also installed as a irq function, and the
'void *' was changed to a struct arm_smmu_domain. Since the iommu_domain
is embedded at a non-zero offset this causes nvidia_smmu_context_fault()
to miscompute the offset. Fixup the types.

  Unable to handle kernel NULL pointer dereference at virtual address 0000000000000120
  Mem abort info:
    ESR = 0x0000000096000004
    EC = 0x25: DABT (current EL), IL = 32 bits
    SET = 0, FnV = 0
    EA = 0, S1PTW = 0
    FSC = 0x04: level 0 translation fault
  Data abort info:
    ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
    CM = 0, WnR = 0, TnD = 0, TagAccess = 0
    GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
  user pgtable: 4k pages, 48-bit VAs, pgdp=0000000107c9f000
  [0000000000000120] pgd=0000000000000000, p4d=0000000000000000
  Internal error: Oops: 0000000096000004 [#1] SMP
  Modules linked in:
  CPU: 1 PID: 47 Comm: kworker/u25:0 Not tainted 6.9.0-0.rc7.58.eln136.aarch64 #1
  Hardware name: Unknown NVIDIA Jetson Orin NX/NVIDIA Jetson Orin NX, BIOS 3.1-32827747 03/19/2023
  Workqueue: events_unbound deferred_probe_work_func
  pstate: 604000c9 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
  pc : nvidia_smmu_context_fault+0x1c/0x158
  lr : __free_irq+0x1d4/0x2e8
  sp : ffff80008044b6f0
  x29: ffff80008044b6f0 x28: ffff000080a60b18 x27: ffffd32b5172e970
  x26: 0000000000000000 x25: ffff0000802f5aac x24: ffff0000802f5a30
  x23: ffff0000802f5b60 x22: 0000000000000057 x21: 0000000000000000
  x20: ffff0000802f5a00 x19: ffff000087d4cd80 x18: ffffffffffffffff
  x17: 6234362066666666 x16: 6630303078302d30 x15: ffff00008156d888
  x14: 0000000000000000 x13: ffff0000801db910 x12: ffff00008156d6d0
  x11: 0000000000000003 x10: ffff0000801db918 x9 : ffffd32b50f94d9c
  x8 : 1fffe0001032fda1 x7 : ffff00008197ed00 x6 : 000000000000000f
  x5 : 000000000000010e x4 : 000000000000010e x3 : 0000000000000000
  x2 : ffffd32b51720cd8 x1 : ffff000087e6f700 x0 : 0000000000000057
  Call trace:
   nvidia_smmu_context_fault+0x1c/0x158
   __free_irq+0x1d4/0x2e8
   free_irq+0x3c/0x80
   devm_free_irq+0x64/0xa8
   arm_smmu_domain_free+0xc4/0x158
   iommu_domain_free+0x44/0xa0
   iommu_deinit_device+0xd0/0xf8
   __iommu_group_remove_device+0xcc/0xe0
   iommu_bus_notifier+0x64/0xa8
   notifier_call_chain+0x78/0x148
   blocking_notifier_call_chain+0x4c/0x90
   bus_notify+0x44/0x70
   device_del+0x264/0x3e8
   pci_remove_bus_device+0x84/0x120
   pci_remove_root_bus+0x5c/0xc0
   dw_pcie_host_deinit+0x38/0xe0
   tegra_pcie_config_rp+0xc0/0x1f0
   tegra_pcie_dw_probe+0x34c/0x700
   platform_probe+0x70/0xe8
   really_probe+0xc8/0x3a0
   __driver_probe_device+0x84/0x160
   driver_probe_device+0x44/0x130
   __device_attach_driver+0xc4/0x170
   bus_for_each_drv+0x90/0x100
   __device_attach+0xa8/0x1c8
   device_initial_probe+0x1c/0x30
   bus_probe_device+0xb0/0xc0
   deferred_probe_work_func+0xbc/0x120
   process_one_work+0x194/0x490
   worker_thread+0x284/0x3b0
   kthread+0xf4/0x108
   ret_from_fork+0x10/0x20
  Code: a9b97bfd 910003fd a9025bf5 f85a0035 (b94122a1)

Cc: stable@vger.kernel.org
Fixes: e0976331ad ("iommu/arm-smmu: Pass arm_smmu_domain to internal functions")
Reported-by: Jerry Snitselaar <jsnitsel@redhat.com>
Closes: https://lore.kernel.org/all/jto5e3ili4auk6sbzpnojdvhppgwuegir7mpd755anfhwcbkfz@2u5gh7bxb4iv
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Tested-by: Jerry Snitselaar <jsnitsel@redhat.com>
Acked-by: Jerry Snitselaar <jsnitsel@redhat.com>
Link: https://lore.kernel.org/r/0-v1-24ce064de41f+4ac-nvidia_smmu_fault_jgg@nvidia.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2024-05-10 09:09:55 +02:00
David Howells da0e01cc70
afs: Fix fileserver rotation getting stuck
Fix the fileserver rotation code in a couple of ways:

 (1) op->server_states is an array, not a pointer to a single record, so
     fix the places that access it to index it.

 (2) In the places that go through an address list to work out which one
     has the best priority, fix the loops to skip known failed addresses.

Without this, the rotation algorithm may get stuck on addresses that are
inaccessible or don't respond.

This can be triggered manually by finding a server that advertises a
non-routable address and giving it a higher priority, eg.:

        echo "add udp 192.168.0.0/16 3000" >/proc/fs/afs/addr_prefs

if the server, say, includes the address 192.168.7.7 in its address list,
and then attempting to access a volume on that server.

Fixes: 495f2ae9e3 ("afs: Fix fileserver rotation")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Link: https://lore.kernel.org/r/4005300.1712309731@warthog.procyon.org.uk/ # v1
Link: https://lore.kernel.org/r/998836.1714746152@warthog.procyon.org.uk
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-05-10 08:49:17 +02:00
Christian Brauner 4810ce7c91
selftests: add F_DUPDFD_QUERY selftests
Add simple selftests for the new F_DUPFD_QUERY fcntl().

Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-05-10 08:49:13 +02:00
Linus Torvalds c62b758bae
fcntl: add F_DUPFD_QUERY fcntl()
Often userspace needs to know whether two file descriptors refer to the
same struct file. For example, systemd uses this to filter out duplicate
file descriptors in it's file descriptor store (cf. [1]) and vulkan uses
it to compare dma-buf fds (cf. [2]).

The only api we provided for this was kcmp() but that's not generally
available or might be disallowed because it is way more powerful (allows
ordering of file pointers, operates on non-current task) etc. So give
userspace a simple way of comparing two file descriptors for sameness
adding a new fcntl() F_DUDFD_QUERY.

Link: a4f0e0da35/src/basic/fd-util.c (L517) [1]
Link: https://gitlab.freedesktop.org/wlroots/wlroots/-/blob/master/render/vulkan/texture.c#L490 [2]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[brauner: commit message]
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-05-10 08:26:31 +02:00
Dave Airlie fa68a34ec3 - Fix use zero-length element array
- Move more from system wq to ordered private wq
 - Do not ignore return for drmm_mutex_init
 -----BEGIN PGP SIGNATURE-----
 
 iQJNBAABCAA3FiEE6rM8lpABPHM5FqyDm6KlpjDL6lMFAmY9IoMZHGx1Y2FzLmRl
 bWFyY2hpQGludGVsLmNvbQAKCRCboqWmMMvqUyaDD/sFDt5Ew3f79bQVoBmJ1G4B
 IHWWDsCiqd+JAo3qP85VBF3vL9qjtTk4khfSkfNrWspcBuTjmnLH88zapODLjJhC
 1CbPFVbEOwlDGZcHMIR8V2itwE/TDBpUy7OQk7mggdsXmrd1ivqsOtup0kpYLhAC
 LI3dsUT1isua5b1wMcXHrqjjITbIU6i0G0G1JYmj8X78mDcSVK/AEIgf59dQa2Cm
 kU9zemEaPZnueDATPPM3q/T3tZIDmkKEs3t7ipDvh1WDtdrTrH4uOvkAKZLCTBLE
 RQtgn6XNYQG5QFbkD7I3HszQXHZhs3poHtj75FudO8Vuz5YFvu7kTXcjdU36+kw0
 qcLCwnWkVklqyozCLuO0dXGdwyGtwsOZAplhAHv/g2FokZjZXaMU2rJu2xKK/FOE
 bzOQubQWtWLOCQvt4Xmh89T0Pj0DAC7K06p+fymL89XvtzpjnsGVDAtBcbCe/9IB
 rivJbp+YUNFB75oq7chRIDAWZZMSNQJoA93YGtvXF/sJpdHwk/ezAxX58tLmlwuu
 kmy8ZV9/beKihA0iikMVAP/i24EYtoUP+03K75S/OGuO603WGfUGa9CotDJgCtE+
 PZpaizYeIQk9Dn7gfCwu/ee6IWBKCHCtP3a5CnnFqXBpgF+2fMEWRxMWqpE+w2yr
 IqX9BHXetTFOxWLsdOvlKQ==
 =iAzA
 -----END PGP SIGNATURE-----

Merge tag 'drm-xe-fixes-2024-05-09' of https://gitlab.freedesktop.org/drm/xe/kernel into drm-fixes

- Fix use zero-length element array
- Move more from system wq to ordered private wq
- Do not ignore return for drmm_mutex_init

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/c3rduifdp5wipkljdpuq4x6uowkc2uyzgdoft4txvp6mgvzjaj@7zw7c6uw4wrf
2024-05-10 10:06:07 +10:00
Dave Airlie b356ead840 - Automate CCS Mode setting during engine resets (Andi)
- Fix audio time stamp programming for DP (Chaitanya)
 - Fix parsing backlight BDB data (Karthikeyan)
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEbSBwaO7dZQkcLOKj+mJfZA7rE8oFAmY70cgACgkQ+mJfZA7r
 E8pThQf8DddZyTSPC4vfN5QdBU8YvUDOOPx3osIURH+kDU7kdvQDHN1pfR4q3+Q2
 afoViGlrpP2TqW7KW0WL6GDuDGnTMvvSryt4axvjaYqJJzSV9YjB2nZb1nWehcgj
 V8YFK+uRXbwFn1LoNmhvlaVguv85h25WqKbzNWHcvwB2N4hFIe+Goo/d9iME3p0Z
 r96KOo3O9z5P4NzGi/qBRWA8K9xfi69ePQKVSa9i2NbHPb074SAP7yjCa3V8oPcy
 QjLiOm7u+h/ilUAiVPUSdp0uHvA/Rrj8H07gdAFKpogteIzC75Fmhw+bLNaqJ+Kd
 BW0la/l+xc1pwKEji1vvhqxeJjMb6Q==
 =k/RY
 -----END PGP SIGNATURE-----

Merge tag 'drm-intel-fixes-2024-05-08' of https://anongit.freedesktop.org/git/drm/drm-intel into drm-fixes

- Automate CCS Mode setting during engine resets (Andi)
- Fix audio time stamp programming for DP (Chaitanya)
- Fix parsing backlight BDB data (Karthikeyan)

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/ZjvTVEmQeVKVB2jx@intel.com
2024-05-10 08:34:50 +10:00
Bagas Sanjaya 1d479e3cd6 Documentation: tpm: Add TPM security docs toctree entry
Stephen Rothwell reports htmldocs warning when merging tpmdd tree for
linux-next:

Documentation/security/tpm/tpm-security.rst: WARNING: document isn't included in any toctree

Add toctree entry for TPM security docs to fix above warning.

Fixes: ddfb3687c538 ("Documentation: add tpm-security.rst")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Closes: https://lore.kernel.org/linux-next/20240506162105.42ce2ff7@canb.auug.org.au/
Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:52 +03:00
James Bottomley eb24c9788c tpm: disable the TPM if NULL name changes
Update tpm2_load_context() to return -EINVAL on integrity failures and
use this as a signal when loading the NULL context that something
might be wrong.  If the signal fails, check the name of the NULL
primary against the one stored in the chip data and if there is a
mismatch disable the TPM because it is likely to have suffered a reset
attack.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:52 +03:00
James Bottomley 3d2daf9d59 Documentation: add tpm-security.rst
Document how the new encrypted secure interface for TPM2 works and how
security can be assured after boot by certifying the NULL seed.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:52 +03:00
James Bottomley 089e0fb3f7 tpm: add the null key name as a sysfs export
This is the last component of encrypted tpm2 session handling that
allows us to verify from userspace that the key derived from the NULL
seed genuinely belongs to the TPM and has not been spoofed.

The procedure for doing this involves creating an attestation identity
key (which requires verification of the TPM EK certificate) and then
using that AIK to sign a certification of the Elliptic Curve key over
the NULL seed.  Userspace must create this EC Key using the parameters
prescribed in TCG TPM v2.0 Provisioning Guidance for the SRK ECC; if
this is done correctly the names will match and the TPM can then run a
TPM2_Certify operation on this derived primary key using the newly
created AIK.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:52 +03:00
James Bottomley 52ce7d9731 KEYS: trusted: Add session encryption protection to the seal/unseal path
If some entity is snooping the TPM bus, the can see the data going in
to be sealed and the data coming out as it is unsealed.  Add parameter
and response encryption to these cases to ensure that no secrets are
leaked even if the bus is snooped.

As part of doing this conversion it was discovered that policy
sessions can't work with HMAC protected authority because of missing
pieces (the tpm Nonce).  I've added code to work the same way as
before, which will result in potential authority exposure (while still
adding security for the command and the returned blob), and a fixme to
redo the API to get rid of this security hole.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:51 +03:00
James Bottomley 1b6d7f9eb1 tpm: add session encryption protection to tpm2_get_random()
If some entity is snooping the TPM bus, they can see the random
numbers we're extracting from the TPM and do prediction attacks
against their consumers.  Foil this attack by using response
encryption to prevent the attacker from seeing the random sequence.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:51 +03:00
James Bottomley 6519fea6fd tpm: add hmac checks to tpm2_pcr_extend()
tpm2_pcr_extend() is used by trusted keys to extend a PCR to prevent a
key from being re-loaded until the next reboot.  To use this
functionality securely, that extend must be protected by a session
hmac.  This patch adds HMAC protection so tampering with the
tpm2_pcr_extend() command in flight is detected.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:51 +03:00
James Bottomley 1085b8276b tpm: Add the rest of the session HMAC API
The final pieces of the HMAC API are for manipulating the session area
of the command.  To add an authentication HMAC session
tpm_buf_append_hmac_session() is called where tpm2_append_auth() would
go. If a non empty password is passed in, this is correctly added to
the HMAC to prove knowledge of it without revealing it.  Note that if
the session is only used to encrypt or decrypt parameters (no
authentication) then tpm_buf_append_hmac_session_opt() must be used
instead.  This functions identically to tpm_buf_append_hmac_session()
when TPM_BUS_SECURITY is enabled, but differently when it isn't,
because effectively nothing is appended to the session area.

Next the parameters should be filled in for the command and finally
tpm_buf_fill_hmac_session() is called immediately prior to transmitting
the command which computes the correct HMAC and places it in the
command at the session location in the tpm buffer

Finally, after tpm_transmit_cmd() is called,
tpm_buf_check_hmac_response() is called to check that the returned
HMAC matched and collect the new state for the next use of the
session, if any.

The features of the session are controlled by the session attributes
set in tpm_buf_append_hmac_session().  If TPM2_SA_CONTINUE_SESSION is
not specified, the session will be flushed and the tpm2_auth structure
freed in tpm_buf_check_hmac_response(); otherwise the session may be
used again.  Parameter encryption is specified by or'ing the flag
TPM2_SA_DECRYPT and response encryption by or'ing the flag
TPM2_SA_ENCRYPT.  the various encryptions will be taken care of by
tpm_buf_fill_hmac_session() and tpm_buf_check_hmac_response()
respectively.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> # crypto API parts
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:51 +03:00
James Bottomley d0a25bb961 tpm: Add HMAC session name/handle append
Add tpm2_append_name() for appending to the handle area of the TPM
command.  When TPM_BUS_SECURITY is enabled and HMAC sessions are in
use this adds the standard u32 handle to the buffer but additionally
records the name of the object which must be used as part of the HMAC
computation.  The name of certain object types (volatile and permanent
handles and NV indexes) is a hash of the public area of the object.
Since this hash is not known ahead of time, it must be requested from
the TPM using TPM2_ReadPublic() (which cannot be HMAC protected, but
if an interposer lies about it, the HMAC check will fail and the
problem will be detected).

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> # crypto API parts
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:51 +03:00
James Bottomley 699e3efd6c tpm: Add HMAC session start and end functions
Add session  based HMAC  authentication plus parameter  decryption and
response encryption  using AES. The  basic design is to  segregate all
the nasty crypto, hash and hmac code into tpm2-sessions.c and export a
usable API.  The API first of all starts off by gaining a session with
tpm2_start_auth_session() which  initiates a session with  the TPM and
allocates  an  opaque  tpm2_auth   structure  to  handle  the  session
parameters.  The  design is that  session use will be  single threaded
from start to finish under the ops lock, so the tpm2_auth structure is
stored in struct tpm2_chip to simpify the externally visible API.

The session can be ended with tpm2_end_auth_session() which is
designed only to be used in error legs.  Ordinarily the further
session API (future patches) will end or continue the session
appropriately without having to call this.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> # crypto API parts
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:51 +03:00
James Bottomley 033ee84e5f tpm: Add TCG mandated Key Derivation Functions (KDFs)
The TCG mandates two Key derivation functions called KDFa and KDFe
used to derive keys from seeds and elliptic curve points respectively.
The definitions for these functions are found in the TPM 2.0 Library
Specification Part 1 - Architecture Guide

https://trustedcomputinggroup.org/resource/tpm-library-specification/

Implement a cut down version of each of these functions sufficient to
support the key derivation needs of HMAC sessions.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:51 +03:00
James Bottomley d2add27cf2 tpm: Add NULL primary creation
The session handling code uses a "salted" session, meaning a session
whose salt is encrypted to the public part of another TPM key so an
observer cannot obtain it (and thus deduce the session keys).  This
patch creates and context saves in the tpm_chip area the primary key
of the NULL hierarchy for this purpose.

[jarkko@kernel.org: fixed documentation errors]
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:51 +03:00
James Bottomley fefb9f1272 tpm: export the context save and load commands
The TPM2 session HMAC and encryption handling code needs to save and
restore a single volatile context for the elliptic curve version of
the NULL seed, so export the APIs which do this for internal use.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:51 +03:00
James Bottomley 11189d6828 tpm: add buffer function to point to returned parameters
Replace all instances of &buf.data[TPM_HEADER_SIZE] with a new
function tpm_buf_parameters() because encryption sessions change
where the return parameters are located in the buffer since if a
return session is present they're 4 bytes beyond the header with those
4 bytes giving the parameter length.  If there is no return session,
then they're in the usual place immediately after the header.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:51 +03:00
Ard Biesheuvel f135440447 crypto: lib - implement library version of AES in CFB mode
Implement AES in CFB mode using the existing, mostly constant-time
generic AES library implementation. This will be used by the TPM code
to encrypt communications with TPM hardware, which is often a discrete
component connected using sniffable wires or traces.

While a CFB template does exist, using a skcipher is a major pain for
non-performance critical synchronous crypto where the algorithm is known
at compile time and the data is in contiguous buffers with valid kernel
virtual addresses.

Tested-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/all/20230216201410.15010-1-James.Bottomley@HansenPartnership.com/
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:51 +03:00
Jarkko Sakkinen 40813f1879 KEYS: trusted: tpm2: Use struct tpm_buf for sized buffers
Take advantage of the new sized buffer (TPM2B) mode of struct tpm_buf in
tpm2_seal_trusted(). This allows to add robustness to the command
construction without requiring to calculate buffer sizes manually.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:51 +03:00
Jarkko Sakkinen acd5eb4f50 tpm: Add tpm_buf_read_{u8,u16,u32}
Declare reader functions for the instances of struct tpm_buf. If the read
goes out of boundary, TPM_BUF_BOUNDARY_ERROR is set, and subsequent read
will do nothing.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:51 +03:00
Jarkko Sakkinen d926ee92e8 tpm: TPM2B formatted buffers
Declare tpm_buf_init_sized() and tpm_buf_reset_sized() for creating TPM2B
formatted buffers. These buffers are also known as sized buffers in the
specifications and literature.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:51 +03:00
Jarkko Sakkinen e1b72e1b11 tpm: Store the length of the tpm_buf data separately.
TPM2B buffers, or sized buffers, have a two byte header, which contains the
length of the payload as a 16-bit big-endian number, without counting in
the space taken by the header. This differs from encoding in the TPM header
where the length includes also the bytes taken by the header.

Unbound the length of a tpm_buf from the value stored to the TPM command
header. A separate encoding and decoding step so that different buffer
types can be supported, with variant header format and length encoding.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:51 +03:00
Jarkko Sakkinen 37e2ee16d6 tpm: Update struct tpm_buf documentation comments
Remove deprecated portions and document enum values.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:51 +03:00
James Bottomley 17d89b2e2f tpm: Move buffer handling from static inlines to real functions
separate out the tpm_buf_... handling functions from static inlines in
tpm.h and move them to their own tpm-buf.c file.  This is a precursor
to adding new functions for other TPM type handling because the amount
of code will grow from the current 70 lines in tpm.h to about 200
lines when the additions are done.  200 lines of inline functions is a
bit too much to keep in a header file.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:50 +03:00
Jarkko Sakkinen 4f0feb5463 tpm: Remove tpm_send()
Open code the last remaining call site for tpm_send().

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:50 +03:00
Jarkko Sakkinen cf792e903a tpm: Remove unused tpm_buf_tag()
The helper function has no call sites. Thus, remove it.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:50 +03:00
Niklas Schnelle 8516b23aa2 char: tpm: Keep TPM_INF_IO_PORT define for HAS_IOPORT=n
The recent change to handle HAS_IOPORT removed the TPM_INF_IO_PORT
define for the HAS_IOPORT=n case despite the define being used in
sections of code not covered by the same ifdef check. This was missed
because at the moment TCG_INFINEON indirectly depends on HAS_IOPORT via
PNP which depends on ACPI || ISA. As TCG_INFINEON does in principle
support MMIO only use add it for COMPILE_TEST to cover the HAS_IOPORT=n
case.

Link: https://lore.kernel.org/lkml/9d9fa267-067e-421b-9a39-aa178b913298@app.fastmail.com/
Fixes: dab56f80e7f9 ("char: tpm: handle HAS_IOPORT dependencies")
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:50 +03:00
Michael Haener 45121fcbe7 dt-bindings: tpm: Add st,st33ktpm2xi2c
Add the ST chip st33ktpm2xi2c to the supported compatible strings of the
TPM TIS I2C schema. The Chip is compliant with the TCG PC Client TPM
Profile specification.

For reference, a datasheet is available at:
https://www.st.com/resource/en/data_brief/st33ktpm2xi2c.pdf

Reviewed-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Signed-off-by: Michael Haener <michael.haener@siemens.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:50 +03:00
Jarkko Sakkinen 8a55256a84 Documentation: tpm_tis
Based recent discussions on LKML, provide preliminary bits of tpm_tis_core
dependent drivers. Includes only bare essentials but can be extended later
on case by case. This way some people may even want to read it later on.

Reviewed-by: Bagas Sanjaya <bagasdotme@gmail.com>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:50 +03:00
Colin Ian King d14d2cc265 tpm/eventlog: remove redundant assignment to variabel ret
Variable ret is being assigned and error code that is never read, it is
either being re-assigned in an error exit path or never referenced again
on the non-error path. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
drivers/char/tpm/eventlog/acpi.c:145:2: warning: Value stored to 'ret'
is never read [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:50 +03:00
Niklas Schnelle 6155153601 char: tpm: handle HAS_IOPORT dependencies
In a future patch HAS_IOPORT=n will disable inb()/outb() and friends at
compile time. We thus need to add this dependency and ifdef sections of
code using inb()/outb() as alternative access methods.

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Acked-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2024-05-09 22:30:50 +03:00
Jens Axboe a772178456 nvme fixes for Linux 6.9
- nvme target fixes (Sagi, Dan, Maurizo)
  - new vendor quirk for broken MSI (Sean)
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE3Fbyvv+648XNRdHTPe3zGtjzRgkFAmY9DAoACgkQPe3zGtjz
 Rgm5fRAAnHWt/juXTgXquz145nVYO6rEBXbmLPa+vB/8/VoXZNEI48dDr9NwOlaN
 voNmDdaMkSOMbbVKEG4pYhHpqgJoC3VV13SEUKmCk874zqrQnDdIITV2bLTY6+hH
 j2ZxytKurntwFONMILfPiHxq7+40W1tvJ2jjywreLWOgD/UxVJ3wtgeBv/mm/mWY
 X2QNTwBg/C57pCpa7B0i4HFALU77Xstrr9ibaRkQ1FQ5gVBnRFcDEqSLw+W+qjs6
 8irxW8bsdIcHdiug0CcrVbrPFR5YBongZW7A+NCHvMSWmneJeXGQWV0+HojB755B
 h1ZORM1XVtFfUoCywsewxuXIbfLdXIU4e3Ne5q1K5P6BiEDVVm0Y+F8hygF+QIT9
 Zp5GIL4TOJ/c6JbuOKHFmA1u2+dTNfL4XwAEp1SQghzuhj9896QUT0zgkhac18Np
 J6rd/nhyGkSK9lEsh1MWiKz96ZG2+Bj1pnvWILu75S2WU+IUDpFVK/oHdiptpspf
 +NzkpKdbM1ZKHk166FMI/qVnoB2yj4rBESMKxVWzgliDL3I5G5EU5JlBPdSqZ+H2
 JWV+XrLjuQ0X/ln6Z8gUtHvnc+WLKH1WWiX9NYVO/sUffG5lleFmQbTOhPq1OlHF
 wrs/pMiRH5maB0ZfP7tSXyJ15Krxx6pH678mfv/aZyVKO+OU5FE=
 =5gq/
 -----END PGP SIGNATURE-----

Merge tag 'nvme-6.9-2024-05-09' of git://git.infradead.org/nvme into block-6.9

Pull NVMe fixes from Keith:

"nvme fixes for Linux 6.9

 - nvme target fixes (Sagi, Dan, Maurizo)
 - new vendor quirk for broken MSI (Sean)"

* tag 'nvme-6.9-2024-05-09' of git://git.infradead.org/nvme:
  nvmet-rdma: fix possible bad dereference when freeing rsps
  nvmet: prevent sprintf() overflow in nvmet_subsys_nsid_exists()
  nvmet: make nvmet_wq unbound
  nvmet-auth: return the error code to the nvmet_auth_ctrl_hash() callers
  nvme-pci: Add quirk for broken MSIs
2024-05-09 11:49:18 -06:00
Linus Torvalds 448b3fe5a0 hwmon fixes for v6.9-rc8
- pmbus/ucd9000: Increase chip access delay to avoid random access
   errors
 
 - corsair-cpro: Protect kernel code against parallel hidraw access
   from userspace
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEiHPvMQj9QTOCiqgVyx8mb86fmYEFAmY8/IQACgkQyx8mb86f
 mYF5YxAAjdKo6Ch/0LaGvUVsOj7fZaKNWX2YW91nCcJCjO0LsliuXZqRj/v1EDxr
 S63ropzUdC+oX8JnYaEpmzK3+KdmrvGQjrwz4zSsD9QIrKDEj2kqZvy6/cnLUvTF
 2X5JX1DjDZNiSiR3tQNJR1NIO0JTtMJ6S2qxZgVp77k6CKfxPpG4NYfBw+7bw2w1
 l+rV4RaquIeZSQzMfZYoRQfNTIneG1nt4JyjD/RN9zmiFikypRrN9PoQs6MzMj/F
 +OjKeXCz11a8rIaJRqKPiRf8uE086qX7TFd7eLKDeP16cCg22CBitIeP95+k8fIZ
 grmA/RtCuNicJlpX5fCysYosYtG6kCdbor6VXpOoY5/bmZNjhrirRiIsa6ueYeNr
 eGA1PEqUfUR6Ot4ZtdWjkKMLo81WtaJDYtYPusRyOcHSXC/PH6xYLuEIFt5nSA/k
 Wvi1yYv/uY9ki3eMSMKI4X59DEnb390lho8OXpk6yHh166AlWmWXVXUw7kVNGvuw
 gIjMlMZ4VDvk9sdqhn6ToW5AZKqaRzgti4VmEzjjr8u3GkD9SwO9klN9EuX4IRj7
 Rgk7JfH+XkSVZCcp01bb7gHK3PwMEtoOvxO/8aq3j7h144blk5gP22c32eT/uTCx
 rIDxF7gtcdQWr6BYz5d1EcZW89kZW8zMtLExAlHGB/dVEHuXWS8=
 =sjbz
 -----END PGP SIGNATURE-----

Merge tag 'hwmon-for-v6.9-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon fixes from Guenter Roeck:

 - pmbus/ucd9000: Increase chip access delay to avoid random access
   errors

 - corsair-cpro: Protect kernel code against parallel hidraw access from
   userspace

* tag 'hwmon-for-v6.9-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (pmbus/ucd9000) Increase delay from 250 to 500us
  hwmon: (corsair-cpro) Protect ccp->wait_input_report with a spinlock
  hwmon: (corsair-cpro) Use complete_all() instead of complete() in ccp_raw_event()
  hwmon: (corsair-cpro) Use a separate buffer for sending commands
2024-05-09 10:17:22 -07:00
Usama Arif db5b4f3253 cgroup: Add documentation for missing zswap memory.stat
This includes zswpin, zswpout and zswpwb.

Signed-off-by: Usama Arif <usamaarif642@gmail.com>
Acked-by: Nhat Pham <nphamcs@gmail.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Message-ID: <20240502185307.3942173-2-usamaarif642@gmail.com>
2024-05-09 10:54:37 -06:00
Lakshmi Yadlapati 26e8383b11 hwmon: (pmbus/ucd9000) Increase delay from 250 to 500us
Following the failure observed with a delay of 250us, experiments were
conducted with various delays. It was found that a delay of 350us
effectively mitigated the issue.

To provide a more optimal solution while still allowing a margin for
stability, the delay is being adjusted to 500us.

Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
Link: https://lore.kernel.org/r/20240507194603.1305750-1-lakshmiy@us.ibm.com
Fixes: 8d655e6523 ("hwmon: (ucd90320) Add minimum delay between bus accesses")
Reviewed-by: Eddie James <eajames@linux.ibm.com>
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-09 09:37:06 -07:00
Linus Torvalds 8c3b7565f8 Including fixes from bluetooth and IPsec.
The bridge patch is actually a follow-up to a recent fix in the same
 area. We have a pending v6.8 AF_UNIX regression; it should be solved
 soon, but not in time for this PR.
 
 Current release - regressions:
 
  - eth: ks8851: Queue RX packets in IRQ handler instead of disabling BHs
 
  - net: bridge: fix corrupted ethernet header on multicast-to-unicast
 
 Current release - new code bugs:
 
  - xfrm: fix possible bad pointer derferencing in error path
 
 Previous releases - regressionis:
 
  - core: fix out-of-bounds access in ops_init
 
  - ipv6:
    - fix potential uninit-value access in __ip6_make_skb()
    - fib6_rules: avoid possible NULL dereference in fib6_rule_action()
 
  - tcp: use refcount_inc_not_zero() in tcp_twsk_unique().
 
  - rtnetlink: correct nested IFLA_VF_VLAN_LIST attribute validation
 
  - rxrpc: fix congestion control algorithm
 
  - bluetooth:
    - l2cap: fix slab-use-after-free in l2cap_connect()
    - msft: fix slab-use-after-free in msft_do_close()
 
  - eth: hns3: fix kernel crash when devlink reload during initialization
 
  - eth: dsa: mv88e6xxx: add phylink_get_caps for the mv88e6320/21 family
 
 Previous releases - always broken:
 
  - xfrm: preserve vlan tags for transport mode software GRO
 
  - tcp: defer shutdown(SEND_SHUTDOWN) for TCP_SYN_RECV sockets
 
  - eth: hns3: keep using user config after hardware reset
 
 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEEg1AjqC77wbdLX2LbKSR5jcyPE6QFAmY8uHASHHBhYmVuaUBy
 ZWRoYXQuY29tAAoJECkkeY3MjxOkedQQAJ4qDwzqUvo+4Ixnn8xQOEeoaqDAfLGR
 TBVFgpG72Hd8sT6C92AO2FPOiBkn5D6VL6QsCsOHmoCBmx9opxdM6K+WIuAldlju
 0IZ/Z2tML5xE7hdrtpI54iqU4OCbf8M9mJrabHaNetWRwLZruLagvyvpdNNtEoup
 nhoVetUYBYmxb3MQ0ez6/zTxvbO1ry7H1xVwbe21hOJszoxuYhLQRx7GBMBm2xn3
 g6m0T7H8EhPKaY/eGoPONcRQ3v29PEuqgVWg0imNy3P4KkTOhshW0jg11mXfaZQA
 32zwLKecdv1gU8Q3Si0ALMtzL3ZC1Iqo4GOEfpr6Bj5Gu+Jd+enPsRDA2hEtMggD
 uh6d9FU4XULZzX5CFEXCoZs0f9N/FNjkDIWUFdHG+0I8pybw+Fbifub76uN1YC5Y
 /02WrtlieOy38UG2FW/zTDRqXMwdwY+VhnVVjK42VnVVFCOM3ucXI/wj5uvytk0B
 iZIWLKtKrVKuUdSdcFvh+Y4z1rK3SFqT5qJEsjzHkLsoap9sbyJrS+MEDeCxv8c4
 RDycwqWdlf1csZFDJ/sIxU9+DvpYY+Zh/ZQgTaU86etWYN7GngSYKFgHSD5F+81X
 kQJgmYInUafzButoL3Kc6JYzfjXYVX9MKAWAjtGdhr7wHOzQHF2U4BUTS4TopjYV
 BQx1t4dZ4n1F
 =qYKQ
 -----END PGP SIGNATURE-----

Merge tag 'net-6.9-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Pull networking fixes from Paolo Abeni:
 "Including fixes from bluetooth and IPsec.

  The bridge patch is actually a follow-up to a recent fix in the same
  area. We have a pending v6.8 AF_UNIX regression; it should be solved
  soon, but not in time for this PR.

  Current release - regressions:

   - eth: ks8851: Queue RX packets in IRQ handler instead of disabling
     BHs

   - net: bridge: fix corrupted ethernet header on multicast-to-unicast

  Current release - new code bugs:

   - xfrm: fix possible bad pointer derferencing in error path

  Previous releases - regressionis:

   - core: fix out-of-bounds access in ops_init

   - ipv6:
      - fix potential uninit-value access in __ip6_make_skb()
      - fib6_rules: avoid possible NULL dereference in fib6_rule_action()

   - tcp: use refcount_inc_not_zero() in tcp_twsk_unique().

   - rtnetlink: correct nested IFLA_VF_VLAN_LIST attribute validation

   - rxrpc: fix congestion control algorithm

   - bluetooth:
      - l2cap: fix slab-use-after-free in l2cap_connect()
      - msft: fix slab-use-after-free in msft_do_close()

   - eth: hns3: fix kernel crash when devlink reload during
     initialization

   - eth: dsa: mv88e6xxx: add phylink_get_caps for the mv88e6320/21
     family

  Previous releases - always broken:

   - xfrm: preserve vlan tags for transport mode software GRO

   - tcp: defer shutdown(SEND_SHUTDOWN) for TCP_SYN_RECV sockets

   - eth: hns3: keep using user config after hardware reset"

* tag 'net-6.9-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (47 commits)
  net: dsa: mv88e6xxx: read cmode on mv88e6320/21 serdes only ports
  net: dsa: mv88e6xxx: add phylink_get_caps for the mv88e6320/21 family
  net: hns3: fix kernel crash when devlink reload during initialization
  net: hns3: fix port vlan filter not disabled issue
  net: hns3: use appropriate barrier function after setting a bit value
  net: hns3: release PTP resources if pf initialization failed
  net: hns3: change type of numa_node_mask as nodemask_t
  net: hns3: direct return when receive a unknown mailbox message
  net: hns3: using user configure after hardware reset
  net/smc: fix neighbour and rtable leak in smc_ib_find_route()
  ipv6: prevent NULL dereference in ip6_output()
  hsr: Simplify code for announcing HSR nodes timer setup
  ipv6: fib6_rules: avoid possible NULL dereference in fib6_rule_action()
  dt-bindings: net: mediatek: remove wrongly added clocks and SerDes
  rxrpc: Only transmit one ACK per jumbo packet received
  rxrpc: Fix congestion control algorithm
  selftests: test_bridge_neigh_suppress.sh: Fix failures due to duplicate MAC
  ipv6: Fix potential uninit-value access in __ip6_make_skb()
  net: phy: marvell-88q2xxx: add support for Rev B1 and B2
  appletalk: Improve handling of broadcast packets
  ...
2024-05-09 08:48:57 -07:00
Linus Torvalds 62788b0f22 ARM fix for v6.9
- clear stale KASan stack poison when a CPU resumes
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEuNNh8scc2k/wOAE+9OeQG+StrGQFAmY8tf8ACgkQ9OeQG+St
 rGRBZg//eI5Nn6PnWQVAJrIDr0/PTiJ7xrE8QlSSn/a2u6fXXUWla3MwGKCj5k51
 R6zMdANFwTFHAa8HecPGCganGgjbdY6FgqCOOCka7Ia+Y5nQXhTEQ0cRgMXf40Hc
 LT/ylnPAlMhd9zNWn9pgdA8AXm8KfQhQsNIewel9rGRE2E2RU9795ldVMwp3/yqH
 3HWXsiQ4bR/EiHD7SewRMPnDaGl+zGdlFEd9eiWtsla+a26/GVMIdikgd/Bjs/Ef
 VjndtgnmHw42BuouWEMx9Fqx21EP3aqegkJhlr6fjZ++/0h7sjgc+kXwyWlxbp7e
 3WW+Nz+V1YgJ3+UIVcyZj2cxNh3AoSxXdstUq86wOaBp647qA4IBI8PD0j7yqIeT
 qYlHaQG7IKOsZhRwSBaV60h3ZISPL9q4rmtN/thBOHXb+xduVc2irfcPIlmg9VKI
 j/+E3DNpwME8j3TWD1lk6fTueQhamkn0HV6F9DHSY0PpFtVSpYn0X5M+7AwVMUfz
 BFBuU7IuP5wR8fr5jin4gX/L1i9kAaflO80B8dm3deQ6JAgD6mU/+tn+fjxqLgFX
 HkPePFUbimQIpDnOShhrqtBtI3+ndxVRiBZkrOhYK3ia6utPqq5Q3i+hIH6acMb9
 jr0s5gn2AZB+KcwGPFanj9aeOlIoz3iKvufZ2eiu/RbtkgxeInI=
 =qmWM
 -----END PGP SIGNATURE-----

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rmk/linux

Pull ARM fix from Russell King:

 - clear stale KASan stack poison when a CPU resumes

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rmk/linux:
  ARM: 9381/1: kasan: clear stale stack poison
2024-05-09 08:44:13 -07:00
Johan Hovold 2a4b49bb58
regulator: core: fix debugfs creation regression
regulator_get() may sometimes be called more than once for the same
consumer device, something which before commit dbe954d8f1 ("regulator:
core: Avoid debugfs: Directory ...  already present! error") resulted in
errors being logged.

A couple of recent commits broke the handling of such cases so that
attributes are now erroneously created in the debugfs root directory the
second time a regulator is requested and the log is filled with errors
like:

	debugfs: File 'uA_load' in directory '/' already present!
	debugfs: File 'min_uV' in directory '/' already present!
	debugfs: File 'max_uV' in directory '/' already present!
	debugfs: File 'constraint_flags' in directory '/' already present!

on any further calls.

Fixes: 2715bb11cf ("regulator: core: Fix more error checking for debugfs_create_dir()")
Fixes: 08880713ce ("regulator: core: Streamline debugfs operations")
Cc: stable@vger.kernel.org
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20240509133304.8883-1-johan+linaro@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-05-09 17:43:57 +02:00