Commit Graph

1169377 Commits

Author SHA1 Message Date
Jann Horn
174bcb2711 firmware_loader: Block path traversal
commit f0e5311aa8022107d63c54e2f03684ec097d1394 upstream.

Most firmware names are hardcoded strings, or are constructed from fairly
constrained format strings where the dynamic parts are just some hex
numbers or such.

However, there are a couple codepaths in the kernel where firmware file
names contain string components that are passed through from a device or
semi-privileged userspace; the ones I could find (not counting interfaces
that require root privileges) are:

 - lpfc_sli4_request_firmware_update() seems to construct the firmware
   filename from "ModelName", a string that was previously parsed out of
   some descriptor ("Vital Product Data") in lpfc_fill_vpd()
 - nfp_net_fw_find() seems to construct a firmware filename from a model
   name coming from nfp_hwinfo_lookup(pf->hwinfo, "nffw.partno"), which I
   think parses some descriptor that was read from the device.
   (But this case likely isn't exploitable because the format string looks
   like "netronome/nic_%s", and there shouldn't be any *folders* starting
   with "netronome/nic_". The previous case was different because there,
   the "%s" is *at the start* of the format string.)
 - module_flash_fw_schedule() is reachable from the
   ETHTOOL_MSG_MODULE_FW_FLASH_ACT netlink command, which is marked as
   GENL_UNS_ADMIN_PERM (meaning CAP_NET_ADMIN inside a user namespace is
   enough to pass the privilege check), and takes a userspace-provided
   firmware name.
   (But I think to reach this case, you need to have CAP_NET_ADMIN over a
   network namespace that a special kind of ethernet device is mapped into,
   so I think this is not a viable attack path in practice.)

Fix it by rejecting any firmware names containing ".." path components.

For what it's worth, I went looking and haven't found any USB device
drivers that use the firmware loader dangerously.

Cc: stable@vger.kernel.org
Reviewed-by: Danilo Krummrich <dakr@kernel.org>
Fixes: abb139e75c ("firmware: teach the kernel to load firmware files directly from the filesystem")
Signed-off-by: Jann Horn <jannh@google.com>
Acked-by: Luis Chamberlain <mcgrof@kernel.org>
Link: https://lore.kernel.org/r/20240828-firmware-traversal-v3-1-c76529c63b5f@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-26 16:23:01 +09:00
j7b3y
f79984b59b Revert "firmware_loader: Add /vendor/firmware and /odm/firmware to search paths"
This reverts commit 8744e80bcb.

Revert "firmware_loader: add /odm/firmware to fw_path[]"

This reverts commit f830bcfc62.

Revert "firmware_loader: add /vendor/firmware to fw_path[]"

This reverts commit eff67caa90.
2025-01-16 11:04:13 +09:00
j7b3y
d14bfe8797 drivers/battery/wireless: add cps4038 2025-01-15 18:04:16 +09:00
j7b3y
f32a1238aa e1q: sync samsung source 2025-01-15 18:04:05 +09:00
Sergey Matsievskiy
0558847d22 pinctrl: ocelot: fix system hang on level based interrupts
commit 93b8ddc54507a227087c60a0013ed833b6ae7d3c upstream.

The current implementation only calls chained_irq_enter() and
chained_irq_exit() if it detects pending interrupts.

```
for (i = 0; i < info->stride; i++) {
	uregmap_read(info->map, id_reg + 4 * i, &reg);
	if (!reg)
		continue;

	chained_irq_enter(parent_chip, desc);
```

However, in case of GPIO pin configured in level mode and the parent
controller configured in edge mode, GPIO interrupt might be lowered by the
hardware. In the result, if the interrupt is short enough, the parent
interrupt is still pending while the GPIO interrupt is cleared;
chained_irq_enter() never gets called and the system hangs trying to
service the parent interrupt.

Moving chained_irq_enter() and chained_irq_exit() outside the for loop
ensures that they are called even when GPIO interrupt is lowered by the
hardware.

The similar code with chained_irq_enter() / chained_irq_exit() functions
wrapping interrupt checking loop may be found in many other drivers:
```
grep -r -A 10 chained_irq_enter drivers/pinctrl
```

Cc: stable@vger.kernel.org
Signed-off-by: Sergey Matsievskiy <matsievskiysv@gmail.com>
Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/20241012105743.12450-2-matsievskiysv@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-13 22:00:24 +09:00
j7b3y
8744e80bcb firmware_loader: Add /vendor/firmware and /odm/firmware to search paths
* Add both /vendor/firmware and /odm/firmware to firmware loader search
  paths because Oplus like to store their firmware in /odm, also add
  the /vendor path so we don't need to specify /vendor/firmware in
  firmware_class.path boot arg.
2025-01-13 13:57:30 +09:00
j7b3y
a83e8e51cf drivers: iommu: arm-smmu: Specify sync probe for qsmmuv500-tbu 2025-01-10 21:29:52 +09:00
Yifei Liu
6a092a18f5 selftests: breakpoints: use remaining time to check if suspend succeed
[ Upstream commit c66be905cda24fb782b91053b196bd2e966f95b7 ]

step_after_suspend_test fails with device busy error while
writing to /sys/power/state to start suspend. The test believes
it failed to enter suspend state with

$ sudo ./step_after_suspend_test
TAP version 13
Bail out! Failed to enter Suspend state

However, in the kernel message, I indeed see the system get
suspended and then wake up later.

[611172.033108] PM: suspend entry (s2idle)
[611172.044940] Filesystems sync: 0.006 seconds
[611172.052254] Freezing user space processes
[611172.059319] Freezing user space processes completed (elapsed 0.001 seconds)
[611172.067920] OOM killer disabled.
[611172.072465] Freezing remaining freezable tasks
[611172.080332] Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
[611172.089724] printk: Suspending console(s) (use no_console_suspend to debug)
[611172.117126] serial 00:03: disabled
some other hardware get reconnected
[611203.136277] OOM killer enabled.
[611203.140637] Restarting tasks ...
[611203.141135] usb 1-8.1: USB disconnect, device number 7
[611203.141755] done.
[611203.155268] random: crng reseeded on system resumption
[611203.162059] PM: suspend exit

After investigation, I noticed that for the code block
if (write(power_state_fd, "mem", strlen("mem")) != strlen("mem"))
	ksft_exit_fail_msg("Failed to enter Suspend state\n");

The write will return -1 and errno is set to 16 (device busy).
It should be caused by the write function is not successfully returned
before the system suspend and the return value get messed when waking up.
As a result, It may be better to check the time passed of those few
instructions to determine whether the suspend is executed correctly for
it is pretty hard to execute those few lines for 5 seconds.

The timer to wake up the system is set to expire after 5 seconds and
no re-arm. If the timer remaining time is 0 second and 0 nano secomd,
it means the timer expired and wake the system up. Otherwise, the system
could be considered to enter the suspend state failed if there is any
remaining time.

After appling this patch, the test would not fail for it believes the
system does not go to suspend by mistake. It now could continue to the
rest part of the test after suspend.

Fixes: bfd092b8c2 ("selftests: breakpoint: add step_after_suspend_test")
Reported-by: Sinadin Shan <sinadin.shan@oracle.com>
Signed-off-by: Yifei Liu <yifei.l.liu@oracle.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-01-10 17:34:38 +09:00
Kazuki Hashimoto
f830bcfc62 firmware_loader: add /odm/firmware to fw_path[]
/odm/firmware must be put before /vendor/firmware, otherwise the wrong
firmware will be loaded.

01-01 09:00:31.514  1333  1333 E msm_cvp ab00000.qcom,cvp: invalid firmware metadata
01-01 09:00:31.514  1333  1333 I msm_cvp : err: __load_fw_to_memory: error -22 loading "evass.mbn"
01-01 09:00:31.514  1333  1333 I msm_cvp : err: Failed to download firmware

Signed-off-by: Kazuki Hashimoto <kazukih0205@gmail.com>
2025-01-10 09:33:46 +09:00
Juhyung Park
eff67caa90 firmware_loader: add /vendor/firmware to fw_path[]
Signed-off-by: Juhyung Park <qkrwngud825@gmail.com>
2025-01-10 09:33:19 +09:00
j7b3y
9da09438f5 e1q: disable CONFIG_CORE_REGDB 2025-01-09 17:01:49 +09:00
wadesong
8d40a15da2 cfg80211: Make core regdb optional
On kernel startup, the cfg80211 core hint code will try to load
regulatory.db unconditionally, which can increase kernel boot
time on some platforms where no regulatory.db is available.

Enclose all the related code for regulatory.db manipulation
with a macro CONFIG_CORE_REGDB so any platform with no
regulatory.db will not be affected by this.

NOTE: it is expected that any platform with no regulatory.db
      should have self-managed regulatory database supported
      by wlan module.

Change-Id: I9fd96012a4c47c26be8c223fc4ee545dac8f640b
Signed-off-by: wadesong <wadesong@codeaurora.org>
2025-01-09 16:59:47 +09:00
j7b3y
cd12e6ec55 Revert "Move specific options into kernel source"
This reverts commit b3a34163b7.
2025-01-09 14:05:34 +09:00
j7b3y
b3a34163b7 Move specific options into kernel source 2025-01-09 13:19:39 +09:00
David Wronek
7bef358e43 Disable CONFIG_BACKLIGHT_QCOM_SPMI_WLED
Change-Id: I081ba803a6dcb0f1024e53d5ec3e8d1beffd0c3b
2025-01-07 17:16:16 +09:00
j7b3y
6c33f03d35 add e1q config 2025-01-04 10:27:12 +09:00
David Wronek
b49f92d500 Add Samsung SM8650 platform config
Change-Id: I8ea6b1303327e3b5a43705310018024303bbaf9a
2024-12-31 20:04:05 +01:00
David Wronek
44895bd4b4 fixup! Fix clang 19 issues 2024-12-27 09:46:48 +01:00
David Wronek
45c35ddaed Fix clang 19 issues
Change-Id: I5d5d81bcefaf02a9542674ec00a58e9dd958561d
2024-12-25 17:54:26 +01:00
Wei Yang
322217c1fe memblock tests: fix undefined reference to `panic'
[ Upstream commit e0f5a8e74be88f2476e58b25d3b49a9521bdc4ec ]

commit e96c6b8f212a ("memblock: report failures when memblock_can_resize
is not set") introduced the usage of panic, which is not defined in
memblock test.

Let's define it directly in panic.h to fix it.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: Song Shuai <songshuaishuai@tinylab.org>
CC: Mike Rapoport <rppt@kernel.org>
Link: https://lore.kernel.org/r/20240402132701.29744-3-richard.weiyang@gmail.com
Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-12-25 13:42:54 +01:00
David Wronek
4a4d118674 e3q: Disable input booster
Change-Id: Ibef4cb569858b7757c2a06a8a971667e1ea71ede
2024-12-22 11:56:24 +01:00
David Wronek
2029f79be4 e3q: TEMPORARY HACK TO LOAD ALL MODULES
Change-Id: Ic4d2c388f19c63fad0d462c396fa08195d49e47f
2024-12-15 11:51:50 +01:00
David Wronek
dc2add5696 e3q: Fix sound card not being online
Change-Id: I8d8c39cae14413f158a61e16856f656b7be27d12
2024-12-11 21:50:34 +01:00
David Wronek
78c670a929 e3q: Import S928BXXS3AXI1 changes 2024-10-20 20:10:16 +02:00
Bruno Martins
976e70b34a scripts: Allow QCOM devicetree overlays to be properly combined
Apply the same logic that Qualcomm uses on their 5.15 kernel_platform
build scripts, as seen in commit e10f5dc.

As a sidenote, passing DTC_FLAGS externally is not an option since it
overrides any other flags set by the kernel makefile.
2024-10-20 20:09:27 +02:00
Danny Lin
5780d3b53b dtc: Silence warnings by default
Change-Id: Id9adf76a357dabd5f64503852baf84e67488fcb0
2024-10-20 20:09:27 +02:00
Cosmin Tanislav
395e33d386 arch: arm64: dts: Exclude standard dts if vendor dts exists
Change-Id: I11f68b27a45fa02861bd5b6526bf49664bfccfb8
2024-10-20 20:09:27 +02:00
David Wronek
dc0027c516 Import S928BXXU3AXH7 changes 2024-10-20 20:09:27 +02:00
David Wronek
4c31cc9fe8 Makefile: export headers from certain external modules 2024-10-07 20:17:23 +02:00
SGCMarkus
247458f58c Android.bp: add soong namespace 2024-10-05 13:28:37 +02:00
TALU
e4a3136cae arm64: Revert "sigcontext: use standard __uint128_t type for vregs in struct fpsimd_context."
It causes this issue with the Android build system:

out/soong/.intermediates/vendor/lineage/build/soong/generated_kernel_includes/ge
n/usr/include/asm/sigcontext.h:53:2: error: unknown type name '__uint128_t'
        __uint128_t vregs[32];
        ^

Change-Id: Ia4cf9c0e2b6a32550ec6c4398139838add0b24a1
2024-10-05 13:26:14 +02:00
danielml
6bc44a0977 scripts: headers: Skip removal of unwanted headers
Change-Id: I5ba672e50a991c266e4e4195a25155708380ab69
2024-10-05 13:25:54 +02:00
SGCMarkus
ad386a8919 Makefile: export headers from certain external modules
* audio-kernel
* display-drivers
* video-kernel
* nxp driver

Change-Id: I64d38125fd705be754f67485e6d2eac2e664d7ef
2024-10-05 13:25:41 +02:00
LuK1337
ef6745fc13 Android: Add empty Android.mk file
* This prevents inclusion of drivers/staging/greybus/tools/Android.mk
  which will conflict in case we have more than 1 kernel tree in AOSP
  source dir.

Change-Id: I335bca7b6d6463b1ffc673ab5367603347516e13
2024-10-05 13:25:26 +02:00
Linux Build Service Account
7cf8e36f33 Merge 328d73e6b8 on remote branch
Change-Id: Ifb5ec2e7d8b7b8b3b11a6aba3565d1c0faa7e4b1
2024-09-11 03:24:30 -07:00
QCTECMDR Service
328d73e6b8 Merge "net: stmmac: Fix LPM issue on gen3" 2024-09-04 19:04:22 -07:00
QCTECMDR Service
9a254c3f9e Merge "soc: qcom: hab: Replace imp whse with rbtree based" 2024-09-04 19:04:21 -07:00
QCTECMDR Service
9ec41dc89f Merge "defconfig: sdmsteppeauto: Enable gpi config" 2024-09-04 19:04:21 -07:00
QCTECMDR Service
17124d3595 Merge "q2spi-msm-geni: Ensure Channel errors handled sequentially after START sequence fail" 2024-09-04 08:58:22 -07:00
Kishor Krishna Bhat
9e0b7733ce defconfig: sdmsteppeauto: Enable gpi config
Enable gpi config to allow the uart to access gpi.

Change-Id: I37bb00f25f3f5caed974b06828a118739a857e29
Signed-off-by: Kishor Krishna Bhat <quic_kishkris@quicinc.com>
2024-09-04 12:48:51 +05:30
QCTECMDR Service
e8fcda613b Merge "net: qrtr: Add condition to check data length while logging" 2024-09-03 22:40:04 -07:00
Chandana Kishori Chiluveru
4219aa4a08 q2spi-msm-geni: Ensure Channel errors handled sequentially after START sequence fail
When slave is in sleep q2spi host transfer will fail with GSI
start sequence failure. In this scenario two events reported from
GSI channel error and TX dma completion event 0x22. Since GSI
reports these events separately if start sequence fail is not
processed before channel error gpi_q2spi_terminate_all is called twice
and leading to GSI failures.

Ensure Channel errors in GSI recover path are handled sequentially
only after START sequence fail is processed.

Change-Id: Ie85528b6354241153330c403ba026c5006d5c78e
Signed-off-by: Chandana Kishori Chiluveru <quic_cchiluve@quicinc.com>
2024-09-03 05:48:04 -07:00
Suraj Jaiswal
d2744b2a67 net: stmmac: Fix LPM issue on gen3
Fix LPM issue on gen3.

Change-Id: Ib7f4953e2cd25db3ace8a5912490ad528b6a0059
Signed-off-by: Suraj Jaiswal <quic_jsuraj@quicinc.com>
2024-09-03 15:09:54 +05:30
QCTECMDR Service
7f32770218 Merge "kernel: msm: Adding PPS2/PPS3" 2024-09-02 23:10:38 -07:00
QCTECMDR Service
10192a0685 Merge "usb: dwc3: dwc3-msm-core: configured dp/dm irqs" 2024-09-02 23:10:38 -07:00
QCTECMDR Service
488e19cdcf Merge "usb: dwc3: dwc3-msm-core: Switch to UTMI clk during host teardown" 2024-09-02 23:10:37 -07:00
QCTECMDR Service
ec0db65b6e Merge "net: stmmac: Re initialize Rx buffers" 2024-09-02 23:10:37 -07:00
QCTECMDR Service
e3bfd6c700 Merge "usb: gadget: f_gsi: bail out if opts is null" 2024-09-02 23:10:37 -07:00
QCTECMDR Service
472400d2a2 Merge "drivers: dcvs: bwmon: synchronize_irq before hibernation" 2024-09-02 23:10:36 -07:00
QCTECMDR Service
c69541a532 Merge "defconfig: Add support for usb related configs in Neo" 2024-09-02 23:10:36 -07:00