919130 Commits

Author SHA1 Message Date
Divisha Bisht
f0e3f64088 msm-5.4.c3: qseecom: Fix possible race condition
Fix possible race condition in data->type value in case of multithreaded
listener or app IOCTLs.

For example, below could cause inconsistent data->type value while
racing belows IOCTLs

Thread1 with QSEECOM_IOCTL_REGISTER_LISTENER_REQ
Thread2 with QSEECOM_IOCTL_UNREGISTER_LISTENER_REQ.

Change-Id: I436b63c044a66c324d94db27566a7be70981bd6b
Signed-off-by: Divisha Bisht <quic_divibish@quicinc.com>
2024-08-29 22:14:16 -07:00
Rajashekar kuruva
54d3e3ca11 USB: storage: Replace the sprintf with scnprintf
'sprintf' has been deprecated, hence replace it with
a safer function scnprintf.

Change-Id: I9bc8e3dfd2032a0447f38fc98a3ad31d9d609cab
Signed-off-by: Rajashekar kuruva <quic_kuruva@quicinc.com>
Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
2024-08-29 21:16:16 -07:00
QCTECMDR Service
83ba639ff8 Merge "adsprpc: Handle UAF scenario in put_args" 2024-08-29 17:29:58 -07:00
Santosh Sakore
c6e7698c0c adsprpc: Handle UAF scenario in put_args
Currently, the DSP updates header buffers with unused DMA handle fds.
In the put_args section, if any DMA handle FDs are present in the
header buffer, the corresponding map is freed. However, since the
header buffer is exposed to users in unsigned PD, users can update
invalid FDs. If this invalid FD matches with any FD that is already
in use, it could lead to a use-after-free (UAF) vulnerability.
As a solution,add DMA handle references for DMA FDs, and the map for
the FD will be freed only when a reference is found.

Acked-by: Om Deore <quic_odeore@quicinc.com>
Change-Id: I19ae21230bf11fe89858b10c9069a5daccabc392
Signed-off-by: Santosh Sakore <quic_ssakore@quicinc.com>
2024-08-29 09:15:22 -07:00
QCTECMDR Service
177e8e0fad Merge "msm: adsprpc: Avoid taking reference for group_info" 2024-08-29 07:38:37 -07:00
ANANDU KRISHNAN E
de9f4fe6f8 msm: adsprpc: Avoid taking reference for group_info
Currently, the get_current_groups API accesses group info, which
increases the usage refcount. If the IOCTL using the
get_current_groups API is called many times, the usage counter
overflows. To avoid this, access group info without taking a
reference. A reference is not required as group info is not
released during the IOCTL call.

Change-Id: Ib4de80cac8b36f73d8f5c6dd9824722153189285
Signed-off-by: ANANDU KRISHNAN E <quic_anane@quicinc.com>
2024-08-29 02:16:09 -07:00
Prashanth K
63a32bf361 usb: gadget: f_gsi: bail out if opts is null
Currently, functions gsi_inst_clean & gsi_free_inst utilises
gsi_opts without any check, however there is a possibility
that the opts structure could become NULL. In such case, due
to lack of if checks can result in NULL pointer dereference.

Change-Id: I548690e2eee377b5292f258972ae7e38417f3085
Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
2024-08-28 22:14:17 -07:00
Greg Kroah-Hartman
df80fcf8cd Merge tag 'android11-5.4.281_r00' into android11-5.4
This catches the android11-5.4 branch up to the 5.4.281 LTS release.
Included in here are the following commits:

* a0347a4c8d Revert "net: mac802154: Fix racy device stats updates by DEV_STATS_INC() and DEV_STATS_ADD()"
*   c043beb2bd Merge 5.4.281 into android11-5.4-lts
|\
| * 84d75fd864 Linux 5.4.281
| * 8be915fc5f tap: add missing verification for short frame
| * 32b0aaba5d tun: add missing verification for short frame
| * 4c43ad4ab4 filelock: Fix fcntl/close race recovery compat path
| * d2c0c43dc4 ALSA: hda/realtek: Enable headset mic on Positivo SU C1400
| * fc16776a82 jfs: don't walk off the end of ealist
| * 564d23cc5b ocfs2: add bounds checking to ocfs2_check_dir_entry()
| * 59801e88c9 net: relax socket state check at accept time.
| * 3dd9734878 drm/amdgpu: Fix signedness bug in sdma_v4_0_process_trap_irq()
| * cfcdc6f6b2 ACPI: processor_idle: Fix invalid comparison with insertion sort for latency
| * 281e90e346 ARM: 9324/1: fix get_user() broken with veneer
| * c733e24a61 hfsplus: fix uninit-value in copy_name
| * 1d405de980 selftests/vDSO: fix clang build errors and warnings
| * 5a2e4cca14 spi: imx: Don't expect DMA for i.MX{25,35,50,51,53} cspi devices
| * 18ea1e471e fs: better handle deep ancestor chains in is_subdir()
| * 9cfc84b1d4 Bluetooth: hci_core: cancel all works upon hci_unregister_dev()
| * adc305fd60 scsi: libsas: Fix exp-attached device scan after probe failure scanned in again after probe failed
| * 8836e1bf58 powerpc/eeh: avoid possible crash when edev->pdev changes
| * a7b952941c powerpc/pseries: Whitelist dtl slub object for copying to userspace
| * e011febff8 net: mac802154: Fix racy device stats updates by DEV_STATS_INC() and DEV_STATS_ADD()
| * c48d9c1e38 net: usb: qmi_wwan: add Telit FN912 compositions
| * 58f03c322b ALSA: dmaengine_pcm: terminate dmaengine before synchronize
| * 455a6653d8 s390/sclp: Fix sclp_init() cleanup on failure
| * 15f5c60fe3 can: kvaser_usb: fix return value for hif_usb_send_regout
| * 45a6b888bc ASoC: ti: omap-hdmi: Fix too long driver name
| * 56c1ce1fa8 ASoC: ti: davinci-mcasp: Set min period size using FIFO config
| * 4b7c9f6501 bytcr_rt5640 : inverse jack detect for Archos 101 cesium
| * 2842f49427 Input: elantech - fix touchpad state on resume for Lenovo N24
| * 409299623a mips: fix compat_sys_lseek syscall
| * 922371a064 ALSA: hda/realtek: Add more codec ID to no shutup pins list
| * be847bb20c KVM: PPC: Book3S HV: Prevent UAF in kvm_spapr_tce_attach_iommu_group()
| * de5fcf757e wifi: cfg80211: wext: add extra SIOCSIWSCAN data check
| * 0feb07d339 mei: demote client disconnect warning on suspend to debug
| * 9f631c8ed0 fs/file: fix the check in find_next_fd()
| * 59fc8ffb54 kconfig: remove wrong expr_trans_bool()
| * a236ded9a3 kconfig: gconf: give a proper initial state to the Save button
| * 9610337109 ila: block BH in ila_output()
| * 47ad139d07 Input: silead - Always support 10 fingers
| * d46afb7c54 wifi: mac80211: fix UBSAN noise in ieee80211_prep_hw_scan()
| * e4bc8d4e49 wifi: mac80211: mesh: init nonpeer_pm to active by default in mesh sdata
| * 275590f2e9 ACPI: EC: Avoid returning AE_OK on errors in address space handler
| * 838d9c0f6b ACPI: EC: Abort address space access upon error
| * 49fba721ae scsi: qedf: Set qed_slowpath_params to zero before use
| * dc2ce1dfce filelock: Remove locks reliably when fcntl/close race is detected
| * 69df3bdb27 gcc-plugins: Rename last_stmt() for GCC 14+
* | b61187c891 ANDROID: GKI: refresh ABI to include kimage_vaddr
* | b2e024e390 Merge branch 'android11-5.4' into branch 'android11-5.4-lts'
* | 33437b2981 ANDROID: preserve CRC for struct tcp_sock
* | f90cc3d8c1 Merge 5.4.280 into android11-5.4-lts
|\|
| * 88d2aa8774 Linux 5.4.280
| * 392b4f1149 i2c: rcar: bring hardware to known state when probing
| * 24c1c8566a nilfs2: fix kernel bug on rename operation of broken directory
| * d2346fca5b tcp: avoid too many retransmit packets
| * 2ff6dd600c tcp: use signed arithmetic in tcp_rtx_probe0_timed_out()
| * 8cc1b4d81a net: tcp: fix unexcepted socket die when snd_wnd is 0
| * 39dc2b8d55 tcp: refactor tcp_retransmit_timer()
| * 7d61d1da2e SUNRPC: Fix RPC client cleaned up the freed pipefs dentries
| * 63e5d035e3 libceph: fix race between delayed_work() and ceph_monc_stop()
| * 2b59187cf0 ALSA: hda/realtek: Limit mic boost on VAIO PRO PX
| * 427524ff30 nvmem: meson-efuse: Fix return value of nvmem callbacks
| * db18df897d hpet: Support 32-bit userspace
| * 60abea505b USB: core: Fix duplicate endpoint bug by clearing reserved bits in the descriptor
| * c95fbdde87 usb: gadget: configfs: Prevent OOB read/write in usb_string_copy()
| * 4fdf8c1442 USB: Add USB_QUIRK_NO_SET_INTF quirk for START BP-850k
| * 421fcde004 USB: serial: option: add Rolling RW350-GL variants
| * c16c577cc6 USB: serial: option: add Netprisma LCUK54 series modules
| * 97fc18b2af USB: serial: option: add support for Foxconn T99W651
| * a647d795ef USB: serial: option: add Fibocom FM350-GL
| * 6877a78894 USB: serial: option: add Telit FN912 rmnet compositions
| * 895b666846 USB: serial: option: add Telit generic core-dump composition
| * b7ea5bea1e octeontx2-af: fix detection of IP layer
| * 833a64978a ARM: davinci: Convert comma to semicolon
| * 834681e42a s390: Mark psw in __load_psw_mask() as __unitialized
| * 7a67c4e476 udp: Set SOCK_RCU_FREE earlier in udp_lib_get_port().
| * 6e8f1c2117 ppp: reject claimed-as-LCP but actually malformed packets
| * 907443174e net: ethernet: lantiq_etop: fix double free in detach
| * b1f3921335 net: lantiq_etop: add blank line after declaration
| * 73c2119833 octeontx2-af: Fix incorrect value output on error path in rvu_check_rsrc_availability()
| * 47d4a1f8fc tcp: fix incorrect undo caused by DSACK of TLP retransmit
| * fe7a7b8942 tcp: add TCP_INFO status for failed client TFO
| * ec48e8e343 vfs: don't mod negative dentry count when on shrinker list
| * c0d80ea39a fs/dcache: Re-use value stored to dentry->d_flags instead of re-reading
| * 1cbbb3d947 filelock: fix potential use-after-free in posix_lock_inode
| * 4380b1af28 nilfs2: fix incorrect inode allocation from reserved inodes
| * 262f126ebb nvme-multipath: find NUMA path only for online numa-node
| * 88f5c27988 ALSA: hda/realtek: Enable headset mic of JP-IK LEAP W502 with ALC897
| * effe0500af i2c: pnx: Fix potential deadlock warning from del_timer_sync() call in isr
| * 40945660b4 media: dw2102: fix a potential buffer overflow
| * cbe5308702 bnx2x: Fix multiple UBSAN array-index-out-of-bounds
| * 917c0e2f15 drm/amdgpu/atomfirmware: silence UBSAN warning
| * e36364f5f3 drm/nouveau: fix null pointer dereference in nouveau_connector_get_modes
| * 23a28f5f3f Revert "mm/writeback: fix possible divide-by-zero in wb_dirty_limits(), again"
| * 7cfcb65054 fsnotify: Do not generate events for O_PATH file descriptors
| * 6ac691872e can: kvaser_usb: Explicitly initialize family in leafimx driver_info struct
| * 25ab2411cb mm: optimize the redundant loop of mm_update_owner_next()
| * 07c176e7ac nilfs2: add missing check for inode numbers on directory entries
| * 08cab183a6 nilfs2: fix inode number range checks
| * 0184bf0a34 inet_diag: Initialize pad field in struct inet_diag_req_v2
| * 5b627a4082 selftests: make order checking verbose in msg_zerocopy selftest
| * 0d1ad62524 selftests: fix OOM in msg_zerocopy selftest
| * 6b21346b39 bonding: Fix out-of-bounds read in bond_option_arp_ip_targets_set()
| * de046fe83c wifi: wilc1000: fix ies_len type in connect path
| * 2a2e79dbe2 tcp_metrics: validate source addr length
| * d8aef6be52 UPSTREAM: tcp: fix DSACK undo in fast recovery to call tcp_try_to_open()
| * 5d17bcc30d net: tcp better handling of reordering then loss cases
| * ddb97a331d tcp: add ece_ack flag to reno sack functions
| * fe36035207 tcp: tcp_mark_head_lost is only valid for sack-tcp
| * b5eb9176eb s390/pkey: Wipe sensitive data on failure
| * 0b3246052e jffs2: Fix potential illegal address access in jffs2_free_inode
| * bf3336ff11 powerpc/xmon: Check cpu id in commands "c#", "dp#" and "dx#"
| * 556edaa27c orangefs: fix out-of-bounds fsid access
| * 048703bb5c powerpc/64: Set _IO_BASE to POISON_POINTER_DELTA not 0 for CONFIG_PCI=n
| * aa5653209c i2c: i801: Annotate apanel_addr as __ro_after_init
| * 5c72587d02 media: dvb-frontends: tda10048: Fix integer overflow
| * e65ebfaabb media: s2255: Use refcount_t instead of atomic_t for num_channels
| * d84e51c272 media: dvb-frontends: tda18271c2dd: Remove casting during div
| * 3bf8d70e14 net: dsa: mv88e6xxx: Correct check for empty list
| * 13528e1d8f Input: ff-core - prefer struct_size over open coded arithmetic
| * 69fa4c636e firmware: dmi: Stop decoding on broken entry
| * a69aac931f sctp: prefer struct_size over open coded arithmetic
| * e3a23c3aa1 media: dw2102: Don't translate i2c read into write
| * eacca028a6 drm/amd/display: Skip finding free audio for unknown engine_id
| * 0046d87ed6 drm/amdgpu: Initialize timestamp for some legacy SOCs
| * 4f314aadee scsi: qedf: Make qedf_execute_tmf() non-preemptible
| * b491370241 IB/core: Implement a limit on UMAD receive List
| * f273ea5eb8 media: dvb-usb: dib0700_devices: Add missing release_firmware()
| * 4777123f8b media: dvb: as102-fe: Fix as10x_register_addr packing
| * 0d60c43df5 drm/lima: fix shared irq handling on driver remove
| * 34b0536965 Compiler Attributes: Add __uninitialized macro
* | a54d566214 Merge 5.4.279 into android11-5.4-lts
|/
* 5096731948 Linux 5.4.279
* 73f0f07b59 arm64: dts: rockchip: Add sound-dai-cells for RK3368
* 8023cf6edd ARM: dts: rockchip: rk3066a: add #sound-dai-cells to hdmi node
* d529193eae tcp: Fix data races around icsk->icsk_af_ops.
* f194e63054 ipv6: Fix data races around sk->sk_prot.
* 18560b76c7 ipv6: annotate some data-races around sk->sk_prot
* 6a91d8eb5a nfs: Leave pages in the pagecache if readpage failed
* d59bb70350 pwm: stm32: Refuse too small period requests
* 82982175be mtd: spinand: macronix: Add support for serial NAND flash
* f531d4bc6c ftruncate: pass a signed offset
* 56f1c7e290 ata: libata-core: Fix double free on error
* fb59ed1a15 batman-adv: Don't accept TT entries for out-of-spec VIDs
* 1c9f2e6015 drm/nouveau/dispnv04: fix null pointer dereference in nv17_tv_get_hd_modes
* dbd75f3225 drm/nouveau/dispnv04: fix null pointer dereference in nv17_tv_get_ld_modes
* c176f429f1 hexagon: fix fadvise64_64 calling conventions
* 672d065b23 csky, hexagon: fix broken sys_sync_file_range
* ed581989d7 net: can: j1939: enhanced error handling for tightly received RTS messages in xtp_rx_rts_session_new
* b00d49003b net: can: j1939: recover socket queue on CAN bus error during BAM transmission
* 5e4ed38eb1 net: can: j1939: Initialize unused data in j1939_send_one()
* 9e0e2aa362 tty: mcf: MCF54418 has 10 UARTS
* 23926d316d usb: atm: cxacru: fix endpoint checking in cxacru_bind()
* adf6ff216a usb: musb: da8xx: fix a resource leak in probe()
* be9ab6bc9b usb: gadget: printer: SS+ support
* cbefac615f net: usb: ax88179_178a: improve link status logs
* 00dd15aa87 iio: chemical: bme680: Fix sensor data read operation
* b0af334616 iio: chemical: bme680: Fix overflows in compensate() functions
* 0e3d3ca499 iio: chemical: bme680: Fix calibration data variable
* e2d03080ed iio: chemical: bme680: Fix pressure value output
* 9423fc2d02 iio: adc: ad7266: Fix variable checking bug
* 605466fcf4 mmc: sdhci: Do not lock spinlock around mmc_gpio_get_ro()
* d9e8b0f56b mmc: sdhci: Do not invert write-protect twice
* f24f76f59f mmc: sdhci-pci: Convert PCIBIOS_* return codes to errnos
* 27c3be8409 x86: stop playing stack games in profile_pc()
* cd75721984 gpio: davinci: Validate the obtained number of IRQs
* 5b289f24bb nvme: fixup comment for nvme RDMA Provider Type
* 49c0f6f119 soc: ti: wkup_m3_ipc: Send NULL dummy message instead of pointer message
* dc307b9eb6 media: dvbdev: Initialize sbuf
* 79d9a000f0 ALSA: emux: improve patch ioctl data validation
* b2262b3be2 net/dpaa2: Avoid explicit cpumask var allocation on stack
* 842afb47d8 net/iucv: Avoid explicit cpumask var allocation on stack
* 143ec47f4f mtd: partitions: redboot: Added conversion of operands to a larger type
* 98686ec182 drm/panel: ilitek-ili9881c: Fix warning with GPIO controllers that sleep
* 23752737c6 netfilter: nf_tables: fully validate NFT_DATA_VALUE on store to data registers
* 7122df1a13 parisc: use correct compat recv/recvfrom syscalls
* be8ee8032f sparc: fix old compat_sys_select()
* cb9285617e net: phy: micrel: add Microchip KSZ 9477 to the device table
* 3f5e8191a1 net: phy: mchp: Add support for LAN8814 QUAD PHY
* d5b0053b93 net: dsa: microchip: fix initial port flush problem
* 8896e18b7c ASoC: fsl-asoc-card: set priv->pdev before using it
* 7d589b7d23 netfilter: nf_tables: validate family when identifying table via handle
* 1c44f7759a drm/amdgpu: fix UBSAN warning in kv_dpm.c
* df9409bb0e pinctrl: rockchip: fix pinmux reset in rockchip_pmx_set
* 18acf67d3c pinctrl: rockchip: fix pinmux bits for RK3328 GPIO3-B pins
* 95848c3596 pinctrl: rockchip: fix pinmux bits for RK3328 GPIO2-B pins
* 420ce12619 pinctrl: fix deadlock in create_pinctrl() when handling -EPROBE_DEFER
* 6290b2cc56 iio: dac: ad5592r: fix temperature channel scaling value
* c1cd6d0591 iio: dac: ad5592r: un-indent code-block for scale read
* 3bd4e475ce iio: dac: ad5592r-base: Replace indio_dev->mlock with own device lock
* 3f0e0be5f8 x86/amd_nb: Check for invalid SMN reads
* 91870a211a PCI: Add PCI_ERROR_RESPONSE and related definitions
* 5bbf6ad532 perf/core: Fix missing wakeup when waiting for context reference
* c1fedc15e6 kheaders: explicitly define file modes for archived headers
* beace929a2 Revert "kheaders: substituting --sort in archive creation"
* 7abb6dcf4d tracing: Add MODULE_DESCRIPTION() to preemptirq_delay_test
* 2a200310e3 arm64: dts: qcom: qcs404: fix bluetooth device address
* f22e9e675e ARM: dts: samsung: smdk4412: fix keypad no-autorepeat
* c4ece19fe5 ARM: dts: samsung: exynos4412-origen: fix keypad no-autorepeat
* 3642af0a2c ARM: dts: samsung: smdkv310: fix keypad no-autorepeat
* 6e55cf4943 i2c: ocores: set IACK bit after core is enabled
* 89059eddac gcov: add support for GCC 14
* a8c6df9fe5 drm/radeon: fix UBSAN warning in kv_dpm.c
* ae465109d8 ACPICA: Revert "ACPICA: avoid Info: mapping multiple BARs. Your kernel is fine."
* 7c3d43723a dmaengine: ioatdma: Fix missing kmem_cache_destroy()
* 70a527b606 regulator: core: Fix modpost error "regulator_get_regmap" undefined
* 6fd8e8e7b0 net: usb: rtl8150 fix unintiatilzed variables in rtl8150_get_link_ksettings
* 3799d02ae4 netfilter: ipset: Fix suspicious rcu_dereference_protected()
* 5b7d611fb8 virtio_net: checksum offloading handling fix
* 0d8a2d287c net/sched: act_api: fix possible infinite loop in tcf_idr_check_alloc()
* 6b02df925e net/sched: act_api: rely on rcu in tcf_idr_check_alloc
* 3a6cd326ea netns: Make get_net_ns() handle zero refcount net
* caf0bec84c xfrm6: check ip6_dst_idev() return value in xfrm6_get_saddr()
* d66fc48261 ipv6: prevent possible NULL dereference in rt6_probe()
* 3200ffeec4 ipv6: prevent possible NULL deref in fib6_nh_init()
* e07a9c2a85 netrom: Fix a memory leak in nr_heartbeat_expiry()
* 11b09f4015 cipso: fix total option length computation
* 10afe5f7d3 mips: bmips: BCM6358: make sure CBR is correctly set
* 31a77b23ae MIPS: Routerboard 532: Fix vendor retry check code
* 64845ac648 MIPS: Octeon: Add PCIe link status check
* 993401b52f PCI/PM: Avoid D3cold for HP Pavilion 17 PC/1972 PCIe Ports
* 060868e6ab udf: udftime: prevent overflow in udf_disk_stamp_to_time()
* dff3b01e91 usb: misc: uss720: check for incompatible versions of the Belkin F5U002
* be601edecf powerpc/io: Avoid clang null pointer arithmetic warnings
* 19c166ee42 powerpc/pseries: Enforce hcall result buffer validity and size
* 6eaaa1e440 Bluetooth: ath3k: Fix multiple issues reported by checkpatch.pl
* 21c963de2e scsi: qedi: Fix crash while reading debugfs attribute
* 594e47957f drop_monitor: replace spin_lock by raw_spin_lock
* 154e3f862b batman-adv: bypass empty buckets in batadv_purge_orig_ref()
* 1d01d0f498 selftests/bpf: Prevent client connect before server bind in test_tc_tunnel.sh
* 075fc5d20c rcutorture: Fix rcu_torture_one_read() pipe_count overflow comment
* f51f449e7d i2c: at91: Fix the functionality flags of the slave-only interface
* 51fe16c058 usb-storage: alauda: Check whether the media is initialized
* 74cd0a4218 greybus: Fix use-after-free bug in gb_interface_release due to race condition.
* cf39c4f77a netfilter: nftables: exthdr: fix 4-byte stack OOB write
* 6302bdfeb4 hugetlb_encode.h: fix undefined behaviour (34 << 26)
* b3f5d4e767 hv_utils: drain the timesync packets on onchannelcallback
* fd093ae0d3 tick/nohz_full: Don't abuse smp_call_function_single() in tick_setup_device()
* a75b8f493d nilfs2: fix potential kernel bug due to lack of writeback flag waiting
* 59f9bea4ef intel_th: pci: Add Lunar Lake support
* b51a4d3310 intel_th: pci: Add Meteor Lake-S support
* 41982a9191 intel_th: pci: Add Sapphire Rapids SOC support
* 3e9c81086e intel_th: pci: Add Granite Rapids SOC support
* 0deb268526 intel_th: pci: Add Granite Rapids support
* 4d35028fb0 dmaengine: axi-dmac: fix possible race in remove()
* 5edb09d66c PCI: rockchip-ep: Remove wrong mask on subsys_vendor_id
* e8e2db1ada ocfs2: fix races between hole punching and AIO+DIO
* 292665c1e7 ocfs2: use coarse time for new created files
* 803d5a33d5 fs/proc: fix softlockup in __read_vmcore
* 681967c4ff vmci: prevent speculation leaks by sanitizing event in event_deliver()
* 4c2df1874b tracing/selftests: Fix kprobe event name test for .isra. functions
* e23f2eaf51 drm/exynos: hdmi: report safe 640x480 mode as a fallback when no EDID found
* ebcf81504f drm/exynos/vidi: fix memory leak in .get_modes()
* 13d25e82b6 drivers: core: synchronize really_probe() and dev_uevent()
* 0d19267cb1 ionic: fix use after netif_napi_del()
* b3e5f33fbe net/ipv6: Fix the RT cache flush via sysctl using a previous delay
* c0761d1f1c netfilter: ipset: Fix race between namespace cleanup and gc in the list:set type
* cd41a24ab4 Bluetooth: L2CAP: Fix rejecting L2CAP_CONN_PARAM_UPDATE_REQ
* 860abda358 net/mlx5e: Fix features validation check for tunneled UDP (non-VXLAN) packets
* 030df5c422 tcp: fix race in tcp_v6_syn_recv_sock()
* 59217c5722 drm/bridge/panel: Fix runtime warning on panel bridge release
* 0674ed1e58 drm/komeda: check for error-valued pointer
* dcc7440f32 liquidio: Adjust a NULL pointer handling path in lio_vf_rep_copy_packet
* 15122dc140 HID: logitech-dj: Fix memory leak in logi_dj_recv_switch_to_dj_mode()
* 700f564758 iommu: Return right value in iommu_sva_bind_device()
* 61bbbc665f iommu/amd: Fix sysfs leak in iommu init
* f9db5fbeff HID: core: remove unnecessary WARN_ON() in implement()
* e817bff375 gpio: tqmx86: fix typo in Kconfig label
* 7ef55e6b95 SUNRPC: return proper error from gss_wrap_req_priv
* 08637180f7 Input: try trimming too long modalias strings
* 19649e49a6 scsi: mpt3sas: Avoid test/set_bit() operating in non-allocated memory
* 707d153ec4 xhci: Apply broken streams quirk to Etron EJ188 xHCI host
* 5a9e518b8b xhci: Apply reset resume quirk to Etron EJ188 xHCI host
* 4cacb44810 xhci: Set correct transferred length for cancelled bulk transfers
* 1e84c9b183 jfs: xattr: fix buffer overflow for invalid xattr
* a1e6e2a221 mei: me: release irq in mei_me_pci_resume error path
* 05b2cd6d33 USB: class: cdc-wdm: Fix CPU lockup caused by excessive log messages
* 405b71f125 nilfs2: fix nilfs_empty_dir() misjudgment and long loop on I/O errors
* d1194314f4 nilfs2: return the mapped address from nilfs_get_page()
* 93ac3da63a nilfs2: Remove check for PageError
* 2c9456e0a5 selftests/mm: compaction_test: fix bogus test success on Aarch64
* 29cfada209 selftests/mm: conform test to TAP format output
* 8767e3ec55 selftests/mm: compaction_test: fix incorrect write of zero to nr_hugepages
* f1ebd2c8de serial: sc16is7xx: fix bug in sc16is7xx_set_baud() when using prescaler
* 0876b726c8 serial: sc16is7xx: replace hardcoded divisor value with BIT() macro
* 63127374c8 drm/amd/display: Handle Y carry-over in VCP X.Y calculation
* 71a0cb1ba6 ASoC: ti: davinci-mcasp: Fix race condition during probe
* 808d885740 ASoC: ti: davinci-mcasp: Handle missing required DT properties
* 84d923099e ASoC: ti: davinci-mcasp: Simplify the configuration parameter handling
* 6405101177 ASoC: ti: davinci-mcasp: Remove legacy dma_request parsing
* 1e2fbb5e1a ASoC: ti: davinci-mcasp: Use platform_get_irq_byname_optional
* 6daaf36291 ASoC: ti: davinci-mcasp: remove always zero of davinci_mcasp_get_dt_params
* da5ff71c65 ASoC: ti: davinci-mcasp: remove redundant assignment to variable ret
* 9e72ef59cb usb: gadget: f_fs: Fix race between aio_cancel() and AIO request complete
* c90af1cced ipv6: fix possible race in __fib6_drop_pcpu_from()
* ba387948b7 af_unix: Annotate data-race of sk->sk_shutdown in sk_diag_fill().
* 5968c834b4 af_unix: Use skb_queue_len_lockless() in sk_diag_show_rqlen().
* 682fe47168 af_unix: Use unix_recvq_full_lockless() in unix_stream_connect().
* 7e1fd47ccd af_unix: Annotate data-race of net->unx.sysctl_max_dgram_qlen.
* 45ad9f9a5f af_unix: Annotate data-races around sk->sk_state in UNIX_DIAG.
* 54d5a52bd8 af_unix: Annotate data-races around sk->sk_state in sendmsg() and recvmsg().
* f69e57925e af_unix: Annotate data-races around sk->sk_state in unix_write_space() and poll().
* 863250c01b af_unix: Annotate data-race of sk->sk_state in unix_inq_len().
* f1a03799d8 ptp: Fix error message on failed pin verification
* c6041e7124 net/sched: taprio: always validate TCA_TAPRIO_ATTR_PRIOMAP
* a0a0a84d9a net/mlx5: Stop waiting for PCI if pci channel is offline
* b2ca635b82 tcp: count CLOSE-WAIT sockets for TCP_MIB_CURRESTAB
* 29e49cc655 vxlan: Fix regression when dropping packets due to invalid src addresses
* d5d9d24178 net: sched: sch_multiq: fix possible OOB write in multiq_tune()
* 80021fe0c7 ipv6: sr: block BH in seg6_output_core() and seg6_input_core()
* 6532f18e66 wifi: iwlwifi: mvm: don't read past the mfuart notifcation
* 2f2809e4c4 wifi: iwlwifi: dbg_ini: move iwl_dbg_tlv_free outside of debugfs ifdef
* d22cfa12ee wifi: iwlwifi: mvm: revert gen2 TX A-MPDU size to 64
* 9c0c2940dc wifi: cfg80211: pmsr: use correct nla_get_uX functions
* 28ba44d680 wifi: mac80211: Fix deadlock in ieee80211_sta_ps_deliver_wakeup()
* ec79670eae wifi: mac80211: mesh: Fix leak of mesh_preq_queue objects

Change-Id: I615ba6af1d77feff21f5d5b89bfa766f9b1e5e3f
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-08-27 18:52:38 +00:00
Hangyu Hua
ef9a17e64f UPSTREAM: net: sched: sch_multiq: fix possible OOB write in multiq_tune()
[ Upstream commit affc18fdc694190ca7575b9a86632a73b9fe043d ]

q->bands will be assigned to qopt->bands to execute subsequent code logic
after kmalloc. So the old q->bands should not be used in kmalloc.
Otherwise, an out-of-bounds write will occur.

Bug: 349777785
Fixes: c2999f7fb0 ("net: sched: multiq: don't call qdisc_put() while holding tree lock")
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
Acked-by: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 0f208fad86631e005754606c3ec80c0d44a11882)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Iec8413c39878596795420ae58bbe6974890cf2de
2024-08-27 09:59:25 +01:00
QCTECMDR Service
0fc0638ba8 Merge "msm: ep_pcie: Avoid setting host wake pending flag for D0" 2024-08-27 00:24:32 -07:00
Carlos Llamas
f4e5b5151e FROMLIST: binder: fix UAF caused by offsets overwrite
Binder objects are processed and copied individually into the target
buffer during transactions. Any raw data in-between these objects is
copied as well. However, this raw data copy lacks an out-of-bounds
check. If the raw data exceeds the data section size then the copy
overwrites the offsets section. This eventually triggers an error that
attempts to unwind the processed objects. However, at this point the
offsets used to index these objects are now corrupted.

Unwinding with corrupted offsets can result in decrements of arbitrary
nodes and lead to their premature release. Other users of such nodes are
left with a dangling pointer triggering a use-after-free. This issue is
made evident by the following KASAN report (trimmed):

  ==================================================================
  BUG: KASAN: slab-use-after-free in _raw_spin_lock+0xe4/0x19c
  Write of size 4 at addr ffff47fc91598f04 by task binder-util/743

  CPU: 9 UID: 0 PID: 743 Comm: binder-util Not tainted 6.11.0-rc4 #1
  Hardware name: linux,dummy-virt (DT)
  Call trace:
   _raw_spin_lock+0xe4/0x19c
   binder_free_buf+0x128/0x434
   binder_thread_write+0x8a4/0x3260
   binder_ioctl+0x18f0/0x258c
  [...]

  Allocated by task 743:
   __kmalloc_cache_noprof+0x110/0x270
   binder_new_node+0x50/0x700
   binder_transaction+0x413c/0x6da8
   binder_thread_write+0x978/0x3260
   binder_ioctl+0x18f0/0x258c
  [...]

  Freed by task 745:
   kfree+0xbc/0x208
   binder_thread_read+0x1c5c/0x37d4
   binder_ioctl+0x16d8/0x258c
  [...]
  ==================================================================

To avoid this issue, let's check that the raw data copy is within the
boundaries of the data section.

Fixes: 6d98eb95b450 ("binder: avoid potential data leakage when copying txn")
Cc: Todd Kjos <tkjos@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Carlos Llamas <cmllamas@google.com>

Bug: 352520660
Link: https://lore.kernel.org/all/20240822182353.2129600-1-cmllamas@google.com/
Change-Id: I1b2dd8403b63e5eeb58904558b7b542141c83fc2
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2024-08-23 16:47:50 +00:00
QCTECMDR Service
97fd8bd8e6 Merge "msm: ep_pcie: Prevent repetitive wake operation if wake is in process" 2024-08-23 07:47:48 -07:00
Sai Chaitanya Kaveti
ccba394a90 msm: ep_pcie: Avoid setting host wake pending flag for D0
In current implementation, when host wake request is received in D0 and
M3 states, the following sequence of events are happening causing next
host wake request from IPA/ client to fail.

Sequence of events:
1. Device is in waking up process in D0, M3 states and expecting M0
next.
2. Wake up request received as device in M3.
3. Host wake API is executed setting host_wake_pending flag as well.
4. M0 received as part of wake up from 1.
5. Device in D0, M0 states.
6. Device again went to suspend state as no transfers are happening.
7. Device in D3cold, M3 states
8. Wake up request received from IPA.
9. Host wake API is called again but its returning without any operation
as host_wake_pending flag is set. wake toggle is not done.
10. host_wake_pending flag is cleared only on receiving next D0.
11. Host wake requests are failing because of 9.

To handle this, avoiding setting of host_wake_pending flag when the host
wake request is received in D0 state.

Change-Id: I83acde55e6c116653c3ed00e6b4560e3db6390bd
Signed-off-by: Sai Chaitanya Kaveti <quic_skaveti@quicinc.com>
2024-08-23 14:46:48 +05:30
Qiang Yu
d62bca7bf4 msm: ep_pcie: Prevent repetitive wake operation if wake is in process
Sometimes, device receives two consecutive wake-up events, added into a
workqueue. Then device assert WAKE# and host deassert PERST# if device
in D3cold state, triggering deassert perst IRQ. In IRQ thread, device
flush the workqueue to make sure previous d3cold process has completed
before enable endpoint. commit 43917f862f7d ("msm: mhi_dev: Flush
workqueue before processing PERST deassert"). However, the second wake
event is also in the workqueue, so ep_pcie_core_wakeup_host_internal
is invoked and seeing dev->perst_deast is true, setted by deassert
PERST# IRQ. Then device goes to access MHI register to issue inband PME,
leading to NOC error because endpoint is still disabled.

So add a check to prevent wake operation if a previous wake has completed.

10567.834470: [0x8219195 mhi_sm_dev_event_manager] Handling
MHI_DEV_EVENT_CORE_WAKEUP event, current states: M3 & D3_COLD_STATE
10567.834498: ep_pcie_core_toggle_wake_gpio: PCIe V1711211: No. 115 to
assert PCIe WAKE#; perst is asserted; D3hot is  received, WAKE GPIO
state:0
10567.834507: ep_pcie_core_wakeup_host_internal: PCIe V1711211: Set wake
pending : 1 and return ; perst is not de-asserted; D3hot is set
10567.849704: [0x8219195 mhi_dev_notify_sm_event] received:
MHI_DEV_EVENT_HW_ACC_WAKEUP
10567.849976: ep_pcie_handle_perst_irq: PCIe V1711211: No. 1018 PERST
deassertion
10567.850053: [0x8219195 mhi_sm_dev_event_manager] Handling
MHI_DEV_EVENT_HW_ACC_WAKEUP event, current states: M3 & D3_COLD_STATE
10567.850071: ep_pcie_core_wakeup_host_internal: PCIe V1711211: request to
assert WAKE# when in D3hot
10567.860093: ep_pcie_core_issue_inband_pme: PCIe V1711211: request to
assert inband wake.

Change-Id: I85fb37c4171c5ef4974c573f0abba199cb718a84
Signed-off-by: Qiang Yu <quic_qianyu@quicinc.com>
2024-08-23 14:36:50 +05:30
QCTECMDR Service
0f0f48e68a Merge "msm_ipa: Install exception rule for PPPoE-MPLS" 2024-08-13 00:40:16 -07:00
Himansu Nayak
752e583b65 msm_ipa: Install exception rule for PPPoE-MPLS
Add code to install exception rule for icmp
and dhcp packet in DL direction for v4 and v6.

Change-Id: I27a2c3cb9cb342a5e4d22246e350bf721d784a15
Signed-off-by: Himansu Nayak <quic_himansu@quicinc.com>
2024-08-13 00:15:43 +05:30
Greg Kroah-Hartman
a0347a4c8d Revert "net: mac802154: Fix racy device stats updates by DEV_STATS_INC() and DEV_STATS_ADD()"
This reverts commit e011febff8 which is
commit b8ec0dc3845f6c9089573cb5c2c4b05f7fc10728 upstream.

It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.

Bug: 161946584
Change-Id: I08cf60f05f5db95e255ce111e9556b0671b0cc09
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-08-11 14:29:33 +00:00
QCTECMDR Service
13dd90963a Merge "Merge android11-5.4.274 (564901b) into msm-5.4" 2024-08-03 23:34:20 -07:00
Greg Kroah-Hartman
c043beb2bd Merge 5.4.281 into android11-5.4-lts
Changes in 5.4.281
	gcc-plugins: Rename last_stmt() for GCC 14+
	filelock: Remove locks reliably when fcntl/close race is detected
	scsi: qedf: Set qed_slowpath_params to zero before use
	ACPI: EC: Abort address space access upon error
	ACPI: EC: Avoid returning AE_OK on errors in address space handler
	wifi: mac80211: mesh: init nonpeer_pm to active by default in mesh sdata
	wifi: mac80211: fix UBSAN noise in ieee80211_prep_hw_scan()
	Input: silead - Always support 10 fingers
	ila: block BH in ila_output()
	kconfig: gconf: give a proper initial state to the Save button
	kconfig: remove wrong expr_trans_bool()
	fs/file: fix the check in find_next_fd()
	mei: demote client disconnect warning on suspend to debug
	wifi: cfg80211: wext: add extra SIOCSIWSCAN data check
	KVM: PPC: Book3S HV: Prevent UAF in kvm_spapr_tce_attach_iommu_group()
	ALSA: hda/realtek: Add more codec ID to no shutup pins list
	mips: fix compat_sys_lseek syscall
	Input: elantech - fix touchpad state on resume for Lenovo N24
	bytcr_rt5640 : inverse jack detect for Archos 101 cesium
	ASoC: ti: davinci-mcasp: Set min period size using FIFO config
	ASoC: ti: omap-hdmi: Fix too long driver name
	can: kvaser_usb: fix return value for hif_usb_send_regout
	s390/sclp: Fix sclp_init() cleanup on failure
	ALSA: dmaengine_pcm: terminate dmaengine before synchronize
	net: usb: qmi_wwan: add Telit FN912 compositions
	net: mac802154: Fix racy device stats updates by DEV_STATS_INC() and DEV_STATS_ADD()
	powerpc/pseries: Whitelist dtl slub object for copying to userspace
	powerpc/eeh: avoid possible crash when edev->pdev changes
	scsi: libsas: Fix exp-attached device scan after probe failure scanned in again after probe failed
	Bluetooth: hci_core: cancel all works upon hci_unregister_dev()
	fs: better handle deep ancestor chains in is_subdir()
	spi: imx: Don't expect DMA for i.MX{25,35,50,51,53} cspi devices
	selftests/vDSO: fix clang build errors and warnings
	hfsplus: fix uninit-value in copy_name
	ARM: 9324/1: fix get_user() broken with veneer
	ACPI: processor_idle: Fix invalid comparison with insertion sort for latency
	drm/amdgpu: Fix signedness bug in sdma_v4_0_process_trap_irq()
	net: relax socket state check at accept time.
	ocfs2: add bounds checking to ocfs2_check_dir_entry()
	jfs: don't walk off the end of ealist
	ALSA: hda/realtek: Enable headset mic on Positivo SU C1400
	filelock: Fix fcntl/close race recovery compat path
	tun: add missing verification for short frame
	tap: add missing verification for short frame
	Linux 5.4.281

Change-Id: If3e8a4591ecbbace6792fd595d60744b4364668c
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-07-31 16:27:42 +00:00
Greg Kroah-Hartman
84d75fd864 Linux 5.4.281
Link: https://lore.kernel.org/r/20240725142730.471190017@linuxfoundation.org
Tested-by: ChromeOS CQ Test <chromeos-kernel-stable-merge@google.com>
Tested-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Tested-by: Shuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/20240726070548.312552217@linuxfoundation.org
Tested-by: ChromeOS CQ Test <chromeos-kernel-stable-merge@google.com>
Tested-by: kernelci.org bot <bot@kernelci.org>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-27 10:38:33 +02:00
Si-Wei Liu
8be915fc5f tap: add missing verification for short frame
commit ed7f2afdd0e043a397677e597ced0830b83ba0b3 upstream.

The cited commit missed to check against the validity of the frame length
in the tap_get_user_xdp() path, which could cause a corrupted skb to be
sent downstack. Even before the skb is transmitted, the
tap_get_user_xdp()-->skb_set_network_header() may assume the size is more
than ETH_HLEN. Once transmitted, this could either cause out-of-bound
access beyond the actual length, or confuse the underlayer with incorrect
or inconsistent header length in the skb metadata.

In the alternative path, tap_get_user() already prohibits short frame which
has the length less than Ethernet header size from being transmitted.

This is to drop any frame shorter than the Ethernet header size just like
how tap_get_user() does.

CVE: CVE-2024-41090
Link: https://lore.kernel.org/netdev/1717026141-25716-1-git-send-email-si-wei.liu@oracle.com/
Fixes: 0efac27791 ("tap: accept an array of XDP buffs through sendmsg()")
Cc: stable@vger.kernel.org
Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Jason Wang <jasowang@redhat.com>
Link: https://patch.msgid.link/20240724170452.16837-2-dongli.zhang@oracle.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-27 10:38:33 +02:00
Dongli Zhang
32b0aaba5d tun: add missing verification for short frame
commit 049584807f1d797fc3078b68035450a9769eb5c3 upstream.

The cited commit missed to check against the validity of the frame length
in the tun_xdp_one() path, which could cause a corrupted skb to be sent
downstack. Even before the skb is transmitted, the
tun_xdp_one-->eth_type_trans() may access the Ethernet header although it
can be less than ETH_HLEN. Once transmitted, this could either cause
out-of-bound access beyond the actual length, or confuse the underlayer
with incorrect or inconsistent header length in the skb metadata.

In the alternative path, tun_get_user() already prohibits short frame which
has the length less than Ethernet header size from being transmitted for
IFF_TAP.

This is to drop any frame shorter than the Ethernet header size just like
how tun_get_user() does.

CVE: CVE-2024-41091
Inspired-by: https://lore.kernel.org/netdev/1717026141-25716-1-git-send-email-si-wei.liu@oracle.com/
Fixes: 043d222f93 ("tuntap: accept an array of XDP buffs through sendmsg()")
Cc: stable@vger.kernel.org
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Reviewed-by: Si-Wei Liu <si-wei.liu@oracle.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Jason Wang <jasowang@redhat.com>
Link: https://patch.msgid.link/20240724170452.16837-3-dongli.zhang@oracle.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-27 10:38:33 +02:00
Jann Horn
4c43ad4ab4 filelock: Fix fcntl/close race recovery compat path
commit f8138f2ad2f745b9a1c696a05b749eabe44337ea upstream.

When I wrote commit 3cad1bc01041 ("filelock: Remove locks reliably when
fcntl/close race is detected"), I missed that there are two copies of the
code I was patching: The normal version, and the version for 64-bit offsets
on 32-bit kernels.
Thanks to Greg KH for stumbling over this while doing the stable
backport...

Apply exactly the same fix to the compat path for 32-bit kernels.

Fixes: c293621bbf ("[PATCH] stale POSIX lock handling")
Cc: stable@kernel.org
Link: https://bugs.chromium.org/p/project-zero/issues/detail?id=2563
Signed-off-by: Jann Horn <jannh@google.com>
Link: https://lore.kernel.org/r/20240723-fs-lock-recover-compatfix-v1-1-148096719529@google.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-27 10:38:33 +02:00
Edson Juliano Drosdeck
d2c0c43dc4 ALSA: hda/realtek: Enable headset mic on Positivo SU C1400
commit 8fc1e8b230771442133d5cf5fa4313277aa2bb8b upstream.

Positivo SU C1400 is equipped with ALC256, and it needs
ALC269_FIXUP_ASPIRE_HEADSET_MIC quirk to make its headset mic work.

Signed-off-by: Edson Juliano Drosdeck <edson.drosdeck@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://patch.msgid.link/20240712180642.22564-1-edson.drosdeck@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-27 10:38:33 +02:00
lei lu
fc16776a82 jfs: don't walk off the end of ealist
commit d0fa70aca54c8643248e89061da23752506ec0d4 upstream.

Add a check before visiting the members of ea to
make sure each ea stays within the ealist.

Signed-off-by: lei lu <llfamsec@gmail.com>
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-27 10:38:33 +02:00
lei lu
564d23cc5b ocfs2: add bounds checking to ocfs2_check_dir_entry()
commit 255547c6bb8940a97eea94ef9d464ea5967763fb upstream.

This adds sanity checks for ocfs2_dir_entry to make sure all members of
ocfs2_dir_entry don't stray beyond valid memory region.

Link: https://lkml.kernel.org/r/20240626104433.163270-1-llfamsec@gmail.com
Signed-off-by: lei lu <llfamsec@gmail.com>
Reviewed-by: Heming Zhao <heming.zhao@suse.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-27 10:38:33 +02:00
Paolo Abeni
59801e88c9 net: relax socket state check at accept time.
commit 26afda78cda3da974fd4c287962c169e9462c495 upstream.

Christoph reported the following splat:

WARNING: CPU: 1 PID: 772 at net/ipv4/af_inet.c:761 __inet_accept+0x1f4/0x4a0
Modules linked in:
CPU: 1 PID: 772 Comm: syz-executor510 Not tainted 6.9.0-rc7-g7da7119fe22b #56
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.el7 04/01/2014
RIP: 0010:__inet_accept+0x1f4/0x4a0 net/ipv4/af_inet.c:759
Code: 04 38 84 c0 0f 85 87 00 00 00 41 c7 04 24 03 00 00 00 48 83 c4 10 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc e8 ec b7 da fd <0f> 0b e9 7f fe ff ff e8 e0 b7 da fd 0f 0b e9 fe fe ff ff 89 d9 80
RSP: 0018:ffffc90000c2fc58 EFLAGS: 00010293
RAX: ffffffff836bdd14 RBX: 0000000000000000 RCX: ffff888104668000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: dffffc0000000000 R08: ffffffff836bdb89 R09: fffff52000185f64
R10: dffffc0000000000 R11: fffff52000185f64 R12: dffffc0000000000
R13: 1ffff92000185f98 R14: ffff88810754d880 R15: ffff8881007b7800
FS:  000000001c772880(0000) GS:ffff88811b280000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fb9fcf2e178 CR3: 00000001045d2002 CR4: 0000000000770ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
 <TASK>
 inet_accept+0x138/0x1d0 net/ipv4/af_inet.c:786
 do_accept+0x435/0x620 net/socket.c:1929
 __sys_accept4_file net/socket.c:1969 [inline]
 __sys_accept4+0x9b/0x110 net/socket.c:1999
 __do_sys_accept net/socket.c:2016 [inline]
 __se_sys_accept net/socket.c:2013 [inline]
 __x64_sys_accept+0x7d/0x90 net/socket.c:2013
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0x58/0x100 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x76/0x7e
RIP: 0033:0x4315f9
Code: fd ff 48 81 c4 80 00 00 00 e9 f1 fe ff ff 0f 1f 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 ab b4 fd ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffdb26d9c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002b
RAX: ffffffffffffffda RBX: 0000000000400300 RCX: 00000000004315f9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000004
RBP: 00000000006e1018 R08: 0000000000400300 R09: 0000000000400300
R10: 0000000000400300 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000040cdf0 R14: 000000000040ce80 R15: 0000000000000055
 </TASK>

The reproducer invokes shutdown() before entering the listener status.
After commit 94062790aedb ("tcp: defer shutdown(SEND_SHUTDOWN) for
TCP_SYN_RECV sockets"), the above causes the child to reach the accept
syscall in FIN_WAIT1 status.

Eric noted we can relax the existing assertion in __inet_accept()

Reported-by: Christoph Paasch <cpaasch@apple.com>
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/490
Suggested-by: Eric Dumazet <edumazet@google.com>
Fixes: 94062790aedb ("tcp: defer shutdown(SEND_SHUTDOWN) for TCP_SYN_RECV sockets")
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/23ab880a44d8cfd967e84de8b93dbf48848e3d8c.1716299669.git.pabeni@redhat.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Nikolay Kuratov <kniv@yandex-team.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-27 10:38:33 +02:00
Dan Carpenter
3dd9734878 drm/amdgpu: Fix signedness bug in sdma_v4_0_process_trap_irq()
commit 6769a23697f17f9bf9365ca8ed62fe37e361a05a upstream.

The "instance" variable needs to be signed for the error handling to work.

Fixes: 8b2faf1a4f3b ("drm/amdgpu: add error handle to avoid out-of-bounds")
Reviewed-by: Bob Zhou <bob.zhou@amd.com>
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Siddh Raman Pant <siddh.raman.pant@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-27 10:38:32 +02:00
Kuan-Wei Chiu
cfcdc6f6b2 ACPI: processor_idle: Fix invalid comparison with insertion sort for latency
commit 233323f9b9f828cd7cd5145ad811c1990b692542 upstream.

The acpi_cst_latency_cmp() comparison function currently used for
sorting C-state latencies does not satisfy transitivity, causing
incorrect sorting results.

Specifically, if there are two valid acpi_processor_cx elements A and B
and one invalid element C, it may occur that A < B, A = C, and B = C.
Sorting algorithms assume that if A < B and A = C, then C < B, leading
to incorrect ordering.

Given the small size of the array (<=8), we replace the library sort
function with a simple insertion sort that properly ignores invalid
elements and sorts valid ones based on latency. This change ensures
correct ordering of the C-state latencies.

Fixes: 65ea8f2c6e23 ("ACPI: processor idle: Fix up C-state latency if not ordered")
Reported-by: Julian Sikorski <belegdol@gmail.com>
Closes: https://lore.kernel.org/lkml/70674dc7-5586-4183-8953-8095567e73df@gmail.com
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Tested-by: Julian Sikorski <belegdol@gmail.com>
Cc: All applicable <stable@vger.kernel.org>
Link: https://patch.msgid.link/20240701205639.117194-1-visitorckw@gmail.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-27 10:38:32 +02:00
Masahiro Yamada
281e90e346 ARM: 9324/1: fix get_user() broken with veneer
commit 24d3ba0a7b44c1617c27f5045eecc4f34752ab03 upstream.

The 32-bit ARM kernel stops working if the kernel grows to the point
where veneers for __get_user_* are created.

AAPCS32 [1] states, "Register r12 (IP) may be used by a linker as a
scratch register between a routine and any subroutine it calls. It
can also be used within a routine to hold intermediate values between
subroutine calls."

However, bl instructions buried within the inline asm are unpredictable
for compilers; hence, "ip" must be added to the clobber list.

This becomes critical when veneers for __get_user_* are created because
veneers use the ip register since commit 02e541db05 ("ARM: 8323/1:
force linker to use PIC veneers").

[1]: https://github.com/ARM-software/abi-aa/blob/2023Q1/aapcs32/aapcs32.rst

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Cc: John Stultz <jstultz@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-27 10:38:32 +02:00
Edward Adam Davis
c733e24a61 hfsplus: fix uninit-value in copy_name
[ Upstream commit 0570730c16307a72f8241df12363f76600baf57d ]

[syzbot reported]
BUG: KMSAN: uninit-value in sized_strscpy+0xc4/0x160
 sized_strscpy+0xc4/0x160
 copy_name+0x2af/0x320 fs/hfsplus/xattr.c:411
 hfsplus_listxattr+0x11e9/0x1a50 fs/hfsplus/xattr.c:750
 vfs_listxattr fs/xattr.c:493 [inline]
 listxattr+0x1f3/0x6b0 fs/xattr.c:840
 path_listxattr fs/xattr.c:864 [inline]
 __do_sys_listxattr fs/xattr.c:876 [inline]
 __se_sys_listxattr fs/xattr.c:873 [inline]
 __x64_sys_listxattr+0x16b/0x2f0 fs/xattr.c:873
 x64_sys_call+0x2ba0/0x3b50 arch/x86/include/generated/asm/syscalls_64.h:195
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcf/0x1e0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Uninit was created at:
 slab_post_alloc_hook mm/slub.c:3877 [inline]
 slab_alloc_node mm/slub.c:3918 [inline]
 kmalloc_trace+0x57b/0xbe0 mm/slub.c:4065
 kmalloc include/linux/slab.h:628 [inline]
 hfsplus_listxattr+0x4cc/0x1a50 fs/hfsplus/xattr.c:699
 vfs_listxattr fs/xattr.c:493 [inline]
 listxattr+0x1f3/0x6b0 fs/xattr.c:840
 path_listxattr fs/xattr.c:864 [inline]
 __do_sys_listxattr fs/xattr.c:876 [inline]
 __se_sys_listxattr fs/xattr.c:873 [inline]
 __x64_sys_listxattr+0x16b/0x2f0 fs/xattr.c:873
 x64_sys_call+0x2ba0/0x3b50 arch/x86/include/generated/asm/syscalls_64.h:195
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcf/0x1e0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
[Fix]
When allocating memory to strbuf, initialize memory to 0.

Reported-and-tested-by: syzbot+efde959319469ff8d4d7@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
Link: https://lore.kernel.org/r/tencent_8BBB6433BC9E1C1B7B4BDF1BF52574BA8808@qq.com
Reported-and-tested-by: syzbot+01ade747b16e9c8030e0@syzkaller.appspotmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-27 10:38:32 +02:00
John Hubbard
1d405de980 selftests/vDSO: fix clang build errors and warnings
[ Upstream commit 73810cd45b99c6c418e1c6a487b52c1e74edb20d ]

When building with clang, via:

    make LLVM=1 -C tools/testing/selftests

...there are several warnings, and an error. This fixes all of those and
allows these tests to run and pass.

1. Fix linker error (undefined reference to memcpy) by providing a local
   version of memcpy.

2. clang complains about using this form:

    if (g = h & 0xf0000000)

...so factor out the assignment into a separate step.

3. The code is passing a signed const char* to elf_hash(), which expects
   a const unsigned char *. There are several callers, so fix this at
   the source by allowing the function to accept a signed argument, and
   then converting to unsigned operations, once inside the function.

4. clang doesn't have __attribute__((externally_visible)) and generates
   a warning to that effect. Fortunately, gcc 12 and gcc 13 do not seem
   to require that attribute in order to build, run and pass tests here,
   so remove it.

Reviewed-by: Carlos Llamas <cmllamas@google.com>
Reviewed-by: Edward Liaw <edliaw@google.com>
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Tested-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-27 10:38:32 +02:00
Uwe Kleine-König
5a2e4cca14 spi: imx: Don't expect DMA for i.MX{25,35,50,51,53} cspi devices
[ Upstream commit ce1dac560a74220f2e53845ec0723b562288aed4 ]

While in commit 2dd33f9cec ("spi: imx: support DMA for imx35") it was
claimed that DMA works on i.MX25, i.MX31 and i.MX35 the respective
device trees don't add DMA channels. The Reference manuals of i.MX31 and
i.MX25 also don't mention the CSPI core being DMA capable. (I didn't
check the others.)

Since commit e267a5b3ec59 ("spi: spi-imx: Use dev_err_probe for failed
DMA channel requests") this results in an error message

	spi_imx 43fa4000.spi: error -ENODEV: can't get the TX DMA channel!

during boot. However that isn't fatal and the driver gets loaded just
fine, just without using DMA.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://patch.msgid.link/20240508095610.2146640-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-27 10:38:32 +02:00
Christian Brauner
18ea1e471e fs: better handle deep ancestor chains in is_subdir()
[ Upstream commit 391b59b045004d5b985d033263ccba3e941a7740 ]

Jan reported that 'cd ..' may take a long time in deep directory
hierarchies under a bind-mount. If concurrent renames happen it is
possible to livelock in is_subdir() because it will keep retrying.

Change is_subdir() from simply retrying over and over to retry once and
then acquire the rename lock to handle deep ancestor chains better. The
list of alternatives to this approach were less then pleasant. Change
the scope of rcu lock to cover the whole walk while at it.

A big thanks to Jan and Linus. Both Jan and Linus had proposed
effectively the same thing just that one version ended up being slightly
more elegant.

Reported-by: Jan Kara <jack@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-27 10:38:32 +02:00
Tetsuo Handa
9cfc84b1d4 Bluetooth: hci_core: cancel all works upon hci_unregister_dev()
[ Upstream commit 0d151a103775dd9645c78c97f77d6e2a5298d913 ]

syzbot is reporting that calling hci_release_dev() from hci_error_reset()
due to hci_dev_put() from hci_error_reset() can cause deadlock at
destroy_workqueue(), for hci_error_reset() is called from
hdev->req_workqueue which destroy_workqueue() needs to flush.

We need to make sure that hdev->{rx_work,cmd_work,tx_work} which are
queued into hdev->workqueue and hdev->{power_on,error_reset} which are
queued into hdev->req_workqueue are no longer running by the moment

       destroy_workqueue(hdev->workqueue);
       destroy_workqueue(hdev->req_workqueue);

are called from hci_release_dev().

Call cancel_work_sync() on these work items from hci_unregister_dev()
as soon as hdev->list is removed from hci_dev_list.

Reported-by: syzbot <syzbot+da0a9c9721e36db712e8@syzkaller.appspotmail.com>
Closes: https://syzkaller.appspot.com/bug?extid=da0a9c9721e36db712e8
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-27 10:38:32 +02:00
Xingui Yang
adc305fd60 scsi: libsas: Fix exp-attached device scan after probe failure scanned in again after probe failed
[ Upstream commit ab2068a6fb84751836a84c26ca72b3beb349619d ]

The expander phy will be treated as broadcast flutter in the next
revalidation after the exp-attached end device probe failed, as follows:

[78779.654026] sas: broadcast received: 0
[78779.654037] sas: REVALIDATING DOMAIN on port 0, pid:10
[78779.654680] sas: ex 500e004aaaaaaa1f phy05 change count has changed
[78779.662977] sas: ex 500e004aaaaaaa1f phy05 originated BROADCAST(CHANGE)
[78779.662986] sas: ex 500e004aaaaaaa1f phy05 new device attached
[78779.663079] sas: ex 500e004aaaaaaa1f phy05:U:8 attached: 500e004aaaaaaa05 (stp)
[78779.693542] hisi_sas_v3_hw 0000:b4:02.0: dev[16:5] found
[78779.701155] sas: done REVALIDATING DOMAIN on port 0, pid:10, res 0x0
[78779.707864] sas: Enter sas_scsi_recover_host busy: 0 failed: 0
...
[78835.161307] sas: --- Exit sas_scsi_recover_host: busy: 0 failed: 0 tries: 1
[78835.171344] sas: sas_probe_sata: for exp-attached device 500e004aaaaaaa05 returned -19
[78835.180879] hisi_sas_v3_hw 0000:b4:02.0: dev[16:5] is gone
[78835.187487] sas: broadcast received: 0
[78835.187504] sas: REVALIDATING DOMAIN on port 0, pid:10
[78835.188263] sas: ex 500e004aaaaaaa1f phy05 change count has changed
[78835.195870] sas: ex 500e004aaaaaaa1f phy05 originated BROADCAST(CHANGE)
[78835.195875] sas: ex 500e004aaaaaaa1f rediscovering phy05
[78835.196022] sas: ex 500e004aaaaaaa1f phy05:U:A attached: 500e004aaaaaaa05 (stp)
[78835.196026] sas: ex 500e004aaaaaaa1f phy05 broadcast flutter
[78835.197615] sas: done REVALIDATING DOMAIN on port 0, pid:10, res 0x0

The cause of the problem is that the related ex_phy's attached_sas_addr was
not cleared after the end device probe failed, so reset it.

Signed-off-by: Xingui Yang <yangxingui@huawei.com>
Link: https://lore.kernel.org/r/20240619091742.25465-1-yangxingui@huawei.com
Reviewed-by: John Garry <john.g.garry@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-27 10:38:31 +02:00
Ganesh Goudar
8836e1bf58 powerpc/eeh: avoid possible crash when edev->pdev changes
[ Upstream commit a1216e62d039bf63a539bbe718536ec789a853dd ]

If a PCI device is removed during eeh_pe_report_edev(), edev->pdev
will change and can cause a crash, hold the PCI rescan/remove lock
while taking a copy of edev->pdev->bus.

Signed-off-by: Ganesh Goudar <ganeshgr@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240617140240.580453-1-ganeshgr@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-27 10:38:31 +02:00
Anjali K
a7b952941c powerpc/pseries: Whitelist dtl slub object for copying to userspace
[ Upstream commit 1a14150e1656f7a332a943154fc486504db4d586 ]

Reading the dispatch trace log from /sys/kernel/debug/powerpc/dtl/cpu-*
results in a BUG() when the config CONFIG_HARDENED_USERCOPY is enabled as
shown below.

    kernel BUG at mm/usercopy.c:102!
    Oops: Exception in kernel mode, sig: 5 [#1]
    LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries
    Modules linked in: xfs libcrc32c dm_service_time sd_mod t10_pi sg ibmvfc
    scsi_transport_fc ibmveth pseries_wdt dm_multipath dm_mirror dm_region_hash dm_log dm_mod fuse
    CPU: 27 PID: 1815 Comm: python3 Not tainted 6.10.0-rc3 #85
    Hardware name: IBM,9040-MRX POWER10 (raw) 0x800200 0xf000006 of:IBM,FW1060.00 (NM1060_042) hv:phyp pSeries
    NIP:  c0000000005d23d4 LR: c0000000005d23d0 CTR: 00000000006ee6f8
    REGS: c000000120c078c0 TRAP: 0700   Not tainted  (6.10.0-rc3)
    MSR:  8000000000029033 <SF,EE,ME,IR,DR,RI,LE>  CR: 2828220f  XER: 0000000e
    CFAR: c0000000001fdc80 IRQMASK: 0
    [ ... GPRs omitted ... ]
    NIP [c0000000005d23d4] usercopy_abort+0x78/0xb0
    LR [c0000000005d23d0] usercopy_abort+0x74/0xb0
    Call Trace:
     usercopy_abort+0x74/0xb0 (unreliable)
     __check_heap_object+0xf8/0x120
     check_heap_object+0x218/0x240
     __check_object_size+0x84/0x1a4
     dtl_file_read+0x17c/0x2c4
     full_proxy_read+0x8c/0x110
     vfs_read+0xdc/0x3a0
     ksys_read+0x84/0x144
     system_call_exception+0x124/0x330
     system_call_vectored_common+0x15c/0x2ec
    --- interrupt: 3000 at 0x7fff81f3ab34

Commit 6d07d1cd30 ("usercopy: Restrict non-usercopy caches to size 0")
requires that only whitelisted areas in slab/slub objects can be copied to
userspace when usercopy hardening is enabled using CONFIG_HARDENED_USERCOPY.
Dtl contains hypervisor dispatch events which are expected to be read by
privileged users. Hence mark this safe for user access.
Specify useroffset=0 and usersize=DISPATCH_LOG_BYTES to whitelist the
entire object.

Co-developed-by: Vishal Chourasia <vishalc@linux.ibm.com>
Signed-off-by: Vishal Chourasia <vishalc@linux.ibm.com>
Signed-off-by: Anjali K <anjalik@linux.ibm.com>
Reviewed-by: Srikar Dronamraju <srikar@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240614173844.746818-1-anjalik@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-27 10:38:31 +02:00
Yunshui Jiang
e011febff8 net: mac802154: Fix racy device stats updates by DEV_STATS_INC() and DEV_STATS_ADD()
[ Upstream commit b8ec0dc3845f6c9089573cb5c2c4b05f7fc10728 ]

mac802154 devices update their dev->stats fields locklessly. Therefore
these counters should be updated atomically. Adopt SMP safe DEV_STATS_INC()
and DEV_STATS_ADD() to achieve this.

Signed-off-by: Yunshui Jiang <jiangyunshui@kylinos.cn>
Message-ID: <20240531080739.2608969-1-jiangyunshui@kylinos.cn>
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-27 10:38:31 +02:00
Daniele Palmas
c48d9c1e38 net: usb: qmi_wwan: add Telit FN912 compositions
[ Upstream commit 77453e2b015b5ced5b3f45364dd5a72dfc3bdecb ]

Add the following Telit FN912 compositions:

0x3000: rmnet + tty (AT/NMEA) + tty (AT) + tty (diag)
T:  Bus=03 Lev=01 Prnt=03 Port=07 Cnt=01 Dev#=  8 Spd=480  MxCh= 0
D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1bc7 ProdID=3000 Rev=05.15
S:  Manufacturer=Telit Cinterion
S:  Product=FN912
S:  SerialNumber=92c4c4d8
C:  #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

0x3001: rmnet + tty (AT) + tty (diag) + DPL (data packet logging) + adb
T:  Bus=03 Lev=01 Prnt=03 Port=07 Cnt=01 Dev#=  7 Spd=480  MxCh= 0
D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1bc7 ProdID=3001 Rev=05.15
S:  Manufacturer=Telit Cinterion
S:  Product=FN912
S:  SerialNumber=92c4c4d8
C:  #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
Acked-by: Bjørn Mork <bjorn@mork.no>
Link: https://patch.msgid.link/20240625102236.69539-1-dnlplm@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-27 10:38:31 +02:00
Shengjiu Wang
58f03c322b ALSA: dmaengine_pcm: terminate dmaengine before synchronize
[ Upstream commit 6a7db25aad8ce6512b366d2ce1d0e60bac00a09d ]

When dmaengine supports pause function, in suspend state,
dmaengine_pause() is called instead of dmaengine_terminate_async(),

In end of playback stream, the runtime->state will go to
SNDRV_PCM_STATE_DRAINING, if system suspend & resume happen
at this time, application will not resume playback stream, the
stream will be closed directly, the dmaengine_terminate_async()
will not be called before the dmaengine_synchronize(), which
violates the call sequence for dmaengine_synchronize().

This behavior also happens for capture streams, but there is no
SNDRV_PCM_STATE_DRAINING state for capture. So use
dmaengine_tx_status() to check the DMA status if the status is
DMA_PAUSED, then call dmaengine_terminate_async() to terminate
dmaengine before dmaengine_synchronize().

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://patch.msgid.link/1718851218-27803-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-27 10:38:31 +02:00
Heiko Carstens
455a6653d8 s390/sclp: Fix sclp_init() cleanup on failure
[ Upstream commit 6434b33faaa063df500af355ee6c3942e0f8d982 ]

If sclp_init() fails it only partially cleans up: if there are multiple
failing calls to sclp_init() sclp_state_change_event will be added several
times to sclp_reg_list, which results in the following warning:

------------[ cut here ]------------
list_add double add: new=000003ffe1598c10, prev=000003ffe1598bf0, next=000003ffe1598c10.
WARNING: CPU: 0 PID: 1 at lib/list_debug.c:35 __list_add_valid_or_report+0xde/0xf8
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.10.0-rc3
Krnl PSW : 0404c00180000000 000003ffe0d6076a (__list_add_valid_or_report+0xe2/0xf8)
           R:0 T:1 IO:0 EX:0 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 RI:0 EA:3
...
Call Trace:
 [<000003ffe0d6076a>] __list_add_valid_or_report+0xe2/0xf8
([<000003ffe0d60766>] __list_add_valid_or_report+0xde/0xf8)
 [<000003ffe0a8d37e>] sclp_init+0x40e/0x450
 [<000003ffe00009f2>] do_one_initcall+0x42/0x1e0
 [<000003ffe15b77a6>] do_initcalls+0x126/0x150
 [<000003ffe15b7a0a>] kernel_init_freeable+0x1ba/0x1f8
 [<000003ffe0d6650e>] kernel_init+0x2e/0x180
 [<000003ffe000301c>] __ret_from_fork+0x3c/0x60
 [<000003ffe0d759ca>] ret_from_fork+0xa/0x30

Fix this by removing sclp_state_change_event from sclp_reg_list when
sclp_init() fails.

Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-27 10:38:31 +02:00
Chen Ni
15f5c60fe3 can: kvaser_usb: fix return value for hif_usb_send_regout
[ Upstream commit 0d34d8163fd87978a6abd792e2d8ad849f4c3d57 ]

As the potential failure of usb_submit_urb(), it should be better to
return the err variable to catch the error.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Link: https://lore.kernel.org/all/20240521041020.1519416-1-nichen@iscas.ac.cn
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-27 10:38:31 +02:00
Primoz Fiser
45a6b888bc ASoC: ti: omap-hdmi: Fix too long driver name
[ Upstream commit 524d3f126362b6033e92cbe107ae2158d7fbff94 ]

Set driver name to "HDMI". This simplifies the code and gets rid of
the following error messages:

  ASoC: driver name too long 'HDMI 58040000.encoder' -> 'HDMI_58040000_e'

Signed-off-by: Primoz Fiser <primoz.fiser@norik.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://lore.kernel.org/r/20240610125847.773394-1-primoz.fiser@norik.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-27 10:38:30 +02:00
Jai Luthra
56c1ce1fa8 ASoC: ti: davinci-mcasp: Set min period size using FIFO config
[ Upstream commit c5dcf8ab10606e76c1d8a0ec77f27d84a392e874 ]

The minimum period size was enforced to 64 as older devices integrating
McASP with EDMA used an internal FIFO of 64 samples.

With UDMA based platforms this internal McASP FIFO is optional, as the
DMA engine internally does some buffering which is already accounted for
when registering the platform. So we should read the actual FIFO
configuration (txnumevt/rxnumevt) instead of hardcoding frames.min to
64.

Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Signed-off-by: Jai Luthra <j-luthra@ti.com>
Link: https://lore.kernel.org/r/20240611-asoc_next-v3-2-fcfd84b12164@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-27 10:38:30 +02:00
Thomas GENTY
4b7c9f6501 bytcr_rt5640 : inverse jack detect for Archos 101 cesium
[ Upstream commit e3209a1827646daaab744aa6a5767b1f57fb5385 ]

When headphones are plugged in, they appear absent; when they are removed,
they appear present.
Add a specific entry in bytcr_rt5640 for this device

Signed-off-by: Thomas GENTY <tomlohave@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240608170251.99936-1-tomlohave@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-27 10:38:30 +02:00
Jonathan Denose
2842f49427 Input: elantech - fix touchpad state on resume for Lenovo N24
[ Upstream commit a69ce592cbe0417664bc5a075205aa75c2ec1273 ]

The Lenovo N24 on resume becomes stuck in a state where it
sends incorrect packets, causing elantech_packet_check_v4 to fail.
The only way for the device to resume sending the correct packets is for
it to be disabled and then re-enabled.

This change adds a dmi check to trigger this behavior on resume.

Signed-off-by: Jonathan Denose <jdenose@google.com>
Link: https://lore.kernel.org/r/20240503155020.v2.1.Ifa0e25ebf968d8f307f58d678036944141ab17e6@changeid
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-27 10:38:30 +02:00
Arnd Bergmann
409299623a mips: fix compat_sys_lseek syscall
[ Upstream commit 0d5679a0aae2d8cda72169452c32e5cb88a7ab33 ]

This is almost compatible, but passing a negative offset should result
in a EINVAL error, but on mips o32 compat mode would seek to a large
32-bit byte offset.

Use compat_sys_lseek() to correctly sign-extend the argument.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-27 10:38:30 +02:00
Kailang Yang
922371a064 ALSA: hda/realtek: Add more codec ID to no shutup pins list
[ Upstream commit 70794b9563fe011988bcf6a081af9777e63e8d37 ]

If it enter to runtime D3 state, it didn't shutup Headset MIC pin.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Link: https://lore.kernel.org/r/8d86f61e7d6f4a03b311e4eb4e5caaef@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-27 10:38:30 +02:00
Michael Ellerman
be847bb20c KVM: PPC: Book3S HV: Prevent UAF in kvm_spapr_tce_attach_iommu_group()
[ Upstream commit a986fa57fd81a1430e00b3c6cf8a325d6f894a63 ]

Al reported a possible use-after-free (UAF) in kvm_spapr_tce_attach_iommu_group().

It looks up `stt` from tablefd, but then continues to use it after doing
fdput() on the returned fd. After the fdput() the tablefd is free to be
closed by another thread. The close calls kvm_spapr_tce_release() and
then release_spapr_tce_table() (via call_rcu()) which frees `stt`.

Although there are calls to rcu_read_lock() in
kvm_spapr_tce_attach_iommu_group() they are not sufficient to prevent
the UAF, because `stt` is used outside the locked regions.

With an artifcial delay after the fdput() and a userspace program which
triggers the race, KASAN detects the UAF:

  BUG: KASAN: slab-use-after-free in kvm_spapr_tce_attach_iommu_group+0x298/0x720 [kvm]
  Read of size 4 at addr c000200027552c30 by task kvm-vfio/2505
  CPU: 54 PID: 2505 Comm: kvm-vfio Not tainted 6.10.0-rc3-next-20240612-dirty #1
  Hardware name: 8335-GTH POWER9 0x4e1202 opal:skiboot-v6.5.3-35-g1851b2a06 PowerNV
  Call Trace:
    dump_stack_lvl+0xb4/0x108 (unreliable)
    print_report+0x2b4/0x6ec
    kasan_report+0x118/0x2b0
    __asan_load4+0xb8/0xd0
    kvm_spapr_tce_attach_iommu_group+0x298/0x720 [kvm]
    kvm_vfio_set_attr+0x524/0xac0 [kvm]
    kvm_device_ioctl+0x144/0x240 [kvm]
    sys_ioctl+0x62c/0x1810
    system_call_exception+0x190/0x440
    system_call_vectored_common+0x15c/0x2ec
  ...
  Freed by task 0:
   ...
   kfree+0xec/0x3e0
   release_spapr_tce_table+0xd4/0x11c [kvm]
   rcu_core+0x568/0x16a0
   handle_softirqs+0x23c/0x920
   do_softirq_own_stack+0x6c/0x90
   do_softirq_own_stack+0x58/0x90
   __irq_exit_rcu+0x218/0x2d0
   irq_exit+0x30/0x80
   arch_local_irq_restore+0x128/0x230
   arch_local_irq_enable+0x1c/0x30
   cpuidle_enter_state+0x134/0x5cc
   cpuidle_enter+0x6c/0xb0
   call_cpuidle+0x7c/0x100
   do_idle+0x394/0x410
   cpu_startup_entry+0x60/0x70
   start_secondary+0x3fc/0x410
   start_secondary_prolog+0x10/0x14

Fix it by delaying the fdput() until `stt` is no longer in use, which
is effectively the entire function. To keep the patch minimal add a call
to fdput() at each of the existing return paths. Future work can convert
the function to goto or __cleanup style cleanup.

With the fix in place the test case no longer triggers the UAF.

Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Closes: https://lore.kernel.org/all/20240610024437.GA1464458@ZenIV/
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240614122910.3499489-1-mpe@ellerman.id.au
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-27 10:38:30 +02:00