Commit Graph

902620 Commits

Author SHA1 Message Date
Douglas Anderson
89945968f1 UPSTREAM: ath10k: Keep track of which interrupts fired, don't poll them
[ Upstream commit d66d24ac300cf41c6b88367fc9b4b6348679273d ]

If we have a per CE (Copy Engine) IRQ then we have no summary
register.  Right now the code generates a summary register by
iterating over all copy engines and seeing if they have an interrupt
pending.

This has a problem.  Specifically if _none_ if the Copy Engines have
an interrupt pending then they might go into low power mode and
reading from their address space will cause a full system crash.  This
was seen to happen when two interrupts went off at nearly the same
time.  Both were handled by a single call of ath10k_snoc_napi_poll()
but, because there were two interrupts handled and thus two calls to
napi_schedule() there was still a second call to
ath10k_snoc_napi_poll() which ran with no interrupts pending.

Instead of iterating over all the copy engines, let's just keep track
of the IRQs that fire.  Then we can effectively generate our own
summary without ever needing to read the Copy Engines.

Tested-on: WCN3990 SNOC WLAN.HL.3.2.2-00490-QCAHLSWMTPL-1

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Rakesh Pillai <pillair@codeaurora.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200709082024.v2.1.I4d2f85ffa06f38532631e864a3125691ef5ffe06@changeid
Stable-dep-of: 170c75d43a77 ("ath10k: Don't touch the CE interrupt registers after power up")
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 146449535
Change-Id: I3dbc75664ccbf4e8a1da60e42e84056551b10524
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
(cherry picked from android11-5.4-lts commit d15f869cb3)
2024-01-30 21:33:52 +05:30
Rakesh Pillai
d9f1b99f4c UPSTREAM: ath10k: Add interrupt summary based CE processing
[ Upstream commit b92aba35d39d10d8a6bdf2495172fd490c598b4a ]

Currently the NAPI processing loops through all
the copy engines and processes a particular copy
engine is the copy completion is set for that copy
engine. The host driver is not supposed to access
any copy engine register after clearing the interrupt
status register.

This might result in kernel crash like the one below
[ 1159.220143] Call trace:
[ 1159.220170]  ath10k_snoc_read32+0x20/0x40 [ath10k_snoc]
[ 1159.220193]  ath10k_ce_per_engine_service_any+0x78/0x130 [ath10k_core]
[ 1159.220203]  ath10k_snoc_napi_poll+0x38/0x8c [ath10k_snoc]
[ 1159.220270]  net_rx_action+0x100/0x3b0
[ 1159.220312]  __do_softirq+0x164/0x30c
[ 1159.220345]  run_ksoftirqd+0x2c/0x64
[ 1159.220380]  smpboot_thread_fn+0x1b0/0x288
[ 1159.220405]  kthread+0x11c/0x12c
[ 1159.220423]  ret_from_fork+0x10/0x18

To avoid such a scenario, we generate an interrupt
summary by reading the copy completion for all the
copy engine before actually processing any of them.
This will avoid reading the interrupt status register
for any CE after the interrupt status is cleared.

Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1

Signed-off-by: Rakesh Pillai <pillair@codeaurora.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1593193967-29897-1-git-send-email-pillair@codeaurora.org
Stable-dep-of: 170c75d43a77 ("ath10k: Don't touch the CE interrupt registers after power up")
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 146449535
Change-Id: I3d85ff89b889eac117c6f14c77b8aae1d5b3d236
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
(cherry picked from android11-5.4-lts commit 696b992edc)
2024-01-30 21:33:36 +05:30
Douglas Anderson
0226ac138f UPSTREAM: ath10k: Wait until copy complete is actually done before completing
[ Upstream commit 8f9ed93d09a97444733d492a3bbf66bcb786a777 ]

On wcn3990 we have "per_ce_irq = true".  That makes the
ath10k_ce_interrupt_summary() function always return 0xfff. The
ath10k_ce_per_engine_service_any() function will see this and think
that _all_ copy engines have an interrupt.  Without checking, the
ath10k_ce_per_engine_service() assumes that if it's called that the
"copy complete" (cc) interrupt fired.  This combination seems bad.

Let's add a check to make sure that the "copy complete" interrupt
actually fired in ath10k_ce_per_engine_service().

This might fix a hard-to-reproduce failure where it appears that the
copy complete handlers run before the copy is really complete.
Specifically a symptom was that we were seeing this on a Qualcomm
sc7180 board:
  arm-smmu 15000000.iommu: Unhandled context fault:
  fsr=0x402, iova=0x7fdd45780, fsynr=0x30003, cbfrsynra=0xc1, cb=10

Even on platforms that don't have wcn3990 this still seems like it
would be a sane thing to do.  Specifically the current IRQ handler
comments indicate that there might be other misc interrupt sources
firing that need to be cleared.  If one of those sources was the one
that caused the IRQ handler to be called it would also be important to
double-check that the interrupt we cared about actually fired.

Tested-on: WCN3990 SNOC WLAN.HL.3.2.2-00490-QCAHLSWMTPL-1

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200609082015.1.Ife398994e5a0a6830e4d4a16306ef36e0144e7ba@changeid
Stable-dep-of: 170c75d43a77 ("ath10k: Don't touch the CE interrupt registers after power up")
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 146449535
Change-Id: I2ed2f1f7b97a27c741341bc6044450b68234114e
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
(cherry picked from android11-5.4-lts commit 366df9ecbc)
2024-01-30 21:33:20 +05:30
Amit Pundir
a7a2a20fff FROMGIT: clk: qcom: gcc-sdm845: Add soft dependency on rpmhpd
With the addition of RPMh power domain to the GCC node in
device tree, we noticed a significant delay in getting the
UFS driver probed on AOSP which futher led to mount failures
because Android do not support rootwait. So adding a soft
dependency on RPMh power domain which informs modprobe to
load rpmhpd module before gcc-sdm845.

Cc: <stable@vger.kernel.org> # v5.4+
Fixes: 4b6ea15c0a11 ("arm64: dts: qcom: sdm845: Add missing RPMh power domain to GCC")
Suggested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20240123062814.2555649-1-amit.pundir@linaro.org
Signed-off-by: Bjorn Andersson <andersson@kernel.org>

Bug: 146449535
(cherry picked from commit 1d9054e3a4fd36e2949e616f7360bdb81bcc1921
https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux.git/commit/?h=for-next)
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Change-Id: I93c875d3d6acc8c2c2bf9f238a72733861f87869
(cherry picked from android11-5.4-lts commit b70f9975af)
2024-01-30 21:33:05 +05:30
Greg Kroah-Hartman
80118b745c Merge tag 'android11-5.4.265_r00' into branch 'android11-5.4'
This merges the changes up to the 5.4.265 LTS release into the
android11-5.4 branch.  It contains the following individual commits:

* e2be513380 ANDROID: GKI: fix crc issue in include/net/addrconf.h
* 3c4b111a71 Revert "cred: switch to using atomic_long_t"
*   5158e9afed Merge 5.4.265 into android11-5.4-lts
|\
| * 2d21f73b2f Linux 5.4.265
| * 5c70542f32 powerpc/ftrace: Fix stack teardown in ftrace_no_trace
| * 0e1867b482 powerpc/ftrace: Create a dummy stackframe to fix stack unwind
| * 9395c04666 mmc: block: Be sure to wait while busy in CQE error recovery
| * 3b8b2c5d76 ring-buffer: Fix memory leak of free page
| * 3459c9aa64 team: Fix use-after-free when an option instance allocation fails
| * 363a67ef3a arm64: mm: Always make sw-dirty PTEs hw-dirty in pte_modify
| * de8ada0236 ext4: prevent the normalized size from exceeding EXT_MAX_BLOCKS
| * f451d6784b soundwire: stream: fix NULL pointer dereference for multi_link
| * 404902216b perf: Fix perf_event_validate_size() lockdep splat
| * 4109d9a855 HID: hid-asus: add const to read-only outgoing usb buffer
| * 1fc4091991 net: usb: qmi_wwan: claim interface 4 for ZTE MF290
| * 88ceaf8e2c asm-generic: qspinlock: fix queued_spin_value_unlocked() implementation
| * 91175d6fe5 HID: multitouch: Add quirk for HONOR GLO-GXXX touchpad
| * 1f94c0d60d HID: hid-asus: reset the backlight brightness level on resume
| * e9a3cd3dcf HID: add ALWAYS_POLL quirk for Apple kb
| * 395ad0baa4 platform/x86: intel_telemetry: Fix kernel doc descriptions
| * af509912cd bcache: avoid NULL checking to c->root in run_cache_set()
| * 356ae9de79 bcache: add code comments for bch_btree_node_get() and __bch_btree_node_alloc()
| * ca4b00c6cb bcache: avoid oversize memory allocation by small stripe_size
| * e1d811cbc3 blk-throttle: fix lockdep warning of "cgroup_mutex or RCU read lock required!"
| * 84f2e5b3e7 usb: aqc111: check packet for fixup for true limit
| * 619a340666 Revert "PCI: acpiphp: Reassign resources on bridge if necessary"
| * 371dbce60a ALSA: hda/hdmi: add force-connect quirks for ASUSTeK Z170 variants
| * be7676b03a cred: switch to using atomic_long_t
| * 9112bd1072 appletalk: Fix Use-After-Free in atalk_ioctl
| * 23ee06762c net: stmmac: Handle disabled MDIO busses from devicetree
| * 538b7b8f21 net: stmmac: use dev_err_probe() for reporting mdio bus registration failure
| * 067e6ec9f5 vsock/virtio: Fix unsigned integer wrap around in virtio_transport_has_space()
| * cc7cf0b2ee sign-file: Fix incorrect return values check
| * 510d45207a net: Remove acked SYN flag from packet in the transmit queue correctly
| * 5d9d500a28 qed: Fix a potential use-after-free in qed_cxt_tables_alloc
| * 3df812627e net/rose: Fix Use-After-Free in rose_ioctl
| * b099c28847 atm: Fix Use-After-Free in do_vcc_ioctl
| * e3430b870e atm: solos-pci: Fix potential deadlock on &tx_queue_lock
| * 8cff60fb73 atm: solos-pci: Fix potential deadlock on &cli_queue_lock
| * fcf17666ef qca_spi: Fix reset behavior
| * 51ad9c19bb qca_debug: Fix ethtool -G iface tx behavior
| * b7f5868664 qca_debug: Prevent crash on TX ring changes
| * 9354e0acdb net: ipv6: support reporting otherwise unknown prefix flags in RTM_NEWPREFIX
| * 053220aaed afs: Fix refcount underflow from error handling race
* | bc99f18e84 Revert "psample: Require 'CAP_NET_ADMIN' when joining "packets" group"
* | 000b611ebf Revert "mmc: core: add helpers mmc_regulator_enable/disable_vqmmc"
* | ee67cef1d3 Revert "mmc: sdhci-sprd: Fix vqmmc not shutting down after the card was pulled"
* | ee9bfb84c7 Revert "genetlink: add CAP_NET_ADMIN test for multicast bind"
* | 4684391cef Revert "drop_monitor: Require 'CAP_SYS_ADMIN' when joining "events" group"
* | 50aa4f43a9 Revert "perf/core: Add a new read format to get a number of lost samples"
* | 8eb4011508 Revert "perf: Fix perf_event_validate_size()"
* | 5c9845d8c6 Revert "hrtimers: Push pending hrtimers away from outgoing CPU earlier"
* | af6deae771 Merge 5.4.264 into android11-5.4-lts
|\|
| * 16e6e107a6 Linux 5.4.264
| * 06bcac5c51 devcoredump: Send uevent once devcd is ready
| * c6a1282e53 devcoredump : Serialize devcd_del work
| * d99376b702 smb: client: fix potential NULL deref in parse_dfs_referrals()
| * ab5813bb20 cifs: Fix non-availability of dedup breaking generic/304
| * bdee8b2805 Revert "btrfs: add dmesg output for first mount and last unmount of a filesystem"
| * dd9e851944 tools headers UAPI: Sync linux/perf_event.h with the kernel sources
| * 4a341627a1 drop_monitor: Require 'CAP_SYS_ADMIN' when joining "events" group
| * fe8402511e psample: Require 'CAP_NET_ADMIN' when joining "packets" group
| * 263bffd2b6 genetlink: add CAP_NET_ADMIN test for multicast bind
| * a149fbadb9 netlink: don't call ->netlink_bind with table lock held
| * 18824f592a io_uring/af_unix: disable sending io_uring over sockets
| * 32f4536c10 nilfs2: fix missing error check for sb_set_blocksize call
| * 77a353924d KVM: s390/mm: Properly reset no-dat
| * 1aee33d43d x86/CPU/AMD: Check vendor in the AMD microcode callback
| * 3371eac211 serial: 8250_omap: Add earlycon support for the AM654 UART controller
| * ce79cf407c serial: sc16is7xx: address RX timeout interrupt errata
| * d896c47f8c ARM: PL011: Fix DMA support
| * 880b035bc6 usb: typec: class: fix typec_altmode_put_partner to put plugs
| * a9022cbdd0 parport: Add support for Brainboxes IX/UC/PX parallel cards
| * fefc0559c5 usb: gadget: f_hid: fix report descriptor allocation
| * 1796ae6a7a mmc: sdhci-sprd: Fix vqmmc not shutting down after the card was pulled
| * a1f29e995f mmc: core: add helpers mmc_regulator_enable/disable_vqmmc
| * 05918dec9a gpiolib: sysfs: Fix error handling on failed export
| * 152f51d159 perf: Fix perf_event_validate_size()
| * 84ca356ec8 perf/core: Add a new read format to get a number of lost samples
| * 07bdb1bd24 arm64: dts: mediatek: mt8173-evb: Fix regulator-fixed node names
| * 6109859f69 arm64: dts: mediatek: mt7622: fix memory node warning check
| * 148d8f0707 packet: Move reference count in packet_sock to atomic_long_t
| * 965cbc6b62 tracing: Fix a possible race when disabling buffered events
| * 6f2e50961f tracing: Fix incomplete locking when disabling buffered events
| * 84302391d1 tracing: Always update snapshot buffer size
| * cb74e8fd6b nilfs2: prevent WARNING in nilfs_sufile_set_segment_usage()
| * 610ebc2895 ALSA: pcm: fix out-of-bounds in snd_pcm_state_names
| * 439166b1b2 ARM: dts: imx7: Declare timers compatible with fsl,imx6dl-gpt
| * 4fe36f83f8 ARM: dts: imx: make gpt node name generic
| * 69b669cc63 ARM: imx: Check return value of devm_kasprintf in imx_mmdc_perf_init
| * 59348f1482 scsi: be2iscsi: Fix a memleak in beiscsi_init_wrb_handle()
| * 8244ea916b tracing: Fix a warning when allocating buffered events fails
| * 4713be8445 ASoC: wm_adsp: fix memleak in wm_adsp_buffer_populate
| * febb7bbe29 hwmon: (acpi_power_meter) Fix 4.29 MW bug
| * ad4cf77667 RDMA/bnxt_re: Correct module description string
| * b4b89b7b2d bpf: sockmap, updating the sg structure should also update curr
| * 7ffff0cc92 tcp: do not accept ACK of bytes we never sent
| * 69431f609b netfilter: xt_owner: Fix for unsafe access of sk->sk_socket
| * c61c61d7e7 net: hns: fix fake link up on xge port
| * 1ec21fde58 ipv4: ip_gre: Avoid skb_pull() failure in ipgre_xmit()
| * e38cd53421 arcnet: restoring support for multiple Sohard Arcnet cards
| * f265467319 net: arcnet: com20020 fix error handling
| * d124c18267 net: arcnet: Fix RESET flag handling
| * 9f5a25aa1b hv_netvsc: rndis_filter needs to select NLS
| * be1ab8bf05 ipv6: fix potential NULL deref in fib6_add()
| * 5cd05bbaae of: dynamic: Fix of_reconfig_get_state_change() return value documentation
| * 5cadae629e of: Add missing 'Return' section in kerneldoc comments
| * b31cb14cac of: Fix kerneldoc output formatting
| * 36ce931a80 of: base: Fix some formatting issues and provide missing descriptions
| * 8c4fcbe27a of/irq: Make of_msi_map_rid() PCI bus agnostic
| * ae374c57af of/irq: make of_msi_map_get_device_domain() bus agnostic
| * e5cfaab662 of/iommu: Make of_map_rid() PCI agnostic
| * f7a8552008 ACPI/IORT: Make iort_msi_map_rid() PCI agnostic
| * da36a3ef32 ACPI/IORT: Make iort_get_device_domain IRQ domain agnostic
| * d786067be2 of: base: Add of_get_cpu_state_node() to get idle states for a CPU node
| * 13f27a0537 drm/amdgpu: correct chunk_ptr to a pointer to chunk.
| * d162a5e6a5 kconfig: fix memory leak from range properties
| * d346441530 tg3: Increment tx_dropped in tg3_tso_bug()
| * cd49b8e07d tg3: Move the [rt]x_dropped counters to tg3_napi
| * 427deb5ba5 netfilter: ipset: fix race condition between swap/destroy and kernel side add/del/test
| * 54d0d83a53 hrtimers: Push pending hrtimers away from outgoing CPU earlier
* | 096ff6ecb4 Revert "HID: core: store the unique system identifier in hid_device"
* | 68c9c64f02 Revert "HID: fix HID device resource race between HID core and debugging support"
* | 0780b1ab09 Merge 5.4.263 into android11-5.4-lts
|\|
| * 34244ed621 Linux 5.4.263
| * afa7b11ea8 mmc: block: Retry commands in CQE error recovery
| * c8008304db mmc: core: convert comma to semicolon
| * 33cc97d249 mmc: cqhci: Fix task clearing in CQE error recovery
| * 3e78540d98 mmc: cqhci: Warn of halt or task clear failure
| * 5b87f35546 mmc: cqhci: Increase recovery halt timeout
| * 1a051c6d15 cpufreq: imx6q: Don't disable 792 Mhz OPP unnecessarily
| * d497e1b2f5 cpufreq: imx6q: don't warn for disabling a non-existing frequency
| * b1a66a050f scsi: qla2xxx: Fix system crash due to bad pointer access
| * c1f97cc21e scsi: qla2xxx: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
| * df0110425f scsi: core: Introduce the scsi_cmd_to_rq() function
| * 66cd605530 scsi: qla2xxx: Simplify the code for aborting SCSI commands
| * 30511f37c9 ima: detect changes to the backing overlay file
| * 8c85e455f7 ovl: skip overlayfs superblocks at global sync
| * 157c8056ab ima: annotate iint mutex to avoid lockdep false positive warnings
| * a8038ae581 fbdev: stifb: Make the STI next font pointer a 32-bit signed offset
| * 939012ee31 mtd: cfi_cmdset_0001: Byte swap OTP info
| * 416dad018e mtd: cfi_cmdset_0001: Support the absence of protection registers
| * 21ad8c1c4f s390/cmma: fix detection of DAT pages
| * c11027d333 s390/mm: fix phys vs virt confusion in mark_kernel_pXd() functions family
| * f1db39b154 smb3: fix touch -h of symlink
| * 97d54b8005 net: ravb: Start TX queues after HW initialization succeeded
| * 7023a293e9 net: ravb: Use pm_runtime_resume_and_get()
| * 05aa8f3e3b ravb: Fix races between ravb_tx_timeout_work() and net related ops
| * d37609b529 net: stmmac: xgmac: Disable FPE MMC interrupts
| * 7ccf772a8b ipv4: igmp: fix refcnt uaf issue when receiving igmp query packet
| * f8b5b5d236 Input: xpad - add HyperX Clutch Gladiate Support
| * 6536698eea btrfs: make error messages more clear when getting a chunk map
| * 4c6274cfd6 btrfs: send: ensure send_fd is writable
| * 79ffc04aba btrfs: fix off-by-one when checking chunk map includes logical address
| * dd94ffab1b btrfs: add dmesg output for first mount and last unmount of a filesystem
| * 30b807d736 powerpc: Don't clobber f0/vs0 during fp|altivec register save
| * bb55decee2 bcache: revert replacing IS_ERR_OR_NULL with IS_ERR
| * 729da56e01 dm verity: don't perform FEC for failed readahead IO
| * b515ed6284 dm-verity: align struct dm_verity_fec_io properly
| * d377e593d1 ALSA: hda/realtek: Add supported ALC257 for ChromeOS
| * 47dd3917c4 ALSA: hda/realtek: Headset Mic VREF to 100%
| * 88ce27f0a3 ALSA: hda: Disable power-save on KONTRON SinglePC
| * 4a2d1399f8 mmc: block: Do not lose cache flush during CQE error recovery
| * 4d7d14c696 firewire: core: fix possible memory leak in create_units()
| * 1eaa188f7f pinctrl: avoid reload of p state in list iteration
| * 40532b2913 io_uring: fix off-by one bvec index
| * 9e7f410f6a USB: dwc3: qcom: fix wakeup after probe deferral
| * db62d193e6 USB: dwc3: qcom: fix resource leaks on probe deferral
| * ca44455362 usb: dwc3: set the dma max_seg_size
| * 7a0b6fc6c3 USB: dwc2: write HCINT with INTMASK applied
| * d1c866356d USB: serial: option: don't claim interface 4 for ZTE MF290
| * 38233a62d3 USB: serial: option: fix FM101R-GL defines
| * 83be9405b3 USB: serial: option: add Fibocom L7xx modules
| * 406fae6c79 bcache: prevent potential division by zero error
| * c00163256a bcache: check return value from btree_node_alloc_replacement()
| * a658ee7930 dm-delay: fix a race between delay_presuspend and delay_bio
| * ef918a1ba4 hv_netvsc: Mark VF as slave before exposing it to user-mode
| * 997d895fa4 hv_netvsc: Fix race of register_netdevice_notifier and VF register
| * f2a0c988d7 USB: serial: option: add Luat Air72*U series products
| * f1ac778940 s390/dasd: protect device queue against concurrent access
| * 300e96e171 bcache: replace a mistaken IS_ERR() by IS_ERR_OR_NULL() in btree_gc_coalesce()
| * 76f791b78d ACPI: resource: Skip IRQ override on ASUS ExpertBook B1402CVA
| * 78c1e3aa69 KVM: arm64: limit PMU version to PMUv3 for ARMv8.1
| * 5d4f6d809e arm64: cpufeature: Extract capped perfmon fields
| * 32cfd5c3b8 ext4: make sure allocate pending entry not fail
| * 70edeedd79 ext4: fix slab-use-after-free in ext4_es_insert_extent()
| * 15a84cf4c7 ext4: using nofail preallocation in ext4_es_insert_extent()
| * 80c8dcb09f ext4: using nofail preallocation in ext4_es_insert_delayed_block()
| * be4684ee83 ext4: using nofail preallocation in ext4_es_remove_extent()
| * d809d1d2ed ext4: use pre-allocated es in __es_remove_extent()
| * 059722ec64 ext4: use pre-allocated es in __es_insert_extent()
| * 53df96011a ext4: factor out __es_alloc_extent() and __es_free_extent()
| * c48b5fdd46 ext4: add a new helper to check if es must be kept
| * b9cd5c3afc MIPS: KVM: Fix a build warning about variable set but not used
| * afbedd6136 nvmet: nul-terminate the NQNs passed in the connect command
| * 84ac94bed0 nvmet: remove unnecessary ctrl parameter
| * 07009245d3 afs: Fix file locking on R/O volumes to operate in local mode
| * 54ffe881d7 afs: Return ENOENT if no cell DNS record can be found
| * 3680d10b41 net: axienet: Fix check for partial TX checksum
| * a7e7b92804 amd-xgbe: propagate the correct speed and duplex status
| * c3a77c754e amd-xgbe: handle the corner-case during tx completion
| * 895f1903ea amd-xgbe: handle corner-case during sfp hotplug
| * 7fabd97a05 arm/xen: fix xen_vcpu_info allocation alignment
| * 9beba93f8c net: usb: ax88179_178a: fix failed operations during ax88179_reset
| * fc23517c87 ipv4: Correct/silence an endian warning in __ip_do_redirect
| * 6fd145351d HID: fix HID device resource race between HID core and debugging support
| * 2c8f796104 HID: core: store the unique system identifier in hid_device
| * 90b3df8b5b drm/rockchip: vop: Fix color for RGB888/BGR888 format on VOP full
| * bfdda8c9c5 ata: pata_isapnp: Add missing error check for devm_ioport_map()
| * 9d980808f9 drm/panel: simple: Fix Innolux G101ICE-L01 timings
| * cc543bad78 drm/panel: simple: Fix Innolux G101ICE-L01 bus flags
| * c2eadc1586 afs: Make error on cell lookup failure consistent with OpenAFS
| * 7369371bb8 PCI: keystone: Drop __init from ks_pcie_add_pcie_{ep,port}()
| * 518b7f7d87 RDMA/irdma: Prevent zero-length STAG registration
| * d359886a7a driver core: Release all resources during unbind before updating device links
* | a0f28e56bc ANDROID: GKI: db845c: Update symbols list and ABI on rpmsg_register_device_override
* | 69365d1ade Revert "tracing: Have trace_event_file have ref counters"
* |   288ce21693 Merge "Merge 5.4.262 into android11-5.4-lts" into android11-5.4-lts
|\ \
| * | a3aeec7ab8 Merge 5.4.262 into android11-5.4-lts
| |\|
| | * 8e221b4717 Linux 5.4.262
| | * b053223b7c netfilter: nf_tables: bogus EBUSY when deleting flowtable after flush (for 5.4)
| | * c35df8b8c5 netfilter: nf_tables: disable toggling dormant table state more than once
| | * e10f661adc netfilter: nf_tables: fix table flag updates
| | * 46c2947fcd netfilter: nftables: update table flags from the commit phase
| | * b09e6ccf0d netfilter: nf_tables: double hook unregistration in netns path
| | * b05a24cc45 netfilter: nf_tables: unregister flowtable hooks on netns exit
| | * a995a68e8a netfilter: nf_tables: fix memleak when more than 255 elements expired
| | * b95d7af657 netfilter: nft_set_hash: try later when GC hits EAGAIN on iteration
| | * 61a7b3de20 netfilter: nft_set_rbtree: use read spinlock to avoid datapath contention
| | * 03caf75da1 netfilter: nft_set_rbtree: skip sync GC for new elements in this transaction
| | * 021d734c7e netfilter: nf_tables: defer gc run if previous batch is still pending
| | * 38ed6a5f83 netfilter: nf_tables: use correct lock to protect gc_list
| | * 4b6346dc1e netfilter: nf_tables: GC transaction race with abort path
| | * b76dcf4662 netfilter: nf_tables: GC transaction race with netns dismantle
| | * 29ff9b8efb netfilter: nf_tables: fix GC transaction races with netns and netlink event exit path
| | * 1398a0eee2 netfilter: nf_tables: remove busy mark and gc batch API
| | * 85520a1f1d netfilter: nft_set_hash: mark set element as dead when deleting from packet path
| | * c357648929 netfilter: nf_tables: adapt set backend to use GC transaction API
| | * bbdb3b65aa netfilter: nf_tables: GC transaction API to avoid race with control plane
| | * 1da4874d05 netfilter: nf_tables: don't skip expired elements during walk
| | * acaee227cf netfilter: nft_set_rbtree: fix overlap expiration walk
| | * 899aa56385 netfilter: nft_set_rbtree: fix null deref on element insertion
| | * 181859bdfb netfilter: nft_set_rbtree: Switch to node list walk for overlap detection
| | * 3c7ec098e3 netfilter: nf_tables: drop map element references from preparation phase
| | * 6b880f3b2c netfilter: nftables: rename set element data activation/deactivation functions
| | * e1eed9e0b5 netfilter: nf_tables: pass context to nft_set_destroy()
| | * 961c4511c7 tracing: Have trace_event_file have ref counters
| | * 7676a41d90 drm/amdgpu: fix error handling in amdgpu_bo_list_get()
| | * 36383005f1 ext4: remove gdb backup copy for meta bg in setup_new_flex_group_blocks
| | * e95f74653d ext4: correct the start block of counting reserved clusters
| | * 1fbfdcc3d6 ext4: correct return value of ext4_convert_meta_bg
| | * dfdfd3f218 ext4: correct offset of gdb backup in non meta_bg group to update_backups
| | * 85c12e80c4 ext4: apply umask if ACL support is disabled
| | * d2aed8814f Revert "net: r8169: Disable multicast filter for RTL8168H and RTL8107E"
| | * b9e5f633b3 nfsd: fix file memleak on client_opens_release
| | * 339d7d40d3 media: venus: hfi: add checks to handle capabilities from firmware
| | * cab97cdd40 media: venus: hfi: fix the check to handle session buffer requirement
| | * 5d39d0c1f4 media: venus: hfi_parser: Add check to keep the number of codecs within range
| | * 497b12d47c media: sharp: fix sharp encoding
| | * 92d8a0478f media: lirc: drop trailing space from scancode transmit
| | * cac054d103 i2c: i801: fix potential race in i801_block_transaction_byte_by_byte
| | * b132e46236 net: dsa: lan9303: consequently nested-lock physical MDIO
| | * 229738d717 Revert ncsi: Propagate carrier gain/loss events to the NCSI controller
| | * 4074957ec6 Bluetooth: btusb: Add 0bda:b85b for Fn-Link RTL8852BE
| | * 356a2ee5fc Bluetooth: btusb: Add RTW8852BE device 13d3:3570 to device tables
| | * afe92b66a5 bluetooth: Add device 13d3:3571 to device tables
| | * dc073a2626 bluetooth: Add device 0bda:887b to device tables
| | * 75d26f7f61 Bluetooth: btusb: Add Realtek RTL8852BE support ID 0x0cb8:0xc559
| | * 323710a6b4 Bluetooth: btusb: add Realtek 8822CE to usb_device_id table
| | * 981ee23b8d Bluetooth: btusb: Add flag to define wideband speech capability
| | * 0fe69c99cc tty: serial: meson: fix hard LOCKUP on crtscts mode
| | * 8f40bbf7dc serial: meson: Use platform_get_irq() to get the interrupt
| | * a1113f2c9b tty: serial: meson: retrieve port FIFO size from DT
| | * 13391526d8 serial: meson: remove redundant initialization of variable id
| | * 6245d0d70f ALSA: hda/realtek - Enable internal speaker of ASUS K6500ZC
| | * 4ef452297d ALSA: info: Fix potential deadlock at disconnection
| | * c7df9523fe parisc/pgtable: Do not drop upper 5 address bits of physical address
| | * c32dfec867 parisc: Prevent booting 64-bit kernels on PA1.x machines
| | * d570d139cb i3c: master: cdns: Fix reading status register
| | * ad6941b192 mm/cma: use nth_page() in place of direct struct page manipulation
| | * 3651286660 dmaengine: stm32-mdma: correct desc prep when channel running
| | * 4a5c267d57 mcb: fix error handling for different scenarios when parsing
| | * 25eb381a73 i2c: core: Run atomic i2c xfer when !preemptible
| | * 975b5ff33f kernel/reboot: emergency_restart: Set correct system_state
| | * 421f9ccc75 quota: explicitly forbid quota files from being encrypted
| | * 7d0c36cd2e jbd2: fix potential data lost in recovering journal raced with synchronizing fs bdev
| | * 665c2f186b btrfs: don't arbitrarily slow down delalloc if we're committing
| | * b5a8382cf8 PM: hibernate: Clean up sync_read handling in snapshot_write_next()
| | * 2b3cfdaa88 PM: hibernate: Use __get_safe_page() rather than touching the list
| | * 612c17a90f mmc: vub300: fix an error code
| | * 398940412e clk: qcom: ipq8074: drop the CLK_SET_RATE_PARENT flag from PLL clocks
| | * 0b2b22b706 parisc/pdc: Add width field to struct pdc_model
| | * 012dba0ab8 PCI: keystone: Don't discard .probe() callback
| | * 9988c9dc3c PCI: keystone: Don't discard .remove() callback
| | * a438322e00 genirq/generic_chip: Make irq_remove_generic_chip() irqdomain aware
| | * 683c562c43 mmc: meson-gx: Remove setting of CMD_CFG_ERROR
| | * d894f9288c ACPI: resource: Do IRQ override on TongFang GMxXGxx
| | * 7b15bc9b75 PCI/sysfs: Protect driver's D3cold preference from user space
| | * 78d3487b5b hvc/xen: fix error path in xen_hvc_init() to always register frontend driver
| | * 6b21ae025b audit: don't WARN_ON_ONCE(!current->mm) in audit_exe_compare()
| | * c0d01f03aa audit: don't take task_lock() in audit_exe_compare() code path
| | * 4d0a828775 KVM: x86: Ignore MSR_AMD64_TW_CFG access
| | * 5066faedd2 KVM: x86: hyper-v: Don't auto-enable stimer on write from user-space
| | * 268d17ab63 x86/cpu/hygon: Fix the CPU topology evaluation for real
| | * acbc12b0b3 scsi: megaraid_sas: Increase register read retry rount from 3 to 30 for selected registers
| | * bae6905103 bpf: Fix precision tracking for BPF_ALU | BPF_TO_BE | BPF_END
| | * 6933bc9a5f randstruct: Fix gcc-plugin performance mode to stay in group
| | * c94d05ac69 media: venus: hfi: add checks to perform sanity on queue pointers
| | * 6d028ade9d cifs: spnego: add ';' in HOST_KEY_LEN
| | * 26415e35f6 tools/power/turbostat: Fix a knl bug
| | * a49786297b macvlan: Don't propagate promisc change to lower dev in passthru
| | * 04cb9ab8eb net/mlx5e: Check return value of snprintf writing to fw_version buffer for representors
| | * c740f4716a net/mlx5_core: Clean driver version and name
| | * e4bdbcce8e net/mlx5e: fix double free of encap_header
| | * 5cc1f24f73 net: stmmac: fix rx budget limit check
| | * c4b712d1a8 net: stmmac: Rework stmmac_rx()
| | * b2762d13df netfilter: nf_conntrack_bridge: initialize err to 0
| | * fd51e7541f net: ethernet: cortina: Fix MTU max setting
| | * 823bffdaac net: ethernet: cortina: Handle large frames
| | * f5055d7345 net: ethernet: cortina: Fix max RX frame define
| | * b4f0e605a5 bonding: stop the device in bond_setup_by_slave()
| | * 7ea0a719e5 ptp: annotate data-race around q->head and q->tail
| | * 89af55e0fa xen/events: fix delayed eoi list handling
| | * db957a2f54 ppp: limit MRU to 64K
| | * f3b250d919 tipc: Fix kernel-infoleak due to uninitialized TLV value
| | * 77236275d4 net: hns3: fix variable may not initialized problem in hns3_init_mac_addr()
| | * 14c6cd41c8 tty: Fix uninit-value access in ppp_sync_receive()
| | * 4d2d30f079 ipvlan: add ipvlan_route_v6_outbound() helper
| | * ed53c15188 NFSv4.1: fix SP4_MACH_CRED protection for pnfs IO
| | * fe449f8b97 wifi: iwlwifi: Use FW rate for non-data frames
| | * eca19db60f pwm: Fix double shift bug
| | * d996530ba9 ASoC: ti: omap-mcbsp: Fix runtime PM underflow warnings
| | * 6d703922bc kgdb: Flush console before entering kgdb on panic
| | * eac3e4760a drm/amd/display: Avoid NULL dereference of timing generator
| | * 514565ff7f media: cobalt: Use FIELD_GET() to extract Link Width
| | * 2bb42a27a9 gfs2: ignore negated quota changes
| | * a251e20a2c media: vivid: avoid integer overflow
| | * 8f83c85ee8 media: gspca: cpia1: shift-out-of-bounds in set_flicker
| | * a8f829886d i2c: sun6i-p2wi: Prevent potential division by zero
| | * 80876a07ca usb: gadget: f_ncm: Always set current gadget in ncm_bind()
| | * 460284dfb1 tty: vcc: Add check for kstrdup() in vcc_probe()
| | * 35b9435123 HID: Add quirk for Dell Pro Wireless Keyboard and Mouse KM5221W
| | * b549acf999 scsi: libfc: Fix potential NULL pointer dereference in fc_lport_ptp_setup()
| | * 33906b36b1 atm: iphase: Do PCI error checks on own line
| | * 54f4dde8fa PCI: tegra194: Use FIELD_GET()/FIELD_PREP() with Link Width fields
| | * 2527775616 ALSA: hda: Fix possible null-ptr-deref when assigning a stream
| | * 953ed26a77 ARM: 9320/1: fix stack depot IRQ stack filter
| | * 7467ca10a5 jfs: fix array-index-out-of-bounds in diAlloc
| | * ecfb47f13b jfs: fix array-index-out-of-bounds in dbFindLeaf
| | * 32bd8f1cbc fs/jfs: Add validity check for db_maxag and db_agpref
| | * a81a56b4cb fs/jfs: Add check for negative db_l2nbperpage
| | * e18d266fb3 RDMA/hfi1: Use FIELD_GET() to extract Link Width
| | * c9c1334697 crypto: pcrypt - Fix hungtask for PADATA_RESET
| | * ddd6e52663 selftests/efivarfs: create-read: fix a resource leak
| | * 437e0fa907 drm/amdgpu: Fix a null pointer access when the smc_rreg pointer is NULL
| | * d50a56749e drm/amd: Fix UBSAN array-index-out-of-bounds for Polaris and Tonga
| | * c847379a5d drm/amd: Fix UBSAN array-index-out-of-bounds for SMU7
| | * 1f24c286f4 drm/komeda: drop all currently held locks if deadlock happens
| | * 5305ae0d4a platform/x86: thinkpad_acpi: Add battery quirk for Thinkpad X120e
| | * 3c4236f1b2 Bluetooth: Fix double free in hci_conn_cleanup
| | * 3cf391e417 wifi: ath10k: Don't touch the CE interrupt registers after power up
| | * 252bde6b17 net: annotate data-races around sk->sk_dst_pending_confirm
| | * 73909810ac net: annotate data-races around sk->sk_tx_queue_mapping
| | * bd653b0709 wifi: ath10k: fix clang-specific fortify warning
| | * 32cc96dc5f wifi: ath9k: fix clang-specific fortify warnings
| | * efeae5f497 wifi: mac80211: don't return unset power in ieee80211_get_tx_power()
| | * 770da15be3 wifi: mac80211_hwsim: fix clang-specific fortify warning
| | * cfe13e1486 x86/mm: Drop the 4 MB restriction on minimal NUMA node memory size
| | * 91f7467ac9 clocksource/drivers/timer-atmel-tcb: Fix initialization on SAM9 hardware
| | * da667a3f8e clocksource/drivers/timer-imx-gpt: Fix potential memory leak
| | * 788c0b3442 perf/core: Bail out early if the request AUX area is out of bound
| | * dcd85e3c92 locking/ww_mutex/test: Fix potential workqueue corruption
* | | 4e4cce8b5a Merge branch 'android11-5.4' into branch 'android11-5.4-lts'
|/ /
* | 12bc15efbc Revert "inet: shrink struct flowi_common"
* | 8d8014e4a1 Revert "ipvlan: properly track tx_errors"
* | 0e07b7bd3c Merge 5.4.261 into android11-5.4-lts
|\|
| * ef379773e2 Linux 5.4.261
| * 3542ef5c37 btrfs: use u64 for buffer sizes in the tree search ioctls
| * 7868e6151a Revert "mmc: core: Capture correct oemid-bits for eMMC cards"
| * 7be3aca8d7 fbdev: fsl-diu-fb: mark wr_reg_wa() static
| * 6c66d737b2 fbdev: imsttfb: fix a resource leak in probe
| * b90c8dfd71 fbdev: imsttfb: Fix error path of imsttfb_probe()
| * 4a6a3f1b38 spi: spi-zynq-qspi: add spi-mem to driver kconfig dependencies
| * 157333513d drm/syncobj: fix DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE
| * 21858a75dc netfilter: nat: fix ipv6 nat redirect with mapped and scoped addresses
| * ae99c5e16a netfilter: nft_redir: use `struct nf_nat_range2` throughout and deduplicate eval call-backs
| * 11380557c2 netfilter: xt_recent: fix (increase) ipv6 literal buffer length
| * cce1d46681 r8169: respect userspace disabling IFF_MULTICAST
| * e820e23338 tg3: power down device only on SYSTEM_POWER_OFF
| * f8065cde49 net/smc: fix dangling sock under state SMC_APPFINCLOSEWAIT
| * 592f934b7a net: stmmac: xgmac: Enable support for multiple Flexible PPS outputs
| * 85513df59a Fix termination state for idr_for_each_entry_ul()
| * 56cddb5e65 net: r8169: Disable multicast filter for RTL8168H and RTL8107E
| * e5a664ef49 dccp/tcp: Call security_inet_conn_request() after setting IPv6 addresses.
| * 3af0af2f98 dccp: Call security_inet_conn_request() after setting IPv4 addresses.
| * afa49774d8 inet: shrink struct flowi_common
| * 2199260c42 tipc: Change nla_policy for bearer-related names to NLA_NUL_STRING
| * cbdcdf42d1 llc: verify mac len before reading mac header
| * 50d1225366 Input: synaptics-rmi4 - fix use after free in rmi_unregister_function()
| * e3677bfcbb pwm: brcmstb: Utilize appropriate clock APIs in suspend/resume
| * 6e9b529589 pwm: sti: Reduce number of allocations and drop usage of chip_data
| * 19e45307f7 pwm: sti: Avoid conditional gotos
| * c4d5179e42 regmap: prevent noinc writes from clobbering cache
| * d62d868b30 media: dvb-usb-v2: af9035: fix missing unlock
| * 7843a9bfbe media: s3c-camif: Avoid inappropriate kfree()
| * b35fdade92 media: bttv: fix use after free error due to btv->timeout timer
| * 0bc0e36fcc pcmcia: ds: fix possible name leak in error path in pcmcia_device_add()
| * 1502edd4a0 pcmcia: ds: fix refcount leak in pcmcia_device_add()
| * 58d6fb6a93 pcmcia: cs: fix possible hung task and memory leak pccardd()
| * 37212eede6 rtc: pcf85363: fix wrong mask/val parameters in regmap_update_bits call
| * 204beeb509 i3c: Fix potential refcount leak in i3c_master_register_new_i3c_devs
| * 247ed618f5 powerpc/pseries: fix potential memory leak in init_cpu_associativity()
| * cee681d4b2 powerpc/imc-pmu: Use the correct spinlock initializer.
| * dc5804b47b powerpc/xive: Fix endian conversion size
| * b6cffe8dd7 modpost: fix tee MODULE_DEVICE_TABLE built on big-endian host
| * 90ab33735e f2fs: fix to initialize map.m_pblk in f2fs_precache_extents()
| * 9f20b06214 dmaengine: pxa_dma: Remove an erroneous BUG_ON() in pxad_free_desc()
| * 688326e2cf USB: usbip: fix stub_dev hub disconnect
| * b003b7a7d4 tools: iio: iio_generic_buffer ensure alignment
| * 7a64d15db7 tools: iio: iio_generic_buffer: Fix some integer type and calculation
| * db6d5b9ff6 tools: iio: privatize globals and functions in iio_generic_buffer.c file
| * 55b90e4c40 misc: st_core: Do not call kfree_skb() under spin_lock_irqsave()
| * ed9b2ad3b9 dmaengine: ti: edma: handle irq_of_parse_and_map() errors
| * 64c47749fc usb: dwc2: fix possible NULL pointer dereference caused by driver concurrency
| * 4050f13f71 tty: tty_jobctrl: fix pid memleak in disassociate_ctty()
| * ba46faaa49 leds: trigger: ledtrig-cpu:: Fix 'output may be truncated' issue for 'cpu'
| * abfd682fc5 ledtrig-cpu: Limit to 8 CPUs
| * f6c3b7a4ce leds: pwm: Don't disable the PWM when the LED should be off
| * cd6f50115f leds: pwm: convert to atomic PWM API
| * 9686f771c0 leds: pwm: simplify if condition
| * 87b1ee831d mfd: dln2: Fix double put in dln2_probe
| * b843d2cd13 ASoC: ams-delta.c: use component after check
| * 4634c9cc72 ASoC: Intel: Skylake: Fix mem leak when parsing UUIDs fails
| * 66888e6953 sh: bios: Revive earlyprintk support
| * fdcbe9ce7b RDMA/hfi1: Workaround truncation compilation error
| * 01698922f5 scsi: ufs: core: Leave space for '\0' in utf8 desc string
| * 3c61391a31 ext4: move 'ix' sanity check to corrent position
| * 454e6493bb ARM: 9321/1: memset: cast the constant byte to unsigned char
| * 727203e6e7 hid: cp2112: Fix duplicate workqueue initialization
| * 48bb2931f2 HID: cp2112: Use irqchip template
| * 7b62cf90d0 crypto: caam/jr - fix Chacha20 + Poly1305 self test failure
| * 090e89c716 crypto: caam/qi2 - fix Chacha20 + Poly1305 self test failure
| * 40ba3fa212 nd_btt: Make BTT lanes preemptible
| * 68655462f8 sched/rt: Provide migrate_disable/enable() inlines
| * d14a373fe5 libnvdimm/of_pmem: Use devm_kstrdup instead of kstrdup and check its return value
| * f5d95a3968 hwrng: geode - fix accessing registers
| * e4e4d4abb8 clk: scmi: Free scmi_clk allocated when the clocks with invalid info are skipped
| * ce11e445d0 firmware: ti_sci: Mark driver as non removable
| * 5d97cc0b49 firmware: ti_sci: Replace HTTP links with HTTPS ones
| * cc1a1dcb41 soc: qcom: llcc: Handle a second device without data corruption
| * 813fdddde2 soc: qcom: Rename llcc-slice to llcc-qcom
| * 077010717b soc: qcom: llcc cleanup to get rid of sdm845 specific driver file
| * 3da50ee512 ARM: dts: qcom: mdm9615: populate vsdcc fixed regulator
| * 6b464d9414 arm64: dts: qcom: sdm845-mtp: fix WiFi configuration
| * 64d9900860 drm/rockchip: cdn-dp: Fix some error handling paths in cdn_dp_probe()
| * ddc42881f1 drm/radeon: possible buffer overflow
| * 4a29f0f7a1 drm/rockchip: vop: Fix call to crtc reset helper
| * 824f0f4f93 drm/rockchip: vop: Fix reset of state in duplicate state crtc funcs
| * eaf62ea650 hwmon: (coretemp) Fix potentially truncated sysfs attribute name
| * 9fb0eed09e platform/x86: wmi: Fix opening of char device
| * 22117b77ee platform/x86: wmi: remove unnecessary initializations
| * 1607ea8a81 platform/x86: wmi: Fix probe failure when failing to register WMI devices
| * d1461f0c9c clk: mediatek: clk-mt2701: Add check for mtk_alloc_clk_data
| * e8ae4b49dd clk: mediatek: clk-mt7629: Add check for mtk_alloc_clk_data
| * cfa68e0ac5 clk: mediatek: clk-mt7629-eth: Add check for mtk_alloc_clk_data
| * 2705c5b97f clk: mediatek: clk-mt6797: Add check for mtk_alloc_clk_data
| * fbe466f06d clk: mediatek: clk-mt6779: Add check for mtk_alloc_clk_data
| * 8ae911637b clk: npcm7xx: Fix incorrect kfree
| * cbcf67b0bc clk: keystone: pll: fix a couple NULL vs IS_ERR() checks
| * 3d38bc4bab clk: imx: Select MXC_CLK for CLK_IMX8QXP
| * ae98b5ef99 clk: qcom: gcc-sm8150: Fix gcc_sdcc2_apps_clk_src
| * 15f335494b clk: qcom: gcc-sm8150: use ARRAY_SIZE instead of specifying num_parents
| * 141ccc1272 clk: qcom: clk-rcg2: Fix clock rate overflow for high parent frequencies
| * dbf13624b2 regmap: debugfs: Fix a erroneous check after snprintf()
| * af50165c12 ipvlan: properly track tx_errors
| * 76304c749e net: add DEV_STATS_READ() helper
| * 4482b250c8 ipv6: avoid atomic fragment on GSO packets
| * 19d5273378 ACPI: sysfs: Fix create_pnp_modalias() and create_of_modalias()
| * 5105d46146 tcp: fix cookie_init_timestamp() overflows
| * e4e819bdc8 tcp: Remove one extra ktime_get_ns() from cookie_init_timestamp
| * 7ab8aa7300 chtls: fix tp->rcv_tstamp initialization
| * 75bbf6e934 r8169: fix rare issue with broken rx after link-down on RTL8125
| * 282342bc47 r8169: use tp_to_dev instead of open code
| * 3091ab943d thermal: core: prevent potential string overflow
| * 35854733ae can: dev: can_restart(): fix race condition between controller restart and netif_carrier_on()
| * b53be254d3 can: dev: can_restart(): don't crash kernel if carrier is OK
| * a29f012a27 wifi: rtlwifi: fix EDCA limit set by BT coexistence
| * bed72a332f tcp_metrics: do not create an entry from tcp_init_metrics()
| * f3902c0e6f tcp_metrics: properly set tp->snd_ssthresh in tcp_init_metrics()
| * b78f2b7774 tcp_metrics: add missing barriers on delete
| * af0fe2c2ff wifi: mt76: mt7603: rework/fix rx pse hang check
| * a2e99dbdc1 wifi: rtw88: debug: Fix the NULL vs IS_ERR() bug for debugfs_create_file()
| * c9b929f793 tcp: call tcp_try_undo_recovery when an RTOd TFO SYNACK is ACKed
| * 25eaef1d0d i40e: fix potential memory leaks in i40e_remove()
| * 09ce728c9e genirq/matrix: Exclude managed interrupts in irq_matrix_allocated()
| * 3718a48ef4 vfs: fix readahead(2) on block devices
* | 0443350950 ANDROID: fix up rpmsg_device ABI break
* | 398b357f13 ANDROID: fix up platform_device ABI break
* | 7b96d6414a Merge 5.4.260 into android11-5.4-lts
|/
* 87e8e7a7aa Linux 5.4.260
* 8b0ecf2167 tty: 8250: Add support for Intashield IS-100
* 6dd5561b23 tty: 8250: Add support for Brainboxes UP cards
* 03145e0ff8 tty: 8250: Add support for additional Brainboxes UC cards
* 5a6471372f tty: 8250: Remove UC-257 and UC-431
* 72f236b57f usb: storage: set 1.50 as the lower bcdDevice for older "Super Top" compatibility
* 792a91fcd2 PCI: Prevent xHCI driver from claiming AMD VanGogh USB3 DRD device
* 4b865e0d78 Revert "ARM: dts: Move am33xx and am43xx mmc nodes to sdhci-omap driver"
* 4e53bab11f nvmet-tcp: Fix a possible UAF in queue intialization setup
* 2c9415ec8e nvmet-tcp: move send/recv error handling in the send/recv methods instead of call-sites
* 784ef618b2 remove the sx8 block driver
* a31f8222a7 ata: ahci: fix enum constants for gcc-13
* cc1afa62e2 net: chelsio: cxgb4: add an error code check in t4_load_phy_fw
* 7e429d1f39 platform/mellanox: mlxbf-tmfifo: Fix a warning message
* 5f4f58eac3 platform/x86: asus-wmi: Change ASUS_WMI_BRN_DOWN code from 0x20 to 0x2e
* 88d1aa03eb scsi: mpt3sas: Fix in error path
* b1f62e3ef9 fbdev: uvesafb: Call cn_del_callback() at the end of uvesafb_exit()
* fb02de6479 ASoC: rt5650: fix the wrong result of key button
* b6c09ff5ea netfilter: nfnetlink_log: silence bogus compiler warning
* 6c23b6d308 spi: npcm-fiu: Fix UMA reads when dummy.nbytes == 0
* 788b308340 fbdev: atyfb: only use ioremap_uc() on i386 and ia64
* 848b9c6888 Input: synaptics-rmi4 - handle reset delay when using SMBus trsnsport
* a0bf183db4 dmaengine: ste_dma40: Fix PM disable depth imbalance in d40_probe
* 39ae053abb irqchip/stm32-exti: add missing DT IRQ flag translation
* fbcd05a0db Input: i8042 - add Fujitsu Lifebook E5411 to i8042 quirk table
* cda248f169 x86: Fix .brk attribute in linker script
* 01e6885b75 rpmsg: Fix possible refcount leak in rpmsg_register_device_override()
* cff56d7a92 rpmsg: glink: Release driver_override
* 3d14785980 rpmsg: Fix calling device_lock() on non-initialized device
* e70898ae1a rpmsg: Fix kfree() of static memory on setting driver_override
* 0df5d80135 rpmsg: Constify local variable in field store macro
* 063444d66f driver: platform: Add helper for safer setting of driver_override
* 83ecffd40c ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow
* 66cfd4cf6a ext4: avoid overlapping preallocations due to overflow
* 1e0a5dec26 ext4: add two helper functions extent_logical_end() and pa_logical_end()
* c2102ac103 x86/mm: Fix RESERVE_BRK() for older binutils
* ced79d864b x86/mm: Simplify RESERVE_BRK()
* 5fc242c118 nfsd: lock_rename() needs both directories to live on the same fs
* e9a988cd4c f2fs: fix to do sanity check on inode type during garbage collection
* 750de03de7 smbdirect: missing rc checks while waiting for rdma events
* 5776aeee2a kobject: Fix slab-out-of-bounds in fill_kobj_path()
* 0a45e0e5dd arm64: fix a concurrency issue in emulation_proc_handler()
* 6ba2ffe3cb drm/dp_mst: Fix NULL deref in get_mst_branch_device_by_guid_helper()
* 9d29933f36 x86/i8259: Skip probing when ACPI/MADT advertises PCAT compatibility
* 1ed21b207e i40e: Fix wrong check for I40E_TXR_FLAGS_WB_ON_ITR
* f48670c3b0 clk: Sanitize possible_parent_show to Handle Return Value of of_clk_get_parent_name
* 511f3e9bbb perf/core: Fix potential NULL deref
* 8de78231cb nvmem: imx: correct nregs for i.MX6UL
* 0b2c3a8601 nvmem: imx: correct nregs for i.MX6SLL
* 6063678df7 nvmem: imx: correct nregs for i.MX6ULL
* 12337d3e88 i2c: aspeed: Fix i2c bus hang in slave read
* e3d8ef87a9 i2c: stm32f7: Fix PEC handling in case of SMBUS transfers
* 5764f6e546 i2c: muxes: i2c-demux-pinctrl: Use of_get_i2c_adapter_by_node()
* a3b9bcedd7 i2c: muxes: i2c-mux-gpmux: Use of_get_i2c_adapter_by_node()
* 07ec3d952a i2c: muxes: i2c-mux-pinctrl: Use of_get_i2c_adapter_by_node()
* 519ff2d9fe iio: exynos-adc: request second interupt only when touchscreen mode is used
* 2bf9fbd136 gtp: fix fragmentation needed check with gso
* 2ab1b7ad50 gtp: uapi: fix GTPA_MAX
* 54ba3b8267 tcp: fix wrong RTO timeout when received SACK reneging
* 29cb3f81bc r8152: Cancel hw_phy_work if we have an error in probe
* 6124d0b100 r8152: Run the unload routine if we have errors during probe
* 1d3cb4aa93 r8152: Increase USB control msg timeout to 5000ms as per spec
* 2f8da95116 net: ieee802154: adf7242: Fix some potential buffer overflow in adf7242_stats_show()
* ec885679fa igc: Fix ambiguity in the ethtool advertising
* 3b098edafe neighbour: fix various data-races
* 418ca6e63e igb: Fix potential memory leak in igb_add_ethtool_nfc_entry
* 00ef4a7de6 treewide: Spelling fix in comment
* e44e78ff44 r8169: fix the KCSAN reported data race in rtl_rx while reading desc->opts1
* b9ba50fc18 r8169: fix the KCSAN reported data-race in rtl_tx while reading TxDescArray[entry].opts1
* a27c6bfc52 virtio-mmio: fix memory leak of vm_dev
* 8d394fcb03 virtio_balloon: Fix endless deflation and inflation on arm64
* be84e96426 mcb-lpc: Reallocate memory region to avoid memory overlapping
* 3235094d55 mcb: Return actual parsed size when reading chameleon table
* fbe17a8be1 selftests/ftrace: Add new test case which checks non unique symbol
* 4d057ca86e mtd: rawnand: marvell: Ensure program page operations are successful

Change-Id: I58a8cd7194465f27b5fde3af6e27010d4d4c543c
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-01-09 13:26:54 +00:00
Greg Kroah-Hartman
e2be513380 ANDROID: GKI: fix crc issue in include/net/addrconf.h
In commit 9354e0acdb ("net: ipv6: support reporting otherwise unknown
prefix flags in RTM_NEWPREFIX") a union is added to fix some issues, but
that messes with the crc of a number of networking symbols for obvious
reasons.  As this does not actually change the abi at all, use some
GENKSYMS magic #define logic to preserve the crc so that all is well.

Bug: 161946584
Fixes: 9354e0acdb ("net: ipv6: support reporting otherwise unknown prefix flags in RTM_NEWPREFIX")
Change-Id: I9d2df74e8f3ae60425534f1b33d50b2bc444f7f5
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-01-05 11:28:46 +00:00
Greg Kroah-Hartman
3c4b111a71 Revert "cred: switch to using atomic_long_t"
This reverts commit be7676b03a which is
commit f8fa5d76925991976b3e7076f9d1052515ec1fca upstream.

It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way.

Bug: 161946584
Bug: 317347552
Change-Id: I9eb52866bc3b2a9f02e3f7fbee0bacbcc06b0849
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-01-03 17:00:08 +00:00
Greg Kroah-Hartman
5158e9afed This is the 5.4.265 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmWC/R4ACgkQONu9yGCS
 aT6XRw/+OE/DwEAaRGgM/gGLayr/n6zJoL7DUhLxkS+wG3beQXFsdigCHRRhTh58
 OCQP6pL6UlbJ8Yge3FtpYqqkR+UyY7c/wsjJI05v7dKUJ742rpFNML9w0Dg9Au8w
 k4TsVU01nnr9HC7rY8k8zYZ/DZdULvIX8RNhSOi0CMO2gkdMUFrh/IC0q5JIWKmL
 xFmMieGtsr4kl4sP2oUbYihf1Li4oblouBV+70kPViC6XA0YhOSCT0+PfDxp5CuD
 sux1srZGY/782zI0O6+ObsYascwgL+wk0oEJRj1vO02tJKKbtEGMJvGO9Mcpto6B
 2YBq40PAhyeKFdt4YzOWCSO7WjvWP7h15U68EY+E6ruy9La+P/dTyhAqsBBTVDEs
 PGFIjxc5pnHn72JQ/U3yJoHFM7yW26VEmEGItsd81VermNgqe2scSPSPHIfM0qFU
 z2l0PcQkm+SLK2cFDSCBUBaXfx4R2UuWe/QY07K2eN5YCC4mqROajVh4Vqyj1Q8j
 PLw/yrt8lOJcDEDMtFq7hcXKMzcb/dYfCZcSfxl6YJeaR4X4ViOkDGVhLEkVeOn5
 K3kyIvPd268rmoy/9jTuDYu6axMhg2eE2dTQqBg8pFwIOgetUwtYcBhyxDtmGZm1
 lNUYmY84BSHZwXuKjNXGgZ5DI0U7nAWis+odR0scHpVKwaC8ta8=
 =d0Ht
 -----END PGP SIGNATURE-----

Merge 5.4.265 into android11-5.4-lts

Changes in 5.4.265
	afs: Fix refcount underflow from error handling race
	net: ipv6: support reporting otherwise unknown prefix flags in RTM_NEWPREFIX
	qca_debug: Prevent crash on TX ring changes
	qca_debug: Fix ethtool -G iface tx behavior
	qca_spi: Fix reset behavior
	atm: solos-pci: Fix potential deadlock on &cli_queue_lock
	atm: solos-pci: Fix potential deadlock on &tx_queue_lock
	atm: Fix Use-After-Free in do_vcc_ioctl
	net/rose: Fix Use-After-Free in rose_ioctl
	qed: Fix a potential use-after-free in qed_cxt_tables_alloc
	net: Remove acked SYN flag from packet in the transmit queue correctly
	sign-file: Fix incorrect return values check
	vsock/virtio: Fix unsigned integer wrap around in virtio_transport_has_space()
	net: stmmac: use dev_err_probe() for reporting mdio bus registration failure
	net: stmmac: Handle disabled MDIO busses from devicetree
	appletalk: Fix Use-After-Free in atalk_ioctl
	cred: switch to using atomic_long_t
	ALSA: hda/hdmi: add force-connect quirks for ASUSTeK Z170 variants
	Revert "PCI: acpiphp: Reassign resources on bridge if necessary"
	usb: aqc111: check packet for fixup for true limit
	blk-throttle: fix lockdep warning of "cgroup_mutex or RCU read lock required!"
	bcache: avoid oversize memory allocation by small stripe_size
	bcache: add code comments for bch_btree_node_get() and __bch_btree_node_alloc()
	bcache: avoid NULL checking to c->root in run_cache_set()
	platform/x86: intel_telemetry: Fix kernel doc descriptions
	HID: add ALWAYS_POLL quirk for Apple kb
	HID: hid-asus: reset the backlight brightness level on resume
	HID: multitouch: Add quirk for HONOR GLO-GXXX touchpad
	asm-generic: qspinlock: fix queued_spin_value_unlocked() implementation
	net: usb: qmi_wwan: claim interface 4 for ZTE MF290
	HID: hid-asus: add const to read-only outgoing usb buffer
	perf: Fix perf_event_validate_size() lockdep splat
	soundwire: stream: fix NULL pointer dereference for multi_link
	ext4: prevent the normalized size from exceeding EXT_MAX_BLOCKS
	arm64: mm: Always make sw-dirty PTEs hw-dirty in pte_modify
	team: Fix use-after-free when an option instance allocation fails
	ring-buffer: Fix memory leak of free page
	mmc: block: Be sure to wait while busy in CQE error recovery
	powerpc/ftrace: Create a dummy stackframe to fix stack unwind
	powerpc/ftrace: Fix stack teardown in ftrace_no_trace
	Linux 5.4.265

Change-Id: I762a9cd127dfce014141a135e818a170c99e3fd1
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-12-21 12:17:30 +00:00
Zhengchao Shao
70db018a10 UPSTREAM: ipv4: igmp: fix refcnt uaf issue when receiving igmp query packet
[ Upstream commit e2b706c691905fe78468c361aaabc719d0a496f1 ]

When I perform the following test operations:
1.ip link add br0 type bridge
2.brctl addif br0 eth0
3.ip addr add 239.0.0.1/32 dev eth0
4.ip addr add 239.0.0.1/32 dev br0
5.ip addr add 224.0.0.1/32 dev br0
6.while ((1))
    do
        ifconfig br0 up
        ifconfig br0 down
    done
7.send IGMPv2 query packets to port eth0 continuously. For example,
./mausezahn ethX -c 0 "01 00 5e 00 00 01 00 72 19 88 aa 02 08 00 45 00 00
1c 00 01 00 00 01 02 0e 7f c0 a8 0a b7 e0 00 00 01 11 64 ee 9b 00 00 00 00"

The preceding tests may trigger the refcnt uaf issue of the mc list. The
stack is as follows:
	refcount_t: addition on 0; use-after-free.
	WARNING: CPU: 21 PID: 144 at lib/refcount.c:25 refcount_warn_saturate (lib/refcount.c:25)
	CPU: 21 PID: 144 Comm: ksoftirqd/21 Kdump: loaded Not tainted 6.7.0-rc1-next-20231117-dirty #80
	Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011
	RIP: 0010:refcount_warn_saturate (lib/refcount.c:25)
	RSP: 0018:ffffb68f00657910 EFLAGS: 00010286
	RAX: 0000000000000000 RBX: ffff8a00c3bf96c0 RCX: ffff8a07b6160908
	RDX: 00000000ffffffd8 RSI: 0000000000000027 RDI: ffff8a07b6160900
	RBP: ffff8a00cba36862 R08: 0000000000000000 R09: 00000000ffff7fff
	R10: ffffb68f006577c0 R11: ffffffffb0fdcdc8 R12: ffff8a00c3bf9680
	R13: ffff8a00c3bf96f0 R14: 0000000000000000 R15: ffff8a00d8766e00
	FS:  0000000000000000(0000) GS:ffff8a07b6140000(0000) knlGS:0000000000000000
	CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
	CR2: 000055f10b520b28 CR3: 000000039741a000 CR4: 00000000000006f0
	Call Trace:
	<TASK>
	igmp_heard_query (net/ipv4/igmp.c:1068)
	igmp_rcv (net/ipv4/igmp.c:1132)
	ip_protocol_deliver_rcu (net/ipv4/ip_input.c:205)
	ip_local_deliver_finish (net/ipv4/ip_input.c:234)
	__netif_receive_skb_one_core (net/core/dev.c:5529)
	netif_receive_skb_internal (net/core/dev.c:5729)
	netif_receive_skb (net/core/dev.c:5788)
	br_handle_frame_finish (net/bridge/br_input.c:216)
	nf_hook_bridge_pre (net/bridge/br_input.c:294)
	__netif_receive_skb_core (net/core/dev.c:5423)
	__netif_receive_skb_list_core (net/core/dev.c:5606)
	__netif_receive_skb_list (net/core/dev.c:5674)
	netif_receive_skb_list_internal (net/core/dev.c:5764)
	napi_gro_receive (net/core/gro.c:609)
	e1000_clean_rx_irq (drivers/net/ethernet/intel/e1000/e1000_main.c:4467)
	e1000_clean (drivers/net/ethernet/intel/e1000/e1000_main.c:3805)
	__napi_poll (net/core/dev.c:6533)
	net_rx_action (net/core/dev.c:6735)
	__do_softirq (kernel/softirq.c:554)
	run_ksoftirqd (kernel/softirq.c:913)
	smpboot_thread_fn (kernel/smpboot.c:164)
	kthread (kernel/kthread.c:388)
	ret_from_fork (arch/x86/kernel/process.c:153)
	ret_from_fork_asm (arch/x86/entry/entry_64.S:250)
	</TASK>

The root causes are as follows:
Thread A					Thread B
...						netif_receive_skb
br_dev_stop					...
    br_multicast_leave_snoopers			...
        __ip_mc_dec_group			...
            __igmp_group_dropped		igmp_rcv
                igmp_stop_timer			    igmp_heard_query         //ref = 1
                ip_ma_put			        igmp_mod_timer
                    refcount_dec_and_test	            igmp_start_timer //ref = 0
			...                                     refcount_inc //ref increases from 0
When the device receives an IGMPv2 Query message, it starts the timer
immediately, regardless of whether the device is running. If the device is
down and has left the multicast group, it will cause the mc list refcount
uaf issue.

Bug: 316932391
Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 94445d9583079e0ccc5dde1370076ff24800d86e)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I277be2304e564994e05b981ccd6cd8cbb9dc85be
2023-12-21 11:28:11 +00:00
Greg Kroah-Hartman
2d21f73b2f Linux 5.4.265
Link: https://lore.kernel.org/r/20231218135042.748715259@linuxfoundation.org
Tested-by: Shuah Khan <skhan@linuxfoundation.org>
Tested-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: kernelci.org bot <bot@kernelci.org>
Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-20 15:41:26 +01:00
Naveen N Rao
5c70542f32 powerpc/ftrace: Fix stack teardown in ftrace_no_trace
commit 4b3338aaa74d7d4ec5b6734dc298f0db94ec83d2 upstream.

Commit 41a506ef71eb ("powerpc/ftrace: Create a dummy stackframe to fix
stack unwind") added use of a new stack frame on ftrace entry to fix
stack unwind. However, the commit missed updating the offset used while
tearing down the ftrace stack when ftrace is disabled. Fix the same.

In addition, the commit missed saving the correct stack pointer in
pt_regs. Update the same.

Fixes: 41a506ef71eb ("powerpc/ftrace: Create a dummy stackframe to fix stack unwind")
Cc: stable@vger.kernel.org # v6.5+
Signed-off-by: Naveen N Rao <naveen@kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231130065947.2188860-1-naveen@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-20 15:41:26 +01:00
Naveen N Rao
0e1867b482 powerpc/ftrace: Create a dummy stackframe to fix stack unwind
commit 41a506ef71eb38d94fe133f565c87c3e06ccc072 upstream.

With ppc64 -mprofile-kernel and ppc32 -pg, profiling instructions to
call into ftrace are emitted right at function entry. The instruction
sequence used is minimal to reduce overhead. Crucially, a stackframe is
not created for the function being traced. This breaks stack unwinding
since the function being traced does not have a stackframe for itself.
As such, it never shows up in the backtrace:

/sys/kernel/debug/tracing # echo 1 > /proc/sys/kernel/stack_tracer_enabled
/sys/kernel/debug/tracing # cat stack_trace
        Depth    Size   Location    (17 entries)
        -----    ----   --------
  0)     4144      32   ftrace_call+0x4/0x44
  1)     4112     432   get_page_from_freelist+0x26c/0x1ad0
  2)     3680     496   __alloc_pages+0x290/0x1280
  3)     3184     336   __folio_alloc+0x34/0x90
  4)     2848     176   vma_alloc_folio+0xd8/0x540
  5)     2672     272   __handle_mm_fault+0x700/0x1cc0
  6)     2400     208   handle_mm_fault+0xf0/0x3f0
  7)     2192      80   ___do_page_fault+0x3e4/0xbe0
  8)     2112     160   do_page_fault+0x30/0xc0
  9)     1952     256   data_access_common_virt+0x210/0x220
 10)     1696     400   0xc00000000f16b100
 11)     1296     384   load_elf_binary+0x804/0x1b80
 12)      912     208   bprm_execve+0x2d8/0x7e0
 13)      704      64   do_execveat_common+0x1d0/0x2f0
 14)      640     160   sys_execve+0x54/0x70
 15)      480      64   system_call_exception+0x138/0x350
 16)      416     416   system_call_common+0x160/0x2c4

Fix this by having ftrace create a dummy stackframe for the function
being traced. With this, backtraces now capture the function being
traced:

/sys/kernel/debug/tracing # cat stack_trace
        Depth    Size   Location    (17 entries)
        -----    ----   --------
  0)     3888      32   _raw_spin_trylock+0x8/0x70
  1)     3856     576   get_page_from_freelist+0x26c/0x1ad0
  2)     3280      64   __alloc_pages+0x290/0x1280
  3)     3216     336   __folio_alloc+0x34/0x90
  4)     2880     176   vma_alloc_folio+0xd8/0x540
  5)     2704     416   __handle_mm_fault+0x700/0x1cc0
  6)     2288      96   handle_mm_fault+0xf0/0x3f0
  7)     2192      48   ___do_page_fault+0x3e4/0xbe0
  8)     2144     192   do_page_fault+0x30/0xc0
  9)     1952     608   data_access_common_virt+0x210/0x220
 10)     1344      16   0xc0000000334bbb50
 11)     1328     416   load_elf_binary+0x804/0x1b80
 12)      912      64   bprm_execve+0x2d8/0x7e0
 13)      848     176   do_execveat_common+0x1d0/0x2f0
 14)      672     192   sys_execve+0x54/0x70
 15)      480      64   system_call_exception+0x138/0x350
 16)      416     416   system_call_common+0x160/0x2c4

This results in two additional stores in the ftrace entry code, but
produces reliable backtraces.

Fixes: 153086644f ("powerpc/ftrace: Add support for -mprofile-kernel ftrace ABI")
Cc: stable@vger.kernel.org
Signed-off-by: Naveen N Rao <naveen@kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230621051349.759567-1-naveen@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-20 15:41:26 +01:00
Adrian Hunter
9395c04666 mmc: block: Be sure to wait while busy in CQE error recovery
commit c616696a902987352426fdaeec1b0b3240949e6b upstream.

STOP command does not guarantee to wait while busy, but subsequent command
MMC_CMDQ_TASK_MGMT to discard the queue will fail if the card is busy, so
be sure to wait by employing mmc_poll_for_busy().

Fixes: 72a5af554d ("mmc: core: Add support for handling CQE requests")
Cc: stable@vger.kernel.org
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Christian Loehle <christian.loehle@arm.com>
Link: https://lore.kernel.org/r/20231103084720.6886-4-adrian.hunter@intel.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-20 15:41:25 +01:00
Steven Rostedt (Google)
3b8b2c5d76 ring-buffer: Fix memory leak of free page
commit 17d801758157bec93f26faaf5ff1a8b9a552d67a upstream.

Reading the ring buffer does a swap of a sub-buffer within the ring buffer
with a empty sub-buffer. This allows the reader to have full access to the
content of the sub-buffer that was swapped out without having to worry
about contention with the writer.

The readers call ring_buffer_alloc_read_page() to allocate a page that
will be used to swap with the ring buffer. When the code is finished with
the reader page, it calls ring_buffer_free_read_page(). Instead of freeing
the page, it stores it as a spare. Then next call to
ring_buffer_alloc_read_page() will return this spare instead of calling
into the memory management system to allocate a new page.

Unfortunately, on freeing of the ring buffer, this spare page is not
freed, and causes a memory leak.

Link: https://lore.kernel.org/linux-trace-kernel/20231210221250.7b9cc83c@rorschach.local.home

Cc: stable@vger.kernel.org
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fixes: 73a757e631 ("ring-buffer: Return reader page back into existing ring buffer")
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-20 15:41:25 +01:00
Florent Revest
3459c9aa64 team: Fix use-after-free when an option instance allocation fails
commit c12296bbecc488623b7d1932080e394d08f3226b upstream.

In __team_options_register, team_options are allocated and appended to
the team's option_list.
If one option instance allocation fails, the "inst_rollback" cleanup
path frees the previously allocated options but doesn't remove them from
the team's option_list.
This leaves dangling pointers that can be dereferenced later by other
parts of the team driver that iterate over options.

This patch fixes the cleanup path to remove the dangling pointers from
the list.

As far as I can tell, this uaf doesn't have much security implications
since it would be fairly hard to exploit (an attacker would need to make
the allocation of that specific small object fail) but it's still nice
to fix.

Cc: stable@vger.kernel.org
Fixes: 80f7c6683f ("team: add support for per-port options")
Signed-off-by: Florent Revest <revest@chromium.org>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Link: https://lore.kernel.org/r/20231206123719.1963153-1-revest@chromium.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-20 15:41:25 +01:00
James Houghton
363a67ef3a arm64: mm: Always make sw-dirty PTEs hw-dirty in pte_modify
commit 3c0696076aad60a2f04c019761921954579e1b0e upstream.

It is currently possible for a userspace application to enter an
infinite page fault loop when using HugeTLB pages implemented with
contiguous PTEs when HAFDBS is not available. This happens because:

1. The kernel may sometimes write PTEs that are sw-dirty but hw-clean
   (PTE_DIRTY | PTE_RDONLY | PTE_WRITE).

2. If, during a write, the CPU uses a sw-dirty, hw-clean PTE in handling
   the memory access on a system without HAFDBS, we will get a page
   fault.

3. HugeTLB will check if it needs to update the dirty bits on the PTE.
   For contiguous PTEs, it will check to see if the pgprot bits need
   updating. In this case, HugeTLB wants to write a sequence of
   sw-dirty, hw-dirty PTEs, but it finds that all the PTEs it is about
   to overwrite are all pte_dirty() (pte_sw_dirty() => pte_dirty()),
   so it thinks no update is necessary.

We can get the kernel to write a sw-dirty, hw-clean PTE with the
following steps (showing the relevant VMA flags and pgprot bits):

i.   Create a valid, writable contiguous PTE.
       VMA vmflags:     VM_SHARED | VM_READ | VM_WRITE
       VMA pgprot bits: PTE_RDONLY | PTE_WRITE
       PTE pgprot bits: PTE_DIRTY | PTE_WRITE

ii.  mprotect the VMA to PROT_NONE.
       VMA vmflags:     VM_SHARED
       VMA pgprot bits: PTE_RDONLY
       PTE pgprot bits: PTE_DIRTY | PTE_RDONLY

iii. mprotect the VMA back to PROT_READ | PROT_WRITE.
       VMA vmflags:     VM_SHARED | VM_READ | VM_WRITE
       VMA pgprot bits: PTE_RDONLY | PTE_WRITE
       PTE pgprot bits: PTE_DIRTY | PTE_WRITE | PTE_RDONLY

Make it impossible to create a writeable sw-dirty, hw-clean PTE with
pte_modify(). Such a PTE should be impossible to create, and there may
be places that assume that pte_dirty() implies pte_hw_dirty().

Signed-off-by: James Houghton <jthoughton@google.com>
Fixes: 031e6e6b4e ("arm64: hugetlb: Avoid unnecessary clearing in huge_ptep_set_access_flags")
Cc: <stable@vger.kernel.org>
Acked-by: Will Deacon <will@kernel.org>
Reviewed-by: Ryan Roberts <ryan.roberts@arm.com>
Link: https://lore.kernel.org/r/20231204172646.2541916-3-jthoughton@google.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-20 15:41:24 +01:00
Baokun Li
de8ada0236 ext4: prevent the normalized size from exceeding EXT_MAX_BLOCKS
commit 2dcf5fde6dffb312a4bfb8ef940cea2d1f402e32 upstream.

For files with logical blocks close to EXT_MAX_BLOCKS, the file size
predicted in ext4_mb_normalize_request() may exceed EXT_MAX_BLOCKS.
This can cause some blocks to be preallocated that will not be used.
And after [Fixes], the following issue may be triggered:

=========================================================
 kernel BUG at fs/ext4/mballoc.c:4653!
 Internal error: Oops - BUG: 00000000f2000800 [#1] SMP
 CPU: 1 PID: 2357 Comm: xfs_io 6.7.0-rc2-00195-g0f5cc96c367f
 Hardware name: linux,dummy-virt (DT)
 pc : ext4_mb_use_inode_pa+0x148/0x208
 lr : ext4_mb_use_inode_pa+0x98/0x208
 Call trace:
  ext4_mb_use_inode_pa+0x148/0x208
  ext4_mb_new_inode_pa+0x240/0x4a8
  ext4_mb_use_best_found+0x1d4/0x208
  ext4_mb_try_best_found+0xc8/0x110
  ext4_mb_regular_allocator+0x11c/0xf48
  ext4_mb_new_blocks+0x790/0xaa8
  ext4_ext_map_blocks+0x7cc/0xd20
  ext4_map_blocks+0x170/0x600
  ext4_iomap_begin+0x1c0/0x348
=========================================================

Here is a calculation when adjusting ac_b_ex in ext4_mb_new_inode_pa():

	ex.fe_logical = orig_goal_end - EXT4_C2B(sbi, ex.fe_len);
	if (ac->ac_o_ex.fe_logical >= ex.fe_logical)
		goto adjust_bex;

The problem is that when orig_goal_end is subtracted from ac_b_ex.fe_len
it is still greater than EXT_MAX_BLOCKS, which causes ex.fe_logical to
overflow to a very small value, which ultimately triggers a BUG_ON in
ext4_mb_new_inode_pa() because pa->pa_free < len.

The last logical block of an actual write request does not exceed
EXT_MAX_BLOCKS, so in ext4_mb_normalize_request() also avoids normalizing
the last logical block to exceed EXT_MAX_BLOCKS to avoid the above issue.

The test case in [Link] can reproduce the above issue with 64k block size.

Link: https://patchwork.kernel.org/project/fstests/list/?series=804003
Cc:  <stable@kernel.org> # 6.4
Fixes: 93cdf49f6eca ("ext4: Fix best extent lstart adjustment logic in ext4_mb_new_inode_pa()")
Signed-off-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20231127063313.3734294-1-libaokun1@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-20 15:41:24 +01:00
Krzysztof Kozlowski
f451d6784b soundwire: stream: fix NULL pointer dereference for multi_link
commit e199bf52ffda8f98f129728d57244a9cd9ad5623 upstream.

If bus is marked as multi_link, but number of masters in the stream is
not higher than bus->hw_sync_min_links (bus->multi_link && m_rt_count >=
bus->hw_sync_min_links), bank switching should not happen.  The first
part of do_bank_switch() code properly takes these conditions into
account, but second part (sdw_ml_sync_bank_switch()) relies purely on
bus->multi_link property.  This is not balanced and leads to NULL
pointer dereference:

  Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
  ...
  Call trace:
   wait_for_completion_timeout+0x124/0x1f0
   do_bank_switch+0x370/0x6f8
   sdw_prepare_stream+0x2d0/0x438
   qcom_snd_sdw_prepare+0xa0/0x118
   sm8450_snd_prepare+0x128/0x148
   snd_soc_link_prepare+0x5c/0xe8
   __soc_pcm_prepare+0x28/0x1ec
   dpcm_be_dai_prepare+0x1e0/0x2c0
   dpcm_fe_dai_prepare+0x108/0x28c
   snd_pcm_do_prepare+0x44/0x68
   snd_pcm_action_single+0x54/0xc0
   snd_pcm_action_nonatomic+0xe4/0xec
   snd_pcm_prepare+0xc4/0x114
   snd_pcm_common_ioctl+0x1154/0x1cc0
   snd_pcm_ioctl+0x54/0x74

Fixes: ce6e74d008 ("soundwire: Add support for multi link bank switch")
Cc: stable@vger.kernel.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20231124180136.390621-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-20 15:41:24 +01:00
Mark Rutland
404902216b perf: Fix perf_event_validate_size() lockdep splat
commit 7e2c1e4b34f07d9aa8937fab88359d4a0fce468e upstream.

When lockdep is enabled, the for_each_sibling_event(sibling, event)
macro checks that event->ctx->mutex is held. When creating a new group
leader event, we call perf_event_validate_size() on a partially
initialized event where event->ctx is NULL, and so when
for_each_sibling_event() attempts to check event->ctx->mutex, we get a
splat, as reported by Lucas De Marchi:

  WARNING: CPU: 8 PID: 1471 at kernel/events/core.c:1950 __do_sys_perf_event_open+0xf37/0x1080

This only happens for a new event which is its own group_leader, and in
this case there cannot be any sibling events. Thus it's safe to skip the
check for siblings, which avoids having to make invasive and ugly
changes to for_each_sibling_event().

Avoid the splat by bailing out early when the new event is its own
group_leader.

Fixes: 382c27f4ed28f803 ("perf: Fix perf_event_validate_size()")
Closes: https://lore.kernel.org/lkml/20231214000620.3081018-1-lucas.demarchi@intel.com/
Closes: https://lore.kernel.org/lkml/ZXpm6gQ%2Fd59jGsuW@xpf.sh.intel.com/
Reported-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reported-by: Pengfei Xu <pengfei.xu@intel.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20231215112450.3972309-1-mark.rutland@arm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-20 15:41:23 +01:00
Denis Benato
4109d9a855 HID: hid-asus: add const to read-only outgoing usb buffer
[ Upstream commit 06ae5afce8cc1f7621cc5c7751e449ce20d68af7 ]

In the function asus_kbd_set_report the parameter buf is read-only
as it gets copied in a memory portion suitable for USB transfer,
but the parameter is not marked as const: add the missing const and mark
const immutable buffers passed to that function.

Signed-off-by: Denis Benato <benato.denis96@gmail.com>
Signed-off-by: Luke D. Jones <luke@ljones.dev>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:23 +01:00
Lech Perczak
1fc4091991 net: usb: qmi_wwan: claim interface 4 for ZTE MF290
[ Upstream commit 99360d9620f09fb8bc15548d855011bbb198c680 ]

Interface 4 is used by for QMI interface in stock firmware of MF28D, the
router which uses MF290 modem. Rebind it to qmi_wwan after freeing it up
from option driver.
The proper configuration is:

Interface mapping is:
0: QCDM, 1: (unknown), 2: AT (PCUI), 2: AT (Modem), 4: QMI

T:  Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#=  4 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=19d2 ProdID=0189 Rev= 0.00
S:  Manufacturer=ZTE, Incorporated
S:  Product=ZTE LTE Technologies MSM
C:* #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=84(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
E:  Ad=86(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms

Cc: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
Link: https://lore.kernel.org/r/20231117231918.100278-3-lech.perczak@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:23 +01:00
Linus Torvalds
88ceaf8e2c asm-generic: qspinlock: fix queued_spin_value_unlocked() implementation
[ Upstream commit 125b0bb95dd6bec81b806b997a4ccb026eeecf8f ]

We really don't want to do atomic_read() or anything like that, since we
already have the value, not the lock.  The whole point of this is that
we've loaded the lock from memory, and we want to check whether the
value we loaded was a locked one or not.

The main use of this is the lockref code, which loads both the lock and
the reference count in one atomic operation, and then works on that
combined value.  With the atomic_read(), the compiler would pointlessly
spill the value to the stack, in order to then be able to read it back
"atomically".

This is the qspinlock version of commit c6f4a9002252 ("asm-generic:
ticket-lock: Optimize arch_spin_value_unlocked()") which fixed this same
bug for ticket locks.

Cc: Guo Ren <guoren@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Waiman Long <longman@redhat.com>
Link: https://lore.kernel.org/all/CAHk-=whNRv0v6kQiV5QO6DJhjH4KEL36vWQ6Re8Csrnh4zbRkQ@mail.gmail.com/
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:22 +01:00
Aoba K
91175d6fe5 HID: multitouch: Add quirk for HONOR GLO-GXXX touchpad
[ Upstream commit 9ffccb691adb854e7b7f3ee57fbbda12ff70533f ]

Honor MagicBook 13 2023 has a touchpad which do not switch to the multitouch
mode until the input mode feature is written by the host.  The touchpad do
report the input mode at touchpad(3), while itself working under mouse mode. As
a workaround, it is possible to call MT_QUIRE_FORCE_GET_FEATURE to force set
feature in mt_set_input_mode for such device.

The touchpad reports as BLTP7853, which cannot retrive any useful manufacture
information on the internel by this string at present.  As the serial number of
the laptop is GLO-G52, while DMI info reports the laptop serial number as
GLO-GXXX, this workaround should applied to all models which has the GLO-GXXX.

Signed-off-by: Aoba K <nexp_0x17@outlook.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:22 +01:00
Denis Benato
1f94c0d60d HID: hid-asus: reset the backlight brightness level on resume
[ Upstream commit 546edbd26cff7ae990e480a59150e801a06f77b1 ]

Some devices managed by this driver automatically set brightness to 0
before entering a suspended state and reset it back to a default
brightness level after the resume:
this has the effect of having the kernel report wrong brightness
status after a sleep, and on some devices (like the Asus RC71L) that
brightness is the intensity of LEDs directly facing the user.

Fix the above issue by setting back brightness to the level it had
before entering a sleep state.

Signed-off-by: Denis Benato <benato.denis96@gmail.com>
Signed-off-by: Luke D. Jones <luke@ljones.dev>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:22 +01:00
Oliver Neukum
e9a3cd3dcf HID: add ALWAYS_POLL quirk for Apple kb
[ Upstream commit c55092187d9ad7b2f8f5a8645286fa03997d442f ]

These devices disconnect if suspended without remote wakeup. They can operate
with the standard driver.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:21 +01:00
Andy Shevchenko
395ad0baa4 platform/x86: intel_telemetry: Fix kernel doc descriptions
[ Upstream commit a6584711e64d9d12ab79a450ec3628fd35e4f476 ]

LKP found issues with a kernel doc in the driver:

core.c:116: warning: Function parameter or member 'ioss_evtconfig' not described in 'telemetry_update_events'
core.c:188: warning: Function parameter or member 'ioss_evtconfig' not described in 'telemetry_get_eventconfig'

It looks like it were copy'n'paste typos when these descriptions
had been introduced. Fix the typos.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202310070743.WALmRGSY-lkp@intel.com/
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20231120150756.1661425-1-andriy.shevchenko@linux.intel.com
Reviewed-by: Rajneesh Bhardwaj <irenic.rajneesh@gmail.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:21 +01:00
Coly Li
af509912cd bcache: avoid NULL checking to c->root in run_cache_set()
[ Upstream commit 3eba5e0b2422aec3c9e79822029599961fdcab97 ]

In run_cache_set() after c->root returned from bch_btree_node_get(), it
is checked by IS_ERR_OR_NULL(). Indeed it is unncessary to check NULL
because bch_btree_node_get() will not return NULL pointer to caller.

This patch replaces IS_ERR_OR_NULL() by IS_ERR() for the above reason.

Signed-off-by: Coly Li <colyli@suse.de>
Link: https://lore.kernel.org/r/20231120052503.6122-11-colyli@suse.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:20 +01:00
Coly Li
356ae9de79 bcache: add code comments for bch_btree_node_get() and __bch_btree_node_alloc()
[ Upstream commit 31f5b956a197d4ec25c8a07cb3a2ab69d0c0b82f ]

This patch adds code comments to bch_btree_node_get() and
__bch_btree_node_alloc() that NULL pointer will not be returned and it
is unnecessary to check NULL pointer by the callers of these routines.

Signed-off-by: Coly Li <colyli@suse.de>
Link: https://lore.kernel.org/r/20231120052503.6122-10-colyli@suse.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:20 +01:00
Coly Li
ca4b00c6cb bcache: avoid oversize memory allocation by small stripe_size
[ Upstream commit baf8fb7e0e5ec54ea0839f0c534f2cdcd79bea9c ]

Arraies bcache->stripe_sectors_dirty and bcache->full_dirty_stripes are
used for dirty data writeback, their sizes are decided by backing device
capacity and stripe size. Larger backing device capacity or smaller
stripe size make these two arraies occupies more dynamic memory space.

Currently bcache->stripe_size is directly inherited from
queue->limits.io_opt of underlying storage device. For normal hard
drives, its limits.io_opt is 0, and bcache sets the corresponding
stripe_size to 1TB (1<<31 sectors), it works fine 10+ years. But for
devices do declare value for queue->limits.io_opt, small stripe_size
(comparing to 1TB) becomes an issue for oversize memory allocations of
bcache->stripe_sectors_dirty and bcache->full_dirty_stripes, while the
capacity of hard drives gets much larger in recent decade.

For example a raid5 array assembled by three 20TB hardrives, the raid
device capacity is 40TB with typical 512KB limits.io_opt. After the math
calculation in bcache code, these two arraies will occupy 400MB dynamic
memory. Even worse Andrea Tomassetti reports that a 4KB limits.io_opt is
declared on a new 2TB hard drive, then these two arraies request 2GB and
512MB dynamic memory from kzalloc(). The result is that bcache device
always fails to initialize on his system.

To avoid the oversize memory allocation, bcache->stripe_size should not
directly inherited by queue->limits.io_opt from the underlying device.
This patch defines BCH_MIN_STRIPE_SZ (4MB) as minimal bcache stripe size
and set bcache device's stripe size against the declared limits.io_opt
value from the underlying storage device,
- If the declared limits.io_opt > BCH_MIN_STRIPE_SZ, bcache device will
  set its stripe size directly by this limits.io_opt value.
- If the declared limits.io_opt < BCH_MIN_STRIPE_SZ, bcache device will
  set its stripe size by a value multiplying limits.io_opt and euqal or
  large than BCH_MIN_STRIPE_SZ.

Then the minimal stripe size of a bcache device will always be >= 4MB.
For a 40TB raid5 device with 512KB limits.io_opt, memory occupied by
bcache->stripe_sectors_dirty and bcache->full_dirty_stripes will be 50MB
in total. For a 2TB hard drive with 4KB limits.io_opt, memory occupied
by these two arraies will be 2.5MB in total.

Such mount of memory allocated for bcache->stripe_sectors_dirty and
bcache->full_dirty_stripes is reasonable for most of storage devices.

Reported-by: Andrea Tomassetti <andrea.tomassetti-opensource@devo.com>
Signed-off-by: Coly Li <colyli@suse.de>
Reviewed-by: Eric Wheeler <bcache@lists.ewheeler.net>
Link: https://lore.kernel.org/r/20231120052503.6122-2-colyli@suse.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:20 +01:00
Ming Lei
e1d811cbc3 blk-throttle: fix lockdep warning of "cgroup_mutex or RCU read lock required!"
[ Upstream commit 27b13e209ddca5979847a1b57890e0372c1edcee ]

Inside blkg_for_each_descendant_pre(), both
css_for_each_descendant_pre() and blkg_lookup() requires RCU read lock,
and either cgroup_assert_mutex_or_rcu_locked() or rcu_read_lock_held()
is called.

Fix the warning by adding rcu read lock.

Reported-by: Changhui Zhong <czhong@redhat.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20231117023527.3188627-2-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:20 +01:00
Oliver Neukum
84f2e5b3e7 usb: aqc111: check packet for fixup for true limit
[ Upstream commit ccab434e674ca95d483788b1895a70c21b7f016a ]

If a device sends a packet that is inbetween 0
and sizeof(u64) the value passed to skb_trim()
as length will wrap around ending up as some very
large value.

The driver will then proceed to parse the header
located at that position, which will either oops or
process some random value.

The fix is to check against sizeof(u64) rather than
0, which the driver currently does. The issue exists
since the introduction of the driver.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:19 +01:00
Bjorn Helgaas
619a340666 Revert "PCI: acpiphp: Reassign resources on bridge if necessary"
commit 5df12742b7e3aae2594a30a9d14d5d6e9e7699f4 upstream.

This reverts commit 40613da52b13fb21c5566f10b287e0ca8c12c4e9 and the
subsequent fix to it:

  cc22522fd55e ("PCI: acpiphp: Use pci_assign_unassigned_bridge_resources() only for non-root bus")

40613da52b13 fixed a problem where hot-adding a device with large BARs
failed if the bridge windows programmed by firmware were not large enough.

cc22522fd55e ("PCI: acpiphp: Use pci_assign_unassigned_bridge_resources()
only for non-root bus") fixed a problem with 40613da52b13: an ACPI hot-add
of a device on a PCI root bus (common in the virt world) or firmware
sending ACPI Bus Check to non-existent Root Ports (e.g., on Dell Inspiron
7352/0W6WV0) caused a NULL pointer dereference and suspend/resume hangs.

Unfortunately the combination of 40613da52b13 and cc22522fd55e caused other
problems:

  - Fiona reported that hot-add of SCSI disks in QEMU virtual machine fails
    sometimes.

  - Dongli reported a similar problem with hot-add of SCSI disks.

  - Jonathan reported a console freeze during boot on bare metal due to an
    error in radeon GPU initialization.

Revert both patches to avoid adding these problems.  This means we will
again see the problems with hot-adding devices with large BARs and the NULL
pointer dereferences and suspend/resume issues that 40613da52b13 and
cc22522fd55e were intended to fix.

Fixes: 40613da52b13 ("PCI: acpiphp: Reassign resources on bridge if necessary")
Fixes: cc22522fd55e ("PCI: acpiphp: Use pci_assign_unassigned_bridge_resources() only for non-root bus")
Reported-by: Fiona Ebner <f.ebner@proxmox.com>
Closes: https://lore.kernel.org/r/9eb669c0-d8f2-431d-a700-6da13053ae54@proxmox.com
Reported-by: Dongli Zhang <dongli.zhang@oracle.com>
Closes: https://lore.kernel.org/r/3c4a446a-b167-11b8-f36f-d3c1b49b42e9@oracle.com
Reported-by: Jonathan Woithe <jwoithe@just42.net>
Closes: https://lore.kernel.org/r/ZXpaNCLiDM+Kv38H@marvin.atrad.com.au
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Igor Mammedov <imammedo@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-20 15:41:19 +01:00
Kai Vehmanen
371dbce60a ALSA: hda/hdmi: add force-connect quirks for ASUSTeK Z170 variants
commit 924f5ca2975b2993ee81a7ecc3c809943a70f334 upstream.

On ASUSTeK Z170M PLUS and Z170 PRO GAMING systems, the display codec
pins are not registered properly without the force-connect quirk. The
codec will report only one pin as having external connectivity, but i915
finds all three connectors on the system, so the two drivers are not
in sync.

Issue found with DRM igt-gpu-tools test kms_hdmi_inject@inject-audio.

Link: https://gitlab.freedesktop.org/drm/intel/-/issues/9801
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Jani Saarinen <jani.saarinen@intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20231208132127.2438067-3-kai.vehmanen@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-20 15:41:19 +01:00
Jens Axboe
be7676b03a cred: switch to using atomic_long_t
commit f8fa5d76925991976b3e7076f9d1052515ec1fca upstream.

There are multiple ways to grab references to credentials, and the only
protection we have against overflowing it is the memory required to do
so.

With memory sizes only moving in one direction, let's bump the reference
count to 64-bit and move it outside the realm of feasibly overflowing.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-20 15:41:18 +01:00
Hyunwoo Kim
9112bd1072 appletalk: Fix Use-After-Free in atalk_ioctl
[ Upstream commit 189ff16722ee36ced4d2a2469d4ab65a8fee4198 ]

Because atalk_ioctl() accesses sk->sk_receive_queue
without holding a sk->sk_receive_queue.lock, it can
cause a race with atalk_recvmsg().
A use-after-free for skb occurs with the following flow.
```
atalk_ioctl() -> skb_peek()
atalk_recvmsg() -> skb_recv_datagram() -> skb_free_datagram()
```
Add sk->sk_receive_queue.lock to atalk_ioctl() to fix this issue.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Signed-off-by: Hyunwoo Kim <v4bel@theori.io>
Link: https://lore.kernel.org/r/20231213041056.GA519680@v4bel-B760M-AORUS-ELITE-AX
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:18 +01:00
Andrew Halaney
23ee06762c net: stmmac: Handle disabled MDIO busses from devicetree
[ Upstream commit e23c0d21ce9234fbc31ece35663ababbb83f9347 ]

Many hardware configurations have the MDIO bus disabled, and are instead
using some other MDIO bus to talk to the MAC's phy.

of_mdiobus_register() returns -ENODEV in this case. Let's handle it
gracefully instead of failing to probe the MAC.

Fixes: 47dd7a540b ("net: add support for STMicroelectronics Ethernet controllers.")
Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
Link: https://lore.kernel.org/r/20231212-b4-stmmac-handle-mdio-enodev-v2-1-600171acf79f@redhat.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:18 +01:00
Rasmus Villemoes
538b7b8f21 net: stmmac: use dev_err_probe() for reporting mdio bus registration failure
[ Upstream commit 839612d23ffd933174db911ce56dc3f3ca883ec5 ]

I have a board where these two lines are always printed during boot:

   imx-dwmac 30bf0000.ethernet: Cannot register the MDIO bus
   imx-dwmac 30bf0000.ethernet: stmmac_dvr_probe: MDIO bus (id: 1) registration failed

It's perfectly fine, and the device is successfully (and silently, as
far as the console goes) probed later.

Use dev_err_probe() instead, which will demote these messages to debug
level (thus removing the alarming messages from the console) when the
error is -EPROBE_DEFER, and also has the advantage of including the
error code if/when it happens to be something other than -EPROBE_DEFER.

While here, add the missing \n to one of the format strings.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Link: https://lore.kernel.org/r/20220602074840.1143360-1-linux@rasmusvillemoes.dk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: e23c0d21ce92 ("net: stmmac: Handle disabled MDIO busses from devicetree")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:17 +01:00
Nikolay Kuratov
067e6ec9f5 vsock/virtio: Fix unsigned integer wrap around in virtio_transport_has_space()
[ Upstream commit 60316d7f10b17a7ebb1ead0642fee8710e1560e0 ]

We need to do signed arithmetic if we expect condition
`if (bytes < 0)` to be possible

Found by Linux Verification Center (linuxtesting.org) with SVACE

Fixes: 06a8fc7836 ("VSOCK: Introduce virtio_vsock_common.ko")
Signed-off-by: Nikolay Kuratov <kniv@yandex-team.ru>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Link: https://lore.kernel.org/r/20231211162317.4116625-1-kniv@yandex-team.ru
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:17 +01:00
Yusong Gao
cc7cf0b2ee sign-file: Fix incorrect return values check
[ Upstream commit 829649443e78d85db0cff0c37cadb28fbb1a5f6f ]

There are some wrong return values check in sign-file when call OpenSSL
API. The ERR() check cond is wrong because of the program only check the
return value is < 0 which ignored the return val is 0. For example:
1. CMS_final() return 1 for success or 0 for failure.
2. i2d_CMS_bio_stream() returns 1 for success or 0 for failure.
3. i2d_TYPEbio() return 1 for success and 0 for failure.
4. BIO_free() return 1 for success and 0 for failure.

Link: https://www.openssl.org/docs/manmaster/man3/
Fixes: e5a2e3c847 ("scripts/sign-file.c: Add support for signing with a raw signature")
Signed-off-by: Yusong Gao <a869920004@gmail.com>
Reviewed-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/r/20231213024405.624692-1-a869920004@gmail.com/ # v5
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:17 +01:00
Dong Chenchen
510d45207a net: Remove acked SYN flag from packet in the transmit queue correctly
[ Upstream commit f99cd56230f56c8b6b33713c5be4da5d6766be1f ]

syzkaller report:

 kernel BUG at net/core/skbuff.c:3452!
 invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
 CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.7.0-rc4-00009-gbee0e7762ad2-dirty #135
 RIP: 0010:skb_copy_and_csum_bits (net/core/skbuff.c:3452)
 Call Trace:
 icmp_glue_bits (net/ipv4/icmp.c:357)
 __ip_append_data.isra.0 (net/ipv4/ip_output.c:1165)
 ip_append_data (net/ipv4/ip_output.c:1362 net/ipv4/ip_output.c:1341)
 icmp_push_reply (net/ipv4/icmp.c:370)
 __icmp_send (./include/net/route.h:252 net/ipv4/icmp.c:772)
 ip_fragment.constprop.0 (./include/linux/skbuff.h:1234 net/ipv4/ip_output.c:592 net/ipv4/ip_output.c:577)
 __ip_finish_output (net/ipv4/ip_output.c:311 net/ipv4/ip_output.c:295)
 ip_output (net/ipv4/ip_output.c:427)
 __ip_queue_xmit (net/ipv4/ip_output.c:535)
 __tcp_transmit_skb (net/ipv4/tcp_output.c:1462)
 __tcp_retransmit_skb (net/ipv4/tcp_output.c:3387)
 tcp_retransmit_skb (net/ipv4/tcp_output.c:3404)
 tcp_retransmit_timer (net/ipv4/tcp_timer.c:604)
 tcp_write_timer (./include/linux/spinlock.h:391 net/ipv4/tcp_timer.c:716)

The panic issue was trigered by tcp simultaneous initiation.
The initiation process is as follows:

      TCP A                                            TCP B

  1.  CLOSED                                           CLOSED

  2.  SYN-SENT     --> <SEQ=100><CTL=SYN>              ...

  3.  SYN-RECEIVED <-- <SEQ=300><CTL=SYN>              <-- SYN-SENT

  4.               ... <SEQ=100><CTL=SYN>              --> SYN-RECEIVED

  5.  SYN-RECEIVED --> <SEQ=100><ACK=301><CTL=SYN,ACK> ...

  // TCP B: not send challenge ack for ack limit or packet loss
  // TCP A: close
	tcp_close
	   tcp_send_fin
              if (!tskb && tcp_under_memory_pressure(sk))
                  tskb = skb_rb_last(&sk->tcp_rtx_queue); //pick SYN_ACK packet
           TCP_SKB_CB(tskb)->tcp_flags |= TCPHDR_FIN;  // set FIN flag

  6.  FIN_WAIT_1  --> <SEQ=100><ACK=301><END_SEQ=102><CTL=SYN,FIN,ACK> ...

  // TCP B: send challenge ack to SYN_FIN_ACK

  7.               ... <SEQ=301><ACK=101><CTL=ACK>   <-- SYN-RECEIVED //challenge ack

  // TCP A:  <SND.UNA=101>

  8.  FIN_WAIT_1 --> <SEQ=101><ACK=301><END_SEQ=102><CTL=SYN,FIN,ACK> ... // retransmit panic

	__tcp_retransmit_skb  //skb->len=0
	    tcp_trim_head
		len = tp->snd_una - TCP_SKB_CB(skb)->seq // len=101-100
		    __pskb_trim_head
			skb->data_len -= len // skb->len=-1, wrap around
	    ... ...
	    ip_fragment
		icmp_glue_bits //BUG_ON

If we use tcp_trim_head() to remove acked SYN from packet that contains data
or other flags, skb->len will be incorrectly decremented. We can remove SYN
flag that has been acked from rtx_queue earlier than tcp_trim_head(), which
can fix the problem mentioned above.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Co-developed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Dong Chenchen <dongchenchen2@huawei.com>
Link: https://lore.kernel.org/r/20231210020200.1539875-1-dongchenchen2@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:16 +01:00
Dinghao Liu
5d9d500a28 qed: Fix a potential use-after-free in qed_cxt_tables_alloc
[ Upstream commit b65d52ac9c085c0c52dee012a210d4e2f352611b ]

qed_ilt_shadow_alloc() will call qed_ilt_shadow_free() to
free p_hwfn->p_cxt_mngr->ilt_shadow on error. However,
qed_cxt_tables_alloc() accesses the freed pointer on failure
of qed_ilt_shadow_alloc() through calling qed_cxt_mngr_free(),
which may lead to use-after-free. Fix this issue by setting
p_mngr->ilt_shadow to NULL in qed_ilt_shadow_free().

Fixes: fe56b9e6a8 ("qed: Add module with basic common support")
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Link: https://lore.kernel.org/r/20231210045255.21383-1-dinghao.liu@zju.edu.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:16 +01:00
Hyunwoo Kim
3df812627e net/rose: Fix Use-After-Free in rose_ioctl
[ Upstream commit 810c38a369a0a0ce625b5c12169abce1dd9ccd53 ]

Because rose_ioctl() accesses sk->sk_receive_queue
without holding a sk->sk_receive_queue.lock, it can
cause a race with rose_accept().
A use-after-free for skb occurs with the following flow.
```
rose_ioctl() -> skb_peek()
rose_accept() -> skb_dequeue() -> kfree_skb()
```
Add sk->sk_receive_queue.lock to rose_ioctl() to fix this issue.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Signed-off-by: Hyunwoo Kim <v4bel@theori.io>
Link: https://lore.kernel.org/r/20231209100538.GA407321@v4bel-B760M-AORUS-ELITE-AX
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:16 +01:00
Hyunwoo Kim
b099c28847 atm: Fix Use-After-Free in do_vcc_ioctl
[ Upstream commit 24e90b9e34f9e039f56b5f25f6e6eb92cdd8f4b3 ]

Because do_vcc_ioctl() accesses sk->sk_receive_queue
without holding a sk->sk_receive_queue.lock, it can
cause a race with vcc_recvmsg().
A use-after-free for skb occurs with the following flow.
```
do_vcc_ioctl() -> skb_peek()
vcc_recvmsg() -> skb_recv_datagram() -> skb_free_datagram()
```
Add sk->sk_receive_queue.lock to do_vcc_ioctl() to fix this issue.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Signed-off-by: Hyunwoo Kim <v4bel@theori.io>
Link: https://lore.kernel.org/r/20231209094210.GA403126@v4bel-B760M-AORUS-ELITE-AX
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:15 +01:00
Chengfeng Ye
e3430b870e atm: solos-pci: Fix potential deadlock on &tx_queue_lock
[ Upstream commit 15319a4e8ee4b098118591c6ccbd17237f841613 ]

As &card->tx_queue_lock is acquired under softirq context along the
following call chain from solos_bh(), other acquisition of the same
lock inside process context should disable at least bh to avoid double
lock.

<deadlock #2>
pclose()
--> spin_lock(&card->tx_queue_lock)
<interrupt>
   --> solos_bh()
   --> fpga_tx()
   --> spin_lock(&card->tx_queue_lock)

This flaw was found by an experimental static analysis tool I am
developing for irq-related deadlock.

To prevent the potential deadlock, the patch uses spin_lock_bh()
on &card->tx_queue_lock under process context code consistently to
prevent the possible deadlock scenario.

Fixes: 213e85d389 ("solos-pci: clean up pclose() function")
Signed-off-by: Chengfeng Ye <dg573847474@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:15 +01:00
Chengfeng Ye
8cff60fb73 atm: solos-pci: Fix potential deadlock on &cli_queue_lock
[ Upstream commit d5dba32b8f6cb39be708b726044ba30dbc088b30 ]

As &card->cli_queue_lock is acquired under softirq context along the
following call chain from solos_bh(), other acquisition of the same
lock inside process context should disable at least bh to avoid double
lock.

<deadlock #1>
console_show()
--> spin_lock(&card->cli_queue_lock)
<interrupt>
   --> solos_bh()
   --> spin_lock(&card->cli_queue_lock)

This flaw was found by an experimental static analysis tool I am
developing for irq-related deadlock.

To prevent the potential deadlock, the patch uses spin_lock_bh()
on the card->cli_queue_lock under process context code consistently
to prevent the possible deadlock scenario.

Fixes: 9c54004ea7 ("atm: Driver for Solos PCI ADSL2+ card.")
Signed-off-by: Chengfeng Ye <dg573847474@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:15 +01:00
Stefan Wahren
fcf17666ef qca_spi: Fix reset behavior
[ Upstream commit 1057812d146dd658c9a9a96d869c2551150207b5 ]

In case of a reset triggered by the QCA7000 itself, the behavior of the
qca_spi driver was not quite correct:
- in case of a pending RX frame decoding the drop counter must be
  incremented and decoding state machine reseted
- also the reset counter must always be incremented regardless of sync
  state

Fixes: 291ab06ecf ("net: qualcomm: new Ethernet over SPI driver for QCA7000")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Link: https://lore.kernel.org/r/20231206141222.52029-4-wahrenst@gmx.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:14 +01:00
Stefan Wahren
51ad9c19bb qca_debug: Fix ethtool -G iface tx behavior
[ Upstream commit 96a7e861d9e04d07febd3011c30cd84cd141d81f ]

After calling ethtool -g it was not possible to adjust the TX ring
size again:

  # ethtool -g eth1
  Ring parameters for eth1:
  Pre-set maximums:
  RX:		4
  RX Mini:	n/a
  RX Jumbo:	n/a
  TX:		10
  Current hardware settings:
  RX:		4
  RX Mini:	n/a
  RX Jumbo:	n/a
  TX:		10
  # ethtool -G eth1 tx 8
  netlink error: Invalid argument

The reason for this is that the readonly setting rx_pending get
initialized and after that the range check in qcaspi_set_ringparam()
fails regardless of the provided parameter. So fix this by accepting
the exposed RX defaults. Instead of adding another magic number
better use a new define here.

Fixes: 291ab06ecf ("net: qualcomm: new Ethernet over SPI driver for QCA7000")
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Link: https://lore.kernel.org/r/20231206141222.52029-3-wahrenst@gmx.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:14 +01:00
Stefan Wahren
b7f5868664 qca_debug: Prevent crash on TX ring changes
[ Upstream commit f4e6064c97c050bd9904925ff7d53d0c9954fc7b ]

The qca_spi driver stop and restart the SPI kernel thread
(via ndo_stop & ndo_open) in case of TX ring changes. This is
a big issue because it allows userspace to prevent restart of
the SPI kernel thread (via signals). A subsequent change of
TX ring wrongly assume a valid spi_thread pointer which result
in a crash.

So prevent this by stopping the network traffic handling and
temporary park the SPI thread.

Fixes: 291ab06ecf ("net: qualcomm: new Ethernet over SPI driver for QCA7000")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Link: https://lore.kernel.org/r/20231206141222.52029-2-wahrenst@gmx.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:14 +01:00
Maciej Żenczykowski
9354e0acdb net: ipv6: support reporting otherwise unknown prefix flags in RTM_NEWPREFIX
[ Upstream commit bd4a816752bab609dd6d65ae021387beb9e2ddbd ]

Lorenzo points out that we effectively clear all unknown
flags from PIO when copying them to userspace in the netlink
RTM_NEWPREFIX notification.

We could fix this one at a time as new flags are defined,
or in one fell swoop - I choose the latter.

We could either define 6 new reserved flags (reserved1..6) and handle
them individually (and rename them as new flags are defined), or we
could simply copy the entire unmodified byte over - I choose the latter.

This unfortunately requires some anonymous union/struct magic,
so we add a static assert on the struct size for a little extra safety.

Cc: David Ahern <dsahern@kernel.org>
Cc: Lorenzo Colitti <lorenzo@google.com>
Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:13 +01:00
David Howells
053220aaed afs: Fix refcount underflow from error handling race
[ Upstream commit 52bf9f6c09fca8c74388cd41cc24e5d1bff812a9 ]

If an AFS cell that has an unreachable (eg. ENETUNREACH) server listed (VL
server or fileserver), an asynchronous probe to one of its addresses may
fail immediately because sendmsg() returns an error.  When this happens, a
refcount underflow can happen if certain events hit a very small window.

The way this occurs is:

 (1) There are two levels of "call" object, the afs_call and the
     rxrpc_call.  Each of them can be transitioned to a "completed" state
     in the event of success or failure.

 (2) Asynchronous afs_calls are self-referential whilst they are active to
     prevent them from evaporating when they're not being processed.  This
     reference is disposed of when the afs_call is completed.

     Note that an afs_call may only be completed once; once completed
     completing it again will do nothing.

 (3) When a call transmission is made, the app-side rxrpc code queues a Tx
     buffer for the rxrpc I/O thread to transmit.  The I/O thread invokes
     sendmsg() to transmit it - and in the case of failure, it transitions
     the rxrpc_call to the completed state.

 (4) When an rxrpc_call is completed, the app layer is notified.  In this
     case, the app is kafs and it schedules a work item to process events
     pertaining to an afs_call.

 (5) When the afs_call event processor is run, it goes down through the
     RPC-specific handler to afs_extract_data() to retrieve data from rxrpc
     - and, in this case, it picks up the error from the rxrpc_call and
     returns it.

     The error is then propagated to the afs_call and that is completed
     too.  At this point the self-reference is released.

 (6) If the rxrpc I/O thread manages to complete the rxrpc_call within the
     window between rxrpc_send_data() queuing the request packet and
     checking for call completion on the way out, then
     rxrpc_kernel_send_data() will return the error from sendmsg() to the
     app.

 (7) Then afs_make_call() will see an error and will jump to the error
     handling path which will attempt to clean up the afs_call.

 (8) The problem comes when the error handling path in afs_make_call()
     tries to unconditionally drop an async afs_call's self-reference.
     This self-reference, however, may already have been dropped by
     afs_extract_data() completing the afs_call

 (9) The refcount underflows when we return to afs_do_probe_vlserver() and
     that tries to drop its reference on the afs_call.

Fix this by making afs_make_call() attempt to complete the afs_call rather
than unconditionally putting it.  That way, if afs_extract_data() manages
to complete the call first, afs_make_call() won't do anything.

The bug can be forced by making do_udp_sendmsg() return -ENETUNREACH and
sticking an msleep() in rxrpc_send_data() after the 'success:' label to
widen the race window.

The error message looks something like:

    refcount_t: underflow; use-after-free.
    WARNING: CPU: 3 PID: 720 at lib/refcount.c:28 refcount_warn_saturate+0xba/0x110
    ...
    RIP: 0010:refcount_warn_saturate+0xba/0x110
    ...
    afs_put_call+0x1dc/0x1f0 [kafs]
    afs_fs_get_capabilities+0x8b/0xe0 [kafs]
    afs_fs_probe_fileserver+0x188/0x1e0 [kafs]
    afs_lookup_server+0x3bf/0x3f0 [kafs]
    afs_alloc_server_list+0x130/0x2e0 [kafs]
    afs_create_volume+0x162/0x400 [kafs]
    afs_get_tree+0x266/0x410 [kafs]
    vfs_get_tree+0x25/0xc0
    fc_mount+0xe/0x40
    afs_d_automount+0x1b3/0x390 [kafs]
    __traverse_mounts+0x8f/0x210
    step_into+0x340/0x760
    path_openat+0x13a/0x1260
    do_filp_open+0xaf/0x160
    do_sys_openat2+0xaf/0x170

or something like:

    refcount_t: underflow; use-after-free.
    ...
    RIP: 0010:refcount_warn_saturate+0x99/0xda
    ...
    afs_put_call+0x4a/0x175
    afs_send_vl_probes+0x108/0x172
    afs_select_vlserver+0xd6/0x311
    afs_do_cell_detect_alias+0x5e/0x1e9
    afs_cell_detect_alias+0x44/0x92
    afs_validate_fc+0x9d/0x134
    afs_get_tree+0x20/0x2e6
    vfs_get_tree+0x1d/0xc9
    fc_mount+0xe/0x33
    afs_d_automount+0x48/0x9d
    __traverse_mounts+0xe0/0x166
    step_into+0x140/0x274
    open_last_lookups+0x1c1/0x1df
    path_openat+0x138/0x1c3
    do_filp_open+0x55/0xb4
    do_sys_openat2+0x6c/0xb6

Fixes: 34fa47612b ("afs: Fix race in async call refcounting")
Reported-by: Bill MacAllister <bill@ca-zephyr.org>
Closes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1052304
Suggested-by: Jeffrey E Altman <jaltman@auristor.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Jeffrey Altman <jaltman@auristor.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Link: https://lore.kernel.org/r/2633992.1702073229@warthog.procyon.org.uk/ # v1
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-20 15:41:13 +01:00