6.1.30-rc1 review
Subsystems (6)
Greg Kroah-Hartman
maintainercover 6.1.30-rc1 review
This is the start of the stable review cycle for the 6.1.30 release. There are 292 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 24 May 2023 19:03:25 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.30-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.1.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 6.1.30-rc1
Li Ma <[email protected]>
drm/amdgpu: reserve the old gc_11_0_*_mes.bin
Jack Xiao <[email protected]>
drm/amd/amdgpu: introduce gc_*_mes_2.bin v2
Li Ma <[email protected]>
drm/amdgpu: declare firmware for new MES 11.0.4
Eric Biggers <[email protected]>
crypto: testmgr - fix RNG performance in fuzz tests
Mathieu Poirier <[email protected]>
remoteproc: imx_dsp_rproc: Fix kernel test robot sparse warning
Ze Gao <[email protected]>
rethook, fprobe: do not trace rethook related functions
Ze Gao <[email protected]>
rethook: use preempt_{disable, enable}_notrace in rethook_trampoline_handler
Peter Collingbourne <[email protected]>
arm64: mte: Do not set PG_mte_tagged if tags were not initialized
Heiko Carstens <[email protected]>
s390/qdio: fix do_sqbs() inline assembly constraint
Heiko Carstens <[email protected]>
s390/crypto: use vector instructions only if available for ChaCha20
Stefan Haberland <[email protected]>
s390/dasd: fix command reject error on ESE devices
Ryusuke Konishi <[email protected]>
nilfs2: fix use-after-free bug of nilfs_root in nilfs_evict_inode()
Michael Ellerman <[email protected]>
powerpc/64s/radix: Fix soft dirty tracking
Jerry Snitselaar <[email protected]>
tpm/tpm_tis: Disable interrupts for more Lenovo devices
Gaurav Batra <[email protected]>
powerpc/iommu: Incorrect DDW Table is referenced for SR-IOV device
Gaurav Batra <[email protected]>
powerpc/iommu: DMA address offset is incorrectly calculated with 2MB TCEs
Michal Simek <[email protected]>
dt-bindings: ata: ahci-ceva: Cover all 4 iommus entries
Alex Deucher <[email protected]>
drm/amdgpu/gfx11: update gpu_clock_counter logic
Tong Liu01 <[email protected]>
drm/amdgpu: refine get gpu clock counter method
Guilherme G. Piccoli <[email protected]>
drm/amdgpu/gfx11: Adjust gfxoff before powergating on gfx11 as well
Bas Nieuwenhuizen <[email protected]>
drm/amdgpu/gfx10: Disable gfxoff before disabling powergating.
Alex Deucher <[email protected]>
drm/amdgpu/gmc11: implement get_vbios_fb_size()
Evan Quan <[email protected]>
drm/amd/pm: fix possible power mode mismatch between driver and PMFW
Xiubo Li <[email protected]>
ceph: force updating the msg pointer in non-split case
George Kennedy <[email protected]>
vc_screen: reload load of struct vc_data pointer in vcs_write() to avoid UAF
Mario Limonciello <[email protected]>
thunderbolt: Clear registers properly when auto clear isn't in use
Krzysztof Kozlowski <[email protected]>
serial: qcom-geni: fix enabling deactivated interrupt
Andrew Davis <[email protected]>
serial: 8250_exar: Add support for USR298x PCI Modems
Vitaliy Tomin <[email protected]>
serial: Add support for Advantech PCI-1611U card
Domenico Cerasuolo <[email protected]>
mm: fix zswap writeback race condition
Peng Zhang <[email protected]>
maple_tree: make maple state reusable after mas_empty_area()
Ilya Leoshkevich <[email protected]>
statfs: enforce statfs[64] structure initialization
Michal Luczaj <[email protected]>
KVM: Fix vcpu_array[0] races
Chih-Yen Chang <[email protected]>
ksmbd: fix global-out-of-bounds in smb2_find_context_vals
Chih-Yen Chang <[email protected]>
ksmbd: fix wrong UserName check in session_user
Chih-Yen Chang <[email protected]>
ksmbd: allocate one more byte for implied bcc[0]
Gustav Johansson <[email protected]>
ksmbd: smb2: Allow messages padded to 8byte boundary
Bharath SM <[email protected]>
SMB3: drop reference to cfile before sending oplock break
Bharath SM <[email protected]>
SMB3: Close all deferred handles of inode in case of handle lease break
Ping-Ke Shih <[email protected]>
wifi: rtw88: use work to update rate to avoid RCU warning
Jimmy Assarsson <[email protected]>
can: kvaser_pciefd: Disable interrupts in probe error path
Jimmy Assarsson <[email protected]>
can: kvaser_pciefd: Do not send EFLUSH command on TFD interrupt
Jimmy Assarsson <[email protected]>
can: kvaser_pciefd: Clear listen-only bit if not explicitly requested
Jimmy Assarsson <[email protected]>
can: kvaser_pciefd: Empty SRB buffer in probe
Jimmy Assarsson <[email protected]>
can: kvaser_pciefd: Call request_irq() before enabling interrupts
Jimmy Assarsson <[email protected]>
can: kvaser_pciefd: Set CAN_STATE_STOPPED in kvaser_pciefd_stop()
Oliver Hartkopp <[email protected]>
can: isotp: recvmsg(): allow MSG_CMSG_COMPAT flag
Oliver Hartkopp <[email protected]>
can: j1939: recvmsg(): allow MSG_CMSG_COMPAT flag
Kai-Heng Feng <[email protected]>
ALSA: hda/realtek: Fix mute and micmute LEDs for yet another HP laptop
Vitaly Rodionov <[email protected]>
ALSA: hda/realtek: Add quirk for HP EliteBook G10 laptops
Luke D. Jones <[email protected]>
ALSA: hda/realtek: Add quirk for 2nd ASUS GU603
Ai Chao <[email protected]>
ALSA: hda/realtek: Add a quirk for HP EliteDesk 805
Jeremy Soller <[email protected]>
ALSA: hda/realtek: Add quirk for Clevo L140AU
Nikhil Mahale <[email protected]>
ALSA: hda: Add NVIDIA codec IDs a3 through a7 to patch table
Takashi Iwai <[email protected]>
ALSA: hda: Fix Oops by 9.1 surround channel names
Mathias Nyman <[email protected]>
xhci: Fix incorrect tracking of free space on transfer rings
Mario Limonciello <[email protected]>
xhci-pci: Only run d3cold avoidance quirk for s2idle
Francesco Dolcini <[email protected]>
Revert "usb: gadget: udc: core: Invoke usb_gadget_connect only when started"
Francesco Dolcini <[email protected]>
Revert "usb: gadget: udc: core: Prevent redundant calls to pullup"
Badhri Jagan Sridharan <[email protected]>
usb: typec: altmodes/displayport: fix pin_assignment_show
Konrad Gräfe <[email protected]>
usb: gadget: u_ether: Fix host MAC address case
Udipto Goswami <[email protected]>
usb: dwc3: debugfs: Resume dwc3 before accessing registers
Roger Quadros <[email protected]>
usb: dwc3: gadget: Improve dwc3_gadget_suspend() and dwc3_gadget_resume()
Weitao Wang <[email protected]>
USB: UHCI: adjust zhaoxin UHCI controllers OverCurrent bit value
Maxime Bizon <[email protected]>
usb-storage: fix deadlock when a scsi command timeouts more than once
Alan Stern <[email protected]>
USB: usbtmc: Fix direction for 0-length ioctl control messages
Takashi Iwai <[email protected]>
ALSA: usb-audio: Add a sample rate workaround for Line6 Pod Go
Arnd Bergmann <[email protected]>
bridge: always declare tunnel functions
Florian Westphal <[email protected]>
netfilter: nft_set_rbtree: fix null deref on element insertion
Florian Westphal <[email protected]>
netfilter: nf_tables: fix nft_trans type confusion
Benjamin Poirier <[email protected]>
net: selftests: Fix optstring
Vladimir Oltean <[email protected]>
net: pcs: xpcs: fix C73 AN not getting enabled
M Chetan Kumar <[email protected]>
net: wwan: iosm: fix NULL pointer dereference when removing device
Eric Dumazet <[email protected]>
vlan: fix a potential uninit-value in vlan_dev_hard_start_xmit()
Aleksandr Loktionov <[email protected]>
igb: fix bit_shift to be in [1..8] range
Marco Migliore <[email protected]>
net: dsa: mv88e6xxx: Fix mv88e6393x EPC write command offset
Christophe JAILLET <[email protected]>
cassini: Fix a memory leak in the error handling path of cas_init_one()
Kuniyuki Iwashima <[email protected]>
tun: Fix memory leak for detached NAPI queue.
Chuang Wang <[email protected]>
net: tun: rebuild error handling in tun_get_user
Michael Kelley <[email protected]>
scsi: storvsc: Don't pass unused PFNs to Hyper-V host
Johannes Berg <[email protected]>
wifi: iwlwifi: mvm: don't trust firmware n_channels
Alon Giladi <[email protected]>
wifi: iwlwifi: mvm: fix OEM's name in the tas approved list
Alon Giladi <[email protected]>
wifi: iwlwifi: fix OEM's name in the ppag approved list
Johannes Berg <[email protected]>
wifi: iwlwifi: fw: fix DBGI dump
Johannes Berg <[email protected]>
wifi: iwlwifi: mvm: fix cancel_delayed_work_sync() deadlock
Michael Lee <[email protected]>
wifi: mac80211: Abort running color change when stopping the AP
Johannes Berg <[email protected]>
wifi: mac80211: fix min center freq offset tracing
Mirsad Goran Todorovac <[email protected]>
wifi: mac80211: fortify the spinlock against deadlock by interrupt
Ilan Peer <[email protected]>
wifi: cfg80211: Drop entries with invalid BSSIDs in RNR
Dawid Wesierski <[email protected]>
ice: Fix ice VF reset during iavf initialization
Jacob Keller <[email protected]>
ice: introduce clear_reset_state operation
Florian Fainelli <[email protected]>
net: bcmgenet: Restore phy_stop() depending upon suspend/close
Florian Fainelli <[email protected]>
net: bcmgenet: Remove phy_stop() from bcmgenet_netif_stop()
Oliver Hartkopp <[email protected]>
can: dev: fix missing CAN XL support in can_put_echo_skb()
Vineeth Vijayan <[email protected]>
s390/cio: include subchannels without devices also for evaluation
Xin Long <[email protected]>
tipc: check the bearer min mtu properly when setting it by netlink
Xin Long <[email protected]>
tipc: do not update mtu if msg_max is too small in mtu negotiation
Xin Long <[email protected]>
tipc: add tipc_bearer_min_mtu to calculate min mtu
Feng Liu <[email protected]>
virtio_net: Fix error unwinding of XDP initialization
Parav Pandit <[email protected]>
virtio-net: Maintain reverse cleanup order
Dong Chenchen <[email protected]>
net: nsh: Use correct mac_offset to unwind gso skb in nsh_gso_segment()
Arnd Bergmann <[email protected]>
drm/exynos: fix g2d_open/close helper function definitions
Ranjani Sridharan <[email protected]>
ASoC: SOF: topology: Fix logic for copying tuples
Douglas Anderson <[email protected]>
ASoC: mediatek: mt8186: Fix use-after-free in driver remove path
Chuck Lever <[email protected]>
SUNRPC: Fix trace_svc_register() call site
NeilBrown <[email protected]>
SUNRPC: always free ctxt when freeing deferred request
NeilBrown <[email protected]>
SUNRPC: double free xprt_ctxt while still in use
Duoming Zhou <[email protected]>
media: netup_unidvb: fix use-after-free at del_timer()
Jijie Shao <[email protected]>
net: hns3: fix reset timeout when enable full VF
Jie Wang <[email protected]>
net: hns3: fix reset delay time to avoid configuration timeout
Jijie Shao <[email protected]>
net: hns3: fix sending pfc frames after reset issue
Jie Wang <[email protected]>
net: hns3: fix output information incomplete for dumping tx queue info with debugfs
Clément Léger <[email protected]>
net: dsa: rzn1-a5psw: disable learning for standalone ports
Alexis Lothoré <[email protected]>
net: dsa: rzn1-a5psw: fix STP states handling
Clément Léger <[email protected]>
net: dsa: rzn1-a5psw: enable management frames for CPU port
Xin Long <[email protected]>
erspan: get the proto with the md version for collect_md
Doug Berger <[email protected]>
serial: 8250_bcm7271: fix leak in `brcmuart_probe`
Doug Berger <[email protected]>
serial: 8250_bcm7271: balance clk_enable calls
Ke Zhang <[email protected]>
serial: arc_uart: fix of_iomap leak in arc_serial_probe
Eric Dumazet <[email protected]>
tcp: fix possible sk_priority leak in tcp_v4_send_reset()
Zhuang Shengen <[email protected]>
vsock: avoid to close connected socket after the timeout
Pieter Jansen van Vuuren <[email protected]>
sfc: disable RXFCS and RXALL features by default
Ryan C. Underwood <[email protected]>
ALSA: hda/realtek: Apply HP B&O top speaker profile to Pavilion 15
Ryder Lee <[email protected]>
wifi: mt76: connac: fix stats->tx_bytes calculation
Dan Carpenter <[email protected]>
ALSA: firewire-digi00x: prevent potential use after free
Grygorii Strashko <[email protected]>
net: phy: dp83867: add w/a for packet errors seen with short cables
Uwe Kleine-König <[email protected]>
net: fec: Better handle pm_runtime_get() failing in .remove()
Andrea Mayer <[email protected]>
selftets: seg6: disable rp_filter by default in srv6_end_dt4_l3vpn_test
Andrea Mayer <[email protected]>
selftests: seg6: disable DAD on IPv6 router cfg for srv6_end_dt4_l3vpn_test
Rob Clark <[email protected]>
drm/msm: Fix submit error-path leaks
Tobias Brunner <[email protected]>
af_key: Reject optional tunnel/BEET mode templates in outbound policies
Tobias Brunner <[email protected]>
xfrm: Reject optional tunnel/BEET mode templates in outbound policies
Wyes Karny <[email protected]>
cpupower: Make TSC read per CPU for Mperf monitor
Shengjiu Wang <[email protected]>
ASoC: fsl_micfil: Fix error handler with pm_runtime_enable
Uwe Kleine-König <[email protected]>
platform: Provide a remove callback that returns no value
Jianhua Lu <[email protected]>
dt-bindings: display/msm: dsi-controller-main: Document qcom, master-dsi and qcom, sync-dual-dsi
Marijn Suijten <[email protected]>
drm/msm/dpu: Remove duplicate register defines from INTF
Marijn Suijten <[email protected]>
drm/msm/dpu: Move non-MDP_TOP INTF_INTR offsets out of hwio header
Marijn Suijten <[email protected]>
drm/msm/dpu: Assign missing writeback log_mask
Srinivas Kandagatla <[email protected]>
drm/msm/dp: unregister audio driver during unbind
Martin Willi <[email protected]>
Revert "Fix XFRM-I support for nested ESP tunnels"
Sabrina Dubroca <[email protected]>
xfrm: don't check the default policy if the policy allows the packet
Horatio Zhang <[email protected]>
drm/amdgpu: drop gfx_v11_0_cp_ecc_error_irq_funcs
Fae <[email protected]>
platform/x86: hp-wmi: add micmute to hp_wmi_keymap struct
Jorge Lopez <[email protected]>
platform/x86: Move existing HP drivers to a new hp subdir
Guilherme G. Piccoli <[email protected]>
parisc: Replace regular spinlock with spin_trylock on panic path
Jarkko Nikula <[email protected]>
mfd: intel-lpss: Add Intel Meteor Lake PCH-S LPSS PCI IDs
Qiang Ning <[email protected]>
mfd: dln2: Fix memory leak in dln2_probe()
Hans de Goede <[email protected]>
mfd: intel_soc_pmic_chtwc: Add Lenovo Yoga Book X90F to intel_cht_wc_models
Richard Fitzgerald <[email protected]>
soundwire: bus: Fix unbalanced pm_runtime_put() causing usage count underflow
Krzysztof Kozlowski <[email protected]>
soundwire: qcom: gracefully handle too many ports in DT
Alain Volmat <[email protected]>
phy: st: miphy28lp: use _poll_timeout functions for waits
Eugene Huang <[email protected]>
soundwire: dmi-quirks: add remapping for Intel 'Rooks County' NUC M15
Hao Zeng <[email protected]>
recordmcount: Fix memory leaks in the uwrite function
Josh Poimboeuf <[email protected]>
lkdtm/stackleak: Fix noinstr violation
Josh Poimboeuf <[email protected]>
sched: Fix KCSAN noinstr violation
Rodríguez Barbarin, José Javier <[email protected]>
mcb-pci: Reallocate memory region to avoid memory overlapping
Tony Lindgren <[email protected]>
serial: 8250: Reinit port->pm on port specific driver unbind
Frank Wang <[email protected]>
usb: typec: tcpm: fix multiple times discover svids error
Jason Gerecke <[email protected]>
HID: wacom: generic: Set battery quirk only when we see battery data
weiliang1503 <[email protected]>
HID: Ignore battery for ELAN touchscreen on ROG Flow X13 GV301RA
Alex Henrie <[email protected]>
HID: apple: Set the tilde quirk flag on the Geyser 3
Baishan Jiang <[email protected]>
ASoC: amd: yc: Add ThinkBook 14 G5+ ARP to quirks list for acp6x
Cem Kaya <[email protected]>
ASoC: amd: Add Dell G15 5525 to quirks list
Fred Oh <[email protected]>
ALSA: hda: LNL: add HD Audio PCI ID
Samuel Čavoj <[email protected]>
usb: typec: ucsi: acpi: add quirk for ASUS Zenbook UM325
Kevin Groeneveld <[email protected]>
spi: spi-imx: fix MX51_ECSPI_* macros when cs > 3
Bastien Nocera <[email protected]>
HID: logitech-hidpp: Reconcile USB and Unifying serials
Bastien Nocera <[email protected]>
HID: logitech-hidpp: Don't use the USB serial for USB devices
Prajna Sariputra <[email protected]>
ASoC: amd: yc: Add DMI entries to support HP OMEN 16-n0xxx (8A42)
Khadija Kamran <[email protected]>
staging: axis-fifo: initialize timeouts in init only
Alex Henrie <[email protected]>
HID: apple: Set the tilde quirk flag on the Geyser 4 and later
Philipp Hortmann <[email protected]>
staging: rtl8192e: Replace macro RTL_PCI_DEVICE with PCI_DEVICE
Max Chou <[email protected]>
Bluetooth: btrtl: Add the support for RTL8851B
Min Li <[email protected]>
Bluetooth: L2CAP: fix "bad unlock balance" in l2cap_disconnect_rsp
Raul Cheleguini <[email protected]>
Bluetooth: Add new quirk for broken set random RPA timeout for ATS2851
Hans de Goede <[email protected]>
Bluetooth: hci_bcm: Fall back to getting bdaddr from EFI if not set
Chethan T N <[email protected]>
Bluetooth: btintel: Add LE States quirk support
Max Chou <[email protected]>
Bluetooth: btrtl: check for NULL in btrtl_set_quirks()
Raul Cheleguini <[email protected]>
Bluetooth: Improve support for Actions Semi ATS2851 based devices
Vasily Khoruzhick <[email protected]>
Bluetooth: btrtl: add support for the RTL8723CS
Vasily Khoruzhick <[email protected]>
Bluetooth: Add new quirk for broken local ext features page 2
Meng Tang <[email protected]>
Bluetooth: btusb: Add new PID/VID 04ca:3801 for MT7663
Simon Horman <[email protected]>
ipvs: Update width of source for ip_vs_sync_conn_options
Zhong Jinghua <[email protected]>
nbd: fix incomplete validation of ioctl arg
Nagarajan Maran <[email protected]>
wifi: ath11k: Fix SKB corruption in REO destination ring
Hans de Goede <[email protected]>
wifi: iwlwifi: dvm: Fix memcpy: detected field-spanning write backtrace
Chaitanya Kulkarni <[email protected]>
null_blk: Always check queue mode setting from configfs
Johannes Berg <[email protected]>
wifi: iwlwifi: fix iwl_mvm_max_amsdu_size() for MLO
Harshitha Prem <[email protected]>
wifi: ath11k: Ignore frags from uninitialized peer in dp.
Colin Ian King <[email protected]>
block, bfq: Fix division by zero error on zero wsum
Johannes Berg <[email protected]>
wifi: iwlwifi: mvm: fix ptk_pn memory leak
Hyunwoo Kim <[email protected]>
wifi: iwlwifi: pcie: Fix integer overflow in iwl_write_to_user_buf
Mukesh Sisodiya <[email protected]>
wifi: iwlwifi: add a new PCI device ID for BZ device
Daniel Gabay <[email protected]>
wifi: iwlwifi: pcie: fix possible NULL pointer dereference
Yu Kuai <[email protected]>
md: fix soft lockup in status_resync
Yafang <[email protected]>
bpf: Add preempt_count_{sub,add} into btf id deny list
Hao Zeng <[email protected]>
samples/bpf: Fix fout leak in hbm's run_bpf_prog
Chao Yu <[email protected]>
f2fs: fix to check readonly condition correctly
Chao Yu <[email protected]>
f2fs: fix to drop all dirty pages during umount() if cp_error is set
Yonggil Song <[email protected]>
f2fs: Fix system crash due to lack of free space in LFS
Stephan Müller <[email protected]>
crypto: jitter - permanent and intermittent health errors
Ojaswin Mujoo <[email protected]>
ext4: Fix best extent lstart adjustment logic in ext4_mb_new_inode_pa()
Kemeng Shi <[email protected]>
ext4: set goal start correctly in ext4_mb_normalize_request
Adrian Hunter <[email protected]>
scsi: ufs: ufs-pci: Add support for Intel Lunar Lake
Andreas Gruenbacher <[email protected]>
gfs2: Fix inode height consistency check
Zheng Wang <[email protected]>
scsi: message: mptlan: Fix use after free bug in mptlan_remove() due to race condition
Eli Cohen <[email protected]>
lib: cpu_rmap: Avoid use after free on rmap->obj array entries
Dmitry Bogdanov <[email protected]>
scsi: target: iscsit: Free cmds before session free
Nick Child <[email protected]>
netdev: Enforce index cap in netdev_get_tx_queue
Nick Child <[email protected]>
net: Catch invalid index in XPS mapping
Nathan Chancellor <[email protected]>
net: pasemi: Fix return type of pasemi_mac_start_tx()
Maxim Korotkov <[email protected]>
bnxt: avoid overflow in bnxt_get_nvram_directory()
Justin Tee <[email protected]>
scsi: lpfc: Correct used_rpi count when devloss tmo fires with no recovery
Justin Tee <[email protected]>
scsi: lpfc: Prevent lpfc_debugfs_lockstat_write() buffer overflow
Jan Kara <[email protected]>
ext2: Check block size validity during mount
Hector Martin <[email protected]>
wifi: brcmfmac: cfg80211: Pass the PMK in binary instead of hex
Hector Martin <[email protected]>
wifi: brcmfmac: pcie: Provide a buffer of random bytes to the device
Kumar Kartikeya Dwivedi <[email protected]>
bpf: Annotate data races in bpf_local_storage
Kees Cook <[email protected]>
wifi: ath: Silence memcpy run-time false positive warning
Wei Chen <[email protected]>
media: mediatek: vcodec: Fix potential array out-of-bounds in decoder queue_setup
Laurent Pinchart <[email protected]>
media: Prefer designated initializers over memset for subdev pad ops
lyndonli <[email protected]>
drm/amdgpu: Fix sdma v4 sw fini error
Mario Limonciello <[email protected]>
drm/amd: Fix an out of bounds error in BIOS parser
Paul Hsieh <[email protected]>
drm/amd/display: Correct DML calculation to follow HW SPEC
Hans de Goede <[email protected]>
ACPI: video: Remove desktops without backlight DMI quirks
Shanker Donthineni <[email protected]>
irqchip/gicv3: Workaround for NVIDIA erratum T241-FABRIC-4
Konrad Dybcio <[email protected]>
arm64: dts: qcom: sdm845-polaris: Drop inexistent properties
void0red <[email protected]>
ACPICA: ACPICA: check null return of ACPI_ALLOCATE_ZEROED in acpi_db_display_objects
Tamir Duberstein <[email protected]>
ACPICA: Avoid undefined behavior: applying zero offset to null pointer
Douglas Anderson <[email protected]>
drm/msm/dp: Clean up handling of DP AUX interrupts
Nur Hussein <[email protected]>
drm/tegra: Avoid potential 32-bit integer overflow
Arnaud Pouliquen <[email protected]>
remoteproc: stm32_rproc: Add mutex protection for workqueue
Ayush Gupta <[email protected]>
drm/amd/display: fixed dcn30+ underflow issue
Armin Wolf <[email protected]>
ACPI: EC: Fix oops when removing custom query handlers
Pierre Gondois <[email protected]>
firmware: arm_sdei: Fix sleep from invalid context BUG
Sebastian Krzyszkowiak <[email protected]>
arm64: dts: imx8mq-librem5: Remove dis_u3_susphy_quirk from usb_dwc3_0
Zheng Wang <[email protected]>
memstick: r592: Fix UAF bug in r592_remove due to race condition
Toby Chen <[email protected]>
drm/rockchip: dw_hdmi: cleanup drm encoder during unbind
Kang Chen <[email protected]>
ACPI: processor: Check for null return of devm_kzalloc() in fch_misc_setup()
Tom Rix <[email protected]>
media: pvrusb2: VIDEO_PVRUSB2 depends on DVB_CORE to use dvb_* symbols
harperchen <[email protected]>
media: pci: tw68: Fix null-ptr-deref bug in buf prepare and finish
harperchen <[email protected]>
media: cx23885: Fix a null-ptr-deref bug in buffer_prepare() and buffer_finish()
Konrad Dybcio <[email protected]>
arm64: dts: qcom: msm8996: Add missing DWC3 quirks
Iuliana Prodan <[email protected]>
remoteproc: imx_dsp_rproc: Add custom memory copy implementation for i.MX DSP Cores
Alexander Stein <[email protected]>
regmap: cache: Return error in cache sync operations for REGCACHE_NONE
Rodrigo Siqueira <[email protected]>
drm/amd/display: Use DC_LOG_DC in the trasform pixel function
Gabe Teeger <[email protected]>
drm/amd/display: Enable HostVM based on rIOMMU active
Hans de Goede <[email protected]>
platform/x86: x86-android-tablets: Add Acer Iconia One 7 B1-750 data
Paul Hsieh <[email protected]>
drm/amd/display: Correct DML calculation to align HW formula
Ayush Gupta <[email protected]>
drm/amd/display: populate subvp cmd info only for the top pipe
Jani Nikula <[email protected]>
drm/displayid: add displayid_get_header() and check bounds better
Tetsuo Handa <[email protected]>
fs: hfsplus: remove WARN_ON() from hfsplus_cat_{read,write}_inode()
Christian Brauner <[email protected]>
open: return EINVAL for O_DIRECTORY | O_CREAT
Zqiang <[email protected]>
rcu: Protect rcu_print_task_exp_stall() ->exp_tasks access
Ivan Orlov <[email protected]>
selftests: cgroup: Add 'malloc' failures checks in test_memcontrol
Paul E. McKenney <[email protected]>
refscale: Move shutdown from wait_event() to wait_event_idle()
Theodore Ts'o <[email protected]>
ext4: allow ext4_get_group_info() to fail
Kemeng Shi <[email protected]>
ext4: allow to find by goal if EXT4_MB_HINT_GOAL_ONLY is set
Theodore Ts'o <[email protected]>
ext4: don't clear SB_RDONLY when remounting r/w until quota is re-enabled
Theodore Ts'o <[email protected]>
ext4: reflect error codes from ext4_multi_mount_protect() to its callers
Zongjie Li <[email protected]>
fbdev: arcfb: Fix error handling in arcfb_probe()
Jani Nikula <[email protected]>
drm/i915: taint kernel when force probing unsupported devices
Rodrigo Vivi <[email protected]>
drm/i915: Expand force_probe to block probe of devices as well.
Nikita Zhandarovich <[email protected]>
drm/i915/dp: prevent potential div-by-zero
Stanislav Lisovskiy <[email protected]>
drm/i915: Fix NULL ptr deref by checking new_crtc_state
John Harrison <[email protected]>
drm/i915/guc: Don't capture Gen8 regs on Xe devices
Kuniyuki Iwashima <[email protected]>
af_unix: Fix data races around sk->sk_shutdown.
Kuniyuki Iwashima <[email protected]>
af_unix: Fix a data race of sk->sk_receive_queue->qlen.
Eric Dumazet <[email protected]>
net: datagram: fix data-races in datagram_poll()
Colin Foster <[email protected]>
net: mscc: ocelot: fix stat counter register values
t.feng <[email protected]>
ipvlan:Fix out-of-bounds caused by unclear skb->cb
Ziwei Xiao <[email protected]>
gve: Remove the code of clearing PBA bit
Eric Dumazet <[email protected]>
tcp: add annotations around sk->sk_shutdown accesses
Eric Dumazet <[email protected]>
net: add vlan_get_protocol_and_depth() helper
Eric Dumazet <[email protected]>
net: deal with most data-races in sk_wait_event()
Eric Dumazet <[email protected]>
net: annotate sk->sk_err write from do_recvmmsg()
Eric Dumazet <[email protected]>
netlink: annotate accesses to nlk->cb_running
Hangbin Liu <[email protected]>
bonding: fix send_peer_notif overflow
Florian Westphal <[email protected]>
netfilter: conntrack: fix possible bug_on with enable_hooks=1
Florian Westphal <[email protected]>
netfilter: nf_tables: always release netdev hooks from notifier
Florian Fainelli <[email protected]>
net: phy: bcm7xx: Correct read from expansion register
Kuniyuki Iwashima <[email protected]>
net: Fix load-tearing on sk->sk_stamp in sock_recv_cmsgs().
Marek Vasut <[email protected]>
net: stmmac: Initialize MAC_ONEUS_TIC_COUNTER register
Roy Novich <[email protected]>
linux/dim: Do nothing if no time delta between samples
Thomas Gleixner <[email protected]>
tick/broadcast: Make broadcast device replacement work correctly
Keoseong Park <[email protected]>
scsi: ufs: core: Fix I/O hang that occurs when BKOPS fails in W-LUN suspend
Christophe JAILLET <[email protected]>
net: mdio: mvusb: Fix an error handling path in mvusb_mdio_probe()
Eric Dumazet <[email protected]>
net: skb_partial_csum_set() fix against transport header magic value
Randy Dunlap <[email protected]>
ARM: 9296/1: HP Jornada 7XX: fix kernel-doc warnings
Saravana Kannan <[email protected]>
drm/mipi-dsi: Set the fwnode for mipi_dsi_device
Sui Jingfeng <[email protected]>
drm/fbdev-generic: prohibit potential out-of-bounds access
-------------
Diffstat:
Documentation/arm64/silicon-errata.rst | 2 +
.../devicetree/bindings/ata/ceva,ahci-1v84.yaml | 2 +-
.../bindings/display/msm/dsi-controller-main.yaml | 12 +
MAINTAINERS | 4 +-
Makefile | 4 +-
arch/arm/mach-sa1100/jornada720_ssp.c | 5 +-
arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi | 1 -
arch/arm64/boot/dts/qcom/msm8996.dtsi | 3 +
arch/arm64/boot/dts/qcom/sdm845-xiaomi-polaris.dts | 2 -
arch/arm64/kernel/mte.c | 7 +-
arch/parisc/include/asm/pdc.h | 1 +
arch/parisc/kernel/firmware.c | 27 +-
arch/powerpc/kernel/dma-iommu.c | 4 +-
arch/powerpc/kernel/iommu.c | 11 +-
arch/powerpc/mm/book3s64/radix_pgtable.c | 4 +-
arch/powerpc/platforms/pseries/iommu.c | 13 +-
arch/riscv/kernel/probes/Makefile | 2 +
arch/s390/crypto/chacha-glue.c | 2 +-
arch/s390/kernel/Makefile | 1 +
arch/x86/kernel/Makefile | 1 +
block/bfq-iosched.c | 2 +
crypto/jitterentropy-kcapi.c | 51 ++--
crypto/jitterentropy.c | 144 ++++------
crypto/jitterentropy.h | 1 -
crypto/testmgr.c | 266 +++++++++++-------
drivers/acpi/acpi_apd.c | 2 +
drivers/acpi/acpica/dbnames.c | 3 +
drivers/acpi/acpica/dswstate.c | 11 +-
drivers/acpi/ec.c | 1 +
drivers/acpi/video_detect.c | 35 ---
drivers/base/platform.c | 4 +-
drivers/base/regmap/regcache.c | 6 +
drivers/block/nbd.c | 6 +
drivers/block/null_blk/main.c | 5 +
drivers/bluetooth/btbcm.c | 47 +++-
drivers/bluetooth/btintel.c | 5 +-
drivers/bluetooth/btrtl.c | 138 +++++++++-
drivers/bluetooth/btrtl.h | 5 +
drivers/bluetooth/btusb.c | 6 +
drivers/bluetooth/hci_h5.c | 4 +
drivers/char/tpm/tpm_tis.c | 16 ++
drivers/firmware/arm_sdei.c | 37 +--
drivers/firmware/smccc/smccc.c | 26 ++
drivers/firmware/smccc/soc_id.c | 28 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 8 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 26 +-
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 8 +-
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 36 ++-
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 21 +-
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 7 +
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 2 +-
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 7 +-
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 3 +-
drivers/gpu/drm/amd/display/dc/dce/dce_transform.c | 5 +-
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c | 3 +-
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c | 2 +-
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c | 2 +-
.../amd/display/dc/dml/dcn30/display_mode_vba_30.c | 2 +-
.../amd/display/dc/dml/dcn31/display_mode_vba_31.c | 300 ++++++++++++++-------
.../gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c | 4 +
.../display/dc/dml/dcn314/display_mode_vba_314.c | 300 ++++++++++++++-------
.../amd/display/dc/dml/dcn32/display_mode_vba_32.c | 2 +-
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 18 ++
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 20 +-
.../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 1 +
drivers/gpu/drm/drm_displayid.c | 17 +-
drivers/gpu/drm/drm_fb_helper.c | 16 +-
drivers/gpu/drm/drm_mipi_dsi.c | 2 +-
drivers/gpu/drm/exynos/exynos_drm_g2d.h | 4 +-
drivers/gpu/drm/i915/Kconfig | 25 +-
drivers/gpu/drm/i915/display/intel_atomic_plane.c | 4 +-
drivers/gpu/drm/i915/display/intel_dp.c | 5 +
drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c | 7 +-
drivers/gpu/drm/i915/i915_params.c | 2 +-
drivers/gpu/drm/i915/i915_pci.c | 39 ++-
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c | 5 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 5 -
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c | 1 +
drivers/gpu/drm/msm/disp/dpu1/dpu_hwio.h | 3 -
drivers/gpu/drm/msm/dp/dp_audio.c | 12 +
drivers/gpu/drm/msm/dp/dp_audio.h | 2 +
drivers/gpu/drm/msm/dp/dp_aux.c | 80 +++---
drivers/gpu/drm/msm/dp/dp_catalog.c | 2 +-
drivers/gpu/drm/msm/dp/dp_catalog.h | 2 +-
drivers/gpu/drm/msm/dp/dp_display.c | 1 +
drivers/gpu/drm/msm/msm_gem_submit.c | 25 +-
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 1 +
drivers/gpu/drm/tegra/sor.c | 2 +-
drivers/hid/hid-apple.c | 19 +-
drivers/hid/hid-ids.h | 1 +
drivers/hid/hid-input.c | 2 +
drivers/hid/hid-logitech-hidpp.c | 53 +++-
drivers/hid/wacom_wac.c | 33 +--
drivers/irqchip/Kconfig | 1 +
drivers/irqchip/irq-gic-v3.c | 115 +++++++-
drivers/mcb/mcb-pci.c | 27 +-
drivers/md/md.c | 18 +-
drivers/media/pci/cx23885/cx23885-core.c | 4 +-
drivers/media/pci/cx23885/cx23885-video.c | 13 +-
drivers/media/pci/netup_unidvb/netup_unidvb_core.c | 2 +-
drivers/media/pci/tw68/tw68-video.c | 16 +-
.../platform/mediatek/vcodec/mtk_vcodec_dec.c | 7 +
drivers/media/platform/renesas/vsp1/vsp1_drm.c | 18 +-
drivers/media/platform/renesas/vsp1/vsp1_entity.c | 11 +-
.../platform/samsung/exynos4-is/fimc-capture.c | 7 +-
drivers/media/platform/ti/am437x/am437x-vpfe.c | 15 +-
drivers/media/platform/ti/cal/cal-video.c | 8 +-
drivers/media/usb/dvb-usb/cxusb-analog.c | 14 +-
drivers/media/usb/pvrusb2/Kconfig | 2 +-
drivers/memstick/host/r592.c | 2 +-
drivers/message/fusion/mptlan.c | 2 +
drivers/mfd/dln2.c | 1 +
drivers/mfd/intel-lpss-pci.c | 15 ++
drivers/mfd/intel_soc_pmic_chtwc.c | 14 +-
drivers/misc/lkdtm/stackleak.c | 6 +
drivers/net/bonding/bond_netlink.c | 7 +-
drivers/net/bonding/bond_options.c | 8 +-
drivers/net/can/dev/skb.c | 3 +-
drivers/net/can/kvaser_pciefd.c | 51 ++--
drivers/net/dsa/mv88e6xxx/port.h | 2 +-
drivers/net/dsa/rzn1_a5psw.c | 83 ++++--
drivers/net/dsa/rzn1_a5psw.h | 3 +-
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +-
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 9 +-
drivers/net/ethernet/freescale/fec_main.c | 15 +-
drivers/net/ethernet/google/gve/gve_main.c | 13 -
.../hisilicon/hns3/hns3_common/hclge_comm_cmd.c | 25 +-
.../hisilicon/hns3/hns3_common/hclge_comm_cmd.h | 8 +-
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c | 2 +-
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.h | 1 +
.../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 15 +-
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 4 +-
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h | 5 +
.../ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 5 +-
drivers/net/ethernet/intel/ice/ice_main.c | 2 +-
drivers/net/ethernet/intel/ice/ice_sriov.c | 24 +-
drivers/net/ethernet/intel/ice/ice_vf_lib.c | 31 ++-
drivers/net/ethernet/intel/ice/ice_vf_lib.h | 6 +-
drivers/net/ethernet/intel/ice/ice_virtchnl.c | 1 +
drivers/net/ethernet/intel/igb/e1000_mac.c | 4 +-
drivers/net/ethernet/mscc/vsc7514_regs.c | 18 +-
drivers/net/ethernet/pasemi/pasemi_mac.c | 2 +-
drivers/net/ethernet/sfc/ef100_netdev.c | 4 +-
drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 1 +
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 5 +
drivers/net/ethernet/sun/cassini.c | 2 +
drivers/net/ipvlan/ipvlan_core.c | 6 +
drivers/net/mdio/mdio-mvusb.c | 11 +-
drivers/net/pcs/pcs-xpcs.c | 2 +-
drivers/net/phy/bcm-phy-lib.h | 5 +
drivers/net/phy/bcm7xxx.c | 2 +-
drivers/net/phy/dp83867.c | 22 +-
drivers/net/tap.c | 4 +-
drivers/net/tun.c | 80 +++---
drivers/net/virtio_net.c | 61 +++--
drivers/net/wireless/ath/ath.h | 12 +-
drivers/net/wireless/ath/ath11k/dp.c | 4 +-
drivers/net/wireless/ath/ath11k/dp_rx.c | 17 +-
drivers/net/wireless/ath/ath11k/peer.h | 1 +
drivers/net/wireless/ath/key.c | 2 +-
.../broadcom/brcm80211/brcmfmac/cfg80211.c | 13 +-
.../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 32 +++
drivers/net/wireless/intel/iwlwifi/dvm/sta.c | 5 +-
drivers/net/wireless/intel/iwlwifi/fw/acpi.c | 2 +-
drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 19 +-
drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 2 +-
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 6 +-
drivers/net/wireless/intel/iwlwifi/mvm/nvm.c | 10 +
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 2 +-
drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 37 ++-
drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 4 +
drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 2 +-
.../net/wireless/mediatek/mt76/mt76_connac2_mac.h | 2 +-
.../net/wireless/mediatek/mt76/mt76_connac_mac.c | 3 +-
drivers/net/wireless/realtek/rtw88/mac80211.c | 2 +-
drivers/net/wireless/realtek/rtw88/main.c | 15 ++
drivers/net/wireless/realtek/rtw88/main.h | 3 +
drivers/net/wwan/iosm/iosm_ipc_imem.c | 27 +-
drivers/net/wwan/iosm/iosm_ipc_imem_ops.c | 12 +-
drivers/net/wwan/iosm/iosm_ipc_imem_ops.h | 6 +-
drivers/parisc/power.c | 16 +-
drivers/phy/st/phy-miphy28lp.c | 42 +--
drivers/platform/x86/Kconfig | 43 +--
drivers/platform/x86/Makefile | 4 +-
drivers/platform/x86/hp/Kconfig | 63 +++++
drivers/platform/x86/hp/Makefile | 10 +
drivers/platform/x86/{ => hp}/hp-wmi.c | 1 +
drivers/platform/x86/{ => hp}/hp_accel.c | 2 +-
drivers/platform/x86/{ => hp}/tc1100-wmi.c | 0
drivers/platform/x86/x86-android-tablets.c | 101 ++++++-
drivers/remoteproc/imx_dsp_rproc.c | 187 ++++++++++++-
drivers/remoteproc/stm32_rproc.c | 8 +
drivers/s390/block/dasd_eckd.c | 33 ++-
drivers/s390/cio/device.c | 2 +
drivers/s390/cio/qdio.h | 2 +-
drivers/scsi/lpfc/lpfc_debugfs.c | 7 +-
drivers/scsi/lpfc/lpfc_els.c | 24 +-
drivers/scsi/storvsc_drv.c | 8 +-
drivers/soundwire/bus.c | 15 +-
drivers/soundwire/dmi-quirks.c | 25 ++
drivers/soundwire/qcom.c | 3 +
drivers/spi/spi-imx.c | 24 +-
drivers/staging/axis-fifo/axis-fifo.c | 28 +-
drivers/staging/media/imx/imx-media-capture.c | 12 +-
drivers/staging/media/imx/imx-media-utils.c | 8 +-
drivers/staging/media/omap4iss/iss_video.c | 6 +-
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 6 +-
drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 5 -
drivers/target/iscsi/iscsi_target.c | 6 +-
drivers/thunderbolt/nhi.c | 29 +-
drivers/thunderbolt/nhi_regs.h | 2 +
drivers/tty/serial/8250/8250_bcm7271.c | 7 +-
drivers/tty/serial/8250/8250_core.c | 1 +
drivers/tty/serial/8250/8250_exar.c | 17 ++
drivers/tty/serial/8250/8250_pci.c | 5 +
drivers/tty/serial/arc_uart.c | 7 +-
drivers/tty/serial/qcom_geni_serial.c | 9 +-
drivers/tty/vt/vc_screen.c | 11 +-
drivers/ufs/core/ufshcd.c | 10 +-
drivers/ufs/host/ufshcd-pci.c | 1 +
drivers/usb/class/usbtmc.c | 2 +
drivers/usb/dwc3/debugfs.c | 109 ++++++++
drivers/usb/dwc3/gadget.c | 67 ++---
drivers/usb/gadget/function/u_ether.c | 3 +
drivers/usb/gadget/udc/core.c | 151 +++--------
drivers/usb/host/uhci-pci.c | 10 +-
drivers/usb/host/xhci-pci.c | 12 +-
drivers/usb/host/xhci-ring.c | 29 +-
drivers/usb/host/xhci.h | 2 +-
drivers/usb/storage/scsiglue.c | 28 +-
drivers/usb/typec/altmodes/displayport.c | 4 +
drivers/usb/typec/tcpm/tcpm.c | 16 +-
drivers/usb/typec/ucsi/ucsi_acpi.c | 44 ++-
drivers/video/fbdev/arcfb.c | 15 +-
fs/ceph/snap.c | 13 +
fs/cifs/cifsglob.h | 4 +-
fs/cifs/file.c | 26 +-
fs/cifs/smb1ops.c | 9 +-
fs/cifs/smb2ops.c | 7 +-
fs/ext2/ext2.h | 1 +
fs/ext2/super.c | 7 +
fs/ext4/balloc.c | 18 +-
fs/ext4/ext4.h | 15 +-
fs/ext4/ialloc.c | 12 +-
fs/ext4/mballoc.c | 131 ++++++---
fs/ext4/mmp.c | 9 +-
fs/ext4/super.c | 24 +-
fs/f2fs/checkpoint.c | 12 +-
fs/f2fs/data.c | 3 +-
fs/f2fs/f2fs.h | 5 +
fs/f2fs/gc.c | 10 +-
fs/f2fs/gc.h | 2 +
fs/f2fs/segment.h | 39 ++-
fs/f2fs/super.c | 2 +-
fs/gfs2/glops.c | 3 +-
fs/hfsplus/inode.c | 28 +-
fs/ksmbd/connection.c | 3 +-
fs/ksmbd/oplock.c | 5 +-
fs/ksmbd/oplock.h | 2 +-
fs/ksmbd/smb2misc.c | 5 +-
fs/ksmbd/smb2pdu.c | 19 +-
fs/nilfs2/inode.c | 18 ++
fs/open.c | 18 +-
fs/statfs.c | 4 +-
include/linux/arm-smccc.h | 18 ++
include/linux/cpuhotplug.h | 1 -
include/linux/dim.h | 3 +-
include/linux/if_vlan.h | 17 ++
include/linux/netdevice.h | 1 +
include/linux/platform_device.h | 11 +
include/linux/sched/task_stack.h | 2 +-
include/linux/sunrpc/svc_rdma.h | 2 +-
include/linux/sunrpc/svc_xprt.h | 2 +-
include/net/bluetooth/hci.h | 15 ++
include/net/bonding.h | 2 +-
include/net/ip_vs.h | 6 +-
include/net/sock.h | 2 +-
include/uapi/asm-generic/fcntl.h | 1 -
kernel/bpf/bpf_local_storage.c | 16 +-
kernel/bpf/verifier.c | 4 +
kernel/rcu/refscale.c | 2 +-
kernel/rcu/tree_exp.h | 6 +-
kernel/time/tick-broadcast.c | 120 ++++++---
kernel/trace/rethook.c | 4 +-
lib/cpu_rmap.c | 5 +-
lib/dim/dim.c | 5 +-
lib/dim/net_dim.c | 3 +-
lib/dim/rdma_dim.c | 3 +-
lib/maple_tree.c | 12 +-
mm/zswap.c | 16 ++
net/8021q/vlan_dev.c | 4 +-
net/bluetooth/hci_event.c | 9 +-
net/bluetooth/hci_sync.c | 6 +-
net/bluetooth/l2cap_core.c | 1 -
net/bridge/br_forward.c | 2 +-
net/bridge/br_private_tunnel.h | 8 +-
net/can/isotp.c | 2 +-
net/can/j1939/socket.c | 2 +-
net/core/datagram.c | 15 +-
net/core/dev.c | 4 +-
net/core/skbuff.c | 4 +-
net/core/stream.c | 12 +-
net/ipv4/af_inet.c | 2 +-
net/ipv4/tcp.c | 14 +-
net/ipv4/tcp_bpf.c | 2 +-
net/ipv4/tcp_input.c | 4 +-
net/ipv4/tcp_ipv4.c | 5 +-
net/ipv6/ip6_gre.c | 13 +-
net/key/af_key.c | 12 +-
net/llc/af_llc.c | 8 +-
net/mac80211/cfg.c | 3 +-
net/mac80211/trace.h | 2 +-
net/mac80211/tx.c | 5 +-
net/netfilter/core.c | 6 +-
net/netfilter/ipvs/ip_vs_sync.c | 2 +-
net/netfilter/nf_conntrack_standalone.c | 3 +-
net/netfilter/nf_tables_api.c | 4 +-
net/netfilter/nft_chain_filter.c | 9 +-
net/netfilter/nft_set_rbtree.c | 20 +-
net/netlink/af_netlink.c | 8 +-
net/nsh/nsh.c | 8 +-
net/packet/af_packet.c | 6 +-
net/smc/smc_close.c | 4 +-
net/smc/smc_rx.c | 4 +-
net/smc/smc_tx.c | 4 +-
net/socket.c | 2 +-
net/sunrpc/svc.c | 2 +-
net/sunrpc/svc_xprt.c | 24 +-
net/sunrpc/svcsock.c | 30 ++-
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 11 +-
net/sunrpc/xprtrdma/svc_rdma_transport.c | 2 +-
net/tipc/bearer.c | 17 +-
net/tipc/bearer.h | 3 +
net/tipc/link.c | 9 +-
net/tipc/socket.c | 4 +-
net/tipc/udp_media.c | 5 +-
net/tls/tls_main.c | 3 +-
net/unix/af_unix.c | 22 +-
net/vmw_vsock/af_vsock.c | 2 +-
net/wireless/scan.c | 6 +-
net/xfrm/xfrm_interface.c | 54 +---
net/xfrm/xfrm_policy.c | 9 -
net/xfrm/xfrm_user.c | 14 +-
samples/bpf/hbm.c | 1 +
scripts/recordmcount.c | 6 +-
sound/firewire/digi00x/digi00x-stream.c | 4 +-
sound/pci/hda/hda_generic.c | 7 +-
sound/pci/hda/hda_intel.c | 3 +
sound/pci/hda/patch_hdmi.c | 5 +
sound/pci/hda/patch_realtek.c | 14 +-
sound/soc/amd/yc/acp6x-mach.c | 21 ++
sound/soc/fsl/fsl_micfil.c | 14 +-
sound/soc/mediatek/mt8186/mt8186-afe-clk.c | 6 -
sound/soc/mediatek/mt8186/mt8186-afe-clk.h | 1 -
sound/soc/mediatek/mt8186/mt8186-afe-pcm.c | 4 -
sound/soc/mediatek/mt8186/mt8186-audsys-clk.c | 46 ++--
sound/soc/mediatek/mt8186/mt8186-audsys-clk.h | 1 -
sound/soc/sof/topology.c | 4 +
sound/usb/format.c | 1 +
tools/include/uapi/asm-generic/fcntl.h | 1 -
.../cpupower/utils/idle_monitor/mperf_monitor.c | 31 +--
tools/testing/selftests/cgroup/test_memcontrol.c | 15 ++
tools/testing/selftests/net/fib_nexthops.sh | 2 +-
.../selftests/net/srv6_end_dt4_l3vpn_test.sh | 17 +-
virt/kvm/kvm_main.c | 16 +-
365 files changed, 4070 insertions(+), 1817 deletions(-)Greg Kroah-Hartman
maintainerPATCH 1/292 drm/fbdev-generic: prohibit potential out-of-bounds access
From: Sui Jingfeng <[email protected]>
[ Upstream commit c8687694bb1f5c48134f152f8c5c2e53483eb99d ]
The fbdev test of IGT may write after EOF, which lead to out-of-bound access for drm drivers with fbdev-generic. For example, run fbdev test on a x86+ast2400 platform, with 1680x1050 resolution, will cause the linux kernel hang with the following call trace:
Oops: 0000 [#1] PREEMPT SMP PTI [IGT] fbdev: starting subtest eof Workqueue: events drm_fb_helper_damage_work [drm_kms_helper] [IGT] fbdev: starting subtest nullptr RIP: 0010:memcpy_erms+0xa/0x20 RSP: 0018:ffffa17d40167d98 EFLAGS: 00010246 RAX: ffffa17d4eb7fa80 RBX: ffffa17d40e0aa80 RCX: 00000000000014c0 RDX: 0000000000001a40 RSI: ffffa17d40e0b000 RDI: ffffa17d4eb80000 RBP: ffffa17d40167e20 R08: 0000000000000000 R09: ffff89522ecff8c0 R10: ffffa17d4e4c5000 R11: 0000000000000000 R12: ffffa17d4eb7fa80 R13: 0000000000001a40 R14: 000000000000041a R15: ffffa17d40167e30 FS: 0000000000000000(0000) GS:ffff895257380000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffa17d40e0b000 CR3: 00000001eaeca006 CR4: 00000000001706e0 Call Trace: <TASK> ? drm_fbdev_generic_helper_fb_dirty+0x207/0x330 [drm_kms_helper] drm_fb_helper_damage_work+0x8f/0x170 [drm_kms_helper] process_one_work+0x21f/0x430 worker_thread+0x4e/0x3c0 ? __pfx_worker_thread+0x10/0x10 kthread+0xf4/0x120 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x2c/0x50 </TASK> CR2: ffffa17d40e0b000 ---[ end trace 0000000000000000 ]---
The is because damage rectangles computed by drm_fb_helper_memory_range_to_clip() function is not guaranteed to be bound in the screen's active display area. Possible reasons are:
1) Buffers are allocated in the granularity of page size, for mmap system call support. The shadow screen buffer consumed by fbdev emulation may also choosed be page size aligned.
2) The DIV_ROUND_UP() used in drm_fb_helper_memory_range_to_clip() will introduce off-by-one error.
For example, on a 16KB page size system, in order to store a 1920x1080 XRGB framebuffer, we need allocate 507 pages. Unfortunately, the size 1920*1080*4 can not be divided exactly by 16KB.
1920 * 1080 * 4 = 8294400 bytes
506 * 16 * 1024 = 8290304 bytes
507 * 16 * 1024 = 8306688 bytes
line_length = 1920*4 = 7680 bytes
507 * 16 * 1024 / 7680 = 1081.6
off / line_length = 507 * 16 * 1024 / 7680 = 1081 DIV_ROUND_UP(507 * 16 * 1024, 7680) will yeild 1082
memcpy_toio() typically issue the copy line by line, when copy the last line, out-of-bound access will be happen. Because:
1082 * line_length = 1082 * 7680 = 8309760, and 8309760 > 8306688
Note that userspace may still write to the invisiable area if a larger buffer than width x stride is exposed. But it is not a big issue as long as there still have memory resolve the access if not drafting so far.
- Also limit the y1 (Daniel)
- keep fix patch it to minimal (Daniel)
- screen_size is page size aligned because of it need mmap (Thomas)
- Adding fixes tag (Thomas)
--- drivers/gpu/drm/drm_fb_helper.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +12 -4
@@ -708,19 +708,27 @@ static void drm_fb_helper_damage(struct fb_info *info, u32 x, u32 y,static void drm_fb_helper_memory_range_to_clip (struct fb_info *info,off_t off,size_t len,struct drm_rect *clip) { +u32 line_length = info->fix.line_length; +u32 fb_height = info->var.yres;off_t end = off + len;u32 x1 =0 ; -u32 y1 = off / info->fix.line_length; +u32 y1 = off / line_length;u32 x2 = info->var.xres; -u32 y2 =DIV_ROUND_UP (end, info->fix.line_length); +u32 y2 =DIV_ROUND_UP (end, line_length); + +/* Don't allow any of them beyond the bottom bound of display area */ +if (y1 > fb_height) + y1 = fb_height; +if (y2 > fb_height) + y2 = fb_height;if ((y2 - y1) ==1 ) {/* * We've only written to a single scanline. Try to reduce * the number of horizontal pixels that need an update. */ -off_t bit_off = (off % info->fix.line_length) *8 ; -off_t bit_end = (end % info->fix.line_length) *8 ; +off_t bit_off = (off % line_length) *8 ; +off_t bit_end = (end % line_length) *8 ; x1 = bit_off / info->var.bits_per_pixel; x2 =DIV_ROUND_UP (bit_end, info->var.bits_per_pixel);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 2/292 drm/mipi-dsi: Set the fwnode for mipi_dsi_device
In reply to Greg Kroah-HartmanFrom: Saravana Kannan <[email protected]>
[ Upstream commit a26cc2934331b57b5a7164bff344f0a2ec245fc0 ]
After commit 3fb16866b51d ("driver core: fw_devlink: Make cycle detection more robust"), fw_devlink prints an error when consumer devices don't have their fwnode set. This used to be ignored silently.
Set the fwnode mipi_dsi_device so fw_devlink can find them and properly track their dependencies.
This fixes errors like this:
[ 0.334054] nwl-dsi 30a00000.mipi-dsi: Failed to create device link with regulator-lcd-1v8 [ 0.346964] nwl-dsi 30a00000.mipi-dsi: Failed to create device link with backlight-dsi
--- drivers/gpu/drm/drm_mipi_dsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_mipi_dsi.c +1 -1
@@ -221,7 +221,7 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,return dsi; } - dsi->dev.of_node = info->node; +device_set_node (&dsi->dev,of_fwnode_handle (info->node)); dsi->channel = info->channel;strlcpy (dsi->name, info->type,sizeof (dsi->name));
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 3/292 ARM: 9296/1: HP Jornada 7XX: fix kernel-doc warnings
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 46dd6078dbc7e363a8bb01209da67015a1538929 ]
Fix kernel-doc warnings from the kernel test robot:
jornada720_ssp.c:24: warning: Function parameter or member 'jornada_ssp_lock' not described in 'DEFINE_SPINLOCK' jornada720_ssp.c:24: warning: expecting prototype for arch/arm/mac(). Prototype was for DEFINE_SPINLOCK() instead jornada720_ssp.c:34: warning: Function parameter or member 'byte' not described in 'jornada_ssp_reverse' jornada720_ssp.c:57: warning: Function parameter or member 'byte' not described in 'jornada_ssp_byte' jornada720_ssp.c:85: warning: Function parameter or member 'byte' not described in 'jornada_ssp_inout'
--- arch/arm/mach-sa1100/jornada720_ssp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/mach-sa1100/jornada720_ssp.c +4 -1
@@ -1,5 +1,5 @@// SPDX-License-Identifier: GPL-2.0-only -/** +/* * arch/arm/mac-sa1100/jornada720_ssp.c * * Copyright (C) 2006/2007 Kristoffer Ericson <[email protected]>
@@ -26,6 +26,7 @@ static unsigned long jornada_ssp_flags;/** * jornada_ssp_reverse - reverses input byte +* @byte: input byte to reverse * * we need to reverse all data we receive from the mcu due to its physical location * returns : 01110111 -> 11101110
@@ -46,6 +47,7 @@ EXPORT_SYMBOL(jornada_ssp_reverse);/** * jornada_ssp_byte - waits for ready ssp bus and sends byte +* @byte: input byte to transmit * * waits for fifo buffer to clear and then transmits, if it doesn't then we will * timeout after <timeout> rounds. Needs mcu running before its called.
@@ -77,6 +79,7 @@ EXPORT_SYMBOL(jornada_ssp_byte);/** * jornada_ssp_inout - decide if input is command or trading byte +* @byte: input byte to send (may be %TXDUMMY) * * returns : (jornada_ssp_byte(byte)) on success * : %-ETIMEDOUT on timeout failure
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 4/292 net: skb_partial_csum_set() fix against transport header magic value
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 424f8416bb39936df6365442d651ee729b283460 ]
skb->transport_header uses the special 0xFFFF value to mark if the transport header was set or not.
We must prevent callers to accidentaly set skb->transport_header to 0xFFFF. Note that only fuzzers can possibly do this today.
syzbot reported:
WARNING: CPU: 0 PID: 2340 at include/linux/skbuff.h:2847 skb_transport_offset include/linux/skbuff.h:2956 [inline] WARNING: CPU: 0 PID: 2340 at include/linux/skbuff.h:2847 virtio_net_hdr_to_skb+0xbcc/0x10c0 include/linux/virtio_net.h:103 Modules linked in: CPU: 0 PID: 2340 Comm: syz-executor.0 Not tainted 6.3.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023 RIP: 0010:skb_transport_header include/linux/skbuff.h:2847 [inline] RIP: 0010:skb_transport_offset include/linux/skbuff.h:2956 [inline] RIP: 0010:virtio_net_hdr_to_skb+0xbcc/0x10c0 include/linux/virtio_net.h:103 Code: 41 39 df 0f 82 c3 04 00 00 48 8b 7c 24 10 44 89 e6 e8 08 6e 59 ff 48 85 c0 74 54 e8 ce 36 7e fc e9 37 f8 ff ff e8 c4 36 7e fc <0f> 0b e9 93 f8 ff ff 44 89 f7 44 89 e6 e8 32 38 7e fc 45 39 e6 0f RSP: 0018:ffffc90004497880 EFLAGS: 00010293 RAX: ffffffff84fea55c RBX: 000000000000ffff RCX: ffff888120be2100 RDX: 0000000000000000 RSI: 000000000000ffff RDI: 000000000000ffff RBP: ffffc90004497990 R08: ffffffff84fe9de5 R09: 0000000000000034 R10: ffffea00048ebd80 R11: 0000000000000034 R12: ffff88811dc2d9c8 R13: dffffc0000000000 R14: ffff88811dc2d9ae R15: 1ffff11023b85b35 FS: 00007f9211a59700(0000) GS:ffff8881f6c00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000200002c0 CR3: 00000001215a5000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> packet_snd net/packet/af_packet.c:3076 [inline] packet_sendmsg+0x4590/0x61a0 net/packet/af_packet.c:3115 sock_sendmsg_nosec net/socket.c:724 [inline] sock_sendmsg net/socket.c:747 [inline] __sys_sendto+0x472/0x630 net/socket.c:2144 __do_sys_sendto net/socket.c:2156 [inline] __se_sys_sendto net/socket.c:2152 [inline] __x64_sys_sendto+0xe5/0x100 net/socket.c:2152 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2f/0x50 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f9210c8c169 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f9211a59168 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 00007f9210dabf80 RCX: 00007f9210c8c169 RDX: 000000000000ffed RSI: 00000000200000c0 RDI: 0000000000000003 RBP: 00007f9210ce7ca1 R08: 0000000020000540 R09: 0000000000000014 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe135d65cf R14: 00007f9211a59300 R15: 0000000000022000
--- net/core/skbuff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/skbuff.c +2 -2
@@ -5053,7 +5053,7 @@ bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off)u32 csum_end = (u32 )start + (u32 )off +sizeof (__sum16);u32 csum_start =skb_headroom (skb) + (u32 )start; -if (unlikely (csum_start >U16_MAX || csum_end >skb_headlen (skb))) { +if (unlikely (csum_start >=U16_MAX || csum_end >skb_headlen (skb))) {net_warn_ratelimited ("bad partial csum: csum=%u/%u headroom=%u headlen=%u\n" , start, off,skb_headroom (skb),skb_headlen (skb));return false;
@@ -5061,7 +5061,7 @@ bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off) skb->ip_summed =CHECKSUM_PARTIAL ; skb->csum_start = csum_start; skb->csum_offset = off; -skb_set_transport_header (skb, start); + skb->transport_header = csum_start;return true; }EXPORT_SYMBOL_GPL (skb_partial_csum_set);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 5/292 net: mdio: mvusb: Fix an error handling path in mvusb_mdio_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 27c1eaa07283b0c94becf8241f95368267cf558b ]
Should of_mdiobus_register() fail, a previous usb_get_dev() call should be undone as in the .disconnect function.
--- drivers/net/mdio/mdio-mvusb.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/mdio/mdio-mvusb.c +10 -1
@@ -73,6 +73,7 @@ static int mvusb_mdio_probe(struct usb_interface *interface,struct device *dev = &interface->dev;struct mvusb_mdio *mvusb;struct mii_bus *mdio; +int ret; mdio =devm_mdiobus_alloc_size (dev,sizeof (*mvusb));if (!mdio)
@@ -93,7 +94,15 @@ static int mvusb_mdio_probe(struct usb_interface *interface, mdio->write = mvusb_mdio_write;usb_set_intfdata (interface, mvusb); -return of_mdiobus_register (mdio, dev->of_node); + ret =of_mdiobus_register (mdio, dev->of_node); +if (ret) + goto put_dev; + +return 0 ; + +put_dev: +usb_put_dev (mvusb->udev); +return ret; }static void mvusb_mdio_disconnect (struct usb_interface *interface)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 6/292 scsi: ufs: core: Fix I/O hang that occurs when BKOPS fails in W-LUN suspend
In reply to Greg Kroah-HartmanFrom: Keoseong Park <[email protected]>
[ Upstream commit 1a7edd041f2d252f251523ba3f2eaead076a8f8d ]
Even when urgent BKOPS fails, the consumer will get stuck in runtime suspend status. Like commit 1a5665fc8d7a ("scsi: ufs: core: WLUN suspend SSU/enter hibern8 fail recovery"), trigger the error handler and return -EBUSY to break the suspend.
--- drivers/ufs/core/ufshcd.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/ufs/core/ufshcd.c +9 -1
@@ -9058,8 +9058,16 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)* that performance might be impacted. */ ret =ufshcd_urgent_bkops (hba); -if (ret) +if (ret) { +/* +* If return err in suspend flow, IO will hang. +* Trigger error handler and break suspend for +* error recovery. +*/ +ufshcd_force_error_recovery (hba); + ret = -EBUSY ; goto enable_scaling; + } }else {/* make sure that auto bkops is disabled */ ufshcd_disable_auto_bkops (hba);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 7/292 tick/broadcast: Make broadcast device replacement work correctly
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
[ Upstream commit f9d36cf445ffff0b913ba187a3eff78028f9b1fb ]
When a tick broadcast clockevent device is initialized for one shot mode then tick_broadcast_setup_oneshot() OR's the periodic broadcast mode cpumask into the oneshot broadcast cpumask.
This is required when switching from periodic broadcast mode to oneshot broadcast mode to ensure that CPUs which are waiting for periodic broadcast are woken up on the next tick.
But it is subtly broken, when an active broadcast device is replaced and the system is already in oneshot (NOHZ/HIGHRES) mode. Victor observed this and debugged the issue.
Then the OR of the periodic broadcast CPU mask is wrong as the periodic cpumask bits are sticky after tick_broadcast_enable() set it for a CPU unless explicitly cleared via tick_broadcast_disable().
That means that this sets all other CPUs which have tick broadcasting enabled at that point unconditionally in the oneshot broadcast mask.
If the affected CPUs were already idle and had their bits set in the oneshot broadcast mask then this does no harm. But for non idle CPUs which were not set this corrupts their state.
On their next invocation of tick_broadcast_enable() they observe the bit set, which indicates that the broadcast for the CPU is already set up. As a consequence they fail to update the broadcast event even if their earliest expiring timer is before the actually programmed broadcast event.
If the programmed broadcast event is far in the future, then this can cause stalls or trigger the hung task detector.
Avoid this by telling tick_broadcast_setup_oneshot() explicitly whether this is the initial switch over from periodic to oneshot broadcast which must take the periodic broadcast mask into account. In the case of initialization of a replacement device this prevents that the broadcast oneshot mask is modified.
There is a second problem with broadcast device replacement in this function. The broadcast device is only armed when the previous state of the device was periodic.
That is correct for the switch from periodic broadcast mode to oneshot broadcast mode as the underlying broadcast device could operate in oneshot state already due to lack of periodic state in hardware. In that case it is already armed to expire at the next tick.
For the replacement case this is wrong as the device is in shutdown state. That means that any already pending broadcast event will not be armed.
This went unnoticed because any CPU which goes idle will observe that the broadcast device has an expiry time of KTIME_MAX and therefore any CPUs next timer event will be earlier and cause a reprogramming of the broadcast device. But that does not guarantee that the events of the CPUs which were already in idle are delivered on time.
Fix this by arming the newly installed device for an immediate event which will reevaluate the per CPU expiry times and reprogram the broadcast device accordingly. This is simpler than caching the last expiry time in yet another place or saving it before the device exchange and handing it down to the setup function. Replacement of broadcast devices is not a frequent operation and usually happens once somewhere late in the boot process.
--- kernel/time/tick-broadcast.c | 120 +++++++++++++++++++++++++---------- 1 file changed, 88 insertions(+), 32 deletions(-)
kernel/time/tick-broadcast.c +88 -32
@@ -35,14 +35,15 @@ static __cacheline_aligned_in_smp DEFINE_RAW_SPINLOCK(tick_broadcast_lock);#ifdef CONFIG_TICK_ONESHOT static DEFINE_PER_CPU(struct clock_event_device *, tick_oneshot_wakeup_device); -static void tick_broadcast_setup_oneshot (struct clock_event_device *bc); +static void tick_broadcast_setup_oneshot (struct clock_event_device *bc,bool from_periodic);static void tick_broadcast_clear_oneshot (int cpu);static void tick_resume_broadcast_oneshot (struct clock_event_device *bc);# ifdef CONFIG_HOTPLUG_CPU static void tick_broadcast_oneshot_offline (unsigned int cpu);# endif #else -static inline void tick_broadcast_setup_oneshot (struct clock_event_device *bc) {BUG (); } +static inline void +tick_broadcast_setup_oneshot (struct clock_event_device *bc,bool from_periodic) {BUG (); }static inline void tick_broadcast_clear_oneshot (int cpu) { }static inline void tick_resume_broadcast_oneshot (struct clock_event_device *bc) { }# ifdef CONFIG_HOTPLUG_CPU
@@ -264,7 +265,7 @@ int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu)if (tick_broadcast_device.mode ==TICKDEV_MODE_PERIODIC )tick_broadcast_start_periodic (bc);else -tick_broadcast_setup_oneshot (bc); +tick_broadcast_setup_oneshot (bc, false); ret =1 ; }else {/*
@@ -500,7 +501,7 @@ void tick_broadcast_control(enum tick_broadcast_mode mode)if (tick_broadcast_device.mode ==TICKDEV_MODE_PERIODIC )tick_broadcast_start_periodic (bc);else -tick_broadcast_setup_oneshot (bc); +tick_broadcast_setup_oneshot (bc, false); } } out:
@@ -1016,48 +1017,101 @@ static inline ktime_t tick_get_next_period(void)/** * tick_broadcast_setup_oneshot - setup the broadcast device */ -static void tick_broadcast_setup_oneshot (struct clock_event_device *bc) +static void tick_broadcast_setup_oneshot (struct clock_event_device *bc, +bool from_periodic) {int cpu =smp_processor_id (); +ktime_t nexttick =0 ;if (!bc)return ; -/* Set it up only once ! */ -if (bc->event_handler != tick_handle_oneshot_broadcast) { -int was_periodic =clockevent_state_periodic (bc); - - bc->event_handler = tick_handle_oneshot_broadcast; - +/* +* When the broadcast device was switched to oneshot by the first +* CPU handling the NOHZ change, the other CPUs will reach this +* code via hrtimer_run_queues() -> tick_check_oneshot_change() +* too. Set up the broadcast device only once! +*/ +if (bc->event_handler == tick_handle_oneshot_broadcast) {/* -* We must be careful here. There might be other CPUs -* waiting for periodic broadcast. We need to set the -* oneshot_mask bits for those and program the -* broadcast device to fire. +* The CPU which switched from periodic to oneshot mode +* set the broadcast oneshot bit for all other CPUs which +* are in the general (periodic) broadcast mask to ensure +* that CPUs which wait for the periodic broadcast are +* woken up. +* +* Clear the bit for the local CPU as the set bit would +* prevent the first tick_broadcast_enter() after this CPU +* switched to oneshot state to program the broadcast +* device. +* +* This code can also be reached via tick_broadcast_control(), +* but this cannot avoid the tick_broadcast_clear_oneshot() +* as that would break the periodic to oneshot transition of +* secondary CPUs. But that's harmless as the below only +* clears already cleared bits. */ +tick_broadcast_clear_oneshot (cpu); +return ; + } + + + bc->event_handler = tick_handle_oneshot_broadcast; + bc->next_event =KTIME_MAX ; + +/* +* When the tick mode is switched from periodic to oneshot it must +* be ensured that CPUs which are waiting for periodic broadcast +* get their wake-up at the next tick. This is achieved by ORing +* tick_broadcast_mask into tick_broadcast_oneshot_mask. +* +* For other callers, e.g. broadcast device replacement, +* tick_broadcast_oneshot_mask must not be touched as this would +* set bits for CPUs which are already NOHZ, but not idle. Their +* next tick_broadcast_enter() would observe the bit set and fail +* to update the expiry time and the broadcast event device. +*/ +if (from_periodic) {cpumask_copy (tmpmask, tick_broadcast_mask); +/* Remove the local CPU as it is obviously not idle */ cpumask_clear_cpu (cpu, tmpmask); -cpumask_or (tick_broadcast_oneshot_mask, - tick_broadcast_oneshot_mask, tmpmask); +cpumask_or (tick_broadcast_oneshot_mask, tick_broadcast_oneshot_mask, tmpmask); -if (was_periodic && !cpumask_empty (tmpmask)) { -ktime_t nextevt =tick_get_next_period (); +/* +* Ensure that the oneshot broadcast handler will wake the +* CPUs which are still waiting for periodic broadcast. +*/ + nexttick =tick_get_next_period (); +tick_broadcast_init_next_event (tmpmask, nexttick); -clockevents_switch_state (bc,CLOCK_EVT_STATE_ONESHOT ); -tick_broadcast_init_next_event (tmpmask, nextevt); -tick_broadcast_set_event (bc, cpu, nextevt); - }else - bc->next_event =KTIME_MAX ; - }else {/* -* The first cpu which switches to oneshot mode sets -* the bit for all other cpus which are in the general -* (periodic) broadcast mask. So the bit is set and -* would prevent the first broadcast enter after this -* to program the bc device. +* If the underlying broadcast clock event device is +* already in oneshot state, then there is nothing to do. +* The device was already armed for the next tick +* in tick_handle_broadcast_periodic() */ -tick_broadcast_clear_oneshot (cpu); +if (clockevent_state_oneshot (bc)) +return ; } + +/* +* When switching from periodic to oneshot mode arm the broadcast +* device for the next tick. +* +* If the broadcast device has been replaced in oneshot mode and +* the oneshot broadcast mask is not empty, then arm it to expire +* immediately in order to reevaluate the next expiring timer. +* @nexttick is 0 and therefore in the past which will cause the +* clockevent code to force an event. +* +* For both cases the programming can be avoided when the oneshot +* broadcast mask is empty. +* +* tick_broadcast_set_event() implicitly switches the broadcast +* device to oneshot state. +*/ +if (!cpumask_empty (tick_broadcast_oneshot_mask)) +tick_broadcast_set_event (bc, cpu, nexttick); }/*
@@ -1066,14 +1120,16 @@ static void tick_broadcast_setup_oneshot(struct clock_event_device *bc)void tick_broadcast_switch_to_oneshot (void ) {struct clock_event_device *bc; +enum tick_device_mode oldmode;unsigned long flags;raw_spin_lock_irqsave (&tick_broadcast_lock, flags); + oldmode = tick_broadcast_device.mode; tick_broadcast_device.mode =TICKDEV_MODE_ONESHOT ; bc = tick_broadcast_device.evtdev;if (bc) -tick_broadcast_setup_oneshot (bc); +tick_broadcast_setup_oneshot (bc, oldmode ==TICKDEV_MODE_PERIODIC );raw_spin_unlock_irqrestore (&tick_broadcast_lock, flags); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 8/292 linux/dim: Do nothing if no time delta between samples
In reply to Greg Kroah-HartmanFrom: Roy Novich <[email protected]>
[ Upstream commit 162bd18eb55adf464a0fa2b4144b8d61c75ff7c2 ]
Add return value for dim_calc_stats. This is an indication for the caller if curr_stats was assigned by the function. Avoid using curr_stats uninitialized over {rdma/net}_dim, when no time delta between samples. Coverity reported this potential use of an uninitialized variable.
--- include/linux/dim.h | 3 ++- lib/dim/dim.c | 5 +++-- lib/dim/net_dim.c | 3 ++- lib/dim/rdma_dim.c | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-)
include/linux/dim.h +2 -1
@@ -236,8 +236,9 @@ void dim_park_tired(struct dim *dim);* * Calculate the delta between two samples (in data rates). * Takes into consideration counter wrap-around. +* Returned boolean indicates whether curr_stats are reliable. */ -void dim_calc_stats (struct dim_sample *start,struct dim_sample *end, +bool dim_calc_stats (struct dim_sample *start,struct dim_sample *end,struct dim_stats *curr_stats);/**
lib/dim/dim.c +3 -2
@@ -54,7 +54,7 @@ void dim_park_tired(struct dim *dim) }EXPORT_SYMBOL (dim_park_tired); -void dim_calc_stats (struct dim_sample *start,struct dim_sample *end, +bool dim_calc_stats (struct dim_sample *start,struct dim_sample *end,struct dim_stats *curr_stats) {/* u32 holds up to 71 minutes, should be enough */
@@ -66,7 +66,7 @@ void dim_calc_stats(struct dim_sample *start, struct dim_sample *end, start->comp_ctr);if (!delta_us) -return ; +return false; curr_stats->ppms =DIV_ROUND_UP (npkts *USEC_PER_MSEC , delta_us); curr_stats->bpms =DIV_ROUND_UP (nbytes *USEC_PER_MSEC , delta_us);
@@ -79,5 +79,6 @@ void dim_calc_stats(struct dim_sample *start, struct dim_sample *end,else curr_stats->cpe_ratio =0 ; +return true; }EXPORT_SYMBOL (dim_calc_stats);
lib/dim/net_dim.c +2 -1
@@ -227,7 +227,8 @@ void net_dim(struct dim *dim, struct dim_sample end_sample) dim->start_sample.event_ctr);if (nevents <DIM_NEVENTS )break ; -dim_calc_stats (&dim->start_sample, &end_sample, &curr_stats); +if (!dim_calc_stats (&dim->start_sample, &end_sample, &curr_stats)) +break ;if (net_dim_decision (&curr_stats, dim)) { dim->state =DIM_APPLY_NEW_PROFILE ;schedule_work (&dim->work);
lib/dim/rdma_dim.c +2 -1
@@ -88,7 +88,8 @@ void rdma_dim(struct dim *dim, u64 completions) nevents = curr_sample->event_ctr - dim->start_sample.event_ctr;if (nevents <DIM_NEVENTS )break ; -dim_calc_stats (&dim->start_sample, curr_sample, &curr_stats); +if (!dim_calc_stats (&dim->start_sample, curr_sample, &curr_stats)) +break ;if (rdma_dim_decision (&curr_stats, dim)) { dim->state =DIM_APPLY_NEW_PROFILE ;schedule_work (&dim->work);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 9/292 net: stmmac: Initialize MAC_ONEUS_TIC_COUNTER register
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit 8efbdbfa99381a017dd2c0f6375a7d80a8118b74 ]
Initialize MAC_ONEUS_TIC_COUNTER register with correct value derived from CSR clock, otherwise EEE is unstable on at least NXP i.MX8M Plus and Micrel KSZ9131RNX PHY, to the point where not even ARP request can be sent out.
i.MX 8M Plus Applications Processor Reference Manual, Rev. 1, 06/2021 11.7.6.1.34 One-microsecond Reference Timer (MAC_ONEUS_TIC_COUNTER) defines this register as:
"
This register controls the generation of the Reference time (1 microsecond tic) for all the LPI timers. This timer has to be programmed by the software initially.
...
The application must program this counter so that the number of clock cycles of CSR clock is 1us. (Subtract 1 from the value before programming). For example if the CSR clock is 100MHz then this field needs to be programmed to value 100 - 1 = 99 (which is 0x63).
This is required to generate the 1US events that are used to update some of the EEE related counters.
"
The reset value is 0x63 on i.MX8M Plus, which means expected CSR clock are 100 MHz. However, the i.MX8M Plus "enet_qos_root_clk" are 266 MHz instead, which means the LPI timers reach their count much sooner on this platform.
This is visible using a scope by monitoring e.g. exit from LPI mode on TX_CTL line from MAC to PHY. This should take 30us per STMMAC_DEFAULT_TWT_LS setting, during which the TX_CTL line transitions from tristate to low, and 30 us later from low to high. On i.MX8M Plus, this transition takes 11 us, which matches the 30us * 100/266 formula for misconfigured MAC_ONEUS_TIC_COUNTER register.
Configure MAC_ONEUS_TIC_COUNTER based on CSR clock, so that the LPI timers have correct 1us reference. This then fixes EEE on i.MX8M Plus with Micrel KSZ9131RNX PHY.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 1 + drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 5 +++++ 2 files changed, 6 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwmac4.h +1 -0
@@ -181,6 +181,7 @@ enum power_event {#define GMAC4_LPI_CTRL_STATUS 0xd0#define GMAC4_LPI_TIMER_CTRL 0xd4#define GMAC4_LPI_ENTRY_TIMER 0xd8 +#define GMAC4_MAC_ONEUS_TIC_COUNTER 0xdc/* LPI control and status defines */ #define GMAC4_LPI_CTRL_STATUS_LPITCSE BIT(21)/* LPI Tx Clock Stop Enable */
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +5 -0
@@ -25,6 +25,7 @@ static void dwmac4_core_init(struct mac_device_info *hw,struct stmmac_priv *priv =netdev_priv (dev);void __iomem *ioaddr = hw->pcsr;u32 value =readl (ioaddr +GMAC_CONFIG ); +u32 clk_rate; value |=GMAC_CORE_INIT ;
@@ -47,6 +48,10 @@ static void dwmac4_core_init(struct mac_device_info *hw,writel (value, ioaddr +GMAC_CONFIG ); +/* Configure LPI 1us counter to number of CSR clock ticks in 1us - 1 */ + clk_rate =clk_get_rate (priv->plat->stmmac_clk); +writel ((clk_rate /1000000 ) -1 , ioaddr +GMAC4_MAC_ONEUS_TIC_COUNTER ); +/* Enable GMAC interrupts */ value =GMAC_INT_DEFAULT_ENABLE ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 10/292 net: Fix load-tearing on sk->sk_stamp in sock_recv_cmsgs().
In reply to Greg Kroah-HartmanFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit dfd9248c071a3710c24365897459538551cb7167 ]
KCSAN found a data race in sock_recv_cmsgs() where the read access to sk->sk_stamp needs READ_ONCE().
BUG: KCSAN: data-race in packet_recvmsg / packet_recvmsg
write (marked) to 0xffff88803c81f258 of 8 bytes by task 19171 on cpu 0:
sock_write_timestamp include/net/sock.h:2670 [inline] sock_recv_cmsgs include/net/sock.h:2722 [inline] packet_recvmsg+0xb97/0xd00 net/packet/af_packet.c:3489 sock_recvmsg_nosec net/socket.c:1019 [inline] sock_recvmsg+0x11a/0x130 net/socket.c:1040 sock_read_iter+0x176/0x220 net/socket.c:1118 call_read_iter include/linux/fs.h:1845 [inline] new_sync_read fs/read_write.c:389 [inline] vfs_read+0x5e0/0x630 fs/read_write.c:470 ksys_read+0x163/0x1a0 fs/read_write.c:613 __do_sys_read fs/read_write.c:623 [inline] __se_sys_read fs/read_write.c:621 [inline] __x64_sys_read+0x41/0x50 fs/read_write.c:621 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x72/0xdc
read to 0xffff88803c81f258 of 8 bytes by task 19183 on cpu 1:
sock_recv_cmsgs include/net/sock.h:2721 [inline] packet_recvmsg+0xb64/0xd00 net/packet/af_packet.c:3489 sock_recvmsg_nosec net/socket.c:1019 [inline] sock_recvmsg+0x11a/0x130 net/socket.c:1040 sock_read_iter+0x176/0x220 net/socket.c:1118 call_read_iter include/linux/fs.h:1845 [inline] new_sync_read fs/read_write.c:389 [inline] vfs_read+0x5e0/0x630 fs/read_write.c:470 ksys_read+0x163/0x1a0 fs/read_write.c:613 __do_sys_read fs/read_write.c:623 [inline] __se_sys_read fs/read_write.c:621 [inline] __x64_sys_read+0x41/0x50 fs/read_write.c:621 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x72/0xdc
value changed: 0xffffffffc4653600 -> 0x0000000000000000
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 19183 Comm: syz-executor.5 Not tainted 6.3.0-rc7-02330-gca6270c12e20 #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
--- include/net/sock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/sock.h +1 -1
@@ -2744,7 +2744,7 @@ static inline void sock_recv_cmsgs(struct msghdr *msg, struct sock *sk,__sock_recv_cmsgs (msg, sk, skb); else if (unlikely(sock_flag(sk, SOCK_TIMESTAMP))) sock_write_timestamp(sk, skb->tstamp); - else if (unlikely(sk->sk_stamp == SK_DEFAULT_STAMP)) + else if (unlikely(sock_read_timestamp(sk) == SK_DEFAULT_STAMP)) sock_write_timestamp(sk, 0); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 11/292 net: phy: bcm7xx: Correct read from expansion register
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
[ Upstream commit 582dbb2cc1a0a7427840f5b1e3c65608e511b061 ]
Since the driver works in the "legacy" addressing mode, we need to write to the expansion register (0x17) with bits 11:8 set to 0xf to properly select the expansion register passed as argument.
--- drivers/net/phy/bcm-phy-lib.h | 5 +++++ drivers/net/phy/bcm7xxx.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/net/phy/bcm-phy-lib.h +5 -0
@@ -40,6 +40,11 @@ static inline int bcm_phy_write_exp_sel(struct phy_device *phydev,return bcm_phy_write_exp (phydev, reg |MII_BCM54XX_EXP_SEL_ER , val); } +static inline int bcm_phy_read_exp_sel (struct phy_device *phydev,u16 reg) +{ +return bcm_phy_read_exp (phydev, reg |MII_BCM54XX_EXP_SEL_ER ); +} +int bcm54xx_auxctl_write (struct phy_device *phydev,u16 regnum,u16 val);int bcm54xx_auxctl_read (struct phy_device *phydev,u16 regnum);
drivers/net/phy/bcm7xxx.c +1 -1
@@ -487,7 +487,7 @@ static int bcm7xxx_16nm_ephy_afe_config(struct phy_device *phydev)bcm_phy_write_misc (phydev,0x0038 ,0x0002 ,0xede0 );/* Read CORE_EXPA9 */ - tmp =bcm_phy_read_exp (phydev,0x00a9 ); + tmp =bcm_phy_read_exp_sel (phydev,0x00a9 );/* CORE_EXPA9[6:1] is rcalcode[5:0] */ rcalcode = (tmp &0x7e ) /2 ;/* Correct RCAL code + 1 is -1% rprogr, LP: +16 */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 12/292 netfilter: nf_tables: always release netdev hooks from notifier
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit dc1c9fd4a8bbe1e06add9053010b652449bfe411 ]
This reverts "netfilter: nf_tables: skip netdev events generated on netns removal".
The problem is that when a veth device is released, the veth release callback will also queue the peer netns device for removal.
Its possible that the peer netns is also slated for removal. In this case, the device memory is already released before the pre_exit hook of the peer netns runs:
BUG: KASAN: slab-use-after-free in nf_hook_entry_head+0x1b8/0x1d0 Read of size 8 at addr ffff88812c0124f0 by task kworker/u8:1/45 Workqueue: netns cleanup_net Call Trace: nf_hook_entry_head+0x1b8/0x1d0 __nf_unregister_net_hook+0x76/0x510 nft_netdev_unregister_hooks+0xa0/0x220 __nft_release_hook+0x184/0x490 nf_tables_pre_exit_net+0x12f/0x1b0 ..
Order is:
1. First netns is released, veth_dellink() queues peer netns device for removal
2. peer netns is queued for removal
3. peer netns device is released, unreg event is triggered
4. unreg event is ignored because netns is going down
5. pre_exit hook calls nft_netdev_unregister_hooks but device memory might be free'd already.
--- net/netfilter/nft_chain_filter.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/netfilter/nft_chain_filter.c +6 -3
@@ -344,6 +344,12 @@ static void nft_netdev_event(unsigned long event, struct net_device *dev,return ; } +/* UNREGISTER events are also happening on netns exit. +* +* Although nf_tables core releases all tables/chains, only this event +* handler provides guarantee that hook->ops.dev is still accessible, +* so we cannot skip exiting net namespaces. +*/ __nft_release_basechain (ctx); }
@@ -362,9 +368,6 @@ static int nf_tables_netdev_event(struct notifier_block *this, event != NETDEV_CHANGENAME)return NOTIFY_DONE ; -if (!check_net (ctx.net)) -return NOTIFY_DONE ; - nft_net =nft_pernet (ctx.net);mutex_lock (&nft_net->commit_mutex);list_for_each_entry (table, &nft_net->tables, list) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 13/292 netfilter: conntrack: fix possible bug_on with enable_hooks=1
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit e72eeab542dbf4f544e389e64fa13b82a1b6d003 ]
I received a bug report (no reproducer so far) where we trip over
712 rcu_read_lock(); 713 ct_hook = rcu_dereference(nf_ct_hook); 714 BUG_ON(ct_hook == NULL); // here
In nf_conntrack_destroy().
First turn this BUG_ON into a WARN. I think it was triggered via enable_hooks=1 flag.
When this flag is turned on, the conntrack hooks are registered before nf_ct_hook pointer gets assigned.
This opens a short window where packets enter the conntrack machinery, can have skb->_nfct set up and a subsequent kfree_skb might occur before nf_ct_hook is set.
Call nf_conntrack_init_end() to set nf_ct_hook before we register the pernet ops.
--- net/netfilter/core.c | 6 ++++-- net/netfilter/nf_conntrack_standalone.c | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-)
net/netfilter/core.c +4 -2
@@ -699,9 +699,11 @@ void nf_conntrack_destroy(struct nf_conntrack *nfct)rcu_read_lock (); ct_hook =rcu_dereference (nf_ct_hook); -BUG_ON (ct_hook ==NULL ); - ct_hook->destroy (nfct); +if (ct_hook) + ct_hook->destroy (nfct);rcu_read_unlock (); + +WARN_ON (!ct_hook); }EXPORT_SYMBOL (nf_conntrack_destroy);
net/netfilter/nf_conntrack_standalone.c +2 -1
@@ -1222,11 +1222,12 @@ static int __init nf_conntrack_standalone_init(void) nf_conntrack_htable_size_user = nf_conntrack_htable_size;#endif +nf_conntrack_init_end (); + ret =register_pernet_subsys (&nf_conntrack_net_ops);if (ret <0 ) goto out_pernet; -nf_conntrack_init_end ();return 0 ; out_pernet:
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 14/292 bonding: fix send_peer_notif overflow
In reply to Greg Kroah-HartmanFrom: Hangbin Liu <[email protected]>
[ Upstream commit 9949e2efb54eb3001cb2f6512ff3166dddbfb75d ]
Bonding send_peer_notif was defined as u8. Since commit 07a4ddec3ce9 ("bonding: add an option to specify a delay between peer notifications"). the bond->send_peer_notif will be num_peer_notif multiplied by peer_notif_delay, which is u8 * u32. This would cause the send_peer_notif overflow easily. e.g.
ip link add bond0 type bond mode 1 miimon 100 num_grat_arp 30 peer_notify_delay 1000
To fix the overflow, let's set the send_peer_notif to u32 and limit peer_notif_delay to 300s.
--- drivers/net/bonding/bond_netlink.c | 7 ++++++- drivers/net/bonding/bond_options.c | 8 +++++++- include/net/bonding.h | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-)
drivers/net/bonding/bond_netlink.c +6 -1
@@ -84,6 +84,11 @@ static int bond_fill_slave_info(struct sk_buff *skb,return -EMSGSIZE ; } +/* Limit the max delay range to 300s */ +static struct netlink_range_validation delay_range = { + .max =300000 , +}; +static const struct nla_policy bond_policy[IFLA_BOND_MAX +1 ] = { [IFLA_BOND_MODE ] = { .type =NLA_U8 }, [IFLA_BOND_ACTIVE_SLAVE ] = { .type =NLA_U32 },
@@ -114,7 +119,7 @@ static const struct nla_policy bond_policy[IFLA_BOND_MAX + 1] = { [IFLA_BOND_AD_ACTOR_SYSTEM ] = { .type =NLA_BINARY , .len = ETH_ALEN }, [IFLA_BOND_TLB_DYNAMIC_LB] = { .type = NLA_U8 }, - [IFLA_BOND_PEER_NOTIF_DELAY] = { .type = NLA_U32 }, + [IFLA_BOND_PEER_NOTIF_DELAY] = NLA_POLICY_FULL_RANGE(NLA_U32, &delay_range), [IFLA_BOND_MISSED_MAX] = { .type = NLA_U8 }, [IFLA_BOND_NS_IP6_TARGET] = { .type = NLA_NESTED }, };
drivers/net/bonding/bond_options.c +7 -1
@@ -169,6 +169,12 @@ static const struct bond_opt_value bond_num_peer_notif_tbl[] = { { NULL, -1, 0} }; +static const struct bond_opt_value bond_peer_notif_delay_tbl[] = { + {"off" ,0 ,0 }, + {"maxval" ,300000 ,BOND_VALFLAG_MAX }, + {NULL ,-1 ,0 } +}; +static const struct bond_opt_value bond_primary_reselect_tbl[] = { {"always" ,BOND_PRI_RESELECT_ALWAYS ,BOND_VALFLAG_DEFAULT }, {"better" ,BOND_PRI_RESELECT_BETTER ,0 },
@@ -488,7 +494,7 @@ static const struct bond_option bond_opts[BOND_OPT_LAST] = { .id = BOND_OPT_PEER_NOTIF_DELAY, .name = "peer_notif_delay", .desc = "Delay between each peer notification on failover event, in milliseconds", - .values = bond_intmax_tbl, + .values = bond_peer_notif_delay_tbl, .set = bond_option_peer_notif_delay_set } };
include/net/bonding.h +1 -1
@@ -235,7 +235,7 @@ struct bonding {*/ spinlock_t mode_lock;spinlock_t stats_lock; -u8 send_peer_notif; +u32 send_peer_notif;u8 igmp_retrans;#ifdef CONFIG_PROC_FS struct proc_dir_entry *proc_entry;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 15/292 netlink: annotate accesses to nlk->cb_running
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit a939d14919b799e6fff8a9c80296ca229ba2f8a4 ]
Both netlink_recvmsg() and netlink_native_seq_show() read nlk->cb_running locklessly. Use READ_ONCE() there.
Add corresponding WRITE_ONCE() to netlink_dump() and __netlink_dump_start()
syzbot reported:
BUG: KCSAN: data-race in __netlink_dump_start / netlink_recvmsg
write to 0xffff88813ea4db59 of 1 bytes by task 28219 on cpu 0:
__netlink_dump_start+0x3af/0x4d0 net/netlink/af_netlink.c:2399 netlink_dump_start include/linux/netlink.h:308 [inline] rtnetlink_rcv_msg+0x70f/0x8c0 net/core/rtnetlink.c:6130 netlink_rcv_skb+0x126/0x220 net/netlink/af_netlink.c:2577 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:6192 netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline] netlink_unicast+0x56f/0x640 net/netlink/af_netlink.c:1365 netlink_sendmsg+0x665/0x770 net/netlink/af_netlink.c:1942 sock_sendmsg_nosec net/socket.c:724 [inline] sock_sendmsg net/socket.c:747 [inline] sock_write_iter+0x1aa/0x230 net/socket.c:1138 call_write_iter include/linux/fs.h:1851 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x463/0x760 fs/read_write.c:584 ksys_write+0xeb/0x1a0 fs/read_write.c:637 __do_sys_write fs/read_write.c:649 [inline] __se_sys_write fs/read_write.c:646 [inline] __x64_sys_write+0x42/0x50 fs/read_write.c:646 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd
read to 0xffff88813ea4db59 of 1 bytes by task 28222 on cpu 1:
netlink_recvmsg+0x3b4/0x730 net/netlink/af_netlink.c:2022 sock_recvmsg_nosec+0x4c/0x80 net/socket.c:1017 ____sys_recvmsg+0x2db/0x310 net/socket.c:2718 ___sys_recvmsg net/socket.c:2762 [inline] do_recvmmsg+0x2e5/0x710 net/socket.c:2856 __sys_recvmmsg net/socket.c:2935 [inline] __do_sys_recvmmsg net/socket.c:2958 [inline] __se_sys_recvmmsg net/socket.c:2951 [inline] __x64_sys_recvmmsg+0xe2/0x160 net/socket.c:2951 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd
value changed: 0x00 -> 0x01
--- net/netlink/af_netlink.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/netlink/af_netlink.c +4 -4
@@ -1979,7 +1979,7 @@ static int netlink_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,skb_free_datagram (sk, skb); -if (nlk->cb_running && +if (READ_ONCE (nlk->cb_running) &&atomic_read (&sk->sk_rmem_alloc) <= sk->sk_rcvbuf /2 ) { ret =netlink_dump (sk);if (ret) {
@@ -2293,7 +2293,7 @@ static int netlink_dump(struct sock *sk)if (cb->done) cb->done (cb); - nlk->cb_running = false; +WRITE_ONCE (nlk->cb_running, false); module = cb->module; skb = cb->skb;mutex_unlock (nlk->cb_mutex);
@@ -2356,7 +2356,7 @@ int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb, goto error_put; } - nlk->cb_running = true; +WRITE_ONCE (nlk->cb_running, true); nlk->dump_done_errno =INT_MAX ;mutex_unlock (nlk->cb_mutex);
@@ -2681,7 +2681,7 @@ static int netlink_native_seq_show(struct seq_file *seq, void *v) nlk->groups ? (u32 )nlk->groups[0 ] :0 ,sk_rmem_alloc_get (s),sk_wmem_alloc_get (s), - nlk->cb_running, +READ_ONCE (nlk->cb_running),refcount_read (&s->sk_refcnt),atomic_read (&s->sk_drops),sock_i_ino (s)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 16/292 net: annotate sk->sk_err write from do_recvmmsg()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit e05a5f510f26607616fecdd4ac136310c8bea56b ]
do_recvmmsg() can write to sk->sk_err from multiple threads.
As said before, many other points reading or writing sk_err need annotations.
--- net/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/socket.c +1 -1
@@ -2890,7 +2890,7 @@ static int do_recvmmsg(int fd, struct mmsghdr __user *mmsg,* error to return on the next call or if the * app asks about it using getsockopt(SO_ERROR). */ - sock->sk->sk_err = -err; +WRITE_ONCE (sock->sk->sk_err, -err); } out_put:fput_light (sock->file, fput_needed);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 17/292 net: deal with most data-races in sk_wait_event()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit d0ac89f6f9879fae316c155de77b5173b3e2c9c9 ]
__condition is evaluated twice in sk_wait_event() macro.
First invocation is lockless, and reads can race with writes, as spotted by syzbot.
BUG: KCSAN: data-race in sk_stream_wait_connect / tcp_disconnect
write to 0xffff88812d83d6a0 of 4 bytes by task 9065 on cpu 1:
tcp_disconnect+0x2cd/0xdb0 inet_shutdown+0x19e/0x1f0 net/ipv4/af_inet.c:911 __sys_shutdown_sock net/socket.c:2343 [inline] __sys_shutdown net/socket.c:2355 [inline] __do_sys_shutdown net/socket.c:2363 [inline] __se_sys_shutdown+0xf8/0x140 net/socket.c:2361 __x64_sys_shutdown+0x31/0x40 net/socket.c:2361 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd
read to 0xffff88812d83d6a0 of 4 bytes by task 9040 on cpu 0:
sk_stream_wait_connect+0x1de/0x3a0 net/core/stream.c:75 tcp_sendmsg_locked+0x2e4/0x2120 net/ipv4/tcp.c:1266 tcp_sendmsg+0x30/0x50 net/ipv4/tcp.c:1484 inet6_sendmsg+0x63/0x80 net/ipv6/af_inet6.c:651 sock_sendmsg_nosec net/socket.c:724 [inline] sock_sendmsg net/socket.c:747 [inline] __sys_sendto+0x246/0x300 net/socket.c:2142 __do_sys_sendto net/socket.c:2154 [inline] __se_sys_sendto net/socket.c:2150 [inline] __x64_sys_sendto+0x78/0x90 net/socket.c:2150 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd
value changed: 0x00000000 -> 0x00000068
--- net/core/stream.c | 12 ++++++------ net/ipv4/tcp_bpf.c | 2 +- net/llc/af_llc.c | 8 +++++--- net/smc/smc_close.c | 4 ++-- net/smc/smc_rx.c | 4 ++-- net/smc/smc_tx.c | 4 ++-- net/tipc/socket.c | 4 ++-- net/tls/tls_main.c | 3 ++- 8 files changed, 22 insertions(+), 19 deletions(-)
net/core/stream.c +6 -6
@@ -73,8 +73,8 @@ int sk_stream_wait_connect(struct sock *sk, long *timeo_p)add_wait_queue (sk_sleep (sk), &wait); sk->sk_write_pending++; done =sk_wait_event (sk, timeo_p, - !sk->sk_err && - !((1 << sk->sk_state) & + !READ_ONCE (sk->sk_err) && + !((1 <<READ_ONCE (sk->sk_state)) & ~(TCPF_ESTABLISHED |TCPF_CLOSE_WAIT )), &wait);remove_wait_queue (sk_sleep (sk), &wait); sk->sk_write_pending--;
@@ -87,9 +87,9 @@ EXPORT_SYMBOL(sk_stream_wait_connect);* sk_stream_closing - Return 1 if we still have things to send in our buffers. * @sk: socket to verify */ -static inline int sk_stream_closing (struct sock *sk) +static int sk_stream_closing (const struct sock *sk) { -return (1 << sk->sk_state) & +return (1 <<READ_ONCE (sk->sk_state)) & (TCPF_FIN_WAIT1 |TCPF_CLOSING |TCPF_LAST_ACK ); }
@@ -142,8 +142,8 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p)set_bit (SOCK_NOSPACE , &sk->sk_socket->flags); sk->sk_write_pending++; -sk_wait_event (sk, ¤t_timeo, sk->sk_err || - (sk->sk_shutdown &SEND_SHUTDOWN ) || +sk_wait_event (sk, ¤t_timeo,READ_ONCE (sk->sk_err) || + (READ_ONCE (sk->sk_shutdown) &SEND_SHUTDOWN ) || (sk_stream_memory_free (sk) && !vm_wait), &wait); sk->sk_write_pending--;
net/ipv4/tcp_bpf.c +1 -1
@@ -168,7 +168,7 @@ static int tcp_msg_wait_data(struct sock *sk, struct sk_psock *psock,sk_set_bit (SOCKWQ_ASYNC_WAITDATA , sk); ret =sk_wait_event (sk, &timeo, !list_empty (&psock->ingress_msg) || - !skb_queue_empty (&sk->sk_receive_queue), &wait); + !skb_queue_empty_lockless (&sk->sk_receive_queue), &wait);sk_clear_bit (SOCKWQ_ASYNC_WAITDATA , sk);remove_wait_queue (sk_sleep (sk), &wait);return ret;
net/llc/af_llc.c +5 -3
@@ -583,7 +583,8 @@ static int llc_ui_wait_for_disc(struct sock *sk, long timeout)add_wait_queue (sk_sleep (sk), &wait);while (1 ) { -if (sk_wait_event (sk, &timeout, sk->sk_state ==TCP_CLOSE , &wait)) +if (sk_wait_event (sk, &timeout, +READ_ONCE (sk->sk_state) ==TCP_CLOSE , &wait))break ; rc = -ERESTARTSYS ;if (signal_pending (current))
@@ -603,7 +604,8 @@ static bool llc_ui_wait_for_conn(struct sock *sk, long timeout)add_wait_queue (sk_sleep (sk), &wait);while (1 ) { -if (sk_wait_event (sk, &timeout, sk->sk_state !=TCP_SYN_SENT , &wait)) +if (sk_wait_event (sk, &timeout, +READ_ONCE (sk->sk_state) !=TCP_SYN_SENT , &wait))break ;if (signal_pending (current) || !timeout)break ;
@@ -622,7 +624,7 @@ static int llc_ui_wait_for_busy_core(struct sock *sk, long timeout)while (1 ) { rc =0 ;if (sk_wait_event (sk, &timeout, - (sk->sk_shutdown &RCV_SHUTDOWN ) || + (READ_ONCE (sk->sk_shutdown) &RCV_SHUTDOWN ) || (!llc_data_accept_state (llc->state) && !llc->remote_busy_flag && !llc->p_flag), &wait))
net/smc/smc_close.c +2 -2
@@ -67,8 +67,8 @@ static void smc_close_stream_wait(struct smc_sock *smc, long timeout) rc =sk_wait_event (sk, &timeout, !smc_tx_prepared_sends (&smc->conn) || - sk->sk_err ==ECONNABORTED || - sk->sk_err ==ECONNRESET || +READ_ONCE (sk->sk_err) ==ECONNABORTED || +READ_ONCE (sk->sk_err) ==ECONNRESET || smc->conn.killed, &wait);if (rc)
net/smc/smc_rx.c +2 -2
@@ -263,9 +263,9 @@ int smc_rx_wait(struct smc_sock *smc, long *timeo,sk_set_bit (SOCKWQ_ASYNC_WAITDATA , sk);add_wait_queue (sk_sleep (sk), &wait); rc =sk_wait_event (sk, timeo, - sk->sk_err || +READ_ONCE (sk->sk_err) || cflags->peer_conn_abort || - sk->sk_shutdown &RCV_SHUTDOWN || +READ_ONCE (sk->sk_shutdown) &RCV_SHUTDOWN || conn->killed ||fcrit (conn), &wait);
net/smc/smc_tx.c +2 -2
@@ -113,8 +113,8 @@ static int smc_tx_wait(struct smc_sock *smc, int flags)break ;/* at least 1 byte of free & no urgent data */ set_bit (SOCK_NOSPACE , &sk->sk_socket->flags); sk_wait_event(sk, &timeo, - sk->sk_err || - (sk->sk_shutdown & SEND_SHUTDOWN) || + READ_ONCE(sk->sk_err) || + (READ_ONCE(sk->sk_shutdown) & SEND_SHUTDOWN) || smc_cdc_rxed_any_close(conn) || (atomic_read(&conn->sndbuf_space) && !conn->urg_tx_pend),
net/tipc/socket.c +2 -2
@@ -313,9 +313,9 @@ static void tsk_rej_rx_queue(struct sock *sk, int error)tipc_sk_respond (sk, skb, error); } -static bool tipc_sk_connected (struct sock *sk) +static bool tipc_sk_connected (const struct sock *sk) { -return sk->sk_state ==TIPC_ESTABLISHED ; +return READ_ONCE (sk->sk_state) ==TIPC_ESTABLISHED ; }/* tipc_sk_type_connectionless - check if the socket is datagram socket
net/tls/tls_main.c +2 -1
@@ -111,7 +111,8 @@ int wait_on_pending_writer(struct sock *sk, long *timeo)break ; } -if (sk_wait_event (sk, timeo, !sk->sk_write_pending, &wait)) +if (sk_wait_event (sk, timeo, + !READ_ONCE (sk->sk_write_pending), &wait))break ; }remove_wait_queue (sk_sleep (sk), &wait);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 18/292 net: add vlan_get_protocol_and_depth() helper
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 4063384ef762cc5946fc7a3f89879e76c6ec51e2 ]
Before blamed commit, pskb_may_pull() was used instead of skb_header_pointer() in __vlan_get_protocol() and friends.
Few callers depended on skb->head being populated with MAC header, syzbot caught one of them (skb_mac_gso_segment())
Add vlan_get_protocol_and_depth() to make the intent clearer and use it where sensible.
This is a more generic fix than commit e9d3f80935b6 ("net/af_packet: make sure to pull mac header") which was dealing with a similar issue.
kernel BUG at include/linux/skbuff.h:2655 !
invalid opcode: 0000 [#1] SMP KASAN
CPU: 0 PID: 1441 Comm: syz-executor199 Not tainted 6.1.24-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023 RIP: 0010:__skb_pull include/linux/skbuff.h:2655 [inline] RIP: 0010:skb_mac_gso_segment+0x68f/0x6a0 net/core/gro.c:136 Code: fd 48 8b 5c 24 10 44 89 6b 70 48 c7 c7 c0 ae 0d 86 44 89 e6 e8 a1 91 d0 00 48 c7 c7 00 af 0d 86 48 89 de 31 d2 e8 d1 4a e9 ff <0f> 0b 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 55 48 89 e5 41 RSP: 0018:ffffc90001bd7520 EFLAGS: 00010286 RAX: ffffffff8469736a RBX: ffff88810f31dac0 RCX: ffff888115a18b00 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc90001bd75e8 R08: ffffffff84697183 R09: fffff5200037adf9 R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000012 R13: 000000000000fee5 R14: 0000000000005865 R15: 000000000000fed7 FS: 000055555633f300(0000) GS:ffff8881f6a00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020000000 CR3: 0000000116fea000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> [<ffffffff847018dd>] __skb_gso_segment+0x32d/0x4c0 net/core/dev.c:3419 [<ffffffff8470398a>] skb_gso_segment include/linux/netdevice.h:4819 [inline] [<ffffffff8470398a>] validate_xmit_skb+0x3aa/0xee0 net/core/dev.c:3725 [<ffffffff84707042>] __dev_queue_xmit+0x1332/0x3300 net/core/dev.c:4313 [<ffffffff851a9ec7>] dev_queue_xmit+0x17/0x20 include/linux/netdevice.h:3029 [<ffffffff851b4a82>] packet_snd net/packet/af_packet.c:3111 [inline] [<ffffffff851b4a82>] packet_sendmsg+0x49d2/0x6470 net/packet/af_packet.c:3142 [<ffffffff84669a12>] sock_sendmsg_nosec net/socket.c:716 [inline] [<ffffffff84669a12>] sock_sendmsg net/socket.c:736 [inline] [<ffffffff84669a12>] __sys_sendto+0x472/0x5f0 net/socket.c:2139 [<ffffffff84669c75>] __do_sys_sendto net/socket.c:2151 [inline] [<ffffffff84669c75>] __se_sys_sendto net/socket.c:2147 [inline] [<ffffffff84669c75>] __x64_sys_sendto+0xe5/0x100 net/socket.c:2147 [<ffffffff8551d40f>] do_syscall_x64 arch/x86/entry/common.c:50 [inline] [<ffffffff8551d40f>] do_syscall_64+0x2f/0x50 arch/x86/entry/common.c:80 [<ffffffff85600087>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
--- drivers/net/tap.c | 4 ++-- include/linux/if_vlan.h | 17 +++++++++++++++++ net/bridge/br_forward.c | 2 +- net/core/dev.c | 2 +- net/packet/af_packet.c | 6 ++---- 5 files changed, 23 insertions(+), 8 deletions(-)
drivers/net/tap.c +2 -2
@@ -739,7 +739,7 @@ static ssize_t tap_get_user(struct tap_queue *q, void *msg_control,/* Move network header to the right position for VLAN tagged packets */ if (eth_type_vlan (skb->protocol) && -__vlan_get_protocol (skb, skb->protocol, &depth) !=0 ) +vlan_get_protocol_and_depth (skb, skb->protocol, &depth) !=0 )skb_set_network_header (skb, depth);/* copy skb_ubuf_info for callback when skb has no error */
@@ -1180,7 +1180,7 @@ static int tap_get_user_xdp(struct tap_queue *q, struct xdp_buff *xdp)/* Move network header to the right position for VLAN tagged packets */ if (eth_type_vlan (skb->protocol) && -__vlan_get_protocol (skb, skb->protocol, &depth) !=0 ) +vlan_get_protocol_and_depth (skb, skb->protocol, &depth) !=0 )skb_set_network_header (skb, depth);rcu_read_lock ();
include/linux/if_vlan.h +17 -0
@@ -631,6 +631,23 @@ static inline __be16 vlan_get_protocol(const struct sk_buff *skb)return __vlan_get_protocol (skb, skb->protocol,NULL ); } +/* This version of __vlan_get_protocol() also pulls mac header in skb->head */ +static inline __be16 vlan_get_protocol_and_depth (struct sk_buff *skb, +__be16 type,int *depth) +{ +int maclen; + + type =__vlan_get_protocol (skb, type, &maclen); + +if (type) { +if (!pskb_may_pull (skb, maclen)) + type =0 ; +else if (depth) + *depth = maclen; + } +return type; +} +/* A getter for the SKB protocol field which will handle VLAN tags consistently * whether VLAN acceleration is enabled or not. */
net/bridge/br_forward.c +1 -1
@@ -42,7 +42,7 @@ int br_dev_queue_push_xmit(struct net *net, struct sock *sk, struct sk_buff *skb eth_type_vlan(skb->protocol)) {int depth; -if (!__vlan_get_protocol (skb, skb->protocol, &depth)) +if (!vlan_get_protocol_and_depth (skb, skb->protocol, &depth)) goto drop;skb_set_network_header (skb, depth);
net/core/dev.c +1 -1
@@ -3350,7 +3350,7 @@ __be16 skb_network_protocol(struct sk_buff *skb, int *depth) type = eth->h_proto; } -return __vlan_get_protocol (skb, type, depth); +return vlan_get_protocol_and_depth (skb, type, depth); }/* openvswitch calls this on rx path, so we need a different check.
net/packet/af_packet.c +2 -4
@@ -1936,10 +1936,8 @@ static void packet_parse_headers(struct sk_buff *skb, struct socket *sock)/* Move network header to the right position for VLAN tagged packets */ if (likely (skb->dev->type ==ARPHRD_ETHER ) &ð_type_vlan (skb->protocol) && -__vlan_get_protocol (skb, skb->protocol, &depth) !=0 ) { -if (pskb_may_pull (skb, depth)) -skb_set_network_header (skb, depth); - } +vlan_get_protocol_and_depth (skb, skb->protocol, &depth) !=0 ) +skb_set_network_header (skb, depth);skb_probe_transport_header (skb); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 19/292 tcp: add annotations around sk->sk_shutdown accesses
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit e14cadfd80d76f01bfaa1a8d745b1db19b57d6be ]
Now sk->sk_shutdown is no longer a bitfield, we can add standard READ_ONCE()/WRITE_ONCE() annotations to silence KCSAN reports like the following:
BUG: KCSAN: data-race in tcp_disconnect / tcp_poll
write to 0xffff88814588582c of 1 bytes by task 3404 on cpu 1:
tcp_disconnect+0x4d6/0xdb0 net/ipv4/tcp.c:3121 __inet_stream_connect+0x5dd/0x6e0 net/ipv4/af_inet.c:715 inet_stream_connect+0x48/0x70 net/ipv4/af_inet.c:727 __sys_connect_file net/socket.c:2001 [inline] __sys_connect+0x19b/0x1b0 net/socket.c:2018 __do_sys_connect net/socket.c:2028 [inline] __se_sys_connect net/socket.c:2025 [inline] __x64_sys_connect+0x41/0x50 net/socket.c:2025 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd
read to 0xffff88814588582c of 1 bytes by task 3374 on cpu 0:
tcp_poll+0x2e6/0x7d0 net/ipv4/tcp.c:562 sock_poll+0x253/0x270 net/socket.c:1383 vfs_poll include/linux/poll.h:88 [inline] io_poll_check_events io_uring/poll.c:281 [inline] io_poll_task_func+0x15a/0x820 io_uring/poll.c:333 handle_tw_list io_uring/io_uring.c:1184 [inline] tctx_task_work+0x1fe/0x4d0 io_uring/io_uring.c:1246 task_work_run+0x123/0x160 kernel/task_work.c:179 get_signal+0xe64/0xff0 kernel/signal.c:2635 arch_do_signal_or_restart+0x89/0x2a0 arch/x86/kernel/signal.c:306 exit_to_user_mode_loop+0x6f/0xe0 kernel/entry/common.c:168 exit_to_user_mode_prepare+0x6c/0xb0 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x26/0x140 kernel/entry/common.c:297 do_syscall_64+0x4d/0xc0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd
value changed: 0x03 -> 0x00
--- net/ipv4/af_inet.c | 2 +- net/ipv4/tcp.c | 14 ++++++++------ net/ipv4/tcp_input.c | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-)
net/ipv4/af_inet.c +1 -1
@@ -897,7 +897,7 @@ int inet_shutdown(struct socket *sock, int how)EPOLLHUP, even on eg. unconnected UDP sockets -- RR */ fallthrough;default : - sk->sk_shutdown |= how; +WRITE_ONCE (sk->sk_shutdown, sk->sk_shutdown | how);if (sk->sk_prot->shutdown) sk->sk_prot->shutdown (sk, how);break ;
net/ipv4/tcp.c +8 -6
@@ -498,6 +498,7 @@ __poll_t tcp_poll(struct file *file, struct socket *sock, poll_table *wait)__poll_t mask;struct sock *sk = sock->sk;const struct tcp_sock *tp =tcp_sk (sk); +u8 shutdown;int state;sock_poll_wait (file, sock, wait);
@@ -540,9 +541,10 @@ __poll_t tcp_poll(struct file *file, struct socket *sock, poll_table *wait)* NOTE. Check for TCP_CLOSE is added. The goal is to prevent * blocking on fresh not-connected or disconnected socket. --ANK */ -if (sk->sk_shutdown ==SHUTDOWN_MASK || state ==TCP_CLOSE ) + shutdown =READ_ONCE (sk->sk_shutdown); +if (shutdown ==SHUTDOWN_MASK || state ==TCP_CLOSE ) mask |=EPOLLHUP ; -if (sk->sk_shutdown &RCV_SHUTDOWN ) +if (shutdown &RCV_SHUTDOWN ) mask |=EPOLLIN |EPOLLRDNORM |EPOLLRDHUP ;/* Connected or passive Fast Open socket? */
@@ -559,7 +561,7 @@ __poll_t tcp_poll(struct file *file, struct socket *sock, poll_table *wait)if (tcp_stream_is_readable (sk, target)) mask |=EPOLLIN |EPOLLRDNORM ; -if (!(sk->sk_shutdown &SEND_SHUTDOWN )) { +if (!(shutdown &SEND_SHUTDOWN )) {if (__sk_stream_is_writeable (sk,1 )) { mask |=EPOLLOUT |EPOLLWRNORM ; }else {/* send SIGIO later */
@@ -2865,7 +2867,7 @@ void __tcp_close(struct sock *sk, long timeout)int data_was_unread =0 ;int state; - sk->sk_shutdown =SHUTDOWN_MASK ; +WRITE_ONCE (sk->sk_shutdown,SHUTDOWN_MASK );if (sk->sk_state ==TCP_LISTEN ) {tcp_set_state (sk,TCP_CLOSE );
@@ -3117,7 +3119,7 @@ int tcp_disconnect(struct sock *sk, int flags)inet_bhash2_reset_saddr (sk); - sk->sk_shutdown =0 ; +WRITE_ONCE (sk->sk_shutdown,0 );sock_reset_flag (sk,SOCK_DONE ); tp->srtt_us =0 ; tp->mdev_us =jiffies_to_usecs (TCP_TIMEOUT_INIT );
@@ -4645,7 +4647,7 @@ void tcp_done(struct sock *sk)if (req)reqsk_fastopen_remove (sk, req, false); - sk->sk_shutdown =SHUTDOWN_MASK ; +WRITE_ONCE (sk->sk_shutdown,SHUTDOWN_MASK );if (!sock_flag (sk,SOCK_DEAD )) sk->sk_state_change (sk);
net/ipv4/tcp_input.c +2 -2
@@ -4361,7 +4361,7 @@ void tcp_fin(struct sock *sk)inet_csk_schedule_ack (sk); - sk->sk_shutdown |=RCV_SHUTDOWN ; +WRITE_ONCE (sk->sk_shutdown, sk->sk_shutdown |RCV_SHUTDOWN );sock_set_flag (sk,SOCK_DONE );switch (sk->sk_state) {
@@ -6585,7 +6585,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)break ;tcp_set_state (sk,TCP_FIN_WAIT2 ); - sk->sk_shutdown |=SEND_SHUTDOWN ; +WRITE_ONCE (sk->sk_shutdown, sk->sk_shutdown |SEND_SHUTDOWN );sk_dst_confirm (sk);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 20/292 gve: Remove the code of clearing PBA bit
In reply to Greg Kroah-HartmanFrom: Ziwei Xiao <[email protected]>
[ Upstream commit f4c2e67c1773d2a2632381ee30e9139c1e744c16 ]
Clearing the PBA bit from the driver is race prone and it may lead to dropped interrupt events. This could potentially lead to the traffic being completely halted.
--- drivers/net/ethernet/google/gve/gve_main.c | 13 ------------- 1 file changed, 13 deletions(-)
drivers/net/ethernet/google/gve/gve_main.c +0 -13
@@ -239,19 +239,6 @@ static int gve_napi_poll_dqo(struct napi_struct *napi, int budget)bool reschedule = false;int work_done =0 ; -/* Clear PCI MSI-X Pending Bit Array (PBA) -* -* This bit is set if an interrupt event occurs while the vector is -* masked. If this bit is set and we reenable the interrupt, it will -* fire again. Since we're just about to poll the queue state, we don't -* need it to fire again. -* -* Under high softirq load, it's possible that the interrupt condition -* is triggered twice before we got the chance to process it. -*/ -gve_write_irq_doorbell_dqo (priv, block, -GVE_ITR_NO_UPDATE_DQO |GVE_ITR_CLEAR_PBA_BIT_DQO ); -if (block->tx) reschedule |=gve_tx_poll_dqo (block,/*do_clean=*/ true);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 21/292 ipvlan:Fix out-of-bounds caused by unclear skb->cb
In reply to Greg Kroah-HartmanFrom: t.feng <[email protected]>
[ Upstream commit 90cbed5247439a966b645b34eb0a2e037836ea8e ]
If skb enqueue the qdisc, fq_skb_cb(skb)->time_to_send is changed which is actually skb->cb, and IPCB(skb_in)->opt will be used in __ip_options_echo. It is possible that memcpy is out of bounds and lead to stack overflow.
We should clear skb->cb before ip_local_out or ip6_local_out.
v2:
1. clean the stack info
2. use IPCB/IP6CB instead of skb->cb
crash on stable-5.10(reproduce in kasan kernel).
Stack info:
[ 2203.651571] BUG: KASAN: stack-out-of-bounds in __ip_options_echo+0x589/0x800 [ 2203.653327] Write of size 4 at addr ffff88811a388f27 by task swapper/3/0 [ 2203.655460] CPU: 3 PID: 0 Comm: swapper/3 Kdump: loaded Not tainted 5.10.0-60.18.0.50.h856.kasan.eulerosv2r11.x86_64 #1 [ 2203.655466] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.10.2-0-g5f4c7b1-20181220_000000-szxrtosci10000 04/01/2014 [ 2203.655475] Call Trace: [ 2203.655481] <IRQ> [ 2203.655501] dump_stack+0x9c/0xd3 [ 2203.655514] print_address_description.constprop.0+0x19/0x170 [ 2203.655530] __kasan_report.cold+0x6c/0x84 [ 2203.655586] kasan_report+0x3a/0x50 [ 2203.655594] check_memory_region+0xfd/0x1f0 [ 2203.655601] memcpy+0x39/0x60 [ 2203.655608] __ip_options_echo+0x589/0x800 [ 2203.655654] __icmp_send+0x59a/0x960 [ 2203.655755] nf_send_unreach+0x129/0x3d0 [nf_reject_ipv4] [ 2203.655763] reject_tg+0x77/0x1bf [ipt_REJECT] [ 2203.655772] ipt_do_table+0x691/0xa40 [ip_tables] [ 2203.655821] nf_hook_slow+0x69/0x100 [ 2203.655828] __ip_local_out+0x21e/0x2b0 [ 2203.655857] ip_local_out+0x28/0x90 [ 2203.655868] ipvlan_process_v4_outbound+0x21e/0x260 [ipvlan] [ 2203.655931] ipvlan_xmit_mode_l3+0x3bd/0x400 [ipvlan] [ 2203.655967] ipvlan_queue_xmit+0xb3/0x190 [ipvlan] [ 2203.655977] ipvlan_start_xmit+0x2e/0xb0 [ipvlan] [ 2203.655984] xmit_one.constprop.0+0xe1/0x280 [ 2203.655992] dev_hard_start_xmit+0x62/0x100 [ 2203.656000] sch_direct_xmit+0x215/0x640 [ 2203.656028] __qdisc_run+0x153/0x1f0 [ 2203.656069] __dev_queue_xmit+0x77f/0x1030 [ 2203.656173] ip_finish_output2+0x59b/0xc20 [ 2203.656244] __ip_finish_output.part.0+0x318/0x3d0 [ 2203.656312] ip_finish_output+0x168/0x190 [ 2203.656320] ip_output+0x12d/0x220 [ 2203.656357] __ip_queue_xmit+0x392/0x880 [ 2203.656380] __tcp_transmit_skb+0x1088/0x11c0 [ 2203.656436] __tcp_retransmit_skb+0x475/0xa30 [ 2203.656505] tcp_retransmit_skb+0x2d/0x190 [ 2203.656512] tcp_retransmit_timer+0x3af/0x9a0 [ 2203.656519] tcp_write_timer_handler+0x3ba/0x510 [ 2203.656529] tcp_write_timer+0x55/0x180 [ 2203.656542] call_timer_fn+0x3f/0x1d0 [ 2203.656555] expire_timers+0x160/0x200 [ 2203.656562] run_timer_softirq+0x1f4/0x480 [ 2203.656606] __do_softirq+0xfd/0x402 [ 2203.656613] asm_call_irq_on_stack+0x12/0x20 [ 2203.656617] </IRQ> [ 2203.656623] do_softirq_own_stack+0x37/0x50 [ 2203.656631] irq_exit_rcu+0x134/0x1a0 [ 2203.656639] sysvec_apic_timer_interrupt+0x36/0x80 [ 2203.656646] asm_sysvec_apic_timer_interrupt+0x12/0x20 [ 2203.656654] RIP: 0010:default_idle+0x13/0x20 [ 2203.656663] Code: 89 f0 5d 41 5c 41 5d 41 5e c3 cc cc cc cc cc cc cc cc cc cc cc cc cc 0f 1f 44 00 00 0f 1f 44 00 00 0f 00 2d 9f 32 57 00 fb f4 <c3> cc cc cc cc 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 41 54 be 08 [ 2203.656668] RSP: 0018:ffff88810036fe78 EFLAGS: 00000256 [ 2203.656676] RAX: ffffffffaf2a87f0 RBX: ffff888100360000 RCX: ffffffffaf290191 [ 2203.656681] RDX: 0000000000098b5e RSI: 0000000000000004 RDI: ffff88811a3c4f60 [ 2203.656686] RBP: 0000000000000000 R08: 0000000000000001 R09: ffff88811a3c4f63 [ 2203.656690] R10: ffffed10234789ec R11: 0000000000000001 R12: 0000000000000003 [ 2203.656695] R13: ffff888100360000 R14: 0000000000000000 R15: 0000000000000000 [ 2203.656729] default_idle_call+0x5a/0x150 [ 2203.656735] cpuidle_idle_call+0x1c6/0x220 [ 2203.656780] do_idle+0xab/0x100 [ 2203.656786] cpu_startup_entry+0x19/0x20 [ 2203.656793] secondary_startup_64_no_verify+0xc2/0xcb
[ 2203.657409] The buggy address belongs to the page: [ 2203.658648] page:0000000027a9842f refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11a388 [ 2203.658665] flags: 0x17ffffc0001000(reserved|node=0|zone=2|lastcpupid=0x1fffff) [ 2203.658675] raw: 0017ffffc0001000 ffffea000468e208 ffffea000468e208 0000000000000000 [ 2203.658682] raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000 [ 2203.658686] page dumped because: kasan: bad access detected
To reproduce(ipvlan with IPVLAN_MODE_L3):
Env setting:
=======================================================
modprobe ipvlan ipvlan_default_mode=1
sysctl net.ipv4.conf.eth0.forwarding=1
iptables -t nat -A POSTROUTING -s 20.0.0.0/255.255.255.0 -o eth0 -j MASQUERADE
ip link add gw link eth0 type ipvlan
ip -4 addr add 20.0.0.254/24 dev gw
ip netns add net1
ip link add ipv1 link eth0 type ipvlan
ip link set ipv1 netns net1
ip netns exec net1 ip link set ipv1 up
ip netns exec net1 ip -4 addr add 20.0.0.4/24 dev ipv1
ip netns exec net1 route add default gw 20.0.0.254
ip netns exec net1 tc qdisc add dev ipv1 root netem loss 10% ifconfig gw up
iptables -t filter -A OUTPUT -p tcp --dport 8888 -j REJECT --reject-with icmp-port-unreachable
=======================================================
And then excute the shell(curl any address of eth0 can reach):
for((i=1;i<=100000;i++))
do
ip netns exec net1 curl x.x.x.x:8888
done
=======================================================
--- drivers/net/ipvlan/ipvlan_core.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ipvlan/ipvlan_core.c +6 -0
@@ -436,6 +436,9 @@ static int ipvlan_process_v4_outbound(struct sk_buff *skb) goto err; }skb_dst_set (skb, &rt->dst); + +memset (IPCB (skb),0 ,sizeof (*IPCB (skb))); + err =ip_local_out (net, skb->sk, skb);if (unlikely (net_xmit_eval (err))) dev->stats.tx_errors++;
@@ -474,6 +477,9 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb) goto err; }skb_dst_set (skb, dst); + +memset (IP6CB (skb),0 ,sizeof (*IP6CB (skb))); + err =ip6_local_out (net, skb->sk, skb);if (unlikely (net_xmit_eval (err))) dev->stats.tx_errors++;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 22/292 net: mscc: ocelot: fix stat counter register values
In reply to Greg Kroah-HartmanFrom: Colin Foster <[email protected]>
[ Upstream commit cdc2e28e214fe9315cdd7e069c1c8e2428f93427 ]
Commit d4c367650704 ("net: mscc: ocelot: keep ocelot_stat_layout by reg address, not offset") organized the stats counters for Ocelot chips, namely the VSC7512 and VSC7514. A few of the counter offsets were incorrect, and were caught by this warning:
WARNING: CPU: 0 PID: 24 at drivers/net/ethernet/mscc/ocelot_stats.c:909 ocelot_stats_init+0x1fc/0x2d8
reg 0x5000078 had address 0x220 but reg 0x5000079 has address 0x214, bulking broken!
Fix these register offsets.
--- drivers/net/ethernet/mscc/vsc7514_regs.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/net/ethernet/mscc/vsc7514_regs.c +9 -9
@@ -252,15 +252,15 @@ const u32 vsc7514_sys_regmap[] = {REG (SYS_COUNT_DROP_YELLOW_PRIO_4 ,0x000218 ),REG (SYS_COUNT_DROP_YELLOW_PRIO_5 ,0x00021c ),REG (SYS_COUNT_DROP_YELLOW_PRIO_6 ,0x000220 ), -REG (SYS_COUNT_DROP_YELLOW_PRIO_7 ,0x000214 ), -REG (SYS_COUNT_DROP_GREEN_PRIO_0 ,0x000218 ), -REG (SYS_COUNT_DROP_GREEN_PRIO_1 ,0x00021c ), -REG (SYS_COUNT_DROP_GREEN_PRIO_2 ,0x000220 ), -REG (SYS_COUNT_DROP_GREEN_PRIO_3 ,0x000224 ), -REG (SYS_COUNT_DROP_GREEN_PRIO_4 ,0x000228 ), -REG (SYS_COUNT_DROP_GREEN_PRIO_5 ,0x00022c ), -REG (SYS_COUNT_DROP_GREEN_PRIO_6 ,0x000230 ), -REG (SYS_COUNT_DROP_GREEN_PRIO_7 ,0x000234 ), +REG (SYS_COUNT_DROP_YELLOW_PRIO_7 ,0x000224 ), +REG (SYS_COUNT_DROP_GREEN_PRIO_0 ,0x000228 ), +REG (SYS_COUNT_DROP_GREEN_PRIO_1 ,0x00022c ), +REG (SYS_COUNT_DROP_GREEN_PRIO_2 ,0x000230 ), +REG (SYS_COUNT_DROP_GREEN_PRIO_3 ,0x000234 ), +REG (SYS_COUNT_DROP_GREEN_PRIO_4 ,0x000238 ), +REG (SYS_COUNT_DROP_GREEN_PRIO_5 ,0x00023c ), +REG (SYS_COUNT_DROP_GREEN_PRIO_6 ,0x000240 ), +REG (SYS_COUNT_DROP_GREEN_PRIO_7 ,0x000244 ),REG (SYS_RESET_CFG ,0x000508 ),REG (SYS_CMID ,0x00050c ), REG(SYS_VLAN_ETYPE_CFG, 0x000510),
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 23/292 net: datagram: fix data-races in datagram_poll()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 5bca1d081f44c9443e61841842ce4e9179d327b6 ]
datagram_poll() runs locklessly, we should add READ_ONCE() annotations while reading sk->sk_err, sk->sk_shutdown and sk->sk_state.
--- net/core/datagram.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
net/core/datagram.c +10 -5
@@ -799,18 +799,21 @@ __poll_t datagram_poll(struct file *file, struct socket *sock, {struct sock *sk = sock->sk;__poll_t mask; +u8 shutdown;sock_poll_wait (file, sock, wait); mask =0 ;/* exceptional events? */ -if (sk->sk_err || !skb_queue_empty_lockless (&sk->sk_error_queue)) +if (READ_ONCE (sk->sk_err) || + !skb_queue_empty_lockless (&sk->sk_error_queue)) mask |=EPOLLERR | (sock_flag (sk,SOCK_SELECT_ERR_QUEUE ) ?EPOLLPRI :0 ); -if (sk->sk_shutdown &RCV_SHUTDOWN ) + shutdown =READ_ONCE (sk->sk_shutdown); +if (shutdown &RCV_SHUTDOWN ) mask |=EPOLLRDHUP |EPOLLIN |EPOLLRDNORM ; -if (sk->sk_shutdown ==SHUTDOWN_MASK ) +if (shutdown ==SHUTDOWN_MASK ) mask |=EPOLLHUP ;/* readable? */
@@ -819,10 +822,12 @@ __poll_t datagram_poll(struct file *file, struct socket *sock,/* Connection-based need to check for termination and startup */ if (connection_based (sk)) { -if (sk->sk_state ==TCP_CLOSE ) +int state =READ_ONCE (sk->sk_state); + +if (state ==TCP_CLOSE ) mask |=EPOLLHUP ;/* connection hasn't started yet? */ -if (sk->sk_state ==TCP_SYN_SENT ) +if (state ==TCP_SYN_SENT )return mask; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 24/292 af_unix: Fix a data race of sk->sk_receive_queue->qlen.
In reply to Greg Kroah-HartmanFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 679ed006d416ea0cecfe24a99d365d1dea69c683 ]
KCSAN found a data race of sk->sk_receive_queue->qlen where recvmsg() updates qlen under the queue lock and sendmsg() checks qlen under unix_state_sock(), not the queue lock, so the reader side needs READ_ONCE().
BUG: KCSAN: data-race in __skb_try_recv_from_queue / unix_wait_for_peer
write (marked) to 0xffff888019fe7c68 of 4 bytes by task 49792 on cpu 0:
__skb_unlink include/linux/skbuff.h:2347 [inline] __skb_try_recv_from_queue+0x3de/0x470 net/core/datagram.c:197 __skb_try_recv_datagram+0xf7/0x390 net/core/datagram.c:263 __unix_dgram_recvmsg+0x109/0x8a0 net/unix/af_unix.c:2452 unix_dgram_recvmsg+0x94/0xa0 net/unix/af_unix.c:2549 sock_recvmsg_nosec net/socket.c:1019 [inline] ____sys_recvmsg+0x3a3/0x3b0 net/socket.c:2720 ___sys_recvmsg+0xc8/0x150 net/socket.c:2764 do_recvmmsg+0x182/0x560 net/socket.c:2858 __sys_recvmmsg net/socket.c:2937 [inline] __do_sys_recvmmsg net/socket.c:2960 [inline] __se_sys_recvmmsg net/socket.c:2953 [inline] __x64_sys_recvmmsg+0x153/0x170 net/socket.c:2953 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x72/0xdc
read to 0xffff888019fe7c68 of 4 bytes by task 49793 on cpu 1:
skb_queue_len include/linux/skbuff.h:2127 [inline] unix_recvq_full net/unix/af_unix.c:229 [inline] unix_wait_for_peer+0x154/0x1a0 net/unix/af_unix.c:1445 unix_dgram_sendmsg+0x13bc/0x14b0 net/unix/af_unix.c:2048 sock_sendmsg_nosec net/socket.c:724 [inline] sock_sendmsg+0x148/0x160 net/socket.c:747 ____sys_sendmsg+0x20e/0x620 net/socket.c:2503 ___sys_sendmsg+0xc6/0x140 net/socket.c:2557 __sys_sendmmsg+0x11d/0x370 net/socket.c:2643 __do_sys_sendmmsg net/socket.c:2672 [inline] __se_sys_sendmmsg net/socket.c:2669 [inline] __x64_sys_sendmmsg+0x58/0x70 net/socket.c:2669 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x72/0xdc
value changed: 0x0000000b -> 0x00000001
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 49793 Comm: syz-executor.0 Not tainted 6.3.0-rc7-02330-gca6270c12e20 #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
--- net/unix/af_unix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/unix/af_unix.c +1 -1
@@ -1441,7 +1441,7 @@ static long unix_wait_for_peer(struct sock *other, long timeo) sched = !sock_flag (other,SOCK_DEAD ) && !(other->sk_shutdown &RCV_SHUTDOWN ) && -unix_recvq_full (other); +unix_recvq_full_lockless (other);unix_state_unlock (other);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 25/292 af_unix: Fix data races around sk->sk_shutdown.
In reply to Greg Kroah-HartmanFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit e1d09c2c2f5793474556b60f83900e088d0d366d ]
KCSAN found a data race around sk->sk_shutdown where unix_release_sock() and unix_shutdown() update it under unix_state_lock(), OTOH unix_poll() and unix_dgram_poll() read it locklessly.
We need to annotate the writes and reads with WRITE_ONCE() and READ_ONCE().
BUG: KCSAN: data-race in unix_poll / unix_release_sock
write to 0xffff88800d0f8aec of 1 bytes by task 264 on cpu 0:
unix_release_sock+0x75c/0x910 net/unix/af_unix.c:631 unix_release+0x59/0x80 net/unix/af_unix.c:1042 __sock_release+0x7d/0x170 net/socket.c:653 sock_close+0x19/0x30 net/socket.c:1397 __fput+0x179/0x5e0 fs/file_table.c:321 ____fput+0x15/0x20 fs/file_table.c:349 task_work_run+0x116/0x1a0 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x174/0x180 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x1a/0x30 kernel/entry/common.c:297 do_syscall_64+0x4b/0x90 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x72/0xdc
read to 0xffff88800d0f8aec of 1 bytes by task 222 on cpu 1:
unix_poll+0xa3/0x2a0 net/unix/af_unix.c:3170 sock_poll+0xcf/0x2b0 net/socket.c:1385 vfs_poll include/linux/poll.h:88 [inline] ep_item_poll.isra.0+0x78/0xc0 fs/eventpoll.c:855 ep_send_events fs/eventpoll.c:1694 [inline] ep_poll fs/eventpoll.c:1823 [inline] do_epoll_wait+0x6c4/0xea0 fs/eventpoll.c:2258 __do_sys_epoll_wait fs/eventpoll.c:2270 [inline] __se_sys_epoll_wait fs/eventpoll.c:2265 [inline] __x64_sys_epoll_wait+0xcc/0x190 fs/eventpoll.c:2265 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x72/0xdc
value changed: 0x00 -> 0x03
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 222 Comm: dbus-broker Not tainted 6.3.0-rc7-02330-gca6270c12e20 #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
--- net/unix/af_unix.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
net/unix/af_unix.c +12 -8
@@ -602,7 +602,7 @@ static void unix_release_sock(struct sock *sk, int embrion)/* Clear state */ unix_state_lock (sk);sock_orphan (sk); - sk->sk_shutdown =SHUTDOWN_MASK ; +WRITE_ONCE (sk->sk_shutdown,SHUTDOWN_MASK ); path = u->path; u->path.dentry =NULL ; u->path.mnt =NULL ;
@@ -627,7 +627,7 @@ static void unix_release_sock(struct sock *sk, int embrion)if (sk->sk_type ==SOCK_STREAM || sk->sk_type ==SOCK_SEQPACKET ) {unix_state_lock (skpair);/* No more writes */ - skpair->sk_shutdown =SHUTDOWN_MASK ; +WRITE_ONCE (skpair->sk_shutdown,SHUTDOWN_MASK );if (!skb_queue_empty (&sk->sk_receive_queue) || embrion) skpair->sk_err =ECONNRESET ;unix_state_unlock (skpair);
@@ -3007,7 +3007,7 @@ static int unix_shutdown(struct socket *sock, int mode) ++mode;unix_state_lock (sk); - sk->sk_shutdown |= mode; +WRITE_ONCE (sk->sk_shutdown, sk->sk_shutdown | mode); other =unix_peer (sk);if (other)sock_hold (other);
@@ -3027,7 +3027,7 @@ static int unix_shutdown(struct socket *sock, int mode)if (mode&SEND_SHUTDOWN ) peer_mode |=RCV_SHUTDOWN ;unix_state_lock (other); - other->sk_shutdown |= peer_mode; +WRITE_ONCE (other->sk_shutdown, other->sk_shutdown | peer_mode);unix_state_unlock (other); other->sk_state_change (other);if (peer_mode ==SHUTDOWN_MASK )
@@ -3159,16 +3159,18 @@ static __poll_t unix_poll(struct file *file, struct socket *sock, poll_table *wa {struct sock *sk = sock->sk;__poll_t mask; +u8 shutdown;sock_poll_wait (file, sock, wait); mask =0 ; + shutdown =READ_ONCE (sk->sk_shutdown);/* exceptional events? */ if (sk->sk_err) mask |=EPOLLERR ; -if (sk->sk_shutdown ==SHUTDOWN_MASK ) +if (shutdown ==SHUTDOWN_MASK ) mask |=EPOLLHUP ; -if (sk->sk_shutdown &RCV_SHUTDOWN ) +if (shutdown &RCV_SHUTDOWN ) mask |=EPOLLRDHUP |EPOLLIN |EPOLLRDNORM ;/* readable? */
@@ -3202,18 +3204,20 @@ static __poll_t unix_dgram_poll(struct file *file, struct socket *sock,struct sock *sk = sock->sk, *other;unsigned int writable;__poll_t mask; +u8 shutdown;sock_poll_wait (file, sock, wait); mask =0 ; + shutdown =READ_ONCE (sk->sk_shutdown);/* exceptional events? */ if (sk->sk_err || !skb_queue_empty_lockless (&sk->sk_error_queue)) mask |=EPOLLERR | (sock_flag (sk,SOCK_SELECT_ERR_QUEUE ) ?EPOLLPRI :0 ); -if (sk->sk_shutdown &RCV_SHUTDOWN ) +if (shutdown &RCV_SHUTDOWN ) mask |=EPOLLRDHUP |EPOLLIN |EPOLLRDNORM ; -if (sk->sk_shutdown ==SHUTDOWN_MASK ) +if (shutdown ==SHUTDOWN_MASK ) mask |=EPOLLHUP ;/* readable? */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 26/292 drm/i915/guc: Dont capture Gen8 regs on Xe devices
In reply to Greg Kroah-HartmanFrom: John Harrison <[email protected]>
[ Upstream commit 275dac1f7f5e9c2a2e806b34d3b10804eec0ac3c ]
A pair of pre-Xe registers were being included in the Xe capture list. GuC was rejecting those as being invalid and logging errors about them. So, stop doing it.
--- drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c +5 -2
@@ -30,12 +30,14 @@ { FORCEWAKE_MT, 0, 0, "FORCEWAKE" }#define COMMON_GEN9BASE_GLOBAL \ - { GEN8_FAULT_TLB_DATA0, 0, 0, "GEN8_FAULT_TLB_DATA0" }, \ - { GEN8_FAULT_TLB_DATA1, 0, 0, "GEN8_FAULT_TLB_DATA1" }, \ { ERROR_GEN6, 0, 0, "ERROR_GEN6" }, \ { DONE_REG, 0, 0, "DONE_REG" }, \ { HSW_GTT_CACHE_EN, 0, 0, "HSW_GTT_CACHE_EN" } +#define GEN9_GLOBAL \ + { GEN8_FAULT_TLB_DATA0, 0, 0, "GEN8_FAULT_TLB_DATA0" }, \ + { GEN8_FAULT_TLB_DATA1, 0, 0, "GEN8_FAULT_TLB_DATA1" } +#define COMMON_GEN12BASE_GLOBAL \ { GEN12_FAULT_TLB_DATA0, 0, 0, "GEN12_FAULT_TLB_DATA0" }, \ { GEN12_FAULT_TLB_DATA1, 0, 0, "GEN12_FAULT_TLB_DATA1" }, \
@@ -136,6 +138,7 @@ static const struct __guc_mmio_reg_descr xe_lpd_blt_inst_regs[] = {static const struct __guc_mmio_reg_descr default_global_regs[] = {COMMON_BASE_GLOBAL ,COMMON_GEN9BASE_GLOBAL , +GEN9_GLOBAL , };static const struct __guc_mmio_reg_descr default_rc_class_regs[] = {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 27/292 drm/i915: Fix NULL ptr deref by checking new_crtc_state
In reply to Greg Kroah-HartmanFrom: Stanislav Lisovskiy <[email protected]>
[ Upstream commit a41d985902c153c31c616fe183cf2ee331e95ecb ]
intel_atomic_get_new_crtc_state can return NULL, unless crtc state wasn't obtained previously with intel_atomic_get_crtc_state, so we must check it for NULLness here, just as in many other places, where we can't guarantee that intel_atomic_get_crtc_state was called.
We are currently getting NULL ptr deref because of that, so this fix was confirmed to help.
--- drivers/gpu/drm/i915/display/intel_atomic_plane.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_atomic_plane.c +2 -2
@@ -988,7 +988,7 @@ intel_prepare_plane_fb(struct drm_plane *_plane,int ret;if (old_obj) { -const struct intel_crtc_state *crtc_state = +const struct intel_crtc_state *new_crtc_state =intel_atomic_get_new_crtc_state (state,to_intel_crtc (old_plane_state->hw.crtc));
@@ -1003,7 +1003,7 @@ intel_prepare_plane_fb(struct drm_plane *_plane,* This should only fail upon a hung GPU, in which case we * can safely continue. */ -if (intel_crtc_needs_modeset (crtc_state)) { +if (new_crtc_state &&intel_crtc_needs_modeset (new_crtc_state)) { ret = i915_sw_fence_await_reservation(&state->commit_ready, old_obj->base.resv, NULL, false, 0,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 28/292 drm/i915/dp: prevent potential div-by-zero
In reply to Greg Kroah-HartmanFrom: Nikita Zhandarovich <[email protected]>
[ Upstream commit 0ff80028e2702c7c3d78b69705dc47c1ccba8c39 ]
drm_dp_dsc_sink_max_slice_count() may return 0 if something goes wrong on the part of the DSC sink and its DPCD register. This null value may be later used as a divisor in intel_dsc_compute_params(), which will lead to an error.
In the unlikely event that this issue occurs, fix it by testing the return value of drm_dp_dsc_sink_max_slice_count() against zero.
Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE.
--- drivers/gpu/drm/i915/display/intel_dp.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/i915/display/intel_dp.c +5 -0
@@ -1512,6 +1512,11 @@ static int intel_dp_dsc_compute_config(struct intel_dp *intel_dp, pipe_config->dsc.slice_count =drm_dp_dsc_sink_max_slice_count (intel_dp->dsc_dpcd, true); +if (!pipe_config->dsc.slice_count) { +drm_dbg_kms (&dev_priv->drm,"Unsupported Slice Count %d\n" , + pipe_config->dsc.slice_count); +return -EINVAL ; + } }else {u16 dsc_max_output_bpp;u8 dsc_dp_slice_count;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 29/292 drm/i915: Expand force_probe to block probe of devices as well.
In reply to Greg Kroah-HartmanFrom: Rodrigo Vivi <[email protected]>
[ Upstream commit 157821fb3e9aaa07cf408686b08d117bf27b7de1 ]
There are new cases where we want to block i915 probe, such as when experimenting or developing the new Xe driver.
But also, with the new hybrid cards, users or developers might want to use i915 only on integrated and fully block the probe of the i915 for the discrete. Or vice versa.
There are even older development and validation reasons, like when you use some distro where the modprobe.blacklist is not present.
But in any case, let's introduce a more granular control, but without introducing yet another parameter, but using the existent force_probe one.
Just by adding a ! in the begin of the id in the force_probe, like in this case where we would block the probe for Alder Lake:
$ insmod i915.ko force_probe='!46a6'
v2: Take care of '*' and '!*' cases as pointed out by
Gustavo and Jani.
Stable-dep-of: 79c901c93562 ("drm/i915: taint kernel when force probing unsupported devices")
--- drivers/gpu/drm/i915/Kconfig | 15 +++++++++++--- drivers/gpu/drm/i915/i915_params.c | 2 +- drivers/gpu/drm/i915/i915_pci.c | 33 +++++++++++++++++++++++++----- 3 files changed, 41 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/Kconfig +12 -3
@@ -54,24 +54,33 @@ config DRM_I915 If "M" is selected, the module will be called i915. config DRM_I915_FORCE_PROBE - string "Force probe driver for selected new Intel hardware" + string "Force probe i915 for selected Intel hardware IDs" depends on DRM_I915 help This is the default value for the i915.force_probe module parameter. Using the module parameter overrides this option. - Force probe the driver for new Intel graphics devices that are + Force probe the i915 for Intel graphics devices that are recognized but not properly supported by this kernel version. It is recommended to upgrade to a kernel version with proper support as soon as it is available. + It can also be used to block the probe of recognized and fully + supported devices. + Use "" to disable force probe. If in doubt, use this. - Use "<pci-id>[,<pci-id>,...]" to force probe the driver for listed + Use "<pci-id>[,<pci-id>,...]" to force probe the i915 for listed devices. For example, "4500" or "4500,4571". Use "*" to force probe the driver for all known devices. + Use "!" right before the ID to block the probe of the device. For + example, "4500,!4571" forces the probe of 4500 and blocks the probe of + 4571. + + Use "!*" to block the probe of the driver for all known devices. + config DRM_I915_CAPTURE_ERROR bool "Enable capturing GPU state following a hang" depends on DRM_I915
drivers/gpu/drm/i915/i915_params.c +1 -1
@@ -122,7 +122,7 @@ i915_param_named_unsafe(enable_psr2_sel_fetch, bool, 0400, "Default: 0");i915_param_named_unsafe (force_probe, charp,0400 , -"Force probe the driver for specified devices. " +"Force probe options for specified supported devices. " "See CONFIG_DRM_I915_FORCE_PROBE for details." ); i915_param_named_unsafe(disable_power_well, int, 0400,
drivers/gpu/drm/i915/i915_pci.c +28 -5
@@ -1252,7 +1252,7 @@ static void i915_pci_remove(struct pci_dev *pdev) }/* is device_id present in comma separated list of ids */ -static bool force_probe (u16 device_id,const char *devices) +static bool device_id_in_list (u16 device_id,const char *devices,bool negative) {char *s, *p, *tok;bool ret;
@@ -1261,7 +1261,9 @@ static bool force_probe(u16 device_id, const char *devices)return false;/* match everything */ -if (strcmp (devices,"*" ) ==0 ) +if (negative &&strcmp (devices,"!*" ) ==0 ) +return true; +if (!negative &&strcmp (devices,"*" ) ==0 )return true; s =kstrdup (devices,GFP_KERNEL );
@@ -1271,6 +1273,12 @@ static bool force_probe(u16 device_id, const char *devices)for (p = s, ret = false; (tok =strsep (&p,"," )) !=NULL ; ) {u16 val; +if (negative && tok[0 ] =='!' ) + tok++; +else if ((negative && tok[0 ] !='!' ) || + (!negative && tok[0 ] =='!' )) +continue ; +if (kstrtou16 (tok,16 , &val) ==0 && val == device_id) { ret = true;break ;
@@ -1282,6 +1290,16 @@ static bool force_probe(u16 device_id, const char *devices)return ret; } +static bool id_forced (u16 device_id) +{ +return device_id_in_list (device_id, i915_modparams.force_probe, false); +} + +static bool id_blocked (u16 device_id) +{ +return device_id_in_list (device_id, i915_modparams.force_probe, true); +} +bool i915_pci_resource_valid (struct pci_dev *pdev,int bar) {if (!pci_resource_flags (pdev, bar))
@@ -1309,10 +1327,9 @@ static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) (struct intel_device_info *) ent->driver_data;int err; -if (intel_info->require_force_probe && - !force_probe (pdev->device, i915_modparams.force_probe)) { +if (intel_info->require_force_probe && !id_forced (pdev->device)) { dev_info(&pdev->dev, - "Your graphics device %04x is not properly supported by the driver in this\n" + "Your graphics device %04x is not properly supported by i915 in this\n" "kernel version. To force driver probe anyway, use i915.force_probe=%04x\n" "module parameter or CONFIG_DRM_I915_FORCE_PROBE=%04x configuration option,\n" "or (recommended) check for kernel updates.\n",
@@ -1320,6 +1337,12 @@ static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)return -ENODEV ; } +if (id_blocked (pdev->device)) { +dev_info (&pdev->dev,"I915 probe blocked for Device ID %04x.\n" , + pdev->device); +return -ENODEV ; + } +/* Only bind to function 0 of the device. Early generations * used function 1 as a placeholder for multi-head. This causes * us confusion instead, especially on the systems where both
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 30/292 drm/i915: taint kernel when force probing unsupported devices
In reply to Greg Kroah-HartmanFrom: Jani Nikula <[email protected]>
[ Upstream commit 79c901c93562bdf1c84ce6c1b744fbbe4389a6eb ]
For development and testing purposes, the i915.force_probe module parameter and DRM_I915_FORCE_PROBE kconfig option allow probing of devices that aren't supported by the driver.
The i915.force_probe module parameter is "unsafe" and setting it taints the kernel. However, using the kconfig option does not.
Always taint the kernel when force probing a device that is not supported.
v2: Drop "depends on EXPERT" to avoid build breakage (kernel test robot)
--- drivers/gpu/drm/i915/Kconfig | 12 +++++++----- drivers/gpu/drm/i915/i915_pci.c | 6 ++++++ 2 files changed, 13 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/Kconfig +7 -5
@@ -60,10 +60,11 @@ config DRM_I915_FORCE_PROBE This is the default value for the i915.force_probe module parameter. Using the module parameter overrides this option. - Force probe the i915 for Intel graphics devices that are - recognized but not properly supported by this kernel version. It is - recommended to upgrade to a kernel version with proper support as soon - as it is available. + Force probe the i915 driver for Intel graphics devices that are + recognized but not properly supported by this kernel version. Force + probing an unsupported device taints the kernel. It is recommended to + upgrade to a kernel version with proper support as soon as it is + available. It can also be used to block the probe of recognized and fully supported devices.
@@ -73,7 +74,8 @@ config DRM_I915_FORCE_PROBE Use "<pci-id>[,<pci-id>,...]" to force probe the i915 for listed devices. For example, "4500" or "4500,4571". - Use "*" to force probe the driver for all known devices. + Use "*" to force probe the driver for all known devices. Not + recommended. Use "!" right before the ID to block the probe of the device. For example, "4500,!4571" forces the probe of 4500 and blocks the probe of
drivers/gpu/drm/i915/i915_pci.c +6 -0
@@ -1343,6 +1343,12 @@ static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)return -ENODEV ; } +if (intel_info->require_force_probe) { +dev_info (&pdev->dev,"Force probing unsupported Device ID %04x, tainting kernel\n" , + pdev->device); +add_taint (TAINT_USER ,LOCKDEP_STILL_OK ); + } +/* Only bind to function 0 of the device. Early generations * used function 1 as a placeholder for multi-head. This causes * us confusion instead, especially on the systems where both
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 31/292 fbdev: arcfb: Fix error handling in arcfb_probe()
In reply to Greg Kroah-HartmanFrom: Zongjie Li <[email protected]>
[ Upstream commit 5a6bef734247c7a8c19511664ff77634ab86f45b ]
Smatch complains that:arcfb_probe() warn: 'irq' from request_irq() not released on lines: 587.
Fix error handling in the arcfb_probe() function. If IO addresses are not provided or framebuffer registration fails, the code will jump to the err_addr or err_register_fb label to release resources. If IRQ request fails, previously allocated resources will be freed.
--- drivers/video/fbdev/arcfb.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/video/fbdev/arcfb.c +9 -6
@@ -523,7 +523,7 @@ static int arcfb_probe(struct platform_device *dev) info =framebuffer_alloc (sizeof (struct arcfb_par ), &dev->dev);if (!info) - goto err; + goto err_fb_alloc; info->screen_base = (char __iomem *)videomemory; info->fbops = &arcfb_ops;
@@ -535,7 +535,7 @@ static int arcfb_probe(struct platform_device *dev)if (!dio_addr || !cio_addr || !c2io_addr) {printk (KERN_WARNING "no IO addresses supplied\n" ); - goto err1; + goto err_addr; } par->dio_addr = dio_addr; par->cio_addr = cio_addr;
@@ -551,12 +551,12 @@ static int arcfb_probe(struct platform_device *dev)printk (KERN_INFO "arcfb: Failed req IRQ %d\n" , par->irq); retval = -EBUSY ; - goto err1; + goto err_addr; } } retval =register_framebuffer (info);if (retval <0 ) - goto err1; + goto err_register_fb;platform_set_drvdata (dev, info);fb_info (info,"Arc frame buffer device, using %dK of video memory\n" , videomemorysize >>10 );
@@ -580,9 +580,12 @@ static int arcfb_probe(struct platform_device *dev) }return 0 ; -err1: + +err_register_fb: +free_irq (par->irq, info); +err_addr:framebuffer_release (info); -err: +err_fb_alloc:vfree (videomemory);return retval; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 32/292 ext4: reflect error codes from ext4_multi_mount_protect() to its callers
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
[ Upstream commit 3b50d5018ed06a647bb26c44bb5ae74e59c903c7 ]
This will allow more fine-grained errno codes to be returned by the mount system call.
Stable-dep-of: a44be64bbecb ("ext4: don't clear SB_RDONLY when remounting r/w until quota is re-enabled")
--- fs/ext4/mmp.c | 9 ++++++++- fs/ext4/super.c | 16 +++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-)
fs/ext4/mmp.c +8 -1
@@ -296,6 +296,7 @@ int ext4_multi_mount_protect(struct super_block *sb,if (mmp_block <le32_to_cpu (es->s_first_data_block) || mmp_block >=ext4_blocks_count (es)) {ext4_warning (sb,"Invalid MMP block in superblock" ); + retval = -EINVAL ; goto failed; }
@@ -321,6 +322,7 @@ int ext4_multi_mount_protect(struct super_block *sb,if (seq ==EXT4_MMP_SEQ_FSCK ) {dump_mmp_msg (sb, mmp,"fsck is running on the filesystem" ); + retval = -EBUSY ; goto failed; }
@@ -334,6 +336,7 @@ int ext4_multi_mount_protect(struct super_block *sb,if (schedule_timeout_interruptible (HZ * wait_time) !=0 ) {ext4_warning (sb,"MMP startup interrupted, failing mount\n" ); + retval = -ETIMEDOUT ; goto failed; }
@@ -344,6 +347,7 @@ int ext4_multi_mount_protect(struct super_block *sb,if (seq !=le32_to_cpu (mmp->mmp_seq)) {dump_mmp_msg (sb, mmp,"Device is already active on another node." ); + retval = -EBUSY ; goto failed; }
@@ -367,6 +371,7 @@ int ext4_multi_mount_protect(struct super_block *sb,*/ if (schedule_timeout_interruptible (HZ * wait_time) !=0 ) {ext4_warning (sb,"MMP startup interrupted, failing mount" ); + retval = -ETIMEDOUT ; goto failed; }
@@ -377,6 +382,7 @@ int ext4_multi_mount_protect(struct super_block *sb,if (seq !=le32_to_cpu (mmp->mmp_seq)) {dump_mmp_msg (sb, mmp,"Device is already active on another node." ); + retval = -EBUSY ; goto failed; }
@@ -396,6 +402,7 @@ int ext4_multi_mount_protect(struct super_block *sb,EXT4_SB (sb)->s_mmp_tsk =NULL ;ext4_warning (sb,"Unable to create kmmpd thread for %s." , sb->s_id); + retval = -ENOMEM ; goto failed; }
@@ -403,5 +410,5 @@ int ext4_multi_mount_protect(struct super_block *sb, failed:brelse (bh); -return 1 ; +return retval; }
fs/ext4/super.c +9 -7
@@ -5281,9 +5281,11 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)ext4_has_feature_orphan_present (sb) || ext4_has_feature_journal_needs_recovery(sb)); -if (ext4_has_feature_mmp (sb) && !sb_rdonly (sb)) -if (ext4_multi_mount_protect (sb,le64_to_cpu (es->s_mmp_block))) +if (ext4_has_feature_mmp (sb) && !sb_rdonly (sb)) { + err =ext4_multi_mount_protect (sb,le64_to_cpu (es->s_mmp_block)); +if (err) goto failed_mount3a; + }/* * The first inode we look at is the journal inode. Don't try
@@ -6524,12 +6526,12 @@ static int __ext4_remount(struct fs_context *fc, struct super_block *sb) goto restore_opts; sb->s_flags &= ~SB_RDONLY ; -if (ext4_has_feature_mmp (sb)) -if (ext4_multi_mount_protect (sb, -le64_to_cpu (es->s_mmp_block))) { - err = -EROFS ; +if (ext4_has_feature_mmp (sb)) { + err =ext4_multi_mount_protect (sb, +le64_to_cpu (es->s_mmp_block)); +if (err) goto restore_opts; - } + }#ifdef CONFIG_QUOTA enable_quota =1 ;#endif
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 33/292 ext4: dont clear SB_RDONLY when remounting r/w until quota is re-enabled
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
[ Upstream commit a44be64bbecb15a452496f60db6eacfee2b59c79 ]
When a file system currently mounted read/only is remounted read/write, if we clear the SB_RDONLY flag too early, before the quota is initialized, and there is another process/thread constantly attempting to create a directory, it's possible to trigger the
WARN_ON_ONCE(dquot_initialize_needed(inode));
in ext4_xattr_block_set(), with the following stack trace:
WARNING: CPU: 0 PID: 5338 at fs/ext4/xattr.c:2141 ext4_xattr_block_set+0x2ef2/0x3680
RIP: 0010:ext4_xattr_block_set+0x2ef2/0x3680 fs/ext4/xattr.c:2141
Call Trace:
ext4_xattr_set_handle+0xcd4/0x15c0 fs/ext4/xattr.c:2458
ext4_initxattrs+0xa3/0x110 fs/ext4/xattr_security.c:44
security_inode_init_security+0x2df/0x3f0 security/security.c:1147
__ext4_new_inode+0x347e/0x43d0 fs/ext4/ialloc.c:1324
ext4_mkdir+0x425/0xce0 fs/ext4/namei.c:2992
vfs_mkdir+0x29d/0x450 fs/namei.c:4038
do_mkdirat+0x264/0x520 fs/namei.c:4061
__do_sys_mkdirat fs/namei.c:4076 [inline]
__se_sys_mkdirat fs/namei.c:4074 [inline]
__x64_sys_mkdirat+0x89/0xa0 fs/namei.c:4074--- fs/ext4/super.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/ext4/super.c +5 -1
@@ -6339,6 +6339,7 @@ static int __ext4_remount(struct fs_context *fc, struct super_block *sb)struct ext4_mount_options old_opts;ext4_group_t g;int err =0 ; +int enable_rw =0 ;#ifdef CONFIG_QUOTA int enable_quota =0 ;int i, j;
@@ -6525,7 +6526,7 @@ static int __ext4_remount(struct fs_context *fc, struct super_block *sb)if (err) goto restore_opts; - sb->s_flags &= ~SB_RDONLY ; + enable_rw =1 ;if (ext4_has_feature_mmp (sb)) { err =ext4_multi_mount_protect (sb,le64_to_cpu (es->s_mmp_block));
@@ -6584,6 +6585,9 @@ static int __ext4_remount(struct fs_context *fc, struct super_block *sb)if (!test_opt (sb,BLOCK_VALIDITY ) && sbi->s_system_blks)ext4_release_system_zone (sb); +if (enable_rw) + sb->s_flags &= ~SB_RDONLY ; +if (!ext4_has_feature_mmp (sb) ||sb_rdonly (sb))ext4_stop_mmpd (sbi);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 34/292 ext4: allow to find by goal if EXT4_MB_HINT_GOAL_ONLY is set
In reply to Greg Kroah-HartmanFrom: Kemeng Shi <[email protected]>
[ Upstream commit 01e4ca29451760b9ac10b4cdc231c52150842643 ]
If EXT4_MB_HINT_GOAL_ONLY is set, ext4_mb_regular_allocator will only allocate blocks from ext4_mb_find_by_goal. Allow to find by goal in ext4_mb_find_by_goal if EXT4_MB_HINT_GOAL_ONLY is set or allocation with EXT4_MB_HINT_GOAL_ONLY set will always fail.
EXT4_MB_HINT_GOAL_ONLY is not used at all, so the problem is not found for now.
Stable-dep-of: 5354b2af3406 ("ext4: allow ext4_get_group_info() to fail")
--- fs/ext4/mballoc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/mballoc.c +1 -1
@@ -2162,7 +2162,7 @@ int ext4_mb_find_by_goal(struct ext4_allocation_context *ac,struct ext4_group_info *grp =ext4_get_group_info (ac->ac_sb, group);struct ext4_free_extent ex; -if (!(ac->ac_flags &EXT4_MB_HINT_TRY_GOAL )) +if (!(ac->ac_flags & (EXT4_MB_HINT_TRY_GOAL |EXT4_MB_HINT_GOAL_ONLY )))return 0 ;if (grp->bb_free ==0 )return 0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 35/292 ext4: allow ext4_get_group_info() to fail
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
[ Upstream commit 5354b2af34064a4579be8bc0e2f15a7b70f14b5f ]
Previously, ext4_get_group_info() would treat an invalid group number as BUG(), since in theory it should never happen. However, if a malicious attaker (or fuzzer) modifies the superblock via the block device while it is the file system is mounted, it is possible for s_first_data_block to get set to a very large number. In that case, when calculating the block group of some block number (such as the starting block of a preallocation region), could result in an underflow and very large block group number. Then the BUG_ON check in ext4_get_group_info() would fire, resutling in a denial of service attack that can be triggered by root or someone with write access to the block device.
For a quality of implementation perspective, it's best that even if the system administrator does something that they shouldn't, that it will not trigger a BUG. So instead of BUG'ing, ext4_get_group_info() will call ext4_error and return NULL. We also add fallback code in all of the callers of ext4_get_group_info() that it might NULL.
Also, since ext4_get_group_info() was already borderline to be an inline function, un-inline it. The results in a next reduction of the compiled text size of ext4 by roughly 2k.
--- fs/ext4/balloc.c | 18 ++++++++++++- fs/ext4/ext4.h | 15 ++--------- fs/ext4/ialloc.c | 12 ++++++--- fs/ext4/mballoc.c | 64 +++++++++++++++++++++++++++++++++++++++-------- fs/ext4/super.c | 2 ++ 5 files changed, 82 insertions(+), 29 deletions(-)
fs/ext4/balloc.c +17 -1
@@ -319,6 +319,22 @@ static ext4_fsblk_t ext4_valid_block_bitmap_padding(struct super_block *sb,return (next_zero_bit < bitmap_size ? next_zero_bit :0 ); } +struct ext4_group_info *ext4_get_group_info (struct super_block *sb, +ext4_group_t group) +{ +struct ext4_group_info **grp_info; +long indexv, indexh; + +if (unlikely (group >=EXT4_SB (sb)->s_groups_count)) { +ext4_error (sb,"invalid group %u" , group); +return NULL ; + } + indexv = group >> (EXT4_DESC_PER_BLOCK_BITS (sb)); + indexh = group & ((EXT4_DESC_PER_BLOCK (sb)) -1 ); + grp_info =sbi_array_rcu_deref (EXT4_SB (sb), s_group_info, indexv); +return grp_info[indexh]; +} +/* * Return the block number which was discovered to be invalid, or 0 if * the block bitmap is valid.
@@ -393,7 +409,7 @@ static int ext4_validate_block_bitmap(struct super_block *sb,if (buffer_verified (bh))return 0 ; -if (EXT4_MB_GRP_BBITMAP_CORRUPT (grp)) +if (!grp ||EXT4_MB_GRP_BBITMAP_CORRUPT (grp))return -EFSCORRUPTED ;ext4_lock_group (sb, block_group);
fs/ext4/ext4.h +2 -13
@@ -2716,6 +2716,8 @@ extern void ext4_check_blocks_bitmap(struct super_block *);extern struct ext4_group_desc *ext4_get_group_desc (struct super_block * sb,ext4_group_t block_group,struct buffer_head ** bh); +extern struct ext4_group_info *ext4_get_group_info (struct super_block *sb, +ext4_group_t group);extern int ext4_should_retry_alloc (struct super_block *sb,int *retries); extern struct buffer_head *ext4_read_block_bitmap_nowait(struct super_block *sb,
@@ -3322,19 +3324,6 @@ static inline void ext4_isize_set(struct ext4_inode *raw_inode, loff_t i_size) raw_inode->i_size_high =cpu_to_le32 (i_size >>32 ); } -static inline -struct ext4_group_info *ext4_get_group_info (struct super_block *sb, -ext4_group_t group) -{ -struct ext4_group_info **grp_info; -long indexv, indexh; -BUG_ON (group >=EXT4_SB (sb)->s_groups_count); - indexv = group >> (EXT4_DESC_PER_BLOCK_BITS (sb)); - indexh = group & ((EXT4_DESC_PER_BLOCK (sb)) -1 ); - grp_info =sbi_array_rcu_deref (EXT4_SB (sb), s_group_info, indexv); -return grp_info[indexh]; -} -/* * Reading s_groups_count requires using smp_rmb() afterwards. See * the locking protocol documented in the comments of ext4_group_add()
fs/ext4/ialloc.c +8 -4
@@ -91,7 +91,7 @@ static int ext4_validate_inode_bitmap(struct super_block *sb,if (buffer_verified (bh))return 0 ; -if (EXT4_MB_GRP_IBITMAP_CORRUPT (grp)) +if (!grp ||EXT4_MB_GRP_IBITMAP_CORRUPT (grp))return -EFSCORRUPTED ;ext4_lock_group (sb, block_group);
@@ -293,7 +293,7 @@ void ext4_free_inode(handle_t *handle, struct inode *inode) }if (!(sbi->s_mount_state &EXT4_FC_REPLAY )) { grp =ext4_get_group_info (sb, block_group); -if (unlikely (EXT4_MB_GRP_IBITMAP_CORRUPT (grp))) { +if (!grp ||unlikely (EXT4_MB_GRP_IBITMAP_CORRUPT (grp))) { fatal = -EFSCORRUPTED ; goto error_return; }
@@ -1047,7 +1047,7 @@ struct inode *__ext4_new_inode(struct user_namespace *mnt_userns,* Skip groups with already-known suspicious inode * tables */ -if (EXT4_MB_GRP_IBITMAP_CORRUPT (grp)) +if (!grp ||EXT4_MB_GRP_IBITMAP_CORRUPT (grp)) goto next_group; }
@@ -1185,6 +1185,10 @@ struct inode *__ext4_new_inode(struct user_namespace *mnt_userns,if (!(sbi->s_mount_state &EXT4_FC_REPLAY )) { grp =ext4_get_group_info (sb, group); +if (!grp) { + err = -EFSCORRUPTED ; + goto out; + }down_read (&grp->alloc_sem);/* * protect vs itable * lazyinit
@@ -1528,7 +1532,7 @@ int ext4_init_inode_table(struct super_block *sb, ext4_group_t group, } gdp =ext4_get_group_desc (sb, group, &group_desc_bh); -if (!gdp) +if (!gdp || !grp) goto out;/*
fs/ext4/mballoc.c +53 -11
215 lines not on this page · raw message
fs/ext4/super.c +2 -0
@@ -1049,6 +1049,8 @@ void ext4_mark_group_bitmap_corrupted(struct super_block *sb,struct ext4_group_desc *gdp =ext4_get_group_desc (sb, group,NULL );int ret; +if (!grp || !gdp) +return ;if (flags &EXT4_GROUP_INFO_BBITMAP_CORRUPT ) { ret =ext4_test_and_set_bit (EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT , &grp->bb_state);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 36/292 refscale: Move shutdown from wait_event() to wait_event_idle()
In reply to Greg Kroah-HartmanFrom: Paul E. McKenney <[email protected]>
[ Upstream commit 6bc6e6b27524304aadb9c04611ddb1c84dd7617a ]
The ref_scale_shutdown() kthread/function uses wait_event() to wait for the refscale test to complete. However, although the read-side tests are normally extremely fast, there is no law against specifying a very large value for the refscale.loops module parameter or against having a slow read-side primitive. Either way, this might well trigger the hung-task timeout.
This commit therefore replaces those wait_event() calls with calls to wait_event_idle(), which do not trigger the hung-task timeout.
--- kernel/rcu/refscale.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/refscale.c +1 -1
@@ -795,7 +795,7 @@ ref_scale_cleanup(void)static int ref_scale_shutdown (void *arg) { -wait_event (shutdown_wq, shutdown_start); +wait_event_idle (shutdown_wq, shutdown_start);smp_mb ();// Wake before output. ref_scale_cleanup ();
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 37/292 selftests: cgroup: Add malloc failures checks in test_memcontrol
In reply to Greg Kroah-HartmanFrom: Ivan Orlov <[email protected]>
[ Upstream commit c83f320e55a49abd90629f42a72897afd579e0de ]
There are several 'malloc' calls in test_memcontrol, which can be unsuccessful. This patch will add 'malloc' failures checking to give more details about test's fail reasons and avoid possible undefined behavior during the future null dereference (like the one in alloc_anon_50M_check_swap function).
--- tools/testing/selftests/cgroup/test_memcontrol.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
tools/testing/selftests/cgroup/test_memcontrol.c +15 -0
@@ -98,6 +98,11 @@ static int alloc_anon_50M_check(const char *cgroup, void *arg)int ret =-1 ; buf =malloc (size); +if (buf ==NULL ) { +fprintf (stderr,"malloc() failed\n" ); +return -1 ; + } +for (ptr = buf; ptr < buf + size; ptr +=PAGE_SIZE ) *ptr =0 ;
@@ -211,6 +216,11 @@ static int alloc_anon_noexit(const char *cgroup, void *arg)char *buf, *ptr; buf =malloc (size); +if (buf ==NULL ) { +fprintf (stderr,"malloc() failed\n" ); +return -1 ; + } +for (ptr = buf; ptr < buf + size; ptr +=PAGE_SIZE ) *ptr =0 ;
@@ -759,6 +769,11 @@ static int alloc_anon_50M_check_swap(const char *cgroup, void *arg)int ret =-1 ; buf =malloc (size); +if (buf ==NULL ) { +fprintf (stderr,"malloc() failed\n" ); +return -1 ; + } +for (ptr = buf; ptr < buf + size; ptr +=PAGE_SIZE ) *ptr =0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 38/292 rcu: Protect rcu_print_task_exp_stall() ->exp_tasks access
In reply to Greg Kroah-HartmanFrom: Zqiang <[email protected]>
[ Upstream commit 3c1566bca3f8349f12b75d0a2d5e4a20ad6262ec ]
For kernels built with CONFIG_PREEMPT_RCU=y, the following scenario can result in a NULL-pointer dereference:
CPU1 CPU2rcu_preempt_deferred_qs_irqrestore rcu_print_task_exp_stall
if (special.b.blocked) READ_ONCE(rnp->exp_tasks) != NULL
raw_spin_lock_rcu_node
np = rcu_next_node_entry(t, rnp)
if (&t->rcu_node_entry == rnp->exp_tasks)
WRITE_ONCE(rnp->exp_tasks, np)
....
raw_spin_unlock_irqrestore_rcu_node
raw_spin_lock_irqsave_rcu_node
t = list_entry(rnp->exp_tasks->prev,
struct task_struct, rcu_node_entry)
(if rnp->exp_tasks is NULL, this
will dereference a NULL pointer)The problem is that CPU2 accesses the rcu_node structure's->exp_tasks field without holding the rcu_node structure's ->lock and CPU2 did not observe CPU1's change to rcu_node structure's ->exp_tasks in time. Therefore, if CPU1 sets rcu_node structure's->exp_tasks pointer to NULL, then CPU2 might dereference that NULL pointer.
This commit therefore holds the rcu_node structure's ->lock while accessing that structure's->exp_tasks field.
[ paulmck: Apply Frederic Weisbecker feedback. ]
--- kernel/rcu/tree_exp.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/rcu/tree_exp.h +4 -2
@@ -800,9 +800,11 @@ static int rcu_print_task_exp_stall(struct rcu_node *rnp)int ndetected =0 ;struct task_struct *t; -if (!READ_ONCE (rnp->exp_tasks)) -return 0 ;raw_spin_lock_irqsave_rcu_node (rnp, flags); +if (!rnp->exp_tasks) { +raw_spin_unlock_irqrestore_rcu_node (rnp, flags); +return 0 ; + } t =list_entry (rnp->exp_tasks->prev, struct task_struct, rcu_node_entry);list_for_each_entry_continue (t, &rnp->blkd_tasks, rcu_node_entry) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 39/292 open: return EINVAL for O_DIRECTORY | O_CREAT
In reply to Greg Kroah-HartmanFrom: Christian Brauner <[email protected]>
[ Upstream commit 43b450632676fb60e9faeddff285d9fac94a4f58 ]
After a couple of years and multiple LTS releases we received a report that the behavior of O_DIRECTORY | O_CREAT changed starting with v5.7.
On kernels prior to v5.7 combinations of O_DIRECTORY, O_CREAT, O_EXCL had the following semantics:
(1) open("/tmp/d", O_DIRECTORY | O_CREAT)
* d doesn't exist: create regular file
* d exists and is a regular file: ENOTDIR
* d exists and is a directory: EISDIR
(2) open("/tmp/d", O_DIRECTORY | O_CREAT | O_EXCL)
* d doesn't exist: create regular file
* d exists and is a regular file: EEXIST
* d exists and is a directory: EEXIST
(3) open("/tmp/d", O_DIRECTORY | O_EXCL)
* d doesn't exist: ENOENT
* d exists and is a regular file: ENOTDIR
* d exists and is a directory: open directory
On kernels since to v5.7 combinations of O_DIRECTORY, O_CREAT, O_EXCL have the following semantics:
(1) open("/tmp/d", O_DIRECTORY | O_CREAT)
* d doesn't exist: ENOTDIR (create regular file)
* d exists and is a regular file: ENOTDIR
* d exists and is a directory: EISDIR
(2) open("/tmp/d", O_DIRECTORY | O_CREAT | O_EXCL)
* d doesn't exist: ENOTDIR (create regular file)
* d exists and is a regular file: EEXIST
* d exists and is a directory: EEXIST
(3) open("/tmp/d", O_DIRECTORY | O_EXCL)
* d doesn't exist: ENOENT
* d exists and is a regular file: ENOTDIR
* d exists and is a directory: open directory
This is a fairly substantial semantic change that userspace didn't notice until Pedro took the time to deliberately figure out corner cases. Since no one noticed this breakage we can somewhat safely assume that O_DIRECTORY | O_CREAT combinations are likely unused.
The v5.7 breakage is especially weird because while ENOTDIR is returned indicating failure a regular file is actually created. This doesn't make a lot of sense.
Time was spent finding potential users of this combination. Searching on codesearch.debian.net showed that codebases often express semantical expectations about O_DIRECTORY | O_CREAT which are completely contrary to what our code has done and currently does.
The expectation often is that this particular combination would create and open a directory. This suggests users who tried to use that combination would stumble upon the counterintuitive behavior no matter if pre-v5.7 or post v5.7 and quickly realize neither semantics give them what they want. For some examples see the code examples in [1] to [3] and the discussion in [4].
There are various ways to address this issue. The lazy/simple option would be to restore the pre-v5.7 behavior and to just live with that bug forever. But since there's a real chance that the O_DIRECTORY | O_CREAT quirk isn't relied upon we should try to get away with murder(ing bad semantics) first. If we need to Frankenstein pre-v5.7 behavior later so be it.
So let's simply return EINVAL categorically for O_DIRECTORY | O_CREAT combinations. In addition to cleaning up the old bug this also opens up the possiblity to make that flag combination do something more intuitive in the future.
Starting with this commit the following semantics apply:
(1) open("/tmp/d", O_DIRECTORY | O_CREAT)
* d doesn't exist: EINVAL
* d exists and is a regular file: EINVAL
* d exists and is a directory: EINVAL
(2) open("/tmp/d", O_DIRECTORY | O_CREAT | O_EXCL)
* d doesn't exist: EINVAL
* d exists and is a regular file: EINVAL
* d exists and is a directory: EINVAL
(3) open("/tmp/d", O_DIRECTORY | O_EXCL)
* d doesn't exist: ENOENT
* d exists and is a regular file: ENOTDIR
* d exists and is a directory: open directory
One additional note, O_TMPFILE is implemented as:
#define __O_TMPFILE 020000000
#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
#define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT)For older kernels it was important to return an explicit error when O_TMPFILE wasn't supported. So O_TMPFILE requires that O_DIRECTORY is raised alongside __O_TMPFILE. It also enforced that O_CREAT wasn't specified. Since O_DIRECTORY | O_CREAT could be used to create a regular allowing that combination together with __O_TMPFILE would've meant that false positives were possible, i.e., that a regular file was created instead of a O_TMPFILE. This could've been used to trick userspace into thinking it operated on a O_TMPFILE when it wasn't.
Now that we block O_DIRECTORY | O_CREAT completely the check for O_CREAT in the __O_TMPFILE branch via if ((flags & O_TMPFILE_MASK) != O_TMPFILE) can be dropped. Instead we can simply check verify that O_DIRECTORY is raised via if (!(flags & O_DIRECTORY)) and explain this in two comments.
As Aleksa pointed out O_PATH is unaffected by this change since it always returned EINVAL if O_CREAT was specified - with or without O_DIRECTORY.
--- fs/open.c | 18 +++++++++++++----- include/uapi/asm-generic/fcntl.h | 1 - tools/include/uapi/asm-generic/fcntl.h | 1 - 3 files changed, 13 insertions(+), 7 deletions(-)
fs/open.c +13 -5
@@ -1158,13 +1158,21 @@ inline int build_open_flags(const struct open_how *how, struct open_flags *op) }/* -* In order to ensure programs get explicit errors when trying to use -* O_TMPFILE on old kernels, O_TMPFILE is implemented such that it -* looks like (O_DIRECTORY|O_RDWR & ~O_CREAT) to old kernels. But we -* have to require userspace to explicitly set it. +* Block bugs where O_DIRECTORY | O_CREAT created regular files. +* Note, that blocking O_DIRECTORY | O_CREAT here also protects +* O_TMPFILE below which requires O_DIRECTORY being raised. */ +if ((flags & (O_DIRECTORY |O_CREAT )) == (O_DIRECTORY |O_CREAT )) +return -EINVAL ; + +/* Now handle the creative implementation of O_TMPFILE. */ if (flags & __O_TMPFILE) { -if ((flags &O_TMPFILE_MASK ) !=O_TMPFILE ) +/* +* In order to ensure programs get explicit errors when trying +* to use O_TMPFILE on old kernels we enforce that O_DIRECTORY +* is raised alongside __O_TMPFILE. +*/ +if (!(flags &O_DIRECTORY ))return -EINVAL ;if (!(acc_mode &MAY_WRITE ))return -EINVAL ;
include/uapi/asm-generic/fcntl.h +0 -1
@@ -91,7 +91,6 @@/* a horrid kludge trying to make sure that this will fail on old kernels */ #define O_TMPFILE (__O_TMPFILE | O_DIRECTORY) -#define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT)#ifndef O_NDELAY #define O_NDELAY O_NONBLOCK
tools/include/uapi/asm-generic/fcntl.h +0 -1
@@ -91,7 +91,6 @@/* a horrid kludge trying to make sure that this will fail on old kernels */ #define O_TMPFILE (__O_TMPFILE | O_DIRECTORY) -#define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT)#ifndef O_NDELAY #define O_NDELAY O_NONBLOCK
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 40/292 fs: hfsplus: remove WARN_ON() from hfsplus_cat_{read,write}_inode()
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
[ Upstream commit 81b21c0f0138ff5a499eafc3eb0578ad2a99622c ]
syzbot is hitting WARN_ON() in hfsplus_cat_{read,write}_inode(), for crafted filesystem image can contain bogus length. There conditions are not kernel bugs that can justify kernel to panic.
Message-Id: <[email protected]>
--- fs/hfsplus/inode.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-)
fs/hfsplus/inode.c +23 -5
@@ -511,7 +511,11 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd)if (type ==HFSPLUS_FOLDER ) {struct hfsplus_cat_folder *folder = &entry.folder; -WARN_ON (fd->entrylength <sizeof (struct hfsplus_cat_folder )); +if (fd->entrylength <sizeof (struct hfsplus_cat_folder )) { +pr_err ("bad catalog folder entry\n" ); + res = -EIO ; + goto out; + }hfs_bnode_read (fd->bnode, &entry, fd->entryoffset,sizeof (struct hfsplus_cat_folder ));hfsplus_get_perms (inode, &folder->permissions,1 );
@@ -531,7 +535,11 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd) }else if (type ==HFSPLUS_FILE ) {struct hfsplus_cat_file *file = &entry.file; -WARN_ON (fd->entrylength <sizeof (struct hfsplus_cat_file )); +if (fd->entrylength <sizeof (struct hfsplus_cat_file )) { +pr_err ("bad catalog file entry\n" ); + res = -EIO ; + goto out; + }hfs_bnode_read (fd->bnode, &entry, fd->entryoffset,sizeof (struct hfsplus_cat_file ));
@@ -562,6 +570,7 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd)pr_err ("bad catalog entry used to create inode\n" ); res = -EIO ; } +out:return res; }
@@ -570,6 +579,7 @@ int hfsplus_cat_write_inode(struct inode *inode)struct inode *main_inode = inode;struct hfs_find_data fd;hfsplus_cat_entry entry; +int res =0 ;if (HFSPLUS_IS_RSRC (inode)) main_inode =HFSPLUS_I (inode)->rsrc_inode;
@@ -588,7 +598,11 @@ int hfsplus_cat_write_inode(struct inode *inode)if (S_ISDIR (main_inode->i_mode)) {struct hfsplus_cat_folder *folder = &entry.folder; -WARN_ON (fd.entrylength <sizeof (struct hfsplus_cat_folder )); +if (fd.entrylength <sizeof (struct hfsplus_cat_folder )) { +pr_err ("bad catalog folder entry\n" ); + res = -EIO ; + goto out; + }hfs_bnode_read (fd.bnode, &entry, fd.entryoffset,sizeof (struct hfsplus_cat_folder ));/* simple node checks? */
@@ -613,7 +627,11 @@ int hfsplus_cat_write_inode(struct inode *inode) }else {struct hfsplus_cat_file *file = &entry.file; -WARN_ON (fd.entrylength <sizeof (struct hfsplus_cat_file )); +if (fd.entrylength <sizeof (struct hfsplus_cat_file )) { +pr_err ("bad catalog file entry\n" ); + res = -EIO ; + goto out; + }hfs_bnode_read (fd.bnode, &entry, fd.entryoffset,sizeof (struct hfsplus_cat_file ));hfsplus_inode_write_fork (inode, &file->data_fork);
@@ -634,7 +652,7 @@ int hfsplus_cat_write_inode(struct inode *inode)set_bit (HFSPLUS_I_CAT_DIRTY , &HFSPLUS_I (inode)->flags); out:hfs_find_exit (&fd); -return 0 ; +return res; }int hfsplus_fileattr_get (struct dentry *dentry,struct fileattr *fa)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 41/292 drm/displayid: add displayid_get_header() and check bounds better
In reply to Greg Kroah-HartmanFrom: Jani Nikula <[email protected]>
[ Upstream commit 5bacecc3c56131c31f18b23d366f2184328fd9cf ]
Add a helper to get a pointer to struct displayid_header. To be pedantic, add buffer overflow checks to not touch the base if that itself would overflow.
--- drivers/gpu/drm/drm_displayid.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_displayid.c +16 -1
@@ -7,13 +7,28 @@#include <drm/drm_edid.h> #include <drm/drm_print.h> +static const struct displayid_header * +displayid_get_header (const u8 *displayid,int length,int index) +{ +const struct displayid_header *base; + +if (sizeof (*base) > length - index) +return ERR_PTR (-EINVAL ); + + base = (const struct displayid_header *)&displayid[index]; + +return base; +} +static int validate_displayid (const u8 *displayid,int length,int idx) {int i, dispid_length;u8 csum =0 ;const struct displayid_header *base; - base = (const struct displayid_header *)&displayid[idx]; + base =displayid_get_header (displayid, length, idx); +if (IS_ERR (base)) +return PTR_ERR (base);DRM_DEBUG_KMS ("base revision 0x%x, length %d, %d %d\n" , base->rev, base->bytes, base->prod_id, base->ext_count);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 42/292 drm/amd/display: populate subvp cmd info only for the top pipe
In reply to Greg Kroah-HartmanFrom: Ayush Gupta <[email protected]>
[ Upstream commit 9bb10b7aaec3b6278f9cc410c17dcaa129bbbbf0 ]
[Why]
System restart observed while changing the display resolution to 8k with extended mode. Sytem restart was caused by a page fault.
[How]
When the driver populates subvp info it did it for both the pipes using vblank which caused an outof bounds array access causing the page fault. added checks to allow the top pipe only to fix this issue.
--- drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c +2 -1
@@ -764,7 +764,8 @@ void dc_dmub_setup_subvp_dmub_command(struct dc *dc, !pipe->top_pipe && !pipe->prev_odm_pipe && pipe->stream->mall_stream_config.type == SUBVP_MAIN) {populate_subvp_cmd_pipe_info (dc, context, &cmd, pipe, cmd_pipe_index++); - } else if (pipe->plane_state && pipe->stream->mall_stream_config.type == SUBVP_NONE) { + } else if (pipe->plane_state && pipe->stream->mall_stream_config.type == SUBVP_NONE && + !pipe->top_pipe && !pipe->prev_odm_pipe) {// Don't need to check for ActiveDRAMClockChangeMargin < 0, not valid in cases where // we run through DML without calculating "natural" P-state support populate_subvp_cmd_vblank_pipe_info (dc, context, &cmd, pipe, cmd_pipe_index++);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 43/292 drm/amd/display: Correct DML calculation to align HW formula
In reply to Greg Kroah-HartmanFrom: Paul Hsieh <[email protected]>
[ Upstream commit 26a9f53198c955b15161da48cdb51041a38d5325 ]
[Why]
In 2560x1440@240p eDP panel, some use cases will enable MPC combine with RGB MPO then underflow happened. This case is not allowed from HW formula.
[How]
Correct eDP, DP and DP2 output bpp calculation to align HW formula.
--- .../dc/dml/dcn31/display_mode_vba_31.c | 298 ++++++++++++------ .../dc/dml/dcn314/display_mode_vba_314.c | 298 ++++++++++++------ 2 files changed, 392 insertions(+), 204 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c +196 -102
@@ -4305,11 +4305,11 @@ void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l v->AudioSampleRate[k], v->AudioSampleLayout[k], v->ODMCombineEnablePerState[i][k]); - }else if (v->Output[k] == dm_dp || v->Output[k] == dm_edp) { + }else if (v->Output[k] == dm_dp || v->Output[k] == dm_edp || v->Output[k] == dm_dp2p0) {if (v->DSCEnable[k] == true) { v->RequiresDSC[i][k] = true; v->LinkDSCEnable = true; -if (v->Output[k] == dm_dp) { +if (v->Output[k] == dm_dp || v->Output[k] == dm_dp2p0) { v->RequiresFEC[i][k] = true; }else { v->RequiresFEC[i][k] = false;
@@ -4317,107 +4317,201 @@ void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l }else { v->RequiresDSC[i][k] = false; v->LinkDSCEnable = false; - v->RequiresFEC[i][k] = false; - } - - v->Outbpp =BPP_INVALID ; -if (v->PHYCLKPerState[i] >=270.0 ) { - v->Outbpp =TruncToValidBPP ( - (1.0 - v->Downspreading /100.0 ) *2700 , - v->OutputLinkDPLanes[k], - v->HTotal[k], - v->HActive[k], - v->PixelClockBackEnd[k], - v->ForcedOutputLinkBPP[k], - v->LinkDSCEnable, - v->Output[k], - v->OutputFormat[k], - v->DSCInputBitPerComponent[k], - v->NumberOfDSCSlices[k], - v->AudioSampleRate[k], - v->AudioSampleLayout[k], - v->ODMCombineEnablePerState[i][k]); - v->OutputBppPerState[i][k] = v->Outbpp; -// TODO: Need some other way to handle this nonsense -// v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR" - } -if (v->Outbpp ==BPP_INVALID && v->PHYCLKPerState[i] >=540.0 ) { - v->Outbpp =TruncToValidBPP ( - (1.0 - v->Downspreading /100.0 ) *5400 , - v->OutputLinkDPLanes[k], - v->HTotal[k], - v->HActive[k], - v->PixelClockBackEnd[k], - v->ForcedOutputLinkBPP[k], - v->LinkDSCEnable, - v->Output[k], - v->OutputFormat[k], - v->DSCInputBitPerComponent[k], - v->NumberOfDSCSlices[k], - v->AudioSampleRate[k], - v->AudioSampleLayout[k], - v->ODMCombineEnablePerState[i][k]); - v->OutputBppPerState[i][k] = v->Outbpp; -// TODO: Need some other way to handle this nonsense -// v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR2" - } -if (v->Outbpp ==BPP_INVALID && v->PHYCLKPerState[i] >=810.0 ) { - v->Outbpp =TruncToValidBPP ( - (1.0 - v->Downspreading /100.0 ) *8100 , - v->OutputLinkDPLanes[k], - v->HTotal[k], - v->HActive[k], - v->PixelClockBackEnd[k], - v->ForcedOutputLinkBPP[k], - v->LinkDSCEnable, - v->Output[k], - v->OutputFormat[k], - v->DSCInputBitPerComponent[k], - v->NumberOfDSCSlices[k], - v->AudioSampleRate[k], - v->AudioSampleLayout[k], - v->ODMCombineEnablePerState[i][k]); - v->OutputBppPerState[i][k] = v->Outbpp; -// TODO: Need some other way to handle this nonsense -// v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR3" - } -if (v->Outbpp ==BPP_INVALID && v->PHYCLKD18PerState[i] >=10000.0 /18 ) { - v->Outbpp =TruncToValidBPP ( - (1.0 - v->Downspreading /100.0 ) *10000 , -4 , - v->HTotal[k], - v->HActive[k], - v->PixelClockBackEnd[k], - v->ForcedOutputLinkBPP[k], - v->LinkDSCEnable, - v->Output[k], - v->OutputFormat[k], - v->DSCInputBitPerComponent[k], - v->NumberOfDSCSlices[k], - v->AudioSampleRate[k], - v->AudioSampleLayout[k], - v->ODMCombineEnablePerState[i][k]); - v->OutputBppPerState[i][k] = v->Outbpp; -//v->OutputTypeAndRatePerState[i][k] = v->Output[k] & "10x4"; +if (v->Output[k] == dm_dp2p0) { + v->RequiresFEC[i][k] = true; + }else { + v->RequiresFEC[i][k] = false; + } } -if (v->Outbpp ==BPP_INVALID && v->PHYCLKD18PerState[i] >=12000.0 /18 ) { - v->Outbpp =TruncToValidBPP ( -12000 , -4 , - v->HTotal[k], - v->HActive[k], - v->PixelClockBackEnd[k], - v->ForcedOutputLinkBPP[k], - v->LinkDSCEnable, - v->Output[k], - v->OutputFormat[k], - v->DSCInputBitPerComponent[k], - v->NumberOfDSCSlices[k], - v->AudioSampleRate[k], - v->AudioSampleLayout[k], - v->ODMCombineEnablePerState[i][k]); - v->OutputBppPerState[i][k] = v->Outbpp; -//v->OutputTypeAndRatePerState[i][k] = v->Output[k] & "12x4"; +if (v->Output[k] == dm_dp2p0) { + v->Outbpp =BPP_INVALID ; +if ((v->OutputLinkDPRate[k] == dm_dp_rate_na || v->OutputLinkDPRate[k] == dm_dp_rate_uhbr10) && + v->PHYCLKD18PerState[k] >=10000.0 /18.0 ) { + v->Outbpp =TruncToValidBPP ( + (1.0 - v->Downspreading /100.0 ) *10000 , + v->OutputLinkDPLanes[k], + v->HTotal[k], + v->HActive[k], + v->PixelClockBackEnd[k], + v->ForcedOutputLinkBPP[k], + v->LinkDSCEnable, + v->Output[k], + v->OutputFormat[k], + v->DSCInputBitPerComponent[k], + v->NumberOfDSCSlices[k], + v->AudioSampleRate[k], + v->AudioSampleLayout[k], + v->ODMCombineEnablePerState[i][k]); +if (v->Outbpp ==BPP_INVALID && v->PHYCLKD18PerState[k] <13500.0 /18.0 && + v->DSCEnable[k] == true && v->ForcedOutputLinkBPP[k] ==0 ) { + v->RequiresDSC[i][k] = true; + v->LinkDSCEnable = true; + v->Outbpp =TruncToValidBPP ( + (1.0 - v->Downspreading /100.0 ) *10000 , + v->OutputLinkDPLanes[k], + v->HTotal[k], + v->HActive[k], + v->PixelClockBackEnd[k], + v->ForcedOutputLinkBPP[k], + v->LinkDSCEnable, + v->Output[k], + v->OutputFormat[k], + v->DSCInputBitPerComponent[k], + v->NumberOfDSCSlices[k], + v->AudioSampleRate[k], + v->AudioSampleLayout[k], + v->ODMCombineEnablePerState[i][k]); + } + v->OutputBppPerState[i][k] = v->Outbpp; +// TODO: Need some other way to handle this nonsense +// v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " UHBR10" + } +if (v->Outbpp ==BPP_INVALID && + (v->OutputLinkDPRate[k] == dm_dp_rate_na || v->OutputLinkDPRate[k] == dm_dp_rate_uhbr13p5) && + v->PHYCLKD18PerState[k] >=13500.0 /18.0 ) { + v->Outbpp =TruncToValidBPP ( + (1.0 - v->Downspreading /100.0 ) *13500 , + v->OutputLinkDPLanes[k], + v->HTotal[k], + v->HActive[k], + v->PixelClockBackEnd[k], + v->ForcedOutputLinkBPP[k], + v->LinkDSCEnable, + v->Output[k], + v->OutputFormat[k], + v->DSCInputBitPerComponent[k], + v->NumberOfDSCSlices[k], + v->AudioSampleRate[k], + v->AudioSampleLayout[k], + v->ODMCombineEnablePerState[i][k]); +if (v->Outbpp ==BPP_INVALID && v->PHYCLKD18PerState[k] <20000.0 /18.0 && + v->DSCEnable[k] == true && v->ForcedOutputLinkBPP[k] ==0 ) { + v->RequiresDSC[i][k] = true; + v->LinkDSCEnable = true; + v->Outbpp =TruncToValidBPP ( + (1.0 - v->Downspreading /100.0 ) *13500 , + v->OutputLinkDPLanes[k], + v->HTotal[k], + v->HActive[k], + v->PixelClockBackEnd[k], + v->ForcedOutputLinkBPP[k], + v->LinkDSCEnable, + v->Output[k], + v->OutputFormat[k], + v->DSCInputBitPerComponent[k], + v->NumberOfDSCSlices[k], + v->AudioSampleRate[k], + v->AudioSampleLayout[k], + v->ODMCombineEnablePerState[i][k]); + } + v->OutputBppPerState[i][k] = v->Outbpp; +// TODO: Need some other way to handle this nonsense +// v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " UHBR13p5" + } +if (v->Outbpp ==BPP_INVALID && + (v->OutputLinkDPRate[k] == dm_dp_rate_na || v->OutputLinkDPRate[k] == dm_dp_rate_uhbr20) && + v->PHYCLKD18PerState[k] >=20000.0 /18.0 ) { + v->Outbpp =TruncToValidBPP ( + (1.0 - v->Downspreading /100.0 ) *20000 , + v->OutputLinkDPLanes[k], + v->HTotal[k], + v->HActive[k], + v->PixelClockBackEnd[k], + v->ForcedOutputLinkBPP[k], + v->LinkDSCEnable, + v->Output[k], + v->OutputFormat[k], + v->DSCInputBitPerComponent[k], + v->NumberOfDSCSlices[k], + v->AudioSampleRate[k], + v->AudioSampleLayout[k], + v->ODMCombineEnablePerState[i][k]); +if (v->Outbpp ==BPP_INVALID && v->DSCEnable[k] == true && + v->ForcedOutputLinkBPP[k] ==0 ) { + v->RequiresDSC[i][k] = true; + v->LinkDSCEnable = true; + v->Outbpp =TruncToValidBPP ( + (1.0 - v->Downspreading /100.0 ) *20000 , + v->OutputLinkDPLanes[k], + v->HTotal[k], + v->HActive[k], + v->PixelClockBackEnd[k], + v->ForcedOutputLinkBPP[k], + v->LinkDSCEnable, + v->Output[k], + v->OutputFormat[k], + v->DSCInputBitPerComponent[k], + v->NumberOfDSCSlices[k], + v->AudioSampleRate[k], + v->AudioSampleLayout[k], + v->ODMCombineEnablePerState[i][k]); + } + v->OutputBppPerState[i][k] = v->Outbpp; +// TODO: Need some other way to handle this nonsense +// v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " UHBR20" + } + }else { + v->Outbpp =BPP_INVALID ; +if (v->PHYCLKPerState[i] >=270.0 ) { + v->Outbpp =TruncToValidBPP ( + (1.0 - v->Downspreading /100.0 ) *2700 , + v->OutputLinkDPLanes[k], + v->HTotal[k], + v->HActive[k], + v->PixelClockBackEnd[k], + v->ForcedOutputLinkBPP[k], + v->LinkDSCEnable, + v->Output[k], + v->OutputFormat[k], + v->DSCInputBitPerComponent[k], + v->NumberOfDSCSlices[k], + v->AudioSampleRate[k], + v->AudioSampleLayout[k], + v->ODMCombineEnablePerState[i][k]); + v->OutputBppPerState[i][k] = v->Outbpp; +// TODO: Need some other way to handle this nonsense +// v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR" + } +if (v->Outbpp ==BPP_INVALID && v->PHYCLKPerState[i] >=540.0 ) { + v->Outbpp =TruncToValidBPP ( + (1.0 - v->Downspreading /100.0 ) *5400 , + v->OutputLinkDPLanes[k], + v->HTotal[k], + v->HActive[k], + v->PixelClockBackEnd[k], + v->ForcedOutputLinkBPP[k], + v->LinkDSCEnable, + v->Output[k], + v->OutputFormat[k], + v->DSCInputBitPerComponent[k], + v->NumberOfDSCSlices[k], + v->AudioSampleRate[k], + v->AudioSampleLayout[k], + v->ODMCombineEnablePerState[i][k]); + v->OutputBppPerState[i][k] = v->Outbpp; +// TODO: Need some other way to handle this nonsense +// v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR2" + } +if (v->Outbpp ==BPP_INVALID && v->PHYCLKPerState[i] >=810.0 ) { + v->Outbpp =TruncToValidBPP ( + (1.0 - v->Downspreading /100.0 ) *8100 , + v->OutputLinkDPLanes[k], + v->HTotal[k], + v->HActive[k], + v->PixelClockBackEnd[k], + v->ForcedOutputLinkBPP[k], + v->LinkDSCEnable, + v->Output[k], + v->OutputFormat[k], + v->DSCInputBitPerComponent[k], + v->NumberOfDSCSlices[k], + v->AudioSampleRate[k], + v->AudioSampleLayout[k], + v->ODMCombineEnablePerState[i][k]); + v->OutputBppPerState[i][k] = v->Outbpp; +// TODO: Need some other way to handle this nonsense +// v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR3" + } } } }else {
drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c +196 -102
314 lines not on this page · raw message
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 44/292 platform/x86: x86-android-tablets: Add Acer Iconia One 7 B1-750 data
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 2f0cf1e85ddb5ae17284050dc1adafb89e4f1d8f ]
The Acer Iconia One 7 B1-750 is a x86 ACPI tablet which ships with Android x86 as factory OS. Its DSDT contains a bunch of I2C devices which are not actually there, causing various resource conflicts. Enumeration of these is skipped through the acpi_quirk_skip_i2c_client_enumeration().
Add support for manually instantiating the I2C + other devices which are actually present on this tablet by adding the necessary device info to the x86-android-tablets module.
--- drivers/platform/x86/x86-android-tablets.c | 101 +++++++++++++++++++-- 1 file changed, 91 insertions(+), 10 deletions(-)
drivers/platform/x86/x86-android-tablets.c +91 -10
@@ -265,6 +265,88 @@ static struct gpiod_lookup_table int3496_gpo2_pin22_gpios = { }, }; +static struct gpiod_lookup_table int3496_reference_gpios = { + .dev_id ="intel-int3496" , + .table = { +GPIO_LOOKUP ("INT33FC:01" ,15 ,"vbus" ,GPIO_ACTIVE_HIGH ), +GPIO_LOOKUP ("INT33FC:02" ,1 ,"mux" ,GPIO_ACTIVE_HIGH ), +GPIO_LOOKUP ("INT33FC:02" ,18 ,"id" ,GPIO_ACTIVE_HIGH ), + { } + }, +}; + +/* Acer Iconia One 7 B1-750 has an Android factory img with everything hardcoded */ +static const char *const acer_b1_750_mount_matrix[] = { +"-1" ,"0" ,"0" , +"0" ,"1" ,"0" , +"0" ,"0" ,"1" +}; + +static const struct property_entry acer_b1_750_bma250e_props[] = { +PROPERTY_ENTRY_STRING_ARRAY ("mount-matrix" , acer_b1_750_mount_matrix), + { } +}; + +static const struct software_node acer_b1_750_bma250e_node = { + .properties = acer_b1_750_bma250e_props, +}; + +static const struct x86_i2c_client_info acer_b1_750_i2c_clients[]__initconst = { + { +/* Novatek NVT-ts touchscreen */ + .board_info = { + .type ="NVT-ts" , + .addr =0x34 , + .dev_name ="NVT-ts" , + }, + .adapter_path ="\\_SB_.I2C4" , + .irq_data = { + .type =X86_ACPI_IRQ_TYPE_GPIOINT , + .chip ="INT33FC:02" , + .index =3 , + .trigger =ACPI_EDGE_SENSITIVE , + .polarity =ACPI_ACTIVE_LOW , + }, + }, { +/* BMA250E accelerometer */ + .board_info = { + .type ="bma250e" , + .addr =0x18 , + .swnode = &acer_b1_750_bma250e_node, + }, + .adapter_path ="\\_SB_.I2C3" , + .irq_data = { + .type =X86_ACPI_IRQ_TYPE_GPIOINT , + .chip ="INT33FC:02" , + .index =25 , + .trigger =ACPI_LEVEL_SENSITIVE , + .polarity =ACPI_ACTIVE_HIGH , + }, + }, +}; + +static struct gpiod_lookup_table acer_b1_750_goodix_gpios = { + .dev_id ="i2c-NVT-ts" , + .table = { +GPIO_LOOKUP ("INT33FC:01" ,26 ,"reset" ,GPIO_ACTIVE_LOW ), + { } + }, +}; + +static struct gpiod_lookup_table *const acer_b1_750_gpios[] = { + &acer_b1_750_goodix_gpios, + &int3496_reference_gpios, +NULL +}; + +static const struct x86_dev_info acer_b1_750_info__initconst = { + .i2c_client_info = acer_b1_750_i2c_clients, + .i2c_client_count =ARRAY_SIZE (acer_b1_750_i2c_clients), + .pdev_info = int3496_pdevs, + .pdev_count =ARRAY_SIZE (int3496_pdevs), + .gpiod_lookup_tables = acer_b1_750_gpios, +}; +/* * Advantech MICA-071 * This is a standard Windows tablet, but it has an extra "quick launch" button
@@ -1298,17 +1380,8 @@ static const struct x86_i2c_client_info nextbook_ares8_i2c_clients[] __initconst }, }; -static struct gpiod_lookup_table nextbook_ares8_int3496_gpios = { - .dev_id ="intel-int3496" , - .table = { -GPIO_LOOKUP ("INT33FC:02" ,1 ,"mux" ,GPIO_ACTIVE_HIGH ), -GPIO_LOOKUP ("INT33FC:02" ,18 ,"id" ,GPIO_ACTIVE_HIGH ), - { } - }, -}; -static struct gpiod_lookup_table *const nextbook_ares8_gpios[] = { - &nextbook_ares8_int3496_gpios, + &int3496_reference_gpios,NULL };
@@ -1435,6 +1508,14 @@ static const struct x86_dev_info xiaomi_mipad2_info __initconst = { };static const struct dmi_system_id x86_android_tablet_ids[]__initconst = { + { +/* Acer Iconia One 7 B1-750 */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Insyde" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"VESPA2" ), + }, + .driver_data = (void *)&acer_b1_750_info, + }, {/* Advantech MICA-071 */ .matches = {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 45/292 drm/amd/display: Enable HostVM based on rIOMMU active
In reply to Greg Kroah-HartmanFrom: Gabe Teeger <[email protected]>
[ Upstream commit 97fa4dfa66fdd52ad3d0c9fadeaaa1e87605bac7 ]
[Why]
There is underflow and flickering occuring. The underflow stops when hostvm is forced to active. According to policy, hostvm should be enabled if riommu is active, but this is not taken into account when deciding whether to enable hostvm.
[What]
For DCN314, set hostvm to true if riommu is active.
--- drivers/gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c +4 -0
@@ -310,6 +310,10 @@ int dcn314_populate_dml_pipes_from_context_fpu(struct dc *dc, struct dc_state *c pipe->plane_state->src_rect.width < pipe->plane_state->dst_rect.width)) upscaled = true; +/* Apply HostVM policy - either based on hypervisor globally enabled, or rIOMMU active */ +if (dc->debug.dml_hostvm_override ==DML_HOSTVM_NO_OVERRIDE ) + pipes[i].pipe.src.hostvm = dc->vm_pa_config.is_hvm_enabled || dc->res_pool->hubbub->riommu_active; +/* * Immediate flip can be set dynamically after enabling the plane. * We need to require support for immediate flip or underflow can be
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 46/292 drm/amd/display: Use DC_LOG_DC in the trasform pixel function
In reply to Greg Kroah-HartmanFrom: Rodrigo Siqueira <[email protected]>
[ Upstream commit 7222f5841ff49709ca666b05ff336776e0664a20 ]
[Why & How]
DC now uses a new commit sequence which is more robust since it addresses cases where we need to reorganize pipes based on planes and other parameters. As a result, this new commit sequence reset the DC state by cleaning plane states and re-creating them accordingly with the need. For this reason, the dce_transform_set_pixel_storage_depth can be invoked after a plane state is destroyed and before its re-creation. In this situation and on DCE devices, DC will hit a condition that will trigger a dmesg log that looks like this:
Console: switching to colour frame buffer device 240x67
------------[ cut here ]------------ [..] Hardware name: System manufacturer System Product Name/PRIME X370-PRO, BIOS 5603 07/28/2020 RIP: 0010:dce_transform_set_pixel_storage_depth+0x3f8/0x480 [amdgpu] [..] RSP: 0018:ffffc9000202b850 EFLAGS: 00010293 RAX: ffffffffa081d100 RBX: ffff888110790000 RCX: 000000000000000c RDX: ffff888100bedbf8 RSI: 0000000000001a50 RDI: ffff88810463c900 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000007 R10: 0000000000000001 R11: 0000000000000f00 R12: ffff88810f500010 R13: ffff888100bedbf8 R14: ffff88810f515688 R15: 0000000000000000 FS: 00007ff0159249c0(0000) GS:ffff88840e940000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ff01528e550 CR3: 0000000002a10000 CR4: 00000000003506e0 Call Trace: <TASK> ? dm_write_reg_func+0x21/0x80 [amdgpu 340dadd3f7c8cf4be11cf0bdc850245e99abe0e8] dc_stream_set_dither_option+0xfb/0x130 [amdgpu 340dadd3f7c8cf4be11cf0bdc850245e99abe0e8] amdgpu_dm_crtc_configure_crc_source+0x10b/0x190 [amdgpu 340dadd3f7c8cf4be11cf0bdc850245e99abe0e8] amdgpu_dm_atomic_commit_tail+0x20a8/0x2a90 [amdgpu 340dadd3f7c8cf4be11cf0bdc850245e99abe0e8] ? free_unref_page_commit+0x98/0x170 ? free_unref_page+0xcc/0x150 commit_tail+0x94/0x120 drm_atomic_helper_commit+0x10f/0x140 drm_atomic_commit+0x94/0xc0 ? drm_plane_get_damage_clips.cold+0x1c/0x1c drm_client_modeset_commit_atomic+0x203/0x250 drm_client_modeset_commit_locked+0x56/0x150 drm_client_modeset_commit+0x21/0x40 drm_fb_helper_lastclose+0x42/0x70 amdgpu_driver_lastclose_kms+0xa/0x10 [amdgpu 340dadd3f7c8cf4be11cf0bdc850245e99abe0e8] drm_release+0xda/0x110 __fput+0x89/0x240 task_work_run+0x5c/0x90 do_exit+0x333/0xae0 do_group_exit+0x2d/0x90 __x64_sys_exit_group+0x14/0x20 do_syscall_64+0x5b/0x80 ? exit_to_user_mode_prepare+0x1e/0x140 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7ff016ceaca1 Code: Unable to access opcode bytes at RIP 0x7ff016ceac77. RSP: 002b:00007ffe7a2357e8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 00007ff016e15a00 RCX: 00007ff016ceaca1 RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000 RBP: 0000000000000000 R08: ffffffffffffff78 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007ff016e15a00 R13: 0000000000000000 R14: 00007ff016e1aee8 R15: 00007ff016e1af00 </TASK>
Since this issue only happens in a transition state on DC, this commit replace BREAK_TO_DEBUGGER with DC_LOG_DC.
--- drivers/gpu/drm/amd/display/dc/dce/dce_transform.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_transform.c +2 -3
@@ -1009,7 +1009,7 @@ static void dce_transform_set_pixel_storage_depth( color_depth =COLOR_DEPTH_101010 ; pixel_depth =0 ; expan_mode =1 ; -BREAK_TO_DEBUGGER (); +DC_LOG_DC ("The pixel depth %d is not valid, set COLOR_DEPTH_101010 instead." , depth);break ; }
@@ -1023,8 +1023,7 @@ static void dce_transform_set_pixel_storage_depth(if (!(xfm_dce->lb_pixel_depth_supported & depth)) {/*we should use unsupported capabilities * unless it is required by w/a*/ -DC_LOG_WARNING ("%s: Capability not supported" , - __func__); +DC_LOG_DC ("%s: Capability not supported" , __func__); } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 47/292 regmap: cache: Return error in cache sync operations for REGCACHE_NONE
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit fd883d79e4dcd2417c2b80756f22a2ff03b0f6e0 ]
There is no sense in doing a cache sync on REGCACHE_NONE regmaps. Instead of panicking the kernel due to missing cache_ops, return an error to client driver.
--- drivers/base/regmap/regcache.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/base/regmap/regcache.c +6 -0
@@ -349,6 +349,9 @@ int regcache_sync(struct regmap *map)const char *name;bool bypass; +if (WARN_ON (map->cache_type ==REGCACHE_NONE )) +return -EINVAL ; +BUG_ON (!map->cache_ops); map->lock (map->lock_arg);
@@ -418,6 +421,9 @@ int regcache_sync_region(struct regmap *map, unsigned int min,const char *name;bool bypass; +if (WARN_ON (map->cache_type ==REGCACHE_NONE )) +return -EINVAL ; +BUG_ON (!map->cache_ops); map->lock (map->lock_arg);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 48/292 remoteproc: imx_dsp_rproc: Add custom memory copy implementation for i.MX DSP Cores
In reply to Greg Kroah-HartmanFrom: Iuliana Prodan <[email protected]>
[ Upstream commit 408ec1ff0caa340c57eecf4cbd14ef0132036a50 ]
The IRAM is part of the HiFi DSP.
According to hardware specification only 32-bits write are allowed otherwise we get a Kernel panic.
Therefore add a custom memory copy and memset functions to deal with the above restriction.
--- drivers/remoteproc/imx_dsp_rproc.c | 187 ++++++++++++++++++++++++++++- 1 file changed, 186 insertions(+), 1 deletion(-)
drivers/remoteproc/imx_dsp_rproc.c +186 -1
@@ -721,6 +721,191 @@ static void imx_dsp_rproc_kick(struct rproc *rproc, int vqid)dev_err (dev,"%s: failed (%d, err:%d)\n" , __func__, vqid, err); } +/* +* Custom memory copy implementation for i.MX DSP Cores +* +* The IRAM is part of the HiFi DSP. +* According to hw specs only 32-bits writes are allowed. +*/ +static int imx_dsp_rproc_memcpy (void *dest,const void *src,size_t size) +{ +const u8 *src_byte = src; +const u32 *source = src; +u32 affected_mask; +u32 *dst = dest; +int i, q, r; +u32 tmp; + +/* destination must be 32bit aligned */ +if (!IS_ALIGNED ((uintptr_t )dest,4 )) +return -EINVAL ; + + q = size /4 ; + r = size %4 ; + +/* copy data in units of 32 bits at a time */ +for (i =0 ; i < q; i++) +writel (source[i], &dst[i]); + +if (r) { + affected_mask =GENMASK (8 * r,0 ); + +/* +* first read the 32bit data of dest, then change affected +* bytes, and write back to dest. +* For unaffected bytes, it should not be changed +*/ + tmp =readl (dest + q *4 ); + tmp &= ~affected_mask; + +/* avoid reading after end of source */ +for (i =0 ; i < r; i++) + tmp |= (src_byte[q *4 + i] << (8 * i)); + +writel (tmp, dest + q *4 ); + } + +return 0 ; +} + +/* +* Custom memset implementation for i.MX DSP Cores +* +* The IRAM is part of the HiFi DSP. +* According to hw specs only 32-bits writes are allowed. +*/ +static int imx_dsp_rproc_memset (void *addr,u8 value,size_t size) +{ +u32 tmp_val = value; +u32 *tmp_dst = addr; +u32 affected_mask; +int q, r; +u32 tmp; + +/* destination must be 32bit aligned */ +if (!IS_ALIGNED ((uintptr_t )addr,4 )) +return -EINVAL ; + + tmp_val |= tmp_val <<8 ; + tmp_val |= tmp_val <<16 ; + + q = size /4 ; + r = size %4 ; + +while (q--) +writel (tmp_val, tmp_dst++); + +if (r) { + affected_mask =GENMASK (8 * r,0 ); + +/* +* first read the 32bit data of addr, then change affected +* bytes, and write back to addr. +* For unaffected bytes, it should not be changed +*/ + tmp =readl (tmp_dst); + tmp &= ~affected_mask; + + tmp |= (tmp_val & affected_mask); +writel (tmp, tmp_dst); + } + +return 0 ; +} + +/* +* imx_dsp_rproc_elf_load_segments() - load firmware segments to memory +* @rproc: remote processor which will be booted using these fw segments +* @fw: the ELF firmware image +* +* This function loads the firmware segments to memory, where the remote +* processor expects them. +* +* Return: 0 on success and an appropriate error code otherwise +*/ +static int imx_dsp_rproc_elf_load_segments (struct rproc *rproc,const struct firmware *fw) +{ +struct device *dev = &rproc->dev; +const void *ehdr, *phdr; +int i, ret =0 ; +u16 phnum; +const u8 *elf_data = fw->data; +u8 class =fw_elf_get_class (fw); +u32 elf_phdr_get_size =elf_size_of_phdr (class); + + ehdr = elf_data; + phnum =elf_hdr_get_e_phnum (class, ehdr); + phdr = elf_data +elf_hdr_get_e_phoff (class, ehdr); + +/* go through the available ELF segments */ +for (i =0 ; i < phnum; i++, phdr += elf_phdr_get_size) { +u64 da =elf_phdr_get_p_paddr (class, phdr); +u64 memsz =elf_phdr_get_p_memsz (class, phdr); +u64 filesz =elf_phdr_get_p_filesz (class, phdr); +u64 offset =elf_phdr_get_p_offset (class, phdr); +u32 type =elf_phdr_get_p_type (class, phdr); +void *ptr; + +if (type !=PT_LOAD || !memsz) +continue ; + +dev_dbg (dev,"phdr: type %d da 0x%llx memsz 0x%llx filesz 0x%llx\n" , + type, da, memsz, filesz); + +if (filesz > memsz) { +dev_err (dev,"bad phdr filesz 0x%llx memsz 0x%llx\n" , + filesz, memsz); + ret = -EINVAL ; +break ; + } + +if (offset + filesz > fw->size) { +dev_err (dev,"truncated fw: need 0x%llx avail 0x%zx\n" , + offset + filesz, fw->size); + ret = -EINVAL ; +break ; + } + +if (!rproc_u64_fit_in_size_t (memsz)) { +dev_err (dev,"size (%llx) does not fit in size_t type\n" , + memsz); + ret = -EOVERFLOW ; +break ; + } + +/* grab the kernel address for this device address */ + ptr =rproc_da_to_va (rproc, da, memsz,NULL ); +if (!ptr) { +dev_err (dev,"bad phdr da 0x%llx mem 0x%llx\n" , da, + memsz); + ret = -EINVAL ; +break ; + } + +/* put the segment where the remote processor expects it */ +if (filesz) { + ret =imx_dsp_rproc_memcpy (ptr, elf_data + offset, filesz); +if (ret) { +dev_err (dev,"memory copy failed for da 0x%llx memsz 0x%llx\n" , + da, memsz); +break ; + } + } + +/* zero out remaining memory for this segment */ +if (memsz > filesz) { + ret =imx_dsp_rproc_memset (ptr + filesz,0 , memsz - filesz); +if (ret) { +dev_err (dev,"memset failed for da 0x%llx memsz 0x%llx\n" , + da, memsz); +break ; + } + } + } + +return ret; +} +static int imx_dsp_rproc_parse_fw (struct rproc *rproc,const struct firmware *fw) {if (rproc_elf_load_rsc_table (rproc, fw))
@@ -735,7 +920,7 @@ static const struct rproc_ops imx_dsp_rproc_ops = { .start = imx_dsp_rproc_start, .stop = imx_dsp_rproc_stop, .kick = imx_dsp_rproc_kick, - .load = rproc_elf_load_segments, + .load = imx_dsp_rproc_elf_load_segments, .parse_fw = imx_dsp_rproc_parse_fw, .sanity_check = rproc_elf_sanity_check, .get_boot_addr = rproc_elf_get_boot_addr,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 49/292 arm64: dts: qcom: msm8996: Add missing DWC3 quirks
In reply to Greg Kroah-HartmanFrom: Konrad Dybcio <[email protected]>
[ Upstream commit d0af0537e28f6eace02deed63b585396de939213 ]
Add missing dwc3 quirks from msm-3.18. Unfortunately, none of them make dwc3-qcom 6af8800.usb: HS-PHY not in L2 go away.
--- arch/arm64/boot/dts/qcom/msm8996.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/qcom/msm8996.dtsi +3 -0
@@ -2979,8 +2979,11 @@ interrupts = <0 131 IRQ_TYPE_LEVEL_HIGH>; phys = <&hsusb_phy1>, <&ssusb_phy_0>; phy-names = "usb2-phy", "usb3-phy"; + snps,hird-threshold = /bits/ 8 <0>; snps,dis_u2_susphy_quirk; snps,dis_enblslpm_quirk; + snps,is-utmi-l1-suspend; + tx-fifo-resize; }; };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 50/292 media: cx23885: Fix a null-ptr-deref bug in buffer_prepare() and buffer_finish()
In reply to Greg Kroah-HartmanFrom: harperchen <[email protected]>
[ Upstream commit 47e8b73bc35d7c54642f78e498697692f6358996 ]
When the driver calls cx23885_risc_buffer() to prepare the buffer, the function call dma_alloc_coherent may fail, resulting in a empty buffer risc->cpu. Later when we free the buffer or access the buffer, null ptr deref is triggered.
This bug is similar to the following one:
https://git.linuxtv.org/media_stage.git/commit/?id=2b064d91440b33fba5b452f2d1b31f13ae911d71.
We believe the bug can be also dynamically triggered from user side. Similarly, we fix this by checking the return value of cx23885_risc_buffer() and the value of risc->cpu before buffer free.
--- drivers/media/pci/cx23885/cx23885-core.c | 4 +++- drivers/media/pci/cx23885/cx23885-video.c | 13 +++++++------ 2 files changed, 10 insertions(+), 7 deletions(-)
drivers/media/pci/cx23885/cx23885-core.c +3 -1
@@ -1325,7 +1325,9 @@ void cx23885_free_buffer(struct cx23885_dev *dev, struct cx23885_buffer *buf) {struct cx23885_riscmem *risc = &buf->risc; -dma_free_coherent (&dev->pci->dev, risc->size, risc->cpu, risc->dma); +if (risc->cpu) +dma_free_coherent (&dev->pci->dev, risc->size, risc->cpu, risc->dma); +memset (risc,0 ,sizeof (*risc)); }static void cx23885_tsport_reg_dump (struct cx23885_tsport *port)
drivers/media/pci/cx23885/cx23885-video.c +7 -6
@@ -342,6 +342,7 @@ static int queue_setup(struct vb2_queue *q,static int buffer_prepare (struct vb2_buffer *vb) { +int ret;struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (vb);struct cx23885_dev *dev = vb->vb2_queue->drv_priv; struct cx23885_buffer *buf =
@@ -358,12 +359,12 @@ static int buffer_prepare(struct vb2_buffer *vb)switch (dev->field) {case V4L2_FIELD_TOP : -cx23885_risc_buffer (dev->pci, &buf->risc, + ret =cx23885_risc_buffer (dev->pci, &buf->risc, sgt->sgl,0 ,UNSET , buf->bpl,0 , dev->height);break ;case V4L2_FIELD_BOTTOM : -cx23885_risc_buffer (dev->pci, &buf->risc, + ret =cx23885_risc_buffer (dev->pci, &buf->risc, sgt->sgl,UNSET ,0 , buf->bpl,0 , dev->height);break ;
@@ -391,21 +392,21 @@ static int buffer_prepare(struct vb2_buffer *vb) line0_offset =0 ; line1_offset = buf->bpl; } -cx23885_risc_buffer (dev->pci, &buf->risc, + ret =cx23885_risc_buffer (dev->pci, &buf->risc, sgt->sgl, line0_offset, line1_offset, buf->bpl, buf->bpl, dev->height >>1 );break ;case V4L2_FIELD_SEQ_TB : -cx23885_risc_buffer (dev->pci, &buf->risc, + ret =cx23885_risc_buffer (dev->pci, &buf->risc, sgt->sgl,0 , buf->bpl * (dev->height >>1 ), buf->bpl,0 , dev->height >>1 );break ;case V4L2_FIELD_SEQ_BT : - cx23885_risc_buffer(dev->pci, &buf->risc, + ret = cx23885_risc_buffer(dev->pci, &buf->risc, sgt->sgl, buf->bpl * (dev->height >> 1), 0, buf->bpl, 0,
@@ -418,7 +419,7 @@ static int buffer_prepare(struct vb2_buffer *vb) buf, buf->vb.vb2_buf.index, dev->width, dev->height, dev->fmt->depth, dev->fmt->fourcc, (unsigned long)buf->risc.dma); -return 0 ; +return ret; }static void buffer_finish (struct vb2_buffer *vb)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 51/292 media: pci: tw68: Fix null-ptr-deref bug in buf prepare and finish
In reply to Greg Kroah-HartmanFrom: harperchen <[email protected]>
[ Upstream commit 1634b7adcc5bef645b3666fdd564e5952a9e24e0 ]
When the driver calls tw68_risc_buffer() to prepare the buffer, the function call dma_alloc_coherent may fail, resulting in a empty buffer buf->cpu. Later when we free the buffer or access the buffer, null ptr deref is triggered.
This bug is similar to the following one:
https://git.linuxtv.org/media_stage.git/commit/?id=2b064d91440b33fba5b452f2d1b31f13ae911d71.
We believe the bug can be also dynamically triggered from user side. Similarly, we fix this by checking the return value of tw68_risc_buffer() and the value of buf->cpu before buffer free.
--- drivers/media/pci/tw68/tw68-video.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/media/pci/tw68/tw68-video.c +9 -7
@@ -437,6 +437,7 @@ static void tw68_buf_queue(struct vb2_buffer *vb)*/ static int tw68_buf_prepare (struct vb2_buffer *vb) { +int ret;struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (vb);struct vb2_queue *vq = vb->vb2_queue;struct tw68_dev *dev =vb2_get_drv_priv (vq);
@@ -452,30 +453,30 @@ static int tw68_buf_prepare(struct vb2_buffer *vb) bpl = (dev->width * dev->fmt->depth) >>3 ;switch (dev->field) {case V4L2_FIELD_TOP : -tw68_risc_buffer (dev->pci, buf, dma->sgl, + ret =tw68_risc_buffer (dev->pci, buf, dma->sgl,0 ,UNSET , bpl,0 , dev->height);break ;case V4L2_FIELD_BOTTOM : -tw68_risc_buffer (dev->pci, buf, dma->sgl, + ret =tw68_risc_buffer (dev->pci, buf, dma->sgl,UNSET ,0 , bpl,0 , dev->height);break ;case V4L2_FIELD_SEQ_TB : -tw68_risc_buffer (dev->pci, buf, dma->sgl, + ret =tw68_risc_buffer (dev->pci, buf, dma->sgl,0 , bpl * (dev->height >>1 ), bpl,0 , dev->height >>1 );break ;case V4L2_FIELD_SEQ_BT : -tw68_risc_buffer (dev->pci, buf, dma->sgl, + ret =tw68_risc_buffer (dev->pci, buf, dma->sgl, bpl * (dev->height >>1 ),0 , bpl,0 , dev->height >>1 );break ;case V4L2_FIELD_INTERLACED :default : -tw68_risc_buffer (dev->pci, buf, dma->sgl, + ret =tw68_risc_buffer (dev->pci, buf, dma->sgl,0 , bpl, bpl, bpl, dev->height >>1 );break ; } -return 0 ; +return ret; }static void tw68_buf_finish (struct vb2_buffer *vb)
@@ -485,7 +486,8 @@ static void tw68_buf_finish(struct vb2_buffer *vb)struct tw68_dev *dev =vb2_get_drv_priv (vq); struct tw68_buf *buf = container_of(vbuf, struct tw68_buf, vb); -dma_free_coherent (&dev->pci->dev, buf->size, buf->cpu, buf->dma); +if (buf->cpu) +dma_free_coherent (&dev->pci->dev, buf->size, buf->cpu, buf->dma); }static int tw68_start_streaming (struct vb2_queue *q,unsigned int count)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 52/292 media: pvrusb2: VIDEO_PVRUSB2 depends on DVB_CORE to use dvb_* symbols
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit 1107283b3351bef138cd12dbda1f999891cab7db ]
A rand config causes this link error
vmlinux.o: In function `pvr2_dvb_create':
(.text+0x8af1d2): undefined reference to `dvb_register_adapter'
The rand config hasCONFIG_VIDEO_PVRUSB2=yCONFIG_VIDEO_DEV=yCONFIG_DVB_CORE=m
VIDEO_PVRUSB2 should also depend on DVB_CORE.
--- drivers/media/usb/pvrusb2/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/pvrusb2/Kconfig +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config VIDEO_PVRUSB2 tristate "Hauppauge WinTV-PVR USB2 support" - depends on VIDEO_DEV && I2C + depends on VIDEO_DEV && I2C && DVB_CORE select VIDEO_TUNER select VIDEO_TVEEPROM select VIDEO_CX2341X
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 53/292 ACPI: processor: Check for null return of devm_kzalloc() in fch_misc_setup()
In reply to Greg Kroah-HartmanFrom: Kang Chen <[email protected]>
[ Upstream commit 4dea41775d951ff1f7b472a346a8ca3ae7e74455 ]
devm_kzalloc() may fail, clk_data->name might be NULL and will cause a NULL pointer dereference later.
--- drivers/acpi/acpi_apd.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/acpi/acpi_apd.c +2 -0
@@ -83,6 +83,8 @@ static int fch_misc_setup(struct apd_private_data *pdata)if (!acpi_dev_get_property (adev,"clk-name" ,ACPI_TYPE_STRING , &obj)) { clk_data->name =devm_kzalloc (&adev->dev, obj->string.length,GFP_KERNEL ); +if (!clk_data->name) +return -ENOMEM ;strcpy (clk_data->name, obj->string.pointer); }else {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 54/292 drm/rockchip: dw_hdmi: cleanup drm encoder during unbind
In reply to Greg Kroah-HartmanFrom: Toby Chen <[email protected]>
[ Upstream commit b5af48eedcb53491c02ded55d5991e03d6da6dbf ]
This fixes a use-after-free crash during rmmod.
The DRM encoder is embedded inside the larger rockchip_hdmi, which is allocated with the component. The component memory gets freed before the main drm device is destroyed. Fix it by running encoder cleanup before tearing down its container.
--- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +1 -0
@@ -640,6 +640,7 @@ static void dw_hdmi_rockchip_unbind(struct device *dev, struct device *master,struct rockchip_hdmi *hdmi =dev_get_drvdata (dev);dw_hdmi_unbind (hdmi->hdmi); +drm_encoder_cleanup (&hdmi->encoder.encoder);clk_disable_unprepare (hdmi->ref_clk);regulator_disable (hdmi->avdd_1v8);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 55/292 memstick: r592: Fix UAF bug in r592_remove due to race condition
In reply to Greg Kroah-HartmanFrom: Zheng Wang <[email protected]>
[ Upstream commit 63264422785021704c39b38f65a78ab9e4a186d7 ]
In r592_probe, dev->detect_timer was bound with r592_detect_timer. In r592_irq function, the timer function will be invoked by mod_timer.
If we remove the module which will call hantro_release to make cleanup, there may be a unfinished work. The possible sequence is as follows, which will cause a typical UAF bug.
Fix it by canceling the work before cleanup in r592_remove.
CPU0 CPU1
|r592_detect_timer
r592_remove |
memstick_free_host|
put_device; |
kfree(host); |
|
| queue_work
| &host->media_checker //use--- drivers/memstick/host/r592.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/memstick/host/r592.c +1 -1
@@ -829,7 +829,7 @@ static void r592_remove(struct pci_dev *pdev)/* Stop the processing thread. That ensures that we won't take any more requests */ kthread_stop (dev->io_thread); - +del_timer_sync (&dev->detect_timer);r592_enable_device (dev, false);while (!error && dev->req) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 56/292 arm64: dts: imx8mq-librem5: Remove dis_u3_susphy_quirk from usb_dwc3_0
In reply to Greg Kroah-HartmanFrom: Sebastian Krzyszkowiak <[email protected]>
[ Upstream commit cfe9de291bd2bbce18c5cd79e1dd582cbbacdb4f ]
This reduces power consumption in system suspend by about 10%.
--- arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi | 1 - 1 file changed, 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi +0 -1
@@ -1299,7 +1299,6 @@ #address-cells = <1>; #size-cells = <0>; dr_mode = "otg"; - snps,dis_u3_susphy_quirk; usb-role-switch; status = "okay";
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 57/292 firmware: arm_sdei: Fix sleep from invalid context BUG
In reply to Greg Kroah-HartmanFrom: Pierre Gondois <[email protected]>
[ Upstream commit d2c48b2387eb89e0bf2a2e06e30987cf410acad4 ]
Running a preempt-rt (v6.2-rc3-rt1) based kernel on an Ampere Altra triggers:
BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:46
in_atomic(): 0, irqs_disabled(): 128, non_block: 0, pid: 24, name: cpuhp/0
preempt_count: 0, expected: 0
RCU nest depth: 0, expected: 0
3 locks held by cpuhp/0/24:
#0: ffffda30217c70d0 (cpu_hotplug_lock){++++}-{0:0}, at: cpuhp_thread_fun+0x5c/0x248
#1: ffffda30217c7120 (cpuhp_state-up){+.+.}-{0:0}, at: cpuhp_thread_fun+0x5c/0x248
#2: ffffda3021c711f0 (sdei_list_lock){....}-{3:3}, at: sdei_cpuhp_up+0x3c/0x130
irq event stamp: 36
hardirqs last enabled at (35): [<ffffda301e85b7bc>] finish_task_switch+0xb4/0x2b0
hardirqs last disabled at (36): [<ffffda301e812fec>] cpuhp_thread_fun+0x21c/0x248
softirqs last enabled at (0): [<ffffda301e80b184>] copy_process+0x63c/0x1ac0
softirqs last disabled at (0): [<0000000000000000>] 0x0
CPU: 0 PID: 24 Comm: cpuhp/0 Not tainted 5.19.0-rc3-rt5-[...]
Hardware name: WIWYNN Mt.Jade Server [...]
Call trace:
dump_backtrace+0x114/0x120
show_stack+0x20/0x70
dump_stack_lvl+0x9c/0xd8
dump_stack+0x18/0x34
__might_resched+0x188/0x228
rt_spin_lock+0x70/0x120
sdei_cpuhp_up+0x3c/0x130
cpuhp_invoke_callback+0x250/0xf08
cpuhp_thread_fun+0x120/0x248
smpboot_thread_fn+0x280/0x320
kthread+0x130/0x140
ret_from_fork+0x10/0x20sdei_cpuhp_up() is called in the STARTING hotplug section, which runs with interrupts disabled. Use a CPUHP_AP_ONLINE_DYN entry instead to execute the cpuhp cb later, with preemption enabled.
SDEI originally got its own cpuhp slot to allow interacting with perf. It got superseded by pNMI and this early slot is not relevant anymore. [1]
Some SDEI calls (e.g. SDEI_1_0_FN_SDEI_PE_MASK) take actions on the calling CPU. It is checked that preemption is disabled for them. _ONLINE cpuhp cb are executed in the 'per CPU hotplug thread'. Preemption is enabled in those threads, but their cpumask is limited to 1 CPU.
Move 'WARN_ON_ONCE(preemptible())' statements so that SDEI cpuhp cb don't trigger them.
Also add a check for the SDEI_1_0_FN_SDEI_PRIVATE_RESET SDEI call which acts on the calling CPU.
[1]:
https://lore.kernel.org/all/[email protected]/
--- drivers/firmware/arm_sdei.c | 37 ++++++++++++++++++++----------------- include/linux/cpuhotplug.h | 1 - 2 files changed, 20 insertions(+), 18 deletions(-)
drivers/firmware/arm_sdei.c +20 -17
@@ -43,6 +43,8 @@ static asmlinkage void (*sdei_firmware_call)(unsigned long function_id,/* entry point from firmware to arch asm code */ static unsigned long sdei_entry_point; +static int sdei_hp_state; +struct sdei_event {/* These three are protected by the sdei_list_lock */ struct list_head list;
@@ -301,8 +303,6 @@ int sdei_mask_local_cpu(void) {int err; -WARN_ON_ONCE (preemptible ()); - err =invoke_sdei_fn (SDEI_1_0_FN_SDEI_PE_MASK ,0 ,0 ,0 ,0 ,0 ,NULL );if (err && err != -EIO ) { pr_warn_once("failed to mask CPU[%u]: %d\n",
@@ -315,6 +315,7 @@ int sdei_mask_local_cpu(void)static void _ipi_mask_cpu (void *ignored) { +WARN_ON_ONCE (preemptible ());sdei_mask_local_cpu (); }
@@ -322,8 +323,6 @@ int sdei_unmask_local_cpu(void) {int err; -WARN_ON_ONCE (preemptible ()); - err =invoke_sdei_fn (SDEI_1_0_FN_SDEI_PE_UNMASK ,0 ,0 ,0 ,0 ,0 ,NULL );if (err && err != -EIO ) { pr_warn_once("failed to unmask CPU[%u]: %d\n",
@@ -336,6 +335,7 @@ int sdei_unmask_local_cpu(void)static void _ipi_unmask_cpu (void *ignored) { +WARN_ON_ONCE (preemptible ());sdei_unmask_local_cpu (); }
@@ -343,6 +343,8 @@ static void _ipi_private_reset(void *ignored) {int err; +WARN_ON_ONCE (preemptible ()); + err =invoke_sdei_fn (SDEI_1_0_FN_SDEI_PRIVATE_RESET ,0 ,0 ,0 ,0 ,0 ,NULL );if (err && err != -EIO )
@@ -389,8 +391,6 @@ static void _local_event_enable(void *data)int err;struct sdei_crosscall_args *arg = data; -WARN_ON_ONCE (preemptible ()); - err =sdei_api_event_enable (arg->event->event_num);sdei_cross_call_return (arg, err);
@@ -479,8 +479,6 @@ static void _local_event_unregister(void *data)int err;struct sdei_crosscall_args *arg = data; -WARN_ON_ONCE (preemptible ()); - err =sdei_api_event_unregister (arg->event->event_num);sdei_cross_call_return (arg, err);
@@ -561,8 +559,6 @@ static void _local_event_register(void *data)struct sdei_registered_event *reg;struct sdei_crosscall_args *arg = data; -WARN_ON (preemptible ()); - reg =per_cpu_ptr (arg->event->private_registered,smp_processor_id ()); err =sdei_api_event_register (arg->event->event_num, sdei_entry_point, reg,0 ,0 );
@@ -717,6 +713,8 @@ static int sdei_pm_notifier(struct notifier_block *nb, unsigned long action, {int rv; +WARN_ON_ONCE (preemptible ()); +switch (action) {case CPU_PM_ENTER : rv =sdei_mask_local_cpu ();
@@ -765,7 +763,7 @@ static int sdei_device_freeze(struct device *dev)int err;/* unregister private events */ -cpuhp_remove_state (CPUHP_AP_ARM_SDEI_STARTING ); +cpuhp_remove_state (sdei_entry_point); err =sdei_unregister_shared ();if (err)
@@ -786,12 +784,15 @@ static int sdei_device_thaw(struct device *dev)return err; } - err =cpuhp_setup_state (CPUHP_AP_ARM_SDEI_STARTING ,"SDEI" , + err =cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"SDEI" , &sdei_cpuhp_up, &sdei_cpuhp_down); -if (err) +if (err <0 ) {pr_warn ("Failed to re-register CPU hotplug notifier...\n" ); +return err; + } -return err; + sdei_hp_state = err; +return 0 ; }static int sdei_device_restore (struct device *dev)
@@ -823,7 +824,7 @@ static int sdei_reboot_notifier(struct notifier_block *nb, unsigned long action,* We are going to reset the interface, after this there is no point * doing work when we take CPUs offline. */ -cpuhp_remove_state (CPUHP_AP_ARM_SDEI_STARTING ); +cpuhp_remove_state (sdei_hp_state);sdei_platform_reset ();
@@ -1003,13 +1004,15 @@ static int sdei_probe(struct platform_device *pdev) goto remove_cpupm; } - err =cpuhp_setup_state (CPUHP_AP_ARM_SDEI_STARTING ,"SDEI" , + err =cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"SDEI" , &sdei_cpuhp_up, &sdei_cpuhp_down); -if (err) { +if (err <0 ) {pr_warn ("Failed to register CPU hotplug notifier...\n" ); goto remove_reboot; } + sdei_hp_state = err; +return 0 ; remove_reboot:
include/linux/cpuhotplug.h +0 -1
@@ -161,7 +161,6 @@ enum cpuhp_state {CPUHP_AP_PERF_X86_CSTATE_STARTING ,CPUHP_AP_PERF_XTENSA_STARTING ,CPUHP_AP_MIPS_OP_LOONGSON3_STARTING , -CPUHP_AP_ARM_SDEI_STARTING ,CPUHP_AP_ARM_VFP_STARTING ,CPUHP_AP_ARM64_DEBUG_MONITORS_STARTING , CPUHP_AP_PERF_ARM_HW_BREAKPOINT_STARTING,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 58/292 ACPI: EC: Fix oops when removing custom query handlers
In reply to Greg Kroah-HartmanFrom: Armin Wolf <[email protected]>
[ Upstream commit e5b492c6bb900fcf9722e05f4a10924410e170c1 ]
When removing custom query handlers, the handler might still be used inside the EC query workqueue, causing a kernel oops if the module holding the callback function was already unloaded.
Fix this by flushing the EC query workqueue when removing custom query handlers.
Tested on a Acer Travelmate 4002WLMi
--- drivers/acpi/ec.c | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/ec.c +1 -0
@@ -1121,6 +1121,7 @@ static void acpi_ec_remove_query_handlers(struct acpi_ec *ec,void acpi_ec_remove_query_handler (struct acpi_ec *ec,u8 query_bit) {acpi_ec_remove_query_handlers (ec, false, query_bit); +flush_workqueue (ec_query_wq); }EXPORT_SYMBOL_GPL (acpi_ec_remove_query_handler);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 59/292 drm/amd/display: fixed dcn30+ underflow issue
In reply to Greg Kroah-HartmanFrom: Ayush Gupta <[email protected]>
[ Upstream commit 37403ced9f2873fab7f39ab4ac963bbb33fb0bc0 ]
[Why]
Observing underflow on dcn30+ system config at 4k144hz
[How]
We set the UCLK hardmax on AC/DC switch if softmax is enabled and also on boot. While booting up the UCLK Hardmax is set to softmax before the init sequence and the init sequence resets the hardmax to UCLK max which enables P-state switching. Just added a conditional check to avoid setting hardmax on init.
--- drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c | 3 ++- drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c | 2 +- drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c +2 -1
@@ -629,7 +629,8 @@ void dcn30_init_hw(struct dc *dc)if (dc->clk_mgr->funcs->notify_wm_ranges) dc->clk_mgr->funcs->notify_wm_ranges (dc->clk_mgr); -if (dc->clk_mgr->funcs->set_hard_max_memclk) +//if softmax is enabled then hardmax will be set by a different call +if (dc->clk_mgr->funcs->set_hard_max_memclk && !dc->clk_mgr->dc_mode_softmax_enabled) dc->clk_mgr->funcs->set_hard_max_memclk (dc->clk_mgr);if (dc->res_pool->hubbub->funcs->force_pstate_change_control)
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c +1 -1
@@ -284,7 +284,7 @@ void dcn31_init_hw(struct dc *dc)if (dc->clk_mgr->funcs->notify_wm_ranges) dc->clk_mgr->funcs->notify_wm_ranges (dc->clk_mgr); -if (dc->clk_mgr->funcs->set_hard_max_memclk) +if (dc->clk_mgr->funcs->set_hard_max_memclk && !dc->clk_mgr->dc_mode_softmax_enabled) dc->clk_mgr->funcs->set_hard_max_memclk (dc->clk_mgr);if (dc->res_pool->hubbub->funcs->force_pstate_change_control)
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c +1 -1
@@ -970,7 +970,7 @@ void dcn32_init_hw(struct dc *dc)if (dc->clk_mgr->funcs->notify_wm_ranges) dc->clk_mgr->funcs->notify_wm_ranges (dc->clk_mgr); -if (dc->clk_mgr->funcs->set_hard_max_memclk) +if (dc->clk_mgr->funcs->set_hard_max_memclk && !dc->clk_mgr->dc_mode_softmax_enabled) dc->clk_mgr->funcs->set_hard_max_memclk (dc->clk_mgr);if (dc->res_pool->hubbub->funcs->force_pstate_change_control)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 60/292 remoteproc: stm32_rproc: Add mutex protection for workqueue
In reply to Greg Kroah-HartmanFrom: Arnaud Pouliquen <[email protected]>
[ Upstream commit 35bdafda40cc343ad2ba2cce105eba03a70241cc ]
The workqueue may execute late even after remoteproc is stopped or stopping, some resources (rpmsg device and endpoint) have been released in rproc_stop_subdevices(), then rproc_vq_interrupt() accessing these resources will cause kernel dump.
Call trace:
virtqueue_add_inbufvirtqueue_add_inbufrpmsg_recv_singlerpmsg_recv_donevring_interruptstm32_rproc_mb_vq_workprocess_one_workworker_thread
kthread
--- drivers/remoteproc/stm32_rproc.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/remoteproc/stm32_rproc.c +8 -0
@@ -291,8 +291,16 @@ static void stm32_rproc_mb_vq_work(struct work_struct *work) struct stm32_mbox *mb = container_of(work, struct stm32_mbox, vq_work);struct rproc *rproc =dev_get_drvdata (mb->client.dev); +mutex_lock (&rproc->lock); + +if (rproc->state !=RPROC_RUNNING ) + goto unlock_mutex; +if (rproc_vq_interrupt (rproc, mb->vq_id) ==IRQ_NONE )dev_dbg (&rproc->dev,"no message found in vq%d\n" , mb->vq_id); + +unlock_mutex: +mutex_unlock (&rproc->lock); }static void stm32_rproc_mb_callback (struct mbox_client *cl,void *data)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 61/292 drm/tegra: Avoid potential 32-bit integer overflow
In reply to Greg Kroah-HartmanFrom: Nur Hussein <[email protected]>
[ Upstream commit 2429b3c529da29d4277d519bd66d034842dcd70c ]
In tegra_sor_compute_config(), the 32-bit value mode->clock is multiplied by 1000, and assigned to the u64 variable pclk. We can avoid a potential 32-bit integer overflow by casting mode->clock to u64 before we do the arithmetic and assignment.
--- drivers/gpu/drm/tegra/sor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tegra/sor.c +1 -1
@@ -1153,7 +1153,7 @@ static int tegra_sor_compute_config(struct tegra_sor *sor, struct drm_dp_link *link) {const u64 f =100000 , link_rate = link->rate *1000 ; -const u64 pclk = mode->clock *1000 ; +const u64 pclk = (u64 )mode->clock *1000 ;u64 input, output, watermark, num;struct tegra_sor_params params;u32 num_syms_per_line;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 62/292 drm/msm/dp: Clean up handling of DP AUX interrupts
In reply to Greg Kroah-HartmanFrom: Douglas Anderson <[email protected]>
[ Upstream commit b20566cdef05cd40d95f10869d2a7646f48b1bbe ]
The DP AUX interrupt handling was a bit of a mess.
* There were two functions (one for "native" transfers and one for "i2c" transfers) that were quite similar. It was hard to say how many of the differences between the two functions were on purpose and how many of them were just an accident of how they were coded.
* Each function sometimes used "else if" to test for error bits and sometimes didn't and again it was hard to say if this was on purpose or just an accident.
* The two functions wouldn't notice whether "unknown" bits were set. For instance, there seems to be a bit "DP_INTR_PLL_UNLOCKED" and if it was set there would be no indication.
* The two functions wouldn't notice if more than one error was set.
Let's fix this by being more consistent / explicit about what we're doing.
By design this could cause different handling for AUX transfers, though I'm not actually aware of any bug fixed as a result of this patch (this patch was created because we simply noticed how odd the old code was by code inspection). Specific notes here:
1. In the old native transfer case if we got "done + wrong address" we'd ignore the "wrong address" (because of the "else if"). Now we won't.
2. In the old native transfer case if we got "done + timeout" we'd ignore the "timeout" (because of the "else if"). Now we won't.
3. In the old native transfer case we'd see "nack_defer" and translate it to the error number for "nack". This differed from the i2c transfer case where "nack_defer" was given the error number for "nack_defer". This 100% can't matter because the only user of this error number treats "nack defer" the same as "nack", so it's clear that the difference between the "native" and "i2c" was pointless here.
4. In the old i2c transfer case if we got "done" plus any error besides "nack" or "defer" then we'd ignore the error. Now we don't.
5. If there is more than one error signaled by the hardware it's possible that we'll report a different one than we used to. I don't know if this matters. If someone is aware of a case this matters we should document it and change the code to make it explicit.
6. One quirk we keep (I don't know if this is important) is that in the i2c transfer case if we see "done + defer" we report that as a "nack". That seemed too intentional in the old code to just drop.
After this change we will add extra logging, including:
* A warning if we see more than one error bit set.
* A warning if we see an unexpected interrupt.
* A warning if we get an AUX transfer interrupt when shouldn't.
It actually turns out that as a result of this change then at boot we sometimes see an error:
[drm:dp_aux_isr] *ERROR* Unexpected DP AUX IRQ 0x01000000 when not busy
That means that, during init, we are seeing DP_INTR_PLL_UNLOCKED. For now I'm going to say that leaving this error reported in the logs is OK-ish and hopefully it will encourage someone to track down what's going on at init time.
One last note here is that this change renames one of the interrupt bits. The bit named "i2c done" clearly was used for native transfers being done too, so I renamed it to indicate this.
Patchwork: https://patchwork.freedesktop.org/patch/520658/
--- drivers/gpu/drm/msm/dp/dp_aux.c | 80 ++++++++++++----------------- drivers/gpu/drm/msm/dp/dp_catalog.c | 2 +- drivers/gpu/drm/msm/dp/dp_catalog.h | 2 +- 3 files changed, 36 insertions(+), 48 deletions(-)
drivers/gpu/drm/msm/dp/dp_aux.c +34 -46
@@ -162,47 +162,6 @@ static ssize_t dp_aux_cmd_fifo_rx(struct dp_aux_private *aux,return i; } -static void dp_aux_native_handler (struct dp_aux_private *aux,u32 isr) -{ -if (isr &DP_INTR_AUX_I2C_DONE ) - aux->aux_error_num =DP_AUX_ERR_NONE ; -else if (isr &DP_INTR_WRONG_ADDR ) - aux->aux_error_num =DP_AUX_ERR_ADDR ; -else if (isr &DP_INTR_TIMEOUT ) - aux->aux_error_num =DP_AUX_ERR_TOUT ; -if (isr &DP_INTR_NACK_DEFER ) - aux->aux_error_num =DP_AUX_ERR_NACK ; -if (isr &DP_INTR_AUX_ERROR ) { - aux->aux_error_num =DP_AUX_ERR_PHY ; -dp_catalog_aux_clear_hw_interrupts (aux->catalog); - } -} - -static void dp_aux_i2c_handler (struct dp_aux_private *aux,u32 isr) -{ -if (isr &DP_INTR_AUX_I2C_DONE ) { -if (isr & (DP_INTR_I2C_NACK |DP_INTR_I2C_DEFER )) - aux->aux_error_num =DP_AUX_ERR_NACK ; -else - aux->aux_error_num =DP_AUX_ERR_NONE ; - }else { -if (isr &DP_INTR_WRONG_ADDR ) - aux->aux_error_num =DP_AUX_ERR_ADDR ; -else if (isr &DP_INTR_TIMEOUT ) - aux->aux_error_num =DP_AUX_ERR_TOUT ; -if (isr &DP_INTR_NACK_DEFER ) - aux->aux_error_num =DP_AUX_ERR_NACK_DEFER ; -if (isr &DP_INTR_I2C_NACK ) - aux->aux_error_num =DP_AUX_ERR_NACK ; -if (isr &DP_INTR_I2C_DEFER ) - aux->aux_error_num =DP_AUX_ERR_DEFER ; -if (isr &DP_INTR_AUX_ERROR ) { - aux->aux_error_num =DP_AUX_ERR_PHY ; -dp_catalog_aux_clear_hw_interrupts (aux->catalog); - } - } -} -static void dp_aux_update_offset_and_segment (struct dp_aux_private *aux,struct drm_dp_aux_msg *input_msg) {
@@ -427,13 +386,42 @@ void dp_aux_isr(struct drm_dp_aux *dp_aux)if (!isr)return ; -if (!aux->cmd_busy) +if (!aux->cmd_busy) { +DRM_ERROR ("Unexpected DP AUX IRQ %#010x when not busy\n" , isr);return ; + } -if (aux->native) -dp_aux_native_handler (aux, isr); -else -dp_aux_i2c_handler (aux, isr); +/* +* The logic below assumes only one error bit is set (other than "done" +* which can apparently be set at the same time as some of the other +* bits). Warn if more than one get set so we know we need to improve +* the logic. +*/ +if (hweight32 (isr & ~DP_INTR_AUX_XFER_DONE ) >1 ) +DRM_WARN ("Some DP AUX interrupts unhandled: %#010x\n" , isr); + +if (isr &DP_INTR_AUX_ERROR ) { + aux->aux_error_num =DP_AUX_ERR_PHY ; +dp_catalog_aux_clear_hw_interrupts (aux->catalog); + }else if (isr &DP_INTR_NACK_DEFER ) { + aux->aux_error_num =DP_AUX_ERR_NACK_DEFER ; + }else if (isr &DP_INTR_WRONG_ADDR ) { + aux->aux_error_num =DP_AUX_ERR_ADDR ; + }else if (isr &DP_INTR_TIMEOUT ) { + aux->aux_error_num =DP_AUX_ERR_TOUT ; + }else if (!aux->native && (isr &DP_INTR_I2C_NACK )) { + aux->aux_error_num =DP_AUX_ERR_NACK ; + }else if (!aux->native && (isr &DP_INTR_I2C_DEFER )) { +if (isr &DP_INTR_AUX_XFER_DONE ) + aux->aux_error_num =DP_AUX_ERR_NACK ; +else + aux->aux_error_num =DP_AUX_ERR_DEFER ; + }else if (isr &DP_INTR_AUX_XFER_DONE ) { + aux->aux_error_num =DP_AUX_ERR_NONE ; + }else { +DRM_WARN ("Unexpected interrupt: %#010x\n" , isr); +return ; + }complete (&aux->comp); }
drivers/gpu/drm/msm/dp/dp_catalog.c +1 -1
@@ -27,7 +27,7 @@#define DP_INTF_CONFIG_DATABUS_WIDEN BIT(4)#define DP_INTERRUPT_STATUS1 \ - (DP_INTR_AUX_I2C_DONE| \ + (DP_INTR_AUX_XFER_DONE| \ DP_INTR_WRONG_ADDR | DP_INTR_TIMEOUT | \ DP_INTR_NACK_DEFER | DP_INTR_WRONG_DATA_CNT | \ DP_INTR_I2C_NACK | DP_INTR_I2C_DEFER | \
drivers/gpu/drm/msm/dp/dp_catalog.h +1 -1
@@ -13,7 +13,7 @@/* interrupts */ #define DP_INTR_HPD BIT(0) -#define DP_INTR_AUX_I2C_DONE BIT(3) +#define DP_INTR_AUX_XFER_DONE BIT(3)#define DP_INTR_WRONG_ADDR BIT(6)#define DP_INTR_TIMEOUT BIT(9)#define DP_INTR_NACK_DEFER BIT(12)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 63/292 ACPICA: Avoid undefined behavior: applying zero offset to null pointer
In reply to Greg Kroah-HartmanFrom: Tamir Duberstein <[email protected]>
[ Upstream commit 05bb0167c80b8f93c6a4e0451b7da9b96db990c2 ]
ACPICA commit 770653e3ba67c30a629ca7d12e352d83c2541b1e
Before this change we see the following UBSAN stack trace in Fuchsia:
#0 0x000021e4213b3302 in acpi_ds_init_aml_walk(struct acpi_walk_state*, union acpi_parse_object*, struct acpi_namespace_node*, u8*, u32, struct acpi_evaluate_info*, u8) ../../third_party/acpica/source/components/dispatcher/dswstate.c:682 <platform-bus-x86.so>+0x233302 #1.2 0x000020d0f660777f in ubsan_get_stack_trace() compiler-rt/lib/ubsan/ubsan_diag.cpp:41 <libclang_rt.asan.so>+0x3d77f #1.1 0x000020d0f660777f in maybe_print_stack_trace() compiler-rt/lib/ubsan/ubsan_diag.cpp:51 <libclang_rt.asan.so>+0x3d77f #1 0x000020d0f660777f in ~scoped_report() compiler-rt/lib/ubsan/ubsan_diag.cpp:387 <libclang_rt.asan.so>+0x3d77f #2 0x000020d0f660b96d in handlepointer_overflow_impl() compiler-rt/lib/ubsan/ubsan_handlers.cpp:809 <libclang_rt.asan.so>+0x4196d #3 0x000020d0f660b50d in compiler-rt/lib/ubsan/ubsan_handlers.cpp:815 <libclang_rt.asan.so>+0x4150d #4 0x000021e4213b3302 in acpi_ds_init_aml_walk(struct acpi_walk_state*, union acpi_parse_object*, struct acpi_namespace_node*, u8*, u32, struct acpi_evaluate_info*, u8) ../../third_party/acpica/source/components/dispatcher/dswstate.c:682 <platform-bus-x86.so>+0x233302 #5 0x000021e4213e2369 in acpi_ds_call_control_method(struct acpi_thread_state*, struct acpi_walk_state*, union acpi_parse_object*) ../../third_party/acpica/source/components/dispatcher/dsmethod.c:605 <platform-bus-x86.so>+0x262369 #6 0x000021e421437fac in acpi_ps_parse_aml(struct acpi_walk_state*) ../../third_party/acpica/source/components/parser/psparse.c:550 <platform-bus-x86.so>+0x2b7fac #7 0x000021e4214464d2 in acpi_ps_execute_method(struct acpi_evaluate_info*) ../../third_party/acpica/source/components/parser/psxface.c:244 <platform-bus-x86.so>+0x2c64d2 #8 0x000021e4213aa052 in acpi_ns_evaluate(struct acpi_evaluate_info*) ../../third_party/acpica/source/components/namespace/nseval.c:250 <platform-bus-x86.so>+0x22a052 #9 0x000021e421413dd8 in acpi_ns_init_one_device(acpi_handle, u32, void*, void**) ../../third_party/acpica/source/components/namespace/nsinit.c:735 <platform-bus-x86.so>+0x293dd8 #10 0x000021e421429e98 in acpi_ns_walk_namespace(acpi_object_type, acpi_handle, u32, u32, acpi_walk_callback, acpi_walk_callback, void*, void**) ../../third_party/acpica/source/components/namespace/nswalk.c:298 <platform-bus-x86.so>+0x2a9e98 #11 0x000021e4214131ac in acpi_ns_initialize_devices(u32) ../../third_party/acpica/source/components/namespace/nsinit.c:268 <platform-bus-x86.so>+0x2931ac #12 0x000021e42147c40d in acpi_initialize_objects(u32) ../../third_party/acpica/source/components/utilities/utxfinit.c:304 <platform-bus-x86.so>+0x2fc40d #13 0x000021e42126d603 in acpi::acpi_impl::initialize_acpi(acpi::acpi_impl*) ../../src/devices/board/lib/acpi/acpi-impl.cc:224 <platform-bus-x86.so>+0xed603
Add a simple check that avoids incrementing a pointer by zero, but otherwise behaves as before. Note that our findings are against ACPICA 20221020, but the same code exists on master.
--- drivers/acpi/acpica/dswstate.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/acpi/acpica/dswstate.c +8 -3
@@ -576,9 +576,14 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state,ACPI_FUNCTION_TRACE (ds_init_aml_walk); walk_state->parser_state.aml = - walk_state->parser_state.aml_start = aml_start; - walk_state->parser_state.aml_end = - walk_state->parser_state.pkg_end = aml_start + aml_length; + walk_state->parser_state.aml_start = + walk_state->parser_state.aml_end = + walk_state->parser_state.pkg_end = aml_start; +/* Avoid undefined behavior: applying zero offset to null pointer */ +if (aml_length !=0 ) { + walk_state->parser_state.aml_end += aml_length; + walk_state->parser_state.pkg_end += aml_length; + }/* The next_op of the next_walk will be the beginning of the method */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 64/292 ACPICA: ACPICA: check null return of ACPI_ALLOCATE_ZEROED in acpi_db_display_objects
In reply to Greg Kroah-HartmanFrom: void0red <[email protected]>
[ Upstream commit ae5a0eccc85fc960834dd66e3befc2728284b86c ]
ACPICA commit 0d5f467d6a0ba852ea3aad68663cbcbd43300fd4
ACPI_ALLOCATE_ZEROED may fails, object_info might be null and will cause null pointer dereference later.
--- drivers/acpi/acpica/dbnames.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/acpi/acpica/dbnames.c +3 -0
@@ -652,6 +652,9 @@ acpi_status acpi_db_display_objects(char *obj_type_arg, char *display_count_arg) object_info =ACPI_ALLOCATE_ZEROED (sizeof (struct acpi_object_info )); +if (!object_info) +return (AE_NO_MEMORY ); +/* Walk the namespace from the root */ (void)acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 65/292 arm64: dts: qcom: sdm845-polaris: Drop inexistent properties
In reply to Greg Kroah-HartmanFrom: Konrad Dybcio <[email protected]>
[ Upstream commit fbc3a1df2866608ca43e7e6d602f66208a5afd88 ]
Drop the qcom,snoc-host-cap-skip-quirk that was never introduced to solve schema warnings.
--- arch/arm64/boot/dts/qcom/sdm845-xiaomi-polaris.dts | 2 -- 1 file changed, 2 deletions(-)
arch/arm64/boot/dts/qcom/sdm845-xiaomi-polaris.dts +0 -2
@@ -731,8 +731,6 @@ vdd-1.3-rfa-supply = <&vreg_l17a_1p3>; vdd-3.3-ch0-supply = <&vreg_l25a_3p3>; vdd-3.3-ch1-supply = <&vreg_l23a_3p3>; - - qcom,snoc-host-cap-skip-quirk; status = "okay"; };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 66/292 irqchip/gicv3: Workaround for NVIDIA erratum T241-FABRIC-4
In reply to Greg Kroah-HartmanFrom: Shanker Donthineni <[email protected]>
[ Upstream commit 35727af2b15d98a2dd2811d631d3a3886111312e ]
The T241 platform suffers from the T241-FABRIC-4 erratum which causes unexpected behavior in the GIC when multiple transactions are received simultaneously from different sources. This hardware issue impacts NVIDIA server platforms that use more than two T241 chips interconnected. Each chip has support for 320 {E}SPIs.
This issue occurs when multiple packets from different GICs are incorrectly interleaved at the target chip. The erratum text below specifies exactly what can cause multiple transfer packets susceptible to interleaving and GIC state corruption. GIC state corruption can lead to a range of problems, including kernel panics, and unexpected behavior.
Quoted 1 line
From the erratum text:
"In some cases, inter-socket AXI4 Stream packets with multiple transfers, may be interleaved by the fabric when presented to ARM Generic Interrupt Controller. GIC expects all transfers of a packet to be delivered without any interleaving.
The following GICv3 commands may result in multiple transfer packets over inter-socket AXI4 Stream interface:
- Register reads from GICD_I* and GICD_N*
- Register writes to 64-bit GICD registers other than GICD_IROUTERn*
- ITS command MOVALL
Multiple commands in GICv4+ utilize multiple transfer packets, including VMOVP, VMOVI, VMAPP, and 64-bit register accesses."
This issue impacts system configurations with more than 2 sockets, that require multi-transfer packets to be sent over inter-socket AXI4 Stream interface between GIC instances on different sockets. GICv4 cannot be supported. GICv3 SW model can only be supported with the workaround. Single and Dual socket configurations are not impacted by this issue and support GICv3 and GICv4."
Writing to the chip alias region of the GICD_In{E} registers except GICD_ICENABLERn has an equivalent effect as writing to the global distributor. The SPI interrupt deactivate path is not impacted by the erratum.
To fix this problem, implement a workaround that ensures read accesses to the GICD_In{E} registers are directed to the chip that owns the SPI, and disable GICv4.x features. To simplify code changes, the gic_configure_irq() function uses the same alias region for both read and write operations to GICD_ICFGR.
--- Documentation/arm64/silicon-errata.rst | 2 + drivers/firmware/smccc/smccc.c | 26 ++++++ drivers/firmware/smccc/soc_id.c | 28 ++---- drivers/irqchip/Kconfig | 1 + drivers/irqchip/irq-gic-v3.c | 115 ++++++++++++++++++++++--- include/linux/arm-smccc.h | 18 ++++ 6 files changed, 156 insertions(+), 34 deletions(-)
Documentation/arm64/silicon-errata.rst +2 -0
@@ -170,6 +170,8 @@ stable kernels. +----------------+-----------------+-----------------+-----------------------------+ | NVIDIA | Carmel Core | N/A | NVIDIA_CARMEL_CNP_ERRATUM | +----------------+-----------------+-----------------+-----------------------------+ +| NVIDIA | T241 GICv3/4.x | T241-FABRIC-4 | N/A | ++----------------+-----------------+-----------------+-----------------------------+ +----------------+-----------------+-----------------+-----------------------------+ | Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 | +----------------+-----------------+-----------------+-----------------------------+
drivers/firmware/smccc/smccc.c +26 -0
@@ -17,9 +17,13 @@ static enum arm_smccc_conduit smccc_conduit = SMCCC_CONDUIT_NONE;bool __ro_after_init smccc_trng_available = false;u64 __ro_after_init smccc_has_sve_hint = false; +s32 __ro_after_init smccc_soc_id_version =SMCCC_RET_NOT_SUPPORTED ; +s32 __ro_after_init smccc_soc_id_revision =SMCCC_RET_NOT_SUPPORTED ;void __init arm_smccc_version_init (u32 version,enum arm_smccc_conduit conduit) { +struct arm_smccc_res res; + smccc_version = version; smccc_conduit = conduit;
@@ -27,6 +31,18 @@ void __init arm_smccc_version_init(u32 version, enum arm_smccc_conduit conduit)if (IS_ENABLED (CONFIG_ARM64_SVE ) && smccc_version >=ARM_SMCCC_VERSION_1_3 ) smccc_has_sve_hint = true; + +if ((smccc_version >=ARM_SMCCC_VERSION_1_2 ) && + (smccc_conduit !=SMCCC_CONDUIT_NONE )) { +arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_FEATURES_FUNC_ID , +ARM_SMCCC_ARCH_SOC_ID , &res); +if ((s32 )res.a0 >=0 ) { +arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_SOC_ID ,0 , &res); + smccc_soc_id_version = (s32 )res.a0; +arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_SOC_ID ,1 , &res); + smccc_soc_id_revision = (s32 )res.a0; + } + } }enum arm_smccc_conduit arm_smccc_1_1_get_conduit (void )
@@ -44,6 +60,16 @@ u32 arm_smccc_get_version(void) }EXPORT_SYMBOL_GPL (arm_smccc_get_version); +s32 arm_smccc_get_soc_id_version (void ) +{ +return smccc_soc_id_version; +} + +s32 arm_smccc_get_soc_id_revision (void ) +{ +return smccc_soc_id_revision; +} +static int __init smccc_devices_init (void ) {struct platform_device *pdev;
drivers/firmware/smccc/soc_id.c +5 -23
@@ -42,41 +42,23 @@ static int __init smccc_soc_init(void)if (arm_smccc_get_version () <ARM_SMCCC_VERSION_1_2 )return 0 ; -if (arm_smccc_1_1_get_conduit () ==SMCCC_CONDUIT_NONE ) { -pr_err ("%s: invalid SMCCC conduit\n" , __func__); -return -EOPNOTSUPP ; - } - -arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_FEATURES_FUNC_ID , -ARM_SMCCC_ARCH_SOC_ID , &res); - -if ((int )res.a0 ==SMCCC_RET_NOT_SUPPORTED ) { + soc_id_version =arm_smccc_get_soc_id_version (); +if (soc_id_version ==SMCCC_RET_NOT_SUPPORTED ) {pr_info ("ARCH_SOC_ID not implemented, skipping ....\n" );return 0 ; } -if ((int )res.a0 <0 ) { -pr_info ("ARCH_FEATURES(ARCH_SOC_ID) returned error: %lx\n" , - res.a0); -return -EINVAL ; - } - -arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_SOC_ID ,0 , &res); -if ((int )res.a0 <0 ) { +if (soc_id_version <0 ) {pr_err ("ARCH_SOC_ID(0) returned error: %lx\n" , res.a0);return -EINVAL ; } - soc_id_version = res.a0; - -arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_SOC_ID ,1 , &res); -if ((int )res.a0 <0 ) { + soc_id_rev =arm_smccc_get_soc_id_revision (); +if (soc_id_rev <0 ) {pr_err ("ARCH_SOC_ID(1) returned error: %lx\n" , res.a0);return -EINVAL ; } - soc_id_rev = res.a0; - soc_dev_attr =kzalloc (sizeof (*soc_dev_attr),GFP_KERNEL );if (!soc_dev_attr)return -ENOMEM ;
drivers/irqchip/Kconfig +1 -0
@@ -35,6 +35,7 @@ config ARM_GIC_V3 select IRQ_DOMAIN_HIERARCHY select PARTITION_PERCPU select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP + select HAVE_ARM_SMCCC_DISCOVERY config ARM_GIC_V3_ITS bool
drivers/irqchip/irq-gic-v3.c +104 -11
205 lines not on this page · raw message
include/linux/arm-smccc.h +18 -0
@@ -226,6 +226,24 @@ void __init arm_smccc_version_init(u32 version, enum arm_smccc_conduit conduit);extern u64 smccc_has_sve_hint; +/** +* arm_smccc_get_soc_id_version() +* +* Returns the SOC ID version. +* +* When ARM_SMCCC_ARCH_SOC_ID is not present, returns SMCCC_RET_NOT_SUPPORTED. +*/ +s32 arm_smccc_get_soc_id_version (void ); + +/** +* arm_smccc_get_soc_id_revision() +* +* Returns the SOC ID revision. +* +* When ARM_SMCCC_ARCH_SOC_ID is not present, returns SMCCC_RET_NOT_SUPPORTED. +*/ +s32 arm_smccc_get_soc_id_revision (void ); +/** * struct arm_smccc_res - Result from SMC/HVC call * @a0-a3 result values from registers 0 to 3
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 67/292 ACPI: video: Remove desktops without backlight DMI quirks
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit abe4f5ae5efa6a63c7d5abfa07eb02bb56b4654e ]
After the recent backlight changes acpi_video# backlight devices are only registered when explicitly requested from the cmdline, by DMI quirk or by the GPU driver.
This means that we no longer get false-positive backlight control support advertised on desktop boards.
Remove the 3 DMI quirks for desktop boards where the false-positive issue was fixed through quirks before. Note many more desktop boards were affected but we never build a full quirk list for this.
--- drivers/acpi/video_detect.c | 35 ----------------------------------- 1 file changed, 35 deletions(-)
drivers/acpi/video_detect.c +0 -35
@@ -130,12 +130,6 @@ static int video_detect_force_native(const struct dmi_system_id *d)return 0 ; } -static int video_detect_force_none (const struct dmi_system_id *d) -{ - acpi_backlight_dmi = acpi_backlight_none; -return 0 ; -} -static const struct dmi_system_id video_detect_dmi_table[] = {/* * Models which should use the vendor backlight interface,
@@ -752,35 +746,6 @@ static const struct dmi_system_id video_detect_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 15 3535"), }, }, - -/* -* Desktops which falsely report a backlight and which our heuristics -* for this do not catch. -*/ - { - .callback = video_detect_force_none, - /* Dell OptiPlex 9020M */ - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), - DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 9020M"), - }, - }, - { - .callback = video_detect_force_none, - /* GIGABYTE GB-BXBT-2807 */ - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"), - DMI_MATCH(DMI_PRODUCT_NAME, "GB-BXBT-2807"), - }, - }, - { - .callback = video_detect_force_none, - /* MSI MS-7721 */ - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "MSI"), - DMI_MATCH(DMI_PRODUCT_NAME, "MS-7721"), - }, - }, { }, };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 68/292 drm/amd/display: Correct DML calculation to follow HW SPEC
In reply to Greg Kroah-HartmanFrom: Paul Hsieh <[email protected]>
[ Upstream commit 385c3e4c29e1d4ce8f68687a8c84621e4c0e0416 ]
[Why]
In 2560x1600@240p eDP panel, driver use lowest voltage level to play 1080p video cause underflow. According to HW SPEC, the senario should use high voltage level.
[How]
ChromaPre value is zero when bandwidth validation. Correct ChromaPre calculation.
--- drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c | 2 +- drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c | 2 +- .../gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c | 2 +- drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c +1 -1
@@ -4866,7 +4866,7 @@ void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l v->DETBufferSizeCThisState[k], &v->UrgentBurstFactorCursorPre[k], &v->UrgentBurstFactorLumaPre[k], - &v->UrgentBurstFactorChroma[k], + &v->UrgentBurstFactorChromaPre[k], &v->NoUrgentLatencyHidingPre[k]); }
drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c +1 -1
@@ -5189,7 +5189,7 @@ void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l v->DETBufferSizeCThisState[k], &v->UrgentBurstFactorCursorPre[k], &v->UrgentBurstFactorLumaPre[k], - &v->UrgentBurstFactorChroma[k], + &v->UrgentBurstFactorChromaPre[k], &v->NotUrgentLatencyHidingPre[k]); }
drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c +1 -1
@@ -5286,7 +5286,7 @@ void dml314_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_ v->DETBufferSizeCThisState[k], &v->UrgentBurstFactorCursorPre[k], &v->UrgentBurstFactorLumaPre[k], - &v->UrgentBurstFactorChroma[k], + &v->UrgentBurstFactorChromaPre[k], &v->NotUrgentLatencyHidingPre[k]); }
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c +1 -1
@@ -3333,7 +3333,7 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l/* Output */ &mode_lib->vba.UrgentBurstFactorCursorPre[k], &mode_lib->vba.UrgentBurstFactorLumaPre[k], - &mode_lib->vba.UrgentBurstFactorChroma[k], + &mode_lib->vba.UrgentBurstFactorChromaPre[k], &mode_lib->vba.NotUrgentLatencyHidingPre[k]); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 69/292 drm/amd: Fix an out of bounds error in BIOS parser
In reply to Greg Kroah-HartmanFrom: Mario Limonciello <[email protected]>
[ Upstream commit d116db180decec1b21bba31d2ff495ac4d8e1b83 ]
The array is hardcoded to 8 in atomfirmware.h, but firmware provides a bigger one sometimes. Deferencing the larger array causes an out of bounds error.
commit 4fc1ba4aa589 ("drm/amd/display: fix array index out of bound error in bios parser") fixed some of this, but there are two other cases not covered by it. Fix those as well.
--- drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +2 -5
@@ -516,11 +516,8 @@ static enum bp_result get_gpio_i2c_info( info->i2c_slave_address = record->i2c_slave_addr;/* TODO: check how to get register offset for en, Y, etc. */ - info->gpio_info.clk_a_register_index = -le16_to_cpu ( - header->gpio_pin[table_index].data_a_reg_index); - info->gpio_info.clk_a_shift = - header->gpio_pin[table_index].gpio_bitshift; + info->gpio_info.clk_a_register_index =le16_to_cpu (pin->data_a_reg_index); + info->gpio_info.clk_a_shift = pin->gpio_bitshift;return BP_RESULT_OK ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 70/292 drm/amdgpu: Fix sdma v4 sw fini error
In reply to Greg Kroah-HartmanFrom: lyndonli <[email protected]>
[ Upstream commit 5e08e9c742a00384e5abe74bd40cf4dc15cb3a2e ]
Fix sdma v4 sw fini error for sdma 4.2.2 to
solve the following general protection fault
[ +0.108196] general protection fault, probably for non-canonical address 0xd5e5a4ae79d24a32: 0000 [#1] PREEMPT SMP PTI
[ +0.000018] RIP: 0010:free_fw_priv+0xd/0x70 [ +0.000022] Call Trace: [ +0.000012] <TASK> [ +0.000011] release_firmware+0x55/0x80 [ +0.000021] amdgpu_ucode_release+0x11/0x20 [amdgpu] [ +0.000415] amdgpu_sdma_destroy_inst_ctx+0x4f/0x90 [amdgpu] [ +0.000360] sdma_v4_0_sw_fini+0xce/0x110 [amdgpu]
--- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +1 -1
@@ -1908,7 +1908,7 @@ static int sdma_v4_0_sw_fini(void *handle)amdgpu_ring_fini (&adev->sdma.instance[i].page); } -if (adev->ip_versions[SDMA0_HWIP ][0 ] ==IP_VERSION (4 ,2 ,0 ) || +if (adev->ip_versions[SDMA0_HWIP ][0 ] ==IP_VERSION (4 ,2 ,2 ) || adev->ip_versions[SDMA0_HWIP ][0 ] ==IP_VERSION (4 ,4 ,0 ))amdgpu_sdma_destroy_inst_ctx (adev, true);else
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 71/292 media: Prefer designated initializers over memset for subdev pad ops
In reply to Greg Kroah-HartmanFrom: Laurent Pinchart <[email protected]>
[ Upstream commit e3a69496a1cde364c74a600d7a370179b58aed29 ]
Structures passed to subdev pad operations are all zero-initialized, but not always with the same kind of code constructs. While most drivers used designated initializers, which zero all the fields that are not specified, when declaring variables, some use memset(). Those two methods lead to the same end result, and, depending on compiler optimizations, may even be completely equivalent, but they're not consistent.
Improve coding style consistency by using designated initializers instead of calling memset(). Where applicable, also move the variables to inner scopes of for loops to ensure correct initialization in all iterations.
--- drivers/media/platform/renesas/vsp1/vsp1_drm.c | 18 +++++++++--------- .../media/platform/renesas/vsp1/vsp1_entity.c | 11 +++++------ .../platform/samsung/exynos4-is/fimc-capture.c | 7 ++++--- drivers/media/platform/ti/am437x/am437x-vpfe.c | 15 ++++++++------- drivers/media/platform/ti/cal/cal-video.c | 8 ++++---- drivers/media/usb/dvb-usb/cxusb-analog.c | 14 +++++++------- drivers/staging/media/imx/imx-media-capture.c | 12 ++++++------ drivers/staging/media/imx/imx-media-utils.c | 8 ++++---- drivers/staging/media/omap4iss/iss_video.c | 6 +++--- 9 files changed, 50 insertions(+), 49 deletions(-)
drivers/media/platform/renesas/vsp1/vsp1_drm.c +9 -9
@@ -66,7 +66,9 @@ static int vsp1_du_insert_uif(struct vsp1_device *vsp1, struct vsp1_entity *prev, unsigned int prev_pad, struct vsp1_entity *next, unsigned int next_pad) { - struct v4l2_subdev_format format; + struct v4l2_subdev_format format = { + .which =V4L2_SUBDEV_FORMAT_ACTIVE , + };int ret;if (!uif) {
@@ -82,8 +84,6 @@ static int vsp1_du_insert_uif(struct vsp1_device *vsp1, prev->sink = uif; prev->sink_pad =UIF_PAD_SINK ; -memset (&format,0 ,sizeof (format)); - format.which =V4L2_SUBDEV_FORMAT_ACTIVE ; format.pad = prev_pad; ret =v4l2_subdev_call (&prev->subdev, pad, get_fmt,NULL , &format);
@@ -118,8 +118,12 @@ static int vsp1_du_pipeline_setup_rpf(struct vsp1_device *vsp1,struct vsp1_entity *uif, unsigned int brx_input) { - struct v4l2_subdev_selection sel; -struct v4l2_subdev_format format; + struct v4l2_subdev_selection sel = { + .which =V4L2_SUBDEV_FORMAT_ACTIVE , + }; +struct v4l2_subdev_format format = { + .which =V4L2_SUBDEV_FORMAT_ACTIVE , + };const struct v4l2_rect *crop;int ret;
@@ -129,8 +133,6 @@ static int vsp1_du_pipeline_setup_rpf(struct vsp1_device *vsp1,*/ crop = &vsp1->drm->inputs[rpf->entity.index].crop; -memset (&format,0 ,sizeof (format)); - format.which =V4L2_SUBDEV_FORMAT_ACTIVE ; format.pad =RWPF_PAD_SINK ; format.format.width = crop->width + crop->left; format.format.height = crop->height + crop->top;
@@ -147,8 +149,6 @@ static int vsp1_du_pipeline_setup_rpf(struct vsp1_device *vsp1, __func__, format.format.width, format.format.height, format.format.code, rpf->entity.index); -memset (&sel,0 ,sizeof (sel)); - sel.which =V4L2_SUBDEV_FORMAT_ACTIVE ; sel.pad =RWPF_PAD_SINK ; sel.target =V4L2_SEL_TGT_CROP ; sel.r = *crop;
drivers/media/platform/renesas/vsp1/vsp1_entity.c +5 -6
@@ -184,15 +184,14 @@ vsp1_entity_get_pad_selection(struct vsp1_entity *entity,int vsp1_entity_init_cfg (struct v4l2_subdev *subdev,struct v4l2_subdev_state *sd_state) { -struct v4l2_subdev_format format;unsigned int pad;for (pad =0 ; pad < subdev->entity.num_pads -1 ; ++pad) { -memset (&format,0 ,sizeof (format)); - - format.pad = pad; - format.which = sd_state ?V4L2_SUBDEV_FORMAT_TRY - :V4L2_SUBDEV_FORMAT_ACTIVE ; +struct v4l2_subdev_format format = { + .pad = pad, + .which = sd_state ?V4L2_SUBDEV_FORMAT_TRY + :V4L2_SUBDEV_FORMAT_ACTIVE , + };v4l2_subdev_call (subdev, pad, set_fmt, sd_state, &format); }
drivers/media/platform/samsung/exynos4-is/fimc-capture.c +4 -3
@@ -763,7 +763,10 @@ static int fimc_pipeline_try_format(struct fimc_ctx *ctx,struct fimc_dev *fimc = ctx->fimc_dev;struct fimc_pipeline *p =to_fimc_pipeline (fimc->vid_cap.ve.pipe);struct v4l2_subdev *sd = p->subdevs[IDX_SENSOR ]; -struct v4l2_subdev_format sfmt; +struct v4l2_subdev_format sfmt = { + .which = set ?V4L2_SUBDEV_FORMAT_ACTIVE + :V4L2_SUBDEV_FORMAT_TRY , + };struct v4l2_mbus_framefmt *mf = &sfmt.format;struct media_entity *me;struct fimc_fmt *ffmt;
@@ -774,9 +777,7 @@ static int fimc_pipeline_try_format(struct fimc_ctx *ctx,if (WARN_ON (!sd || !tfmt))return -EINVAL ; -memset (&sfmt,0 ,sizeof (sfmt)); sfmt.format = *tfmt; - sfmt.which = set ?V4L2_SUBDEV_FORMAT_ACTIVE :V4L2_SUBDEV_FORMAT_TRY ; me =fimc_pipeline_get_head (&sd->entity);
drivers/media/platform/ti/am437x/am437x-vpfe.c +8 -7
@@ -1499,7 +1499,9 @@ static int vpfe_enum_size(struct file *file, void *priv, struct v4l2_frmsizeenum *fsize) {struct vpfe_device *vpfe =video_drvdata (file); -struct v4l2_subdev_frame_size_enum fse; +struct v4l2_subdev_frame_size_enum fse = { + .which =V4L2_SUBDEV_FORMAT_ACTIVE , + };struct v4l2_subdev *sd = vpfe->current_subdev->sd;struct vpfe_fmt *fmt;int ret;
@@ -1514,11 +1516,9 @@ static int vpfe_enum_size(struct file *file, void *priv,memset (fsize->reserved,0x0 ,sizeof (fsize->reserved)); -memset (&fse,0x0 ,sizeof (fse)); fse.index = fsize->index; fse.pad =0 ; fse.code = fmt->code; - fse.which =V4L2_SUBDEV_FORMAT_ACTIVE ; ret =v4l2_subdev_call (sd, pad, enum_frame_size,NULL , &fse);if (ret)return ret;
@@ -2146,7 +2146,6 @@ vpfe_async_bound(struct v4l2_async_notifier *notifier, {struct vpfe_device *vpfe =container_of (notifier->v4l2_dev, struct vpfe_device, v4l2_dev); -struct v4l2_subdev_mbus_code_enum mbus_code;struct vpfe_subdev_info *sdinfo;struct vpfe_fmt *fmt;int ret =0 ;
@@ -2173,9 +2172,11 @@ vpfe_async_bound(struct v4l2_async_notifier *notifier, vpfe->num_active_fmt =0 ;for (j =0 , i =0 ; (ret != -EINVAL ); ++j) { -memset (&mbus_code,0 ,sizeof (mbus_code)); - mbus_code.index = j; - mbus_code.which =V4L2_SUBDEV_FORMAT_ACTIVE ; +struct v4l2_subdev_mbus_code_enum mbus_code = { + .index = j, + .which =V4L2_SUBDEV_FORMAT_ACTIVE , + }; + ret =v4l2_subdev_call (subdev, pad, enum_mbus_code,NULL , &mbus_code);if (ret)
drivers/media/platform/ti/cal/cal-video.c +4 -4
@@ -811,7 +811,6 @@ static const struct v4l2_file_operations cal_fops = {static int cal_ctx_v4l2_init_formats (struct cal_ctx *ctx) { -struct v4l2_subdev_mbus_code_enum mbus_code;struct v4l2_mbus_framefmt mbus_fmt;const struct cal_format_info *fmtinfo;unsigned int i, j, k;
@@ -826,10 +825,11 @@ static int cal_ctx_v4l2_init_formats(struct cal_ctx *ctx) ctx->num_active_fmt =0 ;for (j =0 , i =0 ; ; ++j) { +struct v4l2_subdev_mbus_code_enum mbus_code = { + .index = j, + .which =V4L2_SUBDEV_FORMAT_ACTIVE , + }; -memset (&mbus_code,0 ,sizeof (mbus_code)); - mbus_code.index = j; - mbus_code.which =V4L2_SUBDEV_FORMAT_ACTIVE ; ret =v4l2_subdev_call (ctx->phy->source, pad, enum_mbus_code,NULL , &mbus_code);if (ret == -EINVAL )
drivers/media/usb/dvb-usb/cxusb-analog.c +7 -7
@@ -1014,7 +1014,10 @@ static int cxusb_medion_try_s_fmt_vid_cap(struct file *file, {struct dvb_usb_device *dvbdev =video_drvdata (file);struct cxusb_medion_dev *cxdev = dvbdev->priv; -struct v4l2_subdev_format subfmt; +struct v4l2_subdev_format subfmt = { + .which = isset ?V4L2_SUBDEV_FORMAT_ACTIVE : +V4L2_SUBDEV_FORMAT_TRY , + };u32 field;int ret;
@@ -1024,9 +1027,6 @@ static int cxusb_medion_try_s_fmt_vid_cap(struct file *file, field =vb2_start_streaming_called (&cxdev->videoqueue) ? cxdev->field_order :cxusb_medion_field_order (cxdev); -memset (&subfmt,0 ,sizeof (subfmt)); - subfmt.which = isset ?V4L2_SUBDEV_FORMAT_ACTIVE : -V4L2_SUBDEV_FORMAT_TRY ; subfmt.format.width = f->fmt.pix.width & ~1 ; subfmt.format.height = f->fmt.pix.height & ~1 ; subfmt.format.code =MEDIA_BUS_FMT_FIXED ;
@@ -1464,7 +1464,9 @@ int cxusb_medion_analog_init(struct dvb_usb_device *dvbdev) .buf = tuner_analog_msg_data, .len = sizeof(tuner_analog_msg_data) }; -struct v4l2_subdev_format subfmt; +struct v4l2_subdev_format subfmt = { + .which =V4L2_SUBDEV_FORMAT_ACTIVE , + };int ret;/* switch tuner to analog mode so IF demod will become accessible */
@@ -1507,8 +1509,6 @@ int cxusb_medion_analog_init(struct dvb_usb_device *dvbdev)v4l2_subdev_call (cxdev->tuner, video, s_std, cxdev->norm);v4l2_subdev_call (cxdev->cx25840, video, s_std, cxdev->norm); -memset (&subfmt,0 ,sizeof (subfmt)); - subfmt.which =V4L2_SUBDEV_FORMAT_ACTIVE ; subfmt.format.width = cxdev->width; subfmt.format.height = cxdev->height; subfmt.format.code =MEDIA_BUS_FMT_FIXED ;
drivers/staging/media/imx/imx-media-capture.c +6 -6
@@ -501,14 +501,14 @@ static int capture_legacy_g_parm(struct file *file, void *fh, struct v4l2_streamparm *a) {struct capture_priv *priv =video_drvdata (file); -struct v4l2_subdev_frame_interval fi; +struct v4l2_subdev_frame_interval fi = { + .pad = priv->src_sd_pad, + };int ret;if (a->type !=V4L2_BUF_TYPE_VIDEO_CAPTURE )return -EINVAL ; -memset (&fi,0 ,sizeof (fi)); - fi.pad = priv->src_sd_pad; ret =v4l2_subdev_call (priv->src_sd, video, g_frame_interval, &fi);if (ret <0 )return ret;
@@ -523,14 +523,14 @@ static int capture_legacy_s_parm(struct file *file, void *fh, struct v4l2_streamparm *a) {struct capture_priv *priv =video_drvdata (file); -struct v4l2_subdev_frame_interval fi; +struct v4l2_subdev_frame_interval fi = { + .pad = priv->src_sd_pad, + };int ret;if (a->type !=V4L2_BUF_TYPE_VIDEO_CAPTURE )return -EINVAL ; -memset (&fi,0 ,sizeof (fi)); - fi.pad = priv->src_sd_pad; fi.interval = a->parm.capture.timeperframe; ret =v4l2_subdev_call (priv->src_sd, video, s_frame_interval, &fi);if (ret <0 )
drivers/staging/media/imx/imx-media-utils.c +4 -4
@@ -432,15 +432,15 @@ int imx_media_init_cfg(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state) {struct v4l2_mbus_framefmt *mf_try; -struct v4l2_subdev_format format;unsigned int pad;int ret;for (pad =0 ; pad < sd->entity.num_pads; pad++) { -memset (&format,0 ,sizeof (format)); +struct v4l2_subdev_format format = { + .pad = pad, + .which =V4L2_SUBDEV_FORMAT_ACTIVE , + }; - format.pad = pad; - format.which =V4L2_SUBDEV_FORMAT_ACTIVE ; ret =v4l2_subdev_call (sd, pad, get_fmt,NULL , &format);if (ret)continue ;
drivers/staging/media/omap4iss/iss_video.c +3 -3
@@ -244,7 +244,9 @@ static int __iss_video_get_format(struct iss_video *video, struct v4l2_mbus_framefmt *format) { - struct v4l2_subdev_format fmt; + struct v4l2_subdev_format fmt = { + .which =V4L2_SUBDEV_FORMAT_ACTIVE , + };struct v4l2_subdev *subdev;u32 pad;int ret;
@@ -253,9 +255,7 @@ __iss_video_get_format(struct iss_video *video,if (!subdev)return -EINVAL ; -memset (&fmt,0 ,sizeof (fmt)); fmt.pad = pad; - fmt.which =V4L2_SUBDEV_FORMAT_ACTIVE ;mutex_lock (&video->mutex); ret =v4l2_subdev_call (subdev, pad, get_fmt,NULL , &fmt);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 72/292 media: mediatek: vcodec: Fix potential array out-of-bounds in decoder queue_setup
In reply to Greg Kroah-HartmanFrom: Wei Chen <[email protected]>
[ Upstream commit 8fbcf730cb89c3647f3365226fe7014118fa93c7 ]
variable *nplanes is provided by user via system call argument. The possible value of q_data->fmt->num_planes is 1-3, while the value of *nplanes can be 1-8. The array access by index i can cause array out-of-bounds.
Fix this bug by checking *nplanes against the array size.
--- drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +7 -0
@@ -735,6 +735,13 @@ int vb2ops_vdec_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, }if (*nplanes) { +if (vq->type ==V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ) { +if (*nplanes != q_data->fmt->num_planes) +return -EINVAL ; + }else { +if (*nplanes !=1 ) +return -EINVAL ; + }for (i =0 ; i < *nplanes; i++) {if (sizes[i] < q_data->sizeimage[i])return -EINVAL ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 73/292 wifi: ath: Silence memcpy run-time false positive warning
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit bfcc8ba45eb87bfaaff900bbad2b87b204899d41 ]
The memcpy() in ath_key_config() was attempting to write across neighboring struct members in struct ath_keyval. Introduce a wrapping struct_group, kv_values, to be the addressable target of the memcpy without overflowing an individual member. Silences the false positive run-time warning:
memcpy: detected field-spanning write (size 32) of single field "hk.kv_val" at drivers/net/wireless/ath/key.c:506 (size 16)
--- drivers/net/wireless/ath/ath.h | 12 +++++++----- drivers/net/wireless/ath/key.c | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath.h +7 -5
@@ -96,11 +96,13 @@ struct ath_keyval {u8 kv_type;u8 kv_pad;u16 kv_len; -u8 kv_val[16 ];/* TK */ -u8 kv_mic[8 ];/* Michael MIC key */ -u8 kv_txmic[8 ];/* Michael MIC TX key (used only if the hardware -* supports both MIC keys in the same key cache entry; -* in that case, kv_mic is the RX key) */ +struct_group (kv_values, + u8 kv_val[16]; /* TK */ +u8 kv_mic[8 ];/* Michael MIC key */ +u8 kv_txmic[8 ];/* Michael MIC TX key (used only if the hardware +* supports both MIC keys in the same key cache entry; +* in that case, kv_mic is the RX key) */ + ); };enum ath_cipher {
drivers/net/wireless/ath/key.c +1 -1
@@ -503,7 +503,7 @@ int ath_key_config(struct ath_common *common, hk.kv_len = key->keylen;if (key->keylen) -memcpy (hk.kv_val, key->key, key->keylen); +memcpy (&hk.kv_values, key->key, key->keylen);if (!(key->flags &IEEE80211_KEY_FLAG_PAIRWISE )) {switch (vif->type) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 74/292 bpf: Annotate data races in bpf_local_storage
In reply to Greg Kroah-HartmanFrom: Kumar Kartikeya Dwivedi <[email protected]>
[ Upstream commit 0a09a2f933c73dc76ab0b72da6855f44342a8903 ]
There are a few cases where hlist_node is checked to be unhashed without holding the lock protecting its modification. In this case, one must use hlist_unhashed_lockless to avoid load tearing and KCSAN reports. Fix this by using lockless variant in places not protected by the lock.
Since this is not prompted by any actual KCSAN reports but only from code review, I have not included a fixes tag.
--- kernel/bpf/bpf_local_storage.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
kernel/bpf/bpf_local_storage.c +13 -3
@@ -51,11 +51,21 @@ owner_storage(struct bpf_local_storage_map *smap, void *owner)return map->ops->map_owner_storage_ptr (owner); } +static bool selem_linked_to_storage_lockless (const struct bpf_local_storage_elem *selem) +{ +return !hlist_unhashed_lockless (&selem->snode); +} +static bool selem_linked_to_storage (const struct bpf_local_storage_elem *selem) {return !hlist_unhashed (&selem->snode); } +static bool selem_linked_to_map_lockless (const struct bpf_local_storage_elem *selem) +{ +return !hlist_unhashed_lockless (&selem->map_node); +} +static bool selem_linked_to_map (const struct bpf_local_storage_elem *selem) {return !hlist_unhashed (&selem->map_node);
@@ -165,7 +175,7 @@ static void __bpf_selem_unlink_storage(struct bpf_local_storage_elem *selem,bool free_local_storage = false;unsigned long flags; -if (unlikely (!selem_linked_to_storage (selem))) +if (unlikely (!selem_linked_to_storage_lockless (selem)))/* selem has already been unlinked from sk */ return ;
@@ -199,7 +209,7 @@ void bpf_selem_unlink_map(struct bpf_local_storage_elem *selem)struct bpf_local_storage_map_bucket *b;unsigned long flags; -if (unlikely (!selem_linked_to_map (selem))) +if (unlikely (!selem_linked_to_map_lockless (selem)))/* selem has already be unlinked from smap */ return ;
@@ -410,7 +420,7 @@ bpf_local_storage_update(void *owner, struct bpf_local_storage_map *smap, err =check_flags (old_sdata, map_flags);if (err)return ERR_PTR (err); -if (old_sdata &&selem_linked_to_storage (SELEM (old_sdata))) { +if (old_sdata &&selem_linked_to_storage_lockless (SELEM (old_sdata))) {copy_map_value_locked (&smap->map, old_sdata->data, value, false);return old_sdata;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 75/292 wifi: brcmfmac: pcie: Provide a buffer of random bytes to the device
In reply to Greg Kroah-HartmanFrom: Hector Martin <[email protected]>
[ Upstream commit 91918ce88d9fef408bb12c46a27c73d79b604c20 ]
Newer Apple firmwares on chipsets without a hardware RNG require the host to provide a buffer of 256 random bytes to the device on initialization. This buffer is present immediately before NVRAM, suffixed by a footer containing a magic number and the buffer length.
This won't affect chips/firmwares that do not use this feature, so do it unconditionally for all Apple platforms (those with an Apple OTP).
--- .../broadcom/brcm80211/brcmfmac/pcie.c | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +32 -0
@@ -13,6 +13,7 @@#include <linux/bcma/bcma.h> #include <linux/sched.h> #include <linux/io.h> +#include <linux/random.h> #include <asm/unaligned.h> #include <soc.h>
@@ -1631,6 +1632,13 @@ brcmf_pcie_init_share_ram_info(struct brcmf_pciedev_info *devinfo,return 0 ; } +struct brcmf_random_seed_footer { +__le32 length; +__le32 magic; +}; + +#define BRCMF_RANDOM_SEED_MAGIC 0xfeedc0de +#define BRCMF_RANDOM_SEED_LENGTH 0x100 static int brcmf_pcie_download_fw_nvram(struct brcmf_pciedev_info *devinfo, const struct firmware *fw, void *nvram,
@@ -1667,6 +1675,30 @@ static int brcmf_pcie_download_fw_nvram(struct brcmf_pciedev_info *devinfo, nvram_len;memcpy_toio (devinfo->tcm + address, nvram, nvram_len);brcmf_fw_nvram_free (nvram); + +if (devinfo->otp.valid) { +size_t rand_len =BRCMF_RANDOM_SEED_LENGTH ; +struct brcmf_random_seed_footer footer = { + .length =cpu_to_le32 (rand_len), + .magic =cpu_to_le32 (BRCMF_RANDOM_SEED_MAGIC ), + }; +void *randbuf; + +/* Some Apple chips/firmwares expect a buffer of random +* data to be present before NVRAM +*/ +brcmf_dbg (PCIE ,"Download random seed\n" ); + + address -=sizeof (footer); +memcpy_toio (devinfo->tcm + address, &footer, +sizeof (footer)); + + address -= rand_len; + randbuf =kzalloc (rand_len,GFP_KERNEL ); +get_random_bytes (randbuf, rand_len); +memcpy_toio (devinfo->tcm + address, randbuf, rand_len); +kfree (randbuf); + } }else {brcmf_dbg (PCIE ,"No matching NVRAM file found %s\n" , devinfo->nvram_name);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 76/292 wifi: brcmfmac: cfg80211: Pass the PMK in binary instead of hex
In reply to Greg Kroah-HartmanFrom: Hector Martin <[email protected]>
[ Upstream commit 89b89e52153fda2733562776c7c9d9d3ebf8dd6d ]
Apparently the hex passphrase mechanism does not work on newer chips/firmware (e.g. BCM4387). It seems there was a simple way of passing it in binary all along, so use that and avoid the hexification.
OpenBSD has been doing it like this from the beginning, so this should work on all chips.
Also clear the structure before setting the PMK. This was leaking uninitialized stack contents to the device.
--- .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +7 -6
@@ -1351,13 +1351,14 @@ static int brcmf_set_pmk(struct brcmf_if *ifp, const u8 *pmk_data, u16 pmk_len) {struct brcmf_pub *drvr = ifp->drvr;struct brcmf_wsec_pmk_le pmk; -int i, err; +int err; + +memset (&pmk,0 ,sizeof (pmk)); -/* convert to firmware key format */ - pmk.key_len =cpu_to_le16 (pmk_len <<1 ); - pmk.flags =cpu_to_le16 (BRCMF_WSEC_PASSPHRASE ); -for (i =0 ; i < pmk_len; i++) -snprintf (&pmk.key[2 * i],3 ,"%02x" , pmk_data[i]); +/* pass pmk directly */ + pmk.key_len =cpu_to_le16 (pmk_len); + pmk.flags =cpu_to_le16 (0 ); +memcpy (pmk.key, pmk_data, pmk_len);/* store psk in firmware */ err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_WSEC_PMK,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 77/292 ext2: Check block size validity during mount
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit 62aeb94433fcec80241754b70d0d1836d5926b0a ]
Check that log of block size stored in the superblock has sensible value. Otherwise the shift computing the block size can overflow leading to undefined behavior.
--- fs/ext2/ext2.h | 1 + fs/ext2/super.c | 7 +++++++ 2 files changed, 8 insertions(+)
fs/ext2/ext2.h +1 -0
@@ -180,6 +180,7 @@ static inline struct ext2_sb_info *EXT2_SB(struct super_block *sb)#define EXT2_MIN_BLOCK_SIZE 1024#define EXT2_MAX_BLOCK_SIZE 4096#define EXT2_MIN_BLOCK_LOG_SIZE 10 +#define EXT2_MAX_BLOCK_LOG_SIZE 16#define EXT2_BLOCK_SIZE (s) ((s)->s_blocksize)#define EXT2_ADDR_PER_BLOCK (s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32))#define EXT2_BLOCK_SIZE_BITS (s) ((s)->s_blocksize_bits)
fs/ext2/super.c +7 -0
@@ -945,6 +945,13 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) goto failed_mount; } +if (le32_to_cpu (es->s_log_block_size) > + (EXT2_MAX_BLOCK_LOG_SIZE -BLOCK_SIZE_BITS )) { +ext2_msg (sb,KERN_ERR , +"Invalid log block size: %u" , +le32_to_cpu (es->s_log_block_size)); + goto failed_mount; + } blocksize =BLOCK_SIZE <<le32_to_cpu (sbi->s_es->s_log_block_size);if (test_opt (sb,DAX )) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 78/292 scsi: lpfc: Prevent lpfc_debugfs_lockstat_write() buffer overflow
In reply to Greg Kroah-HartmanFrom: Justin Tee <[email protected]>
[ Upstream commit c6087b82a9146826564a55c5ca0164cac40348f5 ]
A static code analysis tool flagged the possibility of buffer overflow when using copy_from_user() for a debugfs entry.
Currently, it is possible that copy_from_user() copies more bytes than what would fit in the mybuf char array. Add a min() restriction check between sizeof(mybuf) - 1 and nbytes passed from the userspace buffer to protect against buffer overflow.
--- drivers/scsi/lpfc/lpfc_debugfs.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_debugfs.c +5 -2
@@ -2157,10 +2157,13 @@ lpfc_debugfs_lockstat_write(struct file *file, const char __user *buf,char mybuf[64 ];char *pbuf;int i; +size_t bsize;memset (mybuf,0 ,sizeof (mybuf)); -if (copy_from_user (mybuf, buf, nbytes)) + bsize =min (nbytes, (sizeof (mybuf) -1 )); + +if (copy_from_user (mybuf, buf, bsize))return -EFAULT ; pbuf = &mybuf[0 ];
@@ -2181,7 +2184,7 @@ lpfc_debugfs_lockstat_write(struct file *file, const char __user *buf, qp->lock_conflict.wq_access = 0; } } -return nbytes; +return bsize; }#endif
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 79/292 scsi: lpfc: Correct used_rpi count when devloss tmo fires with no recovery
In reply to Greg Kroah-HartmanFrom: Justin Tee <[email protected]>
[ Upstream commit db651ec22524eb8f9c854fbb4d9acd5d7e5be9e4 ]
A fabric controller can sometimes send an RDP request right before a link down event. Because of this outstanding RDP request, the driver does not remove the last reference count on its ndlp causing a potential leak of RPI resources when devloss tmo fires.
In lpfc_cmpl_els_rsp(), modify the NPIV clause to always allow the lpfc_drop_node() routine to execute when not registered with SCSI transport.
This relaxes the contraint that an NPIV ndlp must be in a specific state in order to call lpfc_drop node. Logic is revised such that the lpfc_drop_node() routine is always called to ensure the last ndlp decrement occurs.
--- drivers/scsi/lpfc/lpfc_els.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +13 -11
@@ -5402,18 +5402,20 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,* these conditions and release the RPI. */ if (phba->sli_rev ==LPFC_SLI_REV4 && - (vport && vport->port_type ==LPFC_NPIV_PORT ) && - !(ndlp->fc4_xpt_flags &SCSI_XPT_REGD ) && - ndlp->nlp_flag &NLP_RELEASE_RPI ) { -if (ndlp->nlp_state !=NLP_STE_PLOGI_ISSUE && - ndlp->nlp_state !=NLP_STE_REG_LOGIN_ISSUE ) { -lpfc_sli4_free_rpi (phba, ndlp->nlp_rpi); -spin_lock_irq (&ndlp->lock); - ndlp->nlp_rpi =LPFC_RPI_ALLOC_ERROR ; - ndlp->nlp_flag &= ~NLP_RELEASE_RPI ; -spin_unlock_irq (&ndlp->lock); -lpfc_drop_node (vport, ndlp); + vport && vport->port_type ==LPFC_NPIV_PORT && + !(ndlp->fc4_xpt_flags &SCSI_XPT_REGD )) { +if (ndlp->nlp_flag &NLP_RELEASE_RPI ) { +if (ndlp->nlp_state !=NLP_STE_PLOGI_ISSUE && + ndlp->nlp_state !=NLP_STE_REG_LOGIN_ISSUE ) { +lpfc_sli4_free_rpi (phba, ndlp->nlp_rpi); +spin_lock_irq (&ndlp->lock); + ndlp->nlp_rpi =LPFC_RPI_ALLOC_ERROR ; + ndlp->nlp_flag &= ~NLP_RELEASE_RPI ; +spin_unlock_irq (&ndlp->lock); + } } + +lpfc_drop_node (vport, ndlp); }/* Release the originating I/O reference. */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 80/292 bnxt: avoid overflow in bnxt_get_nvram_directory()
In reply to Greg Kroah-HartmanFrom: Maxim Korotkov <[email protected]>
[ Upstream commit 7c6dddc239abe660598c49ec95ea0ed6399a4b2a ]
The value of an arithmetic expression is subject
of possible overflow due to a failure to cast operands to a larger data type before performing arithmetic. Used macro for multiplication instead operator for avoiding overflow.
Found by Security Code and Linux Verification
Center (linuxtesting.org) with SVACE.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +1 -1
@@ -2822,7 +2822,7 @@ static int bnxt_get_nvram_directory(struct net_device *dev, u32 len, u8 *data)if (rc)return rc; - buflen = dir_entries * entry_length; + buflen =mul_u32_u32 (dir_entries, entry_length); buf =hwrm_req_dma_slice (bp, req, buflen, &dma_handle);if (!buf) {hwrm_req_drop (bp, req);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 81/292 net: pasemi: Fix return type of pasemi_mac_start_tx()
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit c8384d4a51e7cb0e6587f3143f29099f202c5de1 ]
With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), indirect call targets are validated against the expected function pointer prototype to make sure the call target is valid to help mitigate ROP attacks. If they are not identical, there is a failure at run time, which manifests as either a kernel panic or thread getting killed. A warning in clang aims to catch these at compile time, which reveals:
drivers/net/ethernet/pasemi/pasemi_mac.c:1665:21: error: incompatible function pointer types initializing 'netdev_tx_t (*)(struct sk_buff *, struct net_device *)' (aka 'enum netdev_tx (*)(struct sk_buff *, struct net_device *)') with an expression of type 'int (struct sk_buff *, struct net_device *)' [-Werror,-Wincompatible-function-pointer-types-strict]
.ndo_start_xmit = pasemi_mac_start_tx,
^~~~~~~~~~~~~~~~~~~
1 error generated.
->ndo_start_xmit() in 'struct net_device_ops' expects a return type of 'netdev_tx_t', not 'int'. Adjust the return type of pasemi_mac_start_tx() to match the prototype's to resolve the warning. While PowerPC does not currently implement support for kCFI, it could in the future, which means this warning becomes a fatal CFI failure at run time.
--- drivers/net/ethernet/pasemi/pasemi_mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/pasemi/pasemi_mac.c +1 -1
@@ -1423,7 +1423,7 @@ static void pasemi_mac_queue_csdesc(const struct sk_buff *skb,write_dma_reg (PAS_DMA_TXCHAN_INCR (txring->chan.chno),2 ); } -static int pasemi_mac_start_tx (struct sk_buff *skb,struct net_device *dev) +static netdev_tx_t pasemi_mac_start_tx (struct sk_buff *skb,struct net_device *dev) {struct pasemi_mac *const mac =netdev_priv (dev);struct pasemi_mac_txring *const txring =tx_ring (mac);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 82/292 net: Catch invalid index in XPS mapping
In reply to Greg Kroah-HartmanFrom: Nick Child <[email protected]>
[ Upstream commit 5dd0dfd55baec0742ba8f5625a0dd064aca7db16 ]
When setting the XPS value of a TX queue, warn the user once if the index of the queue is greater than the number of allocated TX queues.
Previously, this scenario went uncaught. In the best case, it resulted in unnecessary allocations. In the worst case, it resulted in out-of-bounds memory references through calls to netdev_get_tx_queue( dev, index). Therefore, it is important to inform the user but not worth returning an error and risk downing the netdevice.
--- net/core/dev.c | 2 ++ 1 file changed, 2 insertions(+)
net/core/dev.c +2 -0
@@ -2549,6 +2549,8 @@ int __netif_set_xps_queue(struct net_device *dev, const unsigned long *mask,struct xps_map *map, *new_map;unsigned int nr_ids; +WARN_ON_ONCE (index >= dev->num_tx_queues); +if (dev->num_tc) {/* Do not allow XPS on subordinate device directly */ num_tc = dev->num_tc;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 83/292 netdev: Enforce index cap in netdev_get_tx_queue
In reply to Greg Kroah-HartmanFrom: Nick Child <[email protected]>
[ Upstream commit 1cc6571f562774f1d928dc8b3cff50829b86e970 ]
When requesting a TX queue at a given index, warn on out-of-bounds referencing if the index is greater than the allocated number of queues.
Specifically, since this function is used heavily in the networking stack use DEBUG_NET_WARN_ON_ONCE to avoid executing a new branch on every packet.
--- include/linux/netdevice.h | 1 + 1 file changed, 1 insertion(+)
include/linux/netdevice.h +1 -0
@@ -2428,6 +2428,7 @@ static inlinestruct netdev_queue *netdev_get_tx_queue (const struct net_device *dev,unsigned int index) { +DEBUG_NET_WARN_ON_ONCE (index >= dev->num_tx_queues);return &dev->_tx[index]; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 84/292 scsi: target: iscsit: Free cmds before session free
In reply to Greg Kroah-HartmanFrom: Dmitry Bogdanov <[email protected]>
[ Upstream commit d8990b5a4d065f38f35d69bcd627ec5a7f8330ca ]
Commands from recovery entries are freed after session has been closed. That leads to use-after-free at command free or NPE with such call trace:
Time2Retain timer expired for SID: 1, cleaning up iSCSI session.
BUG: kernel NULL pointer dereference, address: 0000000000000140 RIP: 0010:sbitmap_queue_clear+0x3a/0xa0 Call Trace: target_release_cmd_kref+0xd1/0x1f0 [target_core_mod] transport_generic_free_cmd+0xd1/0x180 [target_core_mod] iscsit_free_cmd+0x53/0xd0 [iscsi_target_mod] iscsit_free_connection_recovery_entries+0x29d/0x320 [iscsi_target_mod] iscsit_close_session+0x13a/0x140 [iscsi_target_mod] iscsit_check_post_dataout+0x440/0x440 [iscsi_target_mod] call_timer_fn+0x24/0x140
Move cleanup of recovery enrties to before session freeing.
--- drivers/target/iscsi/iscsi_target.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/target/iscsi/iscsi_target.c +3 -3
@@ -4531,6 +4531,9 @@ int iscsit_close_session(struct iscsit_session *sess, bool can_sleep)iscsit_stop_time2retain_timer (sess);spin_unlock_bh (&se_tpg->session_lock); +if (sess->sess_ops->ErrorRecoveryLevel ==2 ) +iscsit_free_connection_recovery_entries (sess); +/* * transport_deregister_session_configfs() will clear the * struct se_node_acl->nacl_sess pointer now as a iscsi_np process context
@@ -4554,9 +4557,6 @@ int iscsit_close_session(struct iscsit_session *sess, bool can_sleep)transport_deregister_session (sess->se_sess); -if (sess->sess_ops->ErrorRecoveryLevel ==2 ) -iscsit_free_connection_recovery_entries (sess); -iscsit_free_all_ooo_cmdsns (sess);spin_lock_bh (&se_tpg->session_lock);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 85/292 lib: cpu_rmap: Avoid use after free on rmap->obj array entries
In reply to Greg Kroah-HartmanFrom: Eli Cohen <[email protected]>
[ Upstream commit 4e0473f1060aa49621d40a113afde24818101d37 ]
When calling irq_set_affinity_notifier() with NULL at the notify argument, it will cause freeing of the glue pointer in the corresponding array entry but will leave the pointer in the array. A subsequent call to free_irq_cpu_rmap() will try to free this entry again leading to possible use after free.
Fix that by setting NULL to the array entry and checking that we have non-zero at the array entry when iterating over the array in free_irq_cpu_rmap().
The current code does not suffer from this since there are no cases where irq_set_affinity_notifier(irq, NULL) (note the NULL passed for the notify arg) is called, followed by a call to free_irq_cpu_rmap() so we don't hit and issue. Subsequent patches in this series excersize this flow, hence the required fix.
--- lib/cpu_rmap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
lib/cpu_rmap.c +4 -1
@@ -232,7 +232,8 @@ void free_irq_cpu_rmap(struct cpu_rmap *rmap)for (index =0 ; index < rmap->used; index++) { glue = rmap->obj[index]; -irq_set_affinity_notifier (glue->notify.irq,NULL ); +if (glue) +irq_set_affinity_notifier (glue->notify.irq,NULL ); }cpu_rmap_put (rmap);
@@ -268,6 +269,7 @@ static void irq_cpu_rmap_release(struct kref *ref) container_of(ref, struct irq_glue, notify.kref);cpu_rmap_put (glue->rmap); + glue->rmap->obj[glue->index] =NULL ;kfree (glue); }
@@ -297,6 +299,7 @@ int irq_cpu_rmap_add(struct cpu_rmap *rmap, int irq) rc =irq_set_affinity_notifier (irq, &glue->notify);if (rc) {cpu_rmap_put (glue->rmap); + rmap->obj[glue->index] =NULL ;kfree (glue); }return rc;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 86/292 scsi: message: mptlan: Fix use after free bug in mptlan_remove() due to race condition
In reply to Greg Kroah-HartmanFrom: Zheng Wang <[email protected]>
[ Upstream commit f486893288f3e9b171b836f43853a6426515d800 ]
mptlan_probe() calls mpt_register_lan_device() which initializes the &priv->post_buckets_task workqueue. A call to mpt_lan_wake_post_buckets_task() will subsequently start the work.
During driver unload in mptlan_remove() the following race may occur:
CPU0 CPU1
|mpt_lan_post_receive_buckets_work()
mptlan_remove() |
free_netdev() |
kfree(dev); |
|
| dev->mtu
| //useFix this by finishing the work prior to cleaning up in mptlan_remove().
[mkp: we really should remove mptlan instead of attempting to fix it]
--- drivers/message/fusion/mptlan.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/message/fusion/mptlan.c +2 -0
@@ -1433,7 +1433,9 @@ mptlan_remove(struct pci_dev *pdev) {MPT_ADAPTER *ioc =pci_get_drvdata (pdev);struct net_device *dev = ioc->netdev; +struct mpt_lan_priv *priv =netdev_priv (dev); +cancel_delayed_work_sync (&priv->post_buckets_task);if (dev !=NULL ) {unregister_netdev (dev);free_netdev (dev);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 87/292 gfs2: Fix inode height consistency check
In reply to Greg Kroah-HartmanFrom: Andreas Gruenbacher <[email protected]>
[ Upstream commit cfcdb5bad34f600aed7613c3c1a5e618111f77b7 ]
The maximum allowed height of an inode's metadata tree depends on the filesystem block size; it is lower for bigger-block filesystems. When reading in an inode, make sure that the height doesn't exceed the maximum allowed height.
Arrays like sd_heightsize are sized to be big enough for any filesystem block size; they will often be slightly bigger than what's needed for a specific filesystem.
--- fs/gfs2/glops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/gfs2/glops.c +2 -1
@@ -393,6 +393,7 @@ static int inode_go_demote_ok(const struct gfs2_glock *gl)static int gfs2_dinode_in (struct gfs2_inode *ip,const void *buf) { +struct gfs2_sbd *sdp =GFS2_SB (&ip->i_inode);const struct gfs2_dinode *str = buf;struct timespec64 atime;u16 height, depth;
@@ -439,7 +440,7 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)/* i_diskflags and i_eattr must be set before gfs2_set_inode_flags() */ gfs2_set_inode_flags (inode); height =be16_to_cpu (str->di_height); -if (unlikely (height >GFS2_MAX_META_HEIGHT )) +if (unlikely (height > sdp->sd_max_height)) goto corrupt; ip->i_height = (u8 )height;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 88/292 scsi: ufs: ufs-pci: Add support for Intel Lunar Lake
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
[ Upstream commit 0a07d3c7a1d205b47d9f3608ff4e9d1065d63b6d ]
Add PCI ID to support Intel Lunar Lake, same as MTL.
--- drivers/ufs/host/ufshcd-pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/ufs/host/ufshcd-pci.c +1 -0
@@ -607,6 +607,7 @@ static const struct pci_device_id ufshcd_pci_tbl[] = { { PCI_VDEVICE(INTEL, 0x51FF), (kernel_ulong_t)&ufs_intel_adl_hba_vops }, { PCI_VDEVICE(INTEL, 0x54FF), (kernel_ulong_t)&ufs_intel_adl_hba_vops }, { PCI_VDEVICE(INTEL, 0x7E47), (kernel_ulong_t)&ufs_intel_mtl_hba_vops }, + { PCI_VDEVICE(INTEL, 0xA847), (kernel_ulong_t)&ufs_intel_mtl_hba_vops }, { } /* terminate list */ };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 89/292 ext4: set goal start correctly in ext4_mb_normalize_request
In reply to Greg Kroah-HartmanFrom: Kemeng Shi <[email protected]>
[ Upstream commit b07ffe6927c75d99af534d685282ea188d9f71a6 ]
We need to set ac_g_ex to notify the goal start used in ext4_mb_find_by_goal. Set ac_g_ex instead of ac_f_ex in ext4_mb_normalize_request.
Besides we should assure goal start is in range [first_data_block, blocks_count) as ext4_mb_initialize_context does.
[ Added a check to make sure size is less than ar->pright; otherwise
we could end up passing an underflowed value of ar->pright - size to ext4_get_group_no_and_offset(), which will trigger a BUG_ON later on.
- TYT ]
--- fs/ext4/mballoc.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
fs/ext4/mballoc.c +10 -6
@@ -4018,6 +4018,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac, struct ext4_allocation_request *ar) {struct ext4_sb_info *sbi =EXT4_SB (ac->ac_sb); +struct ext4_super_block *es = sbi->s_es;int bsbits, max;ext4_lblk_t end;loff_t size, start_off;
@@ -4213,18 +4214,21 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac, ac->ac_g_ex.fe_len =EXT4_NUM_B2C (sbi, size);/* define goal start in order to merge */ -if (ar->pright && (ar->lright == (start + size))) { +if (ar->pright && (ar->lright == (start + size)) && + ar->pright >= size && + ar->pright - size >=le32_to_cpu (es->s_first_data_block)) {/* merge to the right */ ext4_get_group_no_and_offset (ac->ac_sb, ar->pright - size, - &ac->ac_f_ex.fe_group, - &ac->ac_f_ex.fe_start); + &ac->ac_g_ex.fe_group, + &ac->ac_g_ex.fe_start); ac->ac_flags |=EXT4_MB_HINT_TRY_GOAL ; } -if (ar->pleft && (ar->lleft +1 == start)) { +if (ar->pleft && (ar->lleft +1 == start) && + ar->pleft +1 <ext4_blocks_count (es)) {/* merge to the left */ ext4_get_group_no_and_offset (ac->ac_sb, ar->pleft +1 , - &ac->ac_f_ex.fe_group, - &ac->ac_f_ex.fe_start); + &ac->ac_g_ex.fe_group, + &ac->ac_g_ex.fe_start); ac->ac_flags |=EXT4_MB_HINT_TRY_GOAL ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 90/292 ext4: Fix best extent lstart adjustment logic in ext4_mb_new_inode_pa()
In reply to Greg Kroah-HartmanFrom: Ojaswin Mujoo <[email protected]>
[ Upstream commit 93cdf49f6eca5e23f6546b8f28457b2e6a6961d9 ]
When the length of best extent found is less than the length of goal extent we need to make sure that the best extent atleast covers the start of the original request. This is done by adjusting the ac_b_ex.fe_logical (logical start) of the extent.
While doing so, the current logic sometimes results in the best extent's logical range overflowing the goal extent. Since this best extent is later added to the inode preallocation list, we have a possibility of introducing overlapping preallocations. This is discussed in detail here [1].
As per Jan's suggestion, to fix this, replace the existing logic with the below logic for adjusting best extent as it keeps fragmentation in check while ensuring logical range of best extent doesn't overflow out of goal extent:
1. Check if best extent can be kept at end of goal range and still cover original start.
2. Else, check if best extent can be kept at start of goal range and still cover original start.
3. Else, keep the best extent at start of original request.
Also, add a few extra BUG_ONs that might help catch errors faster.
[1] https://lore.kernel.org/r/[email protected]
--- fs/ext4/mballoc.c | 49 ++++++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 18 deletions(-)
fs/ext4/mballoc.c +31 -18
@@ -4321,6 +4321,7 @@ static void ext4_mb_use_inode_pa(struct ext4_allocation_context *ac,BUG_ON (start < pa->pa_pstart);BUG_ON (end > pa->pa_pstart +EXT4_C2B (sbi, pa->pa_len));BUG_ON (pa->pa_free < len); +BUG_ON (ac->ac_b_ex.fe_len <=0 ); pa->pa_free -= len;mb_debug (ac->ac_sb,"use %llu/%d from inode pa %p\n" , start, len, pa);
@@ -4650,10 +4651,8 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac) pa = ac->ac_pa;if (ac->ac_b_ex.fe_len < ac->ac_g_ex.fe_len) { -int winl; -int wins; -int win; -int offs; +int new_bex_start; +int new_bex_end;/* we can't allocate as much as normalizer wants. * so, found space must get proper lstart
@@ -4661,26 +4660,40 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac)BUG_ON (ac->ac_g_ex.fe_logical > ac->ac_o_ex.fe_logical);BUG_ON (ac->ac_g_ex.fe_len < ac->ac_o_ex.fe_len); -/* we're limited by original request in that -* logical block must be covered any way -* winl is window we can move our chunk within */ - winl = ac->ac_o_ex.fe_logical - ac->ac_g_ex.fe_logical; +/* +* Use the below logic for adjusting best extent as it keeps +* fragmentation in check while ensuring logical range of best +* extent doesn't overflow out of goal extent: +* +* 1. Check if best ex can be kept at end of goal and still +* cover original start +* 2. Else, check if best ex can be kept at start of goal and +* still cover original start +* 3. Else, keep the best ex at start of original request. +*/ + new_bex_end = ac->ac_g_ex.fe_logical + +EXT4_C2B (sbi, ac->ac_g_ex.fe_len); + new_bex_start = new_bex_end -EXT4_C2B (sbi, ac->ac_b_ex.fe_len); +if (ac->ac_o_ex.fe_logical >= new_bex_start) + goto adjust_bex; -/* also, we should cover whole original request */ - wins =EXT4_C2B (sbi, ac->ac_b_ex.fe_len - ac->ac_o_ex.fe_len); + new_bex_start = ac->ac_g_ex.fe_logical; + new_bex_end = + new_bex_start +EXT4_C2B (sbi, ac->ac_b_ex.fe_len); +if (ac->ac_o_ex.fe_logical < new_bex_end) + goto adjust_bex; -/* the smallest one defines real window */ - win =min (winl, wins); + new_bex_start = ac->ac_o_ex.fe_logical; + new_bex_end = + new_bex_start +EXT4_C2B (sbi, ac->ac_b_ex.fe_len); - offs = ac->ac_o_ex.fe_logical % -EXT4_C2B (sbi, ac->ac_b_ex.fe_len); -if (offs && offs < win) - win = offs; +adjust_bex: + ac->ac_b_ex.fe_logical = new_bex_start; - ac->ac_b_ex.fe_logical = ac->ac_o_ex.fe_logical - -EXT4_NUM_B2C (sbi, win);BUG_ON (ac->ac_o_ex.fe_logical < ac->ac_b_ex.fe_logical);BUG_ON (ac->ac_o_ex.fe_len > ac->ac_b_ex.fe_len); +BUG_ON (new_bex_end > (ac->ac_g_ex.fe_logical + +EXT4_C2B (sbi, ac->ac_g_ex.fe_len))); }/* preallocation can change ac_b_ex, thus we store actually
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 91/292 crypto: jitter - permanent and intermittent health errors
In reply to Greg Kroah-HartmanFrom: Stephan Müller <[email protected]>
[ Upstream commit 3fde2fe99aa6dacd4151c87382b07ce7f30f0a52 ]
According to SP800-90B, two health failures are allowed: the intermittend and the permanent failure. So far, only the intermittent failure was implemented. The permanent failure was achieved by resetting the entire entropy source including its health test state and waiting for two or more back-to-back health errors.
This approach is appropriate for RCT, but not for APT as APT has a non-linear cutoff value. Thus, this patch implements 2 cutoff values for both RCT/APT. This implies that the health state is left untouched when an intermittent failure occurs. The noise source is reset and a new APT powerup-self test is performed. Yet, whith the unchanged health test state, the counting of failures continues until a permanent failure is reached.
Any non-failing raw entropy value causes the health tests to reset.
The intermittent error has an unchanged significance level of 2^-30. The permanent error has a significance level of 2^-60. Considering that this level also indicates a false-positive rate (see SP800-90B section 4.2) a false-positive must only be incurred with a low probability when considering a fleet of Linux kernels as a whole. Hitting the permanent error may cause a panic(), the following calculation applies: Assuming that a fleet of 10^9 Linux kernels run concurrently with this patch in FIPS mode and on each kernel 2 health tests are performed every minute for one year, the chances of a false positive is about 1:1000 based on the binomial distribution.
In addition, any power-up health test errors triggered with jent_entropy_init are treated as permanent errors.
A permanent failure causes the entire entropy source to permanently return an error. This implies that a caller can only remedy the situation by re-allocating a new instance of the Jitter RNG. In a subsequent patch, a transparent re-allocation will be provided which also changes the implied heuristic entropy assessment.
In addition, when the kernel is booted with fips=1, the Jitter RNG is defined to be part of a FIPS module. The permanent error of the Jitter RNG is translated as a FIPS module error. In this case, the entire FIPS module must cease operation. This is implemented in the kernel by invoking panic().
The patch also fixes an off-by-one in the RCT cutoff value which is now set to 30 instead of 31. This is because the counting of the values starts with 0.
--- crypto/jitterentropy-kcapi.c | 51 ++++++------- crypto/jitterentropy.c | 144 +++++++++++++---------------------- crypto/jitterentropy.h | 1 - 3 files changed, 76 insertions(+), 120 deletions(-)
crypto/jitterentropy-kcapi.c +24 -27
@@ -37,6 +37,7 @@* DAMAGE. */ +#include <linux/fips.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/slab.h>
@@ -59,11 +60,6 @@ void jent_zfree(void *ptr)kfree_sensitive (ptr); } -void jent_panic (char *s) -{ -panic ("%s" , s); -} -void jent_memcpy (void *dest,const void *src,unsigned int n) {memcpy (dest, src, n);
@@ -102,7 +98,6 @@ void jent_get_nstime(__u64 *out)struct jitterentropy {spinlock_t jent_lock;struct rand_data *entropy_collector; -unsigned int reset_cnt; };static int jent_kcapi_init (struct crypto_tfm *tfm)
@@ -138,32 +133,30 @@ static int jent_kcapi_random(struct crypto_rng *tfm,spin_lock (&rng->jent_lock); -/* Return a permanent error in case we had too many resets in a row. */ -if (rng->reset_cnt > (1 <<10 )) { - ret = -EFAULT ; - goto out; - } - ret =jent_read_entropy (rng->entropy_collector, rdata, dlen); -/* Reset RNG in case of health failures */ -if (ret <-1 ) { -pr_warn_ratelimited ("Reset Jitter RNG due to health test failure: %s failure\n" , - (ret ==-2 ) ?"Repetition Count Test" : -"Adaptive Proportion Test" ); - - rng->reset_cnt++; - +if (ret ==-3 ) { +/* Handle permanent health test error */ +/* +* If the kernel was booted with fips=1, it implies that +* the entire kernel acts as a FIPS 140 module. In this case +* an SP800-90B permanent health test error is treated as +* a FIPS module error. +*/ +if (fips_enabled) +panic ("Jitter RNG permanent health test failure\n" ); + +pr_err ("Jitter RNG permanent health test failure\n" ); + ret = -EFAULT ; + }else if (ret ==-2 ) { +/* Handle intermittent health test error */ +pr_warn_ratelimited ("Reset Jitter RNG due to intermittent health test failure\n" ); ret = -EAGAIN ; - }else { - rng->reset_cnt =0 ; - -/* Convert the Jitter RNG error into a usable error code */ -if (ret ==-1 ) - ret = -EINVAL ; + }else if (ret ==-1 ) { +/* Handle other errors */ + ret = -EINVAL ; } -out:spin_unlock (&rng->jent_lock);return ret;
@@ -197,6 +190,10 @@ static int __init jent_mod_init(void) ret =jent_entropy_init ();if (ret) { +/* Handle permanent health test error */ +if (fips_enabled) +panic ("jitterentropy: Initialization failed with host not compliant with requirements: %d\n" , ret); +pr_info ("jitterentropy: Initialization failed with host not compliant with requirements: %d\n" , ret);return -EFAULT ; }
crypto/jitterentropy.c +52 -92
209 lines not on this page · raw message
crypto/jitterentropy.h +0 -1
@@ -2,7 +2,6 @@extern void *jent_zalloc (unsigned int len);extern void jent_zfree (void *ptr); -extern void jent_panic (char *s);extern void jent_memcpy (void *dest,const void *src,unsigned int n);extern void jent_get_nstime (__u64 *out);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 92/292 f2fs: Fix system crash due to lack of free space in LFS
In reply to Greg Kroah-HartmanFrom: Yonggil Song <[email protected]>
[ Upstream commit d11cef14f8146f3babd286c2cc8ca09c166295e2 ]
When f2fs tries to checkpoint during foreground gc in LFS mode, system crash occurs due to lack of free space if the amount of dirty node and dentry pages generated by data migration exceeds free space. The reproduction sequence is as follows.
- 20GiB capacity block device (null_blk)
- format and mount with LFS mode
- create a file and write 20,000MiB
- 4k random write on full range of the file
RIP: 0010:new_curseg+0x48a/0x510 [f2fs] Code: 55 e7 f5 89 c0 48 0f af c3 48 8b 5d c0 48 c1 e8 20 83 c0 01 89 43 6c 48 83 c4 28 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc <0f> 0b f0 41 80 4f 48 04 45 85 f6 0f 84 ba fd ff ff e9 ef fe ff ff RSP: 0018:ffff977bc397b218 EFLAGS: 00010246 RAX: 00000000000027b9 RBX: 0000000000000000 RCX: 00000000000027c0 RDX: 0000000000000000 RSI: 00000000000027b9 RDI: ffff8c25ab4e74f8 RBP: ffff977bc397b268 R08: 00000000000027b9 R09: ffff8c29e4a34b40 R10: 0000000000000001 R11: ffff977bc397b0d8 R12: 0000000000000000 R13: ffff8c25b4dd81a0 R14: 0000000000000000 R15: ffff8c2f667f9000 FS: 0000000000000000(0000) GS:ffff8c344ec80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000c00055d000 CR3: 0000000e30810003 CR4: 00000000003706e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> allocate_segment_by_default+0x9c/0x110 [f2fs] f2fs_allocate_data_block+0x243/0xa30 [f2fs] ? __mod_lruvec_page_state+0xa0/0x150 do_write_page+0x80/0x160 [f2fs] f2fs_do_write_node_page+0x32/0x50 [f2fs] __write_node_page+0x339/0x730 [f2fs] f2fs_sync_node_pages+0x5a6/0x780 [f2fs] block_operations+0x257/0x340 [f2fs] f2fs_write_checkpoint+0x102/0x1050 [f2fs] f2fs_gc+0x27c/0x630 [f2fs] ? folio_mark_dirty+0x36/0x70 f2fs_balance_fs+0x16f/0x180 [f2fs]
This patch adds checking whether free sections are enough before checkpoint during gc.
--- fs/f2fs/gc.c | 10 ++++++++-- fs/f2fs/gc.h | 2 ++ fs/f2fs/segment.h | 39 ++++++++++++++++++++++++++++++--------- 3 files changed, 40 insertions(+), 11 deletions(-)
fs/f2fs/gc.c +8 -2
@@ -1811,6 +1811,7 @@ int f2fs_gc(struct f2fs_sb_info *sbi, struct f2fs_gc_control *gc_control) .iroot = RADIX_TREE_INIT(gc_list.iroot, GFP_NOFS), };unsigned int skipped_round =0 , round =0 ; +unsigned int upper_secs; trace_f2fs_gc_begin(sbi->sb, gc_type, gc_control->no_bg_gc, gc_control->nr_free_secs,
@@ -1896,8 +1897,13 @@ int f2fs_gc(struct f2fs_sb_info *sbi, struct f2fs_gc_control *gc_control) } } -/* Write checkpoint to reclaim prefree segments */ -if (free_sections (sbi) <NR_CURSEG_PERSIST_TYPE && +__get_secs_required (sbi,NULL , &upper_secs,NULL ); + +/* +* Write checkpoint to reclaim prefree segments. +* We need more three extra sections for writer's data/node/dentry. +*/ +if (free_sections (sbi) <= upper_secs +NR_GC_CHECKPOINT_SECS &&prefree_segments (sbi)) { ret =f2fs_write_checkpoint (sbi, &cpc);if (ret)
fs/f2fs/gc.h +2 -0
@@ -30,6 +30,8 @@/* Search max. number of dirty segments to select a victim segment */ #define DEF_MAX_VICTIM_SEARCH 4096/* covers 8GB */ +#define NR_GC_CHECKPOINT_SECS (3)/* data/node/dentry sections */ +struct f2fs_gc_kthread {struct task_struct *f2fs_gc_task;wait_queue_head_t gc_wait_queue_head;
fs/f2fs/segment.h +30 -9
@@ -608,8 +608,12 @@ static inline bool has_curseg_enough_space(struct f2fs_sb_info *sbi,return true; } -static inline bool has_not_enough_free_secs (struct f2fs_sb_info *sbi, -int freed,int needed) +/* +* calculate needed sections for dirty node/dentry +* and call has_curseg_enough_space +*/ +static inline void __get_secs_required (struct f2fs_sb_info *sbi, +unsigned int *lower_p,unsigned int *upper_p,bool *curseg_p) {unsigned int total_node_blocks =get_pages (sbi,F2FS_DIRTY_NODES ) + get_pages(sbi, F2FS_DIRTY_DENTS) +
@@ -619,20 +623,37 @@ static inline bool has_not_enough_free_secs(struct f2fs_sb_info *sbi,unsigned int dent_secs = total_dent_blocks /CAP_BLKS_PER_SEC (sbi);unsigned int node_blocks = total_node_blocks %CAP_BLKS_PER_SEC (sbi);unsigned int dent_blocks = total_dent_blocks %CAP_BLKS_PER_SEC (sbi); -unsigned int free, need_lower, need_upper; + +if (lower_p) + *lower_p = node_secs + dent_secs; +if (upper_p) + *upper_p = node_secs + dent_secs + + (node_blocks ?1 :0 ) + (dent_blocks ?1 :0 ); +if (curseg_p) + *curseg_p =has_curseg_enough_space (sbi, + node_blocks, dent_blocks); +} + +static inline bool has_not_enough_free_secs (struct f2fs_sb_info *sbi, +int freed,int needed) +{ +unsigned int free_secs, lower_secs, upper_secs; +bool curseg_space;if (unlikely (is_sbi_flag_set (sbi,SBI_POR_DOING )))return false; - free =free_sections (sbi) + freed; - need_lower = node_secs + dent_secs +reserved_sections (sbi) + needed; - need_upper = need_lower + (node_blocks ?1 :0 ) + (dent_blocks ?1 :0 ); +__get_secs_required (sbi, &lower_secs, &upper_secs, &curseg_space); + + free_secs =free_sections (sbi) + freed; + lower_secs += needed +reserved_sections (sbi); + upper_secs += needed +reserved_sections (sbi); -if (free > need_upper) +if (free_secs > upper_secs)return false; -else if (free <= need_lower) +else if (free_secs <= lower_secs)return true; -return !has_curseg_enough_space (sbi, node_blocks, dent_blocks); +return !curseg_space; }static inline bool f2fs_is_checkpoint_ready (struct f2fs_sb_info *sbi)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 93/292 f2fs: fix to drop all dirty pages during umount() if cp_error is set
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit c9b3649a934d131151111354bcbb638076f03a30 ]
xfstest generic/361 reports a bug as below:
f2fs_bug_on(sbi, sbi->fsync_node_num);
kernel BUG at fs/f2fs/super.c:1627!
RIP: 0010:f2fs_put_super+0x3a8/0x3b0 Call Trace: generic_shutdown_super+0x8c/0x1b0 kill_block_super+0x2b/0x60 kill_f2fs_super+0x87/0x110 deactivate_locked_super+0x39/0x80 deactivate_super+0x46/0x50 cleanup_mnt+0x109/0x170 __cleanup_mnt+0x16/0x20 task_work_run+0x65/0xa0 exit_to_user_mode_prepare+0x175/0x190 syscall_exit_to_user_mode+0x25/0x50 do_syscall_64+0x4c/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc
During umount(), if cp_error is set, f2fs_wait_on_all_pages() should not stop waiting all F2FS_WB_CP_DATA pages to be writebacked, otherwise, fsync_node_num can be non-zero after f2fs_wait_on_all_pages() causing this bug.
In this case, to avoid deadloop in f2fs_wait_on_all_pages(), it needs to drop all dirty pages rather than redirtying them.
--- fs/f2fs/checkpoint.c | 12 ++++++++++-- fs/f2fs/data.c | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-)
fs/f2fs/checkpoint.c +10 -2
@@ -322,8 +322,15 @@ static int __f2fs_write_meta_page(struct page *page,trace_f2fs_writepage (page,META ); -if (unlikely (f2fs_cp_error (sbi))) +if (unlikely (f2fs_cp_error (sbi))) { +if (is_sbi_flag_set (sbi,SBI_IS_CLOSE )) { +ClearPageUptodate (page); +dec_page_count (sbi,F2FS_DIRTY_META ); +unlock_page (page); +return 0 ; + } goto redirty_out; + }if (unlikely (is_sbi_flag_set (sbi,SBI_POR_DOING ))) goto redirty_out;if (wbc->for_reclaim && page->index <GET_SUM_BLOCK (sbi,0 ))
@@ -1301,7 +1308,8 @@ void f2fs_wait_on_all_pages(struct f2fs_sb_info *sbi, int type)if (!get_pages (sbi, type))break ; -if (unlikely (f2fs_cp_error (sbi))) +if (unlikely (f2fs_cp_error (sbi) && + !is_sbi_flag_set (sbi,SBI_IS_CLOSE )))break ;if (type ==F2FS_DIRTY_META )
fs/f2fs/data.c +2 -1
@@ -2788,7 +2788,8 @@ int f2fs_write_single_data_page(struct page *page, int *submitted,* don't drop any dirty dentry pages for keeping lastest * directory structure. */ -if (S_ISDIR (inode->i_mode)) +if (S_ISDIR (inode->i_mode) && + !is_sbi_flag_set (sbi,SBI_IS_CLOSE )) goto redirty_out; goto out; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 94/292 f2fs: fix to check readonly condition correctly
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit d78dfefcde9d311284434560d69c0478c55a657e ]
With below case, it can mount multi-device image w/ rw option, however one of secondary device is set as ro, later update will cause panic, so let's introduce f2fs_dev_is_readonly(), and check multi-devices rw status in f2fs_remount() w/ it in order to avoid such inconsistent mount status.
mkfs.f2fs -c /dev/zram1 /dev/zram0 -f
blockdev --setro /dev/zram1
mount -t f2fs dev/zram0 /mnt/f2fs
mount: /mnt/f2fs: WARNING: source write-protected, mounted read-only. mount -t f2fs -o remount,rw mnt/f2fs
dd if=/dev/zero of=/mnt/f2fs/file bs=1M count=8192
kernel BUG at fs/f2fs/inline.c:258!
RIP: 0010:f2fs_write_inline_data+0x23e/0x2d0 [f2fs] Call Trace: f2fs_write_single_data_page+0x26b/0x9f0 [f2fs] f2fs_write_cache_pages+0x389/0xa60 [f2fs] __f2fs_write_data_pages+0x26b/0x2d0 [f2fs] f2fs_write_data_pages+0x2e/0x40 [f2fs] do_writepages+0xd3/0x1b0 __writeback_single_inode+0x5b/0x420 writeback_sb_inodes+0x236/0x5a0 __writeback_inodes_wb+0x56/0xf0 wb_writeback+0x2a3/0x490 wb_do_writeback+0x2b2/0x330 wb_workfn+0x6a/0x260 process_one_work+0x270/0x5e0 worker_thread+0x52/0x3e0 kthread+0xf4/0x120 ret_from_fork+0x29/0x50
--- fs/f2fs/f2fs.h | 5 +++++ fs/f2fs/super.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-)
fs/f2fs/f2fs.h +5 -0
@@ -4435,6 +4435,11 @@ static inline bool f2fs_hw_is_readonly(struct f2fs_sb_info *sbi)return false; } +static inline bool f2fs_dev_is_readonly (struct f2fs_sb_info *sbi) +{ +return f2fs_sb_has_readonly (sbi) ||f2fs_hw_is_readonly (sbi); +} +static inline bool f2fs_lfs_mode (struct f2fs_sb_info *sbi) {return F2FS_OPTION (sbi).fs_mode ==FS_MODE_LFS ;
fs/f2fs/super.c +1 -1
@@ -2258,7 +2258,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)if (f2fs_readonly (sb) && (*flags &SB_RDONLY )) goto skip; -if (f2fs_sb_has_readonly (sbi) && !(*flags &SB_RDONLY )) { +if (f2fs_dev_is_readonly (sbi) && !(*flags &SB_RDONLY )) { err = -EROFS ; goto restore_opts; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 95/292 samples/bpf: Fix fout leak in hbms run_bpf_prog
In reply to Greg Kroah-HartmanFrom: Hao Zeng <[email protected]>
[ Upstream commit 23acb14af1914010dd0aae1bbb7fab28bf518b8e ]
Fix fout being fopen'ed but then not subsequently fclose'd. In the affected branch, fout is otherwise going out of scope.
--- samples/bpf/hbm.c | 1 + 1 file changed, 1 insertion(+)
samples/bpf/hbm.c +1 -0
@@ -315,6 +315,7 @@ static int run_bpf_prog(char *prog, int cg_id) fout =fopen (fname,"w" );fprintf (fout,"id:%d\n" , cg_id);fprintf (fout,"ERROR: Could not lookup queue_stats\n" ); +fclose (fout); }else if (stats_flag && qstats.lastPacketTime > qstats.firstPacketTime) { long long delta_us = (qstats.lastPacketTime -
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 96/292 bpf: Add preempt_count_{sub,add} into btf id deny list
In reply to Greg Kroah-HartmanFrom: Yafang <[email protected]>
[ Upstream commit c11bd046485d7bf1ca200db0e7d0bdc4bafdd395 ]
The recursion check in __bpf_prog_enter* and __bpf_prog_exit* leave preempt_count_{sub,add} unprotected. When attaching trampoline to them we get panic as follows,
[ 867.843050] BUG: TASK stack guard page was hit at 0000000009d325cf (stack is 0000000046a46a15..00000000537e7b28) [ 867.843064] stack guard page: 0000 [#1] PREEMPT SMP NOPTI [ 867.843067] CPU: 8 PID: 11009 Comm: trace Kdump: loaded Not tainted 6.2.0+ #4 [ 867.843100] Call Trace: [ 867.843101] <TASK> [ 867.843104] asm_exc_int3+0x3a/0x40 [ 867.843108] RIP: 0010:preempt_count_sub+0x1/0xa0 [ 867.843135] __bpf_prog_enter_recur+0x17/0x90 [ 867.843148] bpf_trampoline_6442468108_0+0x2e/0x1000 [ 867.843154] ? preempt_count_sub+0x1/0xa0 [ 867.843157] preempt_count_sub+0x5/0xa0 [ 867.843159] ? migrate_enable+0xac/0xf0 [ 867.843164] __bpf_prog_exit_recur+0x2d/0x40 [ 867.843168] bpf_trampoline_6442468108_0+0x55/0x1000 ... [ 867.843788] preempt_count_sub+0x5/0xa0 [ 867.843793] ? migrate_enable+0xac/0xf0 [ 867.843829] __bpf_prog_exit_recur+0x2d/0x40 [ 867.843837] BUG: IRQ stack guard page was hit at 0000000099bd8228 (stack is 00000000b23e2bc4..000000006d95af35) [ 867.843841] BUG: IRQ stack guard page was hit at 000000005ae07924 (stack is 00000000ffd69623..0000000014eb594c) [ 867.843843] BUG: IRQ stack guard page was hit at 00000000028320f0 (stack is 00000000034b6438..0000000078d1bcec) [ 867.843842] bpf_trampoline_6442468108_0+0x55/0x1000
...
That is because in __bpf_prog_exit_recur, the preempt_count_{sub,add} are called after prog->active is decreased.
Fixing this by adding these two functions into btf ids deny list.
--- kernel/bpf/verifier.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/bpf/verifier.c +4 -0
@@ -15133,6 +15133,10 @@ BTF_ID(func, migrate_enable)#if !definedCONFIG_PREEMPT_RCU && !definedCONFIG_TINY_RCU BTF_ID(func, rcu_read_unlock_strict)#endif +#if defined(CONFIG_DEBUG_PREEMPT ) || defined(CONFIG_TRACE_PREEMPT_TOGGLE ) +BTF_ID(func, preempt_count_add) +BTF_ID(func, preempt_count_sub) +#endif BTF_SET_END (btf_id_deny) static int check_attach_btf_id(struct bpf_verifier_env *env)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 97/292 md: fix soft lockup in status_resync
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit 6efddf1e32e2a264694766ca485a4f5e04ee82a7 ]
status_resync() will calculate 'curr_resync - recovery_active' to show user a progress bar like following:
[============>........] resync = 61.4%
'curr_resync' and 'recovery_active' is updated in md_do_sync(), and status_resync() can read them concurrently, hence it's possible that 'curr_resync - recovery_active' can overflow to a huge number. In this case status_resync() will be stuck in the loop to print a large amount of '=', which will end up soft lockup.
Fix the problem by setting 'resync' to MD_RESYNC_ACTIVE in this case, this way resync in progress will be reported to user.
--- drivers/md/md.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/md/md.c +9 -9
@@ -8028,16 +8028,16 @@ static int status_resync(struct seq_file *seq, struct mddev *mddev) }else if (resync > max_sectors) { resync = max_sectors; }else { - resync -=atomic_read (&mddev->recovery_active); -if (resync <MD_RESYNC_ACTIVE ) { -/* -* Resync has started, but the subtraction has -* yielded one of the special values. Force it -* to active to ensure the status reports an -* active resync. -*/ + res =atomic_read (&mddev->recovery_active); +/* +* Resync has started, but the subtraction has overflowed or +* yielded one of the special values. Force it to active to +* ensure the status reports an active resync. +*/ +if (resync < res || resync - res <MD_RESYNC_ACTIVE ) resync =MD_RESYNC_ACTIVE ; - } +else + resync -= res; }if (resync ==MD_RESYNC_NONE ) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 98/292 wifi: iwlwifi: pcie: fix possible NULL pointer dereference
In reply to Greg Kroah-HartmanFrom: Daniel Gabay <[email protected]>
[ Upstream commit b655b9a9f8467684cfa8906713d33b71ea8c8f54 ]
It is possible that iwl_pci_probe() will fail and free the trans, then afterwards iwl_pci_remove() will be called and crash by trying to access trans which is already freed, fix it.
iwlwifi 0000:01:00.0: Detected crf-id 0xa5a5a5a2, cnv-id 0xa5a5a5a2
wfpm id 0xa5a5a5a2 iwlwifi 0000:01:00.0: Can't find a correct rfid for crf id 0x5a2 ... BUG: kernel NULL pointer dereference, address: 0000000000000028 ... RIP: 0010:iwl_pci_remove+0x12/0x30 [iwlwifi] pci_device_remove+0x3e/0xb0 device_release_driver_internal+0x103/0x1f0 driver_detach+0x4c/0x90 bus_remove_driver+0x5c/0xd0 driver_unregister+0x31/0x50 pci_unregister_driver+0x40/0x90 iwl_pci_unregister_driver+0x15/0x20 [iwlwifi] __exit_compat+0x9/0x98 [iwlwifi] __x64_sys_delete_module+0x147/0x260
--- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/intel/iwlwifi/pcie/drv.c +3 -0
@@ -1685,6 +1685,9 @@ static void iwl_pci_remove(struct pci_dev *pdev) {struct iwl_trans *trans =pci_get_drvdata (pdev); +if (!trans) +return ; +iwl_drv_stop (trans->drv);iwl_trans_pcie_free (trans);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 99/292 wifi: iwlwifi: add a new PCI device ID for BZ device
In reply to Greg Kroah-HartmanFrom: Mukesh Sisodiya <[email protected]>
[ Upstream commit c30a2a64788b3d617a9c5d96adb76c68b0862e5f ]
Add support for a new PCI device ID 0x272b once registering with PCIe.
--- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/intel/iwlwifi/pcie/drv.c +1 -0
@@ -504,6 +504,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = { /* Bz devices */ {IWL_PCI_DEVICE(0x2727, PCI_ANY_ID, iwl_bz_trans_cfg)}, + {IWL_PCI_DEVICE(0x272b, PCI_ANY_ID, iwl_bz_trans_cfg)}, {IWL_PCI_DEVICE(0xA840, PCI_ANY_ID, iwl_bz_trans_cfg)}, {IWL_PCI_DEVICE(0x7740, PCI_ANY_ID, iwl_bz_trans_cfg)}, #endif /* CONFIG_IWLMVM */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 100/292 wifi: iwlwifi: pcie: Fix integer overflow in iwl_write_to_user_buf
In reply to Greg Kroah-HartmanFrom: Hyunwoo Kim <[email protected]>
[ Upstream commit 58d1b717879bfeabe09b35e41ad667c79933eb2e ]
An integer overflow occurs in the iwl_write_to_user_buf() function, which is called by the iwl_dbgfs_monitor_data_read() function.
static bool iwl_write_to_user_buf(char __user *user_buf, ssize_t count,
void *buf, ssize_t *size, ssize_t *bytes_copied)
{
int buf_size_left = count - *bytes_copied;
buf_size_left = buf_size_left - (buf_size_left % sizeof(u32));
if (*size > buf_size_left)
*size = buf_size_left;If the user passes a SIZE_MAX value to the "ssize_t count" parameter, the ssize_t count parameter is assigned to "int buf_size_left". Then compare "*size" with "buf_size_left" . Here, "buf_size_left" is a negative number, so "*size" is assigned "buf_size_left" and goes into the third argument of the copy_to_user function, causing a heap overflow.
This is not a security vulnerability because iwl_dbgfs_monitor_data_read() is a debugfs operation with 0400 privileges.
--- drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/pcie/trans.c +1 -1
@@ -2852,7 +2852,7 @@ static bool iwl_write_to_user_buf(char __user *user_buf, ssize_t count, void *buf, ssize_t *size, ssize_t *bytes_copied) { - int buf_size_left = count - *bytes_copied; + ssize_t buf_size_left = count - *bytes_copied; buf_size_left = buf_size_left - (buf_size_left %sizeof (u32));if (*size > buf_size_left)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 101/292 wifi: iwlwifi: mvm: fix ptk_pn memory leak
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit d066a530af8e1833c7ea2cef7784004700c85f79 ]
If adding a key to firmware fails we leak the allocated ptk_pn. This shouldn't happen in practice, but we should still fix it.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +5 -1
@@ -3445,7 +3445,7 @@ static int __iwl_mvm_mac_set_key(struct ieee80211_hw *hw,struct iwl_mvm_vif *mvmvif =iwl_mvm_vif_from_mac80211 (vif);struct iwl_mvm *mvm =IWL_MAC80211_GET_MVM (hw);struct iwl_mvm_sta *mvmsta =NULL ; -struct iwl_mvm_key_pn *ptk_pn; +struct iwl_mvm_key_pn *ptk_pn =NULL ;int keyidx = key->keyidx;int ret, i;u8 key_offset;
@@ -3590,6 +3590,10 @@ static int __iwl_mvm_mac_set_key(struct ieee80211_hw *hw,if (ret) {IWL_WARN (mvm,"set key failed\n" ); key->hw_key_idx =STA_KEY_IDX_INVALID ; +if (ptk_pn) { +RCU_INIT_POINTER (mvmsta->ptk_pn[keyidx],NULL ); +kfree (ptk_pn); + }/* * can't add key for RX, but we don't need it * in the device for TX so still return 0,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 102/292 block, bfq: Fix division by zero error on zero wsum
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit e53413f8deedf738a6782cc14cc00bd5852ccf18 ]
When the weighted sum is zero the calculation of limit causes a division by zero error. Fix this by continuing to the next level.
This was discovered by running as root:
stress-ng --ioprio 0
Fixes divison by error oops:
[ 521.450556] divide error: 0000 [#1] SMP NOPTI [ 521.450766] CPU: 2 PID: 2684464 Comm: stress-ng-iopri Not tainted 6.2.1-1280.native #1 [ 521.451117] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.1-0-g3208b098f51a-prebuilt.qemu.org 04/01/2014 [ 521.451627] RIP: 0010:bfqq_request_over_limit+0x207/0x400 [ 521.451875] Code: 01 48 8d 0c c8 74 0b 48 8b 82 98 00 00 00 48 8d 0c c8 8b 85 34 ff ff ff 48 89 ca 41 0f af 41 50 48 d1 ea 48 98 48 01 d0 31 d2 <48> f7 f1 41 39 41 48 89 85 34 ff ff ff 0f 8c 7b 01 00 00 49 8b 44 [ 521.452699] RSP: 0018:ffffb1af84eb3948 EFLAGS: 00010046 [ 521.452938] RAX: 000000000000003c RBX: 0000000000000000 RCX: 0000000000000000 [ 521.453262] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffb1af84eb3978 [ 521.453584] RBP: ffffb1af84eb3a30 R08: 0000000000000001 R09: ffff8f88ab8a4ba0 [ 521.453905] R10: 0000000000000000 R11: 0000000000000001 R12: ffff8f88ab8a4b18 [ 521.454224] R13: ffff8f8699093000 R14: 0000000000000001 R15: ffffb1af84eb3970 [ 521.454549] FS: 00005640b6b0b580(0000) GS:ffff8f88b3880000(0000) knlGS:0000000000000000 [ 521.454912] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 521.455170] CR2: 00007ffcbcae4e38 CR3: 00000002e46de001 CR4: 0000000000770ee0 [ 521.455491] PKRU: 55555554 [ 521.455619] Call Trace: [ 521.455736] <TASK> [ 521.455837] ? bfq_request_merge+0x3a/0xc0 [ 521.456027] ? elv_merge+0x115/0x140 [ 521.456191] bfq_limit_depth+0xc8/0x240 [ 521.456366] __blk_mq_alloc_requests+0x21a/0x2c0 [ 521.456577] blk_mq_submit_bio+0x23c/0x6c0 [ 521.456766] __submit_bio+0xb8/0x140 [ 521.457236] submit_bio_noacct_nocheck+0x212/0x300 [ 521.457748] submit_bio_noacct+0x1a6/0x580 [ 521.458220] submit_bio+0x43/0x80 [ 521.458660] ext4_io_submit+0x23/0x80 [ 521.459116] ext4_do_writepages+0x40a/0xd00 [ 521.459596] ext4_writepages+0x65/0x100 [ 521.460050] do_writepages+0xb7/0x1c0 [ 521.460492] __filemap_fdatawrite_range+0xa6/0x100 [ 521.460979] file_write_and_wait_range+0xbf/0x140 [ 521.461452] ext4_sync_file+0x105/0x340 [ 521.461882] __x64_sys_fsync+0x67/0x100 [ 521.462305] ? syscall_exit_to_user_mode+0x2c/0x1c0 [ 521.462768] do_syscall_64+0x3b/0xc0 [ 521.463165] entry_SYSCALL_64_after_hwframe+0x5a/0xc4 [ 521.463621] RIP: 0033:0x5640b6c56590 [ 521.464006] Code: 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 80 3d 71 70 0e 00 00 74 17 b8 4a 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 48 c3 0f 1f 80 00 00 00 00 48 83 ec 18 89 7c
--- block/bfq-iosched.c | 2 ++ 1 file changed, 2 insertions(+)
block/bfq-iosched.c +2 -0
@@ -637,6 +637,8 @@ static bool bfqq_request_over_limit(struct bfq_queue *bfqq, int limit) sched_data->service_tree[i].wsum; } } +if (!wsum) +continue ; limit =DIV_ROUND_CLOSEST (limit * entity->weight, wsum);if (entity->allocated >= limit) { bfq_log_bfqq(bfqq->bfqd, bfqq,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 103/292 wifi: ath11k: Ignore frags from uninitialized peer in dp.
In reply to Greg Kroah-HartmanFrom: Harshitha Prem <[email protected]>
[ Upstream commit a06bfb3c9f69f303692cdae87bc0899d2ae8b2a6 ]
When max virtual ap interfaces are configured in all the bands with ACS and hostapd restart is done every 60s, a crash is observed at random times.
In this certain scenario, a fragmented packet is received for self peer, for which rx_tid and rx_frags are not initialized in datapath. While handling this fragment, crash is observed as the rx_frag list is uninitialised and when we walk in ath11k_dp_rx_h_sort_frags, skb null leads to exception.
To address this, before processing received fragments we check dp_setup_done flag is set to ensure that peer has completed its dp peer setup for fragment queue, else ignore processing the fragments.
Call trace: ath11k_dp_process_rx_err+0x550/0x1084 [ath11k] ath11k_dp_service_srng+0x70/0x370 [ath11k] 0xffffffc009693a04 __napi_poll+0x30/0xa4 net_rx_action+0x118/0x270 __do_softirq+0x10c/0x244 irq_exit+0x64/0xb4 __handle_domain_irq+0x88/0xac gic_handle_irq+0x74/0xbc el1_irq+0xf0/0x1c0 arch_cpu_idle+0x10/0x18 do_idle+0x104/0x248 cpu_startup_entry+0x20/0x64 rest_init+0xd0/0xdc arch_call_rest_init+0xc/0x14 start_kernel+0x480/0x4b8 Code: f9400281 f94066a2 91405021 b94a0023 (f9406401)
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/dp.c | 4 +++- drivers/net/wireless/ath/ath11k/dp_rx.c | 8 ++++++++ drivers/net/wireless/ath/ath11k/peer.h | 1 + 3 files changed, 12 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/dp.c +3 -1
@@ -36,6 +36,7 @@ void ath11k_dp_peer_cleanup(struct ath11k *ar, int vdev_id, const u8 *addr) }ath11k_peer_rx_tid_cleanup (ar, peer); + peer->dp_setup_done = false;crypto_free_shash (peer->tfm_mmic);spin_unlock_bh (&ab->base_lock); }
@@ -72,7 +73,8 @@ int ath11k_dp_peer_setup(struct ath11k *ar, int vdev_id, const u8 *addr) ret =ath11k_peer_rx_frag_setup (ar, addr, vdev_id);if (ret) {ath11k_warn (ab,"failed to setup rx defrag context\n" ); -return ret; + tid--; + goto peer_clean; }/* TODO: Setup other peer specific resource used in data path */
drivers/net/wireless/ath/ath11k/dp_rx.c +8 -0
@@ -3138,6 +3138,7 @@ int ath11k_peer_rx_frag_setup(struct ath11k *ar, const u8 *peer_mac, int vdev_id } peer->tfm_mmic = tfm; + peer->dp_setup_done = true;spin_unlock_bh (&ab->base_lock);return 0 ;
@@ -3583,6 +3584,13 @@ static int ath11k_dp_rx_frag_h_mpdu(struct ath11k *ar, ret = -ENOENT ; goto out_unlock; } +if (!peer->dp_setup_done) { +ath11k_warn (ab,"The peer %pM [%d] has uninitialized datapath\n" , + peer->addr, peer_id); + ret = -ENOENT ; + goto out_unlock; + } + rx_tid = &peer->rx_tid[tid]; if ((!skb_queue_empty(&rx_tid->rx_frags) && seqno != rx_tid->cur_sn) ||
drivers/net/wireless/ath/ath11k/peer.h +1 -0
@@ -35,6 +35,7 @@ struct ath11k_peer {u16 sec_type;u16 sec_type_grp;bool is_authorized; +bool dp_setup_done; };void ath11k_peer_unmap_event (struct ath11k_base *ab,u16 peer_id);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 104/292 wifi: iwlwifi: fix iwl_mvm_max_amsdu_size() for MLO
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit b2bc600cced23762d4e97db8989b18772145604f ]
For MLO, we cannot use vif->bss_conf.chandef.chan->band, since that will lead to a NULL-ptr dereference as bss_conf isn't used. However, in case of real MLO, we also need to take both LMACs into account if they exist, since the station might be active on both LMACs at the same time.
--- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 37 +++++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/tx.c +34 -3
@@ -788,10 +788,11 @@ unsigned int iwl_mvm_max_amsdu_size(struct iwl_mvm *mvm, struct ieee80211_sta *sta, unsigned int tid) {struct iwl_mvm_sta *mvmsta =iwl_mvm_sta_from_mac80211 (sta); -enum nl80211_band band = mvmsta->vif->bss_conf.chandef.chan->band;u8 ac = tid_to_mac80211_ac[tid]; +enum nl80211_band band;unsigned int txf; -int lmac =iwl_mvm_get_lmac_id (mvm->fw, band); +unsigned int val; +int lmac;/* For HE redirect to trigger based fifos */ if (sta->deflink.he_cap.has_he && !WARN_ON (!iwl_mvm_has_new_tx_api (mvm)))
@@ -805,7 +806,37 @@ unsigned int iwl_mvm_max_amsdu_size(struct iwl_mvm *mvm,* We also want to have the start of the next packet inside the * fifo to be able to send bursts. */ - return min_t(unsigned int, mvmsta->max_amsdu_len, + val = mvmsta->max_amsdu_len; + +if (hweight16 (sta->valid_links) <=1 ) { +if (sta->valid_links) { +struct ieee80211_bss_conf *link_conf; +unsigned int link =ffs (sta->valid_links) -1 ; + +rcu_read_lock (); + link_conf =rcu_dereference (mvmsta->vif->link_conf[link]); +if (WARN_ON (!link_conf)) + band =NL80211_BAND_2GHZ ; +else + band = link_conf->chandef.chan->band; +rcu_read_unlock (); + }else { + band = mvmsta->vif->bss_conf.chandef.chan->band; + } + + lmac =iwl_mvm_get_lmac_id (mvm->fw, band); + }else if (fw_has_capa (&mvm->fw->ucode_capa, +IWL_UCODE_TLV_CAPA_CDB_SUPPORT )) { +/* for real MLO restrict to both LMACs if they exist */ + lmac =IWL_LMAC_5G_INDEX ; + val = min_t(unsigned int, val, + mvm->fwrt.smem_cfg.lmac[lmac].txfifo_size[txf] -256 ); + lmac =IWL_LMAC_24G_INDEX ; + }else { + lmac =IWL_LMAC_24G_INDEX ; + } + + return min_t(unsigned int, val, mvm->fwrt.smem_cfg.lmac[lmac].txfifo_size[txf] -256 ); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 105/292 null_blk: Always check queue mode setting from configfs
In reply to Greg Kroah-HartmanFrom: Chaitanya Kulkarni <[email protected]>
[ Upstream commit 63f8793ee60513a09f110ea460a6ff2c33811cdb ]
Make sure to check device queue mode in the null_validate_conf() and return error for NULL_Q_RQ as we don't allow legacy I/O path, without this patch we get OOPs when queue mode is set to 1 from configfs, following are repro steps :-
modprobe null_blk nr_devices=0
mkdir config/nullb/nullb0
echo 1 > config/nullb/nullb0/memory_backed
echo 4096 > config/nullb/nullb0/blocksize
echo 20480 > config/nullb/nullb0/size
echo 1 > config/nullb/nullb0/queue_mode
echo 1 > config/nullb/nullb0/power
Entering kdb (current=0xffff88810acdd080, pid 2372) on processor 42 Oops: (null) due to oops @ 0xffffffffc041c329
CPU: 42 PID: 2372 Comm: sh Tainted: G O N 6.3.0-rc5lblk+ #5 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 RIP: 0010:null_add_dev.part.0+0xd9/0x720 [null_blk] Code: 01 00 00 85 d2 0f 85 a1 03 00 00 48 83 bb 08 01 00 00 00 0f 85 f7 03 00 00 80 bb 62 01 00 00 00 48 8b 75 20 0f 85 6d 02 00 00 <48> 89 6e 60 48 8b 75 20 bf 06 00 00 00 e8 f5 37 2c c1 48 8b 75 20 RSP: 0018:ffffc900052cbde0 EFLAGS: 00010246 RAX: 0000000000000001 RBX: ffff88811084d800 RCX: 0000000000000001 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff888100042e00 RBP: ffff8881053d8200 R08: ffffc900052cbd68 R09: ffff888105db2000 R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000002 R13: ffff888104765200 R14: ffff88810eec1748 R15: ffff88810eec1740 FS: 00007fd445fd1740(0000) GS:ffff8897dfc80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000060 CR3: 0000000166a00000 CR4: 0000000000350ee0 DR0: ffffffff8437a488 DR1: ffffffff8437a489 DR2: ffffffff8437a48a DR3: ffffffff8437a48b DR6: 00000000ffff0ff0 DR7: 0000000000000400 Call Trace: <TASK> nullb_device_power_store+0xd1/0x120 [null_blk] configfs_write_iter+0xb4/0x120 vfs_write+0x2ba/0x3c0 ksys_write+0x5f/0xe0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc RIP: 0033:0x7fd4460c57a7 Code: 0d 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 48 89 54 24 18 48 89 74 24 RSP: 002b:00007ffd3792a4a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007fd4460c57a7 RDX: 0000000000000002 RSI: 000055b43c02e4c0 RDI: 0000000000000001 RBP: 000055b43c02e4c0 R08: 000000000000000a R09: 00007fd44615b4e0 R10: 00007fd44615b3e0 R11: 0000000000000246 R12: 0000000000000002 R13: 00007fd446198520 R14: 0000000000000002 R15: 00007fd446198700 </TASK>
--- drivers/block/null_blk/main.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/block/null_blk/main.c +5 -0
@@ -1945,6 +1945,11 @@ static int null_init_tag_set(struct nullb *nullb, struct blk_mq_tag_set *set)static int null_validate_conf (struct nullb_device *dev) { +if (dev->queue_mode ==NULL_Q_RQ ) { +pr_err ("legacy IO path is no longer available\n" ); +return -EINVAL ; + } + dev->blocksize =round_down (dev->blocksize,512 ); dev->blocksize = clamp_t(unsigned int, dev->blocksize, 512, 4096);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 106/292 wifi: iwlwifi: dvm: Fix memcpy: detected field-spanning write backtrace
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit ef16799640865f937719f0771c93be5dca18adc6 ]
A received TKIP key may be up to 32 bytes because it may contain MIC rx/tx keys too. These are not used by iwl and copying these over overflows the iwl_keyinfo.key field.
Add a check to not copy more data to iwl_keyinfo.key then will fit.
This fixes backtraces like this one:
memcpy: detected field-spanning write (size 32) of single field "sta_cmd.key.key" at drivers/net/wireless/intel/iwlwifi/dvm/sta.c:1103 (size 16)
WARNING: CPU: 1 PID: 946 at drivers/net/wireless/intel/iwlwifi/dvm/sta.c:1103 iwlagn_send_sta_key+0x375/0x390 [iwldvm] <snip> Hardware name: Dell Inc. Latitude E6430/0H3MT5, BIOS A21 05/08/2017 RIP: 0010:iwlagn_send_sta_key+0x375/0x390 [iwldvm] <snip> Call Trace: <TASK> iwl_set_dynamic_key+0x1f0/0x220 [iwldvm] iwlagn_mac_set_key+0x1e4/0x280 [iwldvm] drv_set_key+0xa4/0x1b0 [mac80211] ieee80211_key_enable_hw_accel+0xa8/0x2d0 [mac80211] ieee80211_key_replace+0x22d/0x8e0 [mac80211] <snip>
--- drivers/net/wireless/intel/iwlwifi/dvm/sta.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/dvm/sta.c +4 -1
@@ -1081,6 +1081,7 @@ static int iwlagn_send_sta_key(struct iwl_priv *priv, {__le16 key_flags;struct iwl_addsta_cmd sta_cmd; +size_t to_copy;int i;spin_lock_bh (&priv->sta_lock);
@@ -1100,7 +1101,9 @@ static int iwlagn_send_sta_key(struct iwl_priv *priv, sta_cmd.key.tkip_rx_tsc_byte2 = tkip_iv32;for (i =0 ; i <5 ; i++) sta_cmd.key.tkip_rx_ttak[i] =cpu_to_le16 (tkip_p1k[i]); -memcpy (sta_cmd.key.key, keyconf->key, keyconf->keylen); +/* keyconf may contain MIC rx/tx keys which iwl does not use */ + to_copy =min_t (size_t,sizeof (sta_cmd.key.key), keyconf->keylen); +memcpy (sta_cmd.key.key, keyconf->key, to_copy);break ;case WLAN_CIPHER_SUITE_WEP104 : key_flags |=STA_KEY_FLG_KEY_SIZE_MSK ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 107/292 wifi: ath11k: Fix SKB corruption in REO destination ring
In reply to Greg Kroah-HartmanFrom: Nagarajan Maran <[email protected]>
[ Upstream commit f9fff67d2d7ca6fa8066132003a3deef654c55b1 ]
While running traffics for a long time, randomly an RX descriptor filled with value "0" from REO destination ring is received. This descriptor which is invalid causes the wrong SKB (SKB stored in the IDR lookup with buffer id "0") to be fetched which in turn causes SKB memory corruption issue and the same leads to crash after some time.
Changed the start id for idr allocation to "1" and the buffer id "0" is reserved for error validation. Introduced Sanity check to validate the descriptor, before processing the SKB.
Crash Signature :
Unable to handle kernel paging request at virtual address 3f004900 PC points to "b15_dma_inv_range+0x30/0x50" LR points to "dma_cache_maint_page+0x8c/0x128".
The Backtrace obtained is as follows:
[<8031716c>] (b15_dma_inv_range) from [<80313a4c>] (dma_cache_maint_page+0x8c/0x128)
[<80313a4c>] (dma_cache_maint_page) from [<80313b90>] (__dma_page_dev_to_cpu+0x28/0xcc) [<80313b90>] (__dma_page_dev_to_cpu) from [<7fb5dd68>] (ath11k_dp_process_rx+0x1e8/0x4a4 [ath11k]) [<7fb5dd68>] (ath11k_dp_process_rx [ath11k]) from [<7fb53c20>] (ath11k_dp_service_srng+0xb0/0x2ac [ath11k]) [<7fb53c20>] (ath11k_dp_service_srng [ath11k]) from [<7f67bba4>] (ath11k_pci_ext_grp_napi_poll+0x1c/0x78 [ath11k_pci]) [<7f67bba4>] (ath11k_pci_ext_grp_napi_poll [ath11k_pci]) from [<807d5cf4>] (__napi_poll+0x28/0xb8) [<807d5cf4>] (__napi_poll) from [<807d5f28>] (net_rx_action+0xf0/0x280)
[<807d5f28>] (net_rx_action) from [<80302148>] (__do_softirq+0xd0/0x280)
[<80302148>] (__do_softirq) from [<80320408>] (irq_exit+0x74/0xd4)
[<80320408>] (irq_exit) from [<803638a4>] (__handle_domain_irq+0x90/0xb4)
[<803638a4>] (__handle_domain_irq) from [<805bedec>] (gic_handle_irq+0x58/0x90)
[<805bedec>] (gic_handle_irq) from [<80301a78>] (__irq_svc+0x58/0x8c)
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/dp_rx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath11k/dp_rx.c +6 -3
@@ -389,10 +389,10 @@ int ath11k_dp_rxbufs_replenish(struct ath11k_base *ab, int mac_id, goto fail_free_skb;spin_lock_bh (&rx_ring->idr_lock); - buf_id =idr_alloc (&rx_ring->bufs_idr, skb,0 , - rx_ring->bufs_max *3 ,GFP_ATOMIC ); + buf_id =idr_alloc (&rx_ring->bufs_idr, skb,1 , + (rx_ring->bufs_max *3 ) +1 ,GFP_ATOMIC );spin_unlock_bh (&rx_ring->idr_lock); -if (buf_id <0 ) +if (buf_id <=0 ) goto fail_dma_unmap; desc =ath11k_hal_srng_src_get_next_entry (ab, srng);
@@ -2665,6 +2665,9 @@ int ath11k_dp_process_rx(struct ath11k_base *ab, int ring_id, cookie); mac_id =FIELD_GET (DP_RXDMA_BUF_COOKIE_PDEV_ID , cookie); +if (unlikely (buf_id ==0 )) +continue ; + ar = ab->pdevs[mac_id].ar; rx_ring = &ar->dp.rx_refill_buf_ring;spin_lock_bh (&rx_ring->idr_lock);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 108/292 nbd: fix incomplete validation of ioctl arg
In reply to Greg Kroah-HartmanFrom: Zhong Jinghua <[email protected]>
[ Upstream commit 55793ea54d77719a071b1ccc05a05056e3b5e009 ]
We tested and found an alarm caused by nbd_ioctl arg without verification. The UBSAN warning calltrace like below:
UBSAN: Undefined behaviour in fs/buffer.c:1709:35 signed integer overflow: -9223372036854775808 - 1 cannot be represented in type 'long long int' CPU: 3 PID: 2523 Comm: syz-executor.0 Not tainted 4.19.90 #1 Hardware name: linux,dummy-virt (DT) Call trace: dump_backtrace+0x0/0x3f0 arch/arm64/kernel/time.c:78 show_stack+0x28/0x38 arch/arm64/kernel/traps.c:158 __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x170/0x1dc lib/dump_stack.c:118 ubsan_epilogue+0x18/0xb4 lib/ubsan.c:161 handle_overflow+0x188/0x1dc lib/ubsan.c:192 __ubsan_handle_sub_overflow+0x34/0x44 lib/ubsan.c:206 __block_write_full_page+0x94c/0xa20 fs/buffer.c:1709 block_write_full_page+0x1f0/0x280 fs/buffer.c:2934 blkdev_writepage+0x34/0x40 fs/block_dev.c:607 __writepage+0x68/0xe8 mm/page-writeback.c:2305 write_cache_pages+0x44c/0xc70 mm/page-writeback.c:2240 generic_writepages+0xdc/0x148 mm/page-writeback.c:2329 blkdev_writepages+0x2c/0x38 fs/block_dev.c:2114 do_writepages+0xd4/0x250 mm/page-writeback.c:2344
The reason for triggering this warning is __block_write_full_page() -> i_size_read(inode) - 1 overflow.inode->i_size is assigned in __nbd_ioctl() -> nbd_set_size() -> bytesize. We think it is necessary to limit the size of arg to prevent errors.
Moreover, __nbd_ioctl() -> nbd_add_socket(), arg will be cast to int. Assuming the value of arg is 0x80000000000000001) (on a 64-bit machine), it will become 1 after the coercion, which will return unexpected results.
Fix it by adding checks to prevent passing in too large numbers.
--- drivers/block/nbd.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/block/nbd.c +6 -0
@@ -325,6 +325,9 @@ static int nbd_set_size(struct nbd_device *nbd, loff_t bytesize,if (blk_validate_block_size (blksize))return -EINVAL ; +if (bytesize <0 ) +return -EINVAL ; + nbd->config->bytesize = bytesize; nbd->config->blksize_bits =__ffs (blksize);
@@ -1110,6 +1113,9 @@ static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg,struct nbd_sock *nsock;int err; +/* Arg will be cast to int, check it to avoid overflow */ +if (arg >INT_MAX ) +return -EINVAL ; sock =nbd_get_socket (nbd, arg, &err);if (!sock)return err;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 109/292 ipvs: Update width of source for ip_vs_sync_conn_options
In reply to Greg Kroah-HartmanFrom: Simon Horman <[email protected]>
[ Upstream commit e3478c68f6704638d08f437cbc552ca5970c151a ]
In ip_vs_sync_conn_v0() copy is made to struct ip_vs_sync_conn_options. That structure looks like this:
struct ip_vs_sync_conn_options {
struct ip_vs_seq in_seq;
struct ip_vs_seq out_seq;
};The source of the copy is the in_seq field of struct ip_vs_conn. Whose type is struct ip_vs_seq. Thus we can see that the source - is not as wide as the amount of data copied, which is the width of struct ip_vs_sync_conn_option.
The copy is safe because the next field in is another struct ip_vs_seq. Make use of struct_group() to annotate this.
Flagged by gcc-13 as:
In file included from ./include/linux/string.h:254,
from ./include/linux/bitmap.h:11,
from ./include/linux/cpumask.h:12,
from ./arch/x86/include/asm/paravirt.h:17,
from ./arch/x86/include/asm/cpuid.h:62,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/timex.h:5,
from ./include/linux/timex.h:67,
from ./include/linux/time32.h:13,
from ./include/linux/time.h:60,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:13,
from net/netfilter/ipvs/ip_vs_sync.c:38:
In function 'fortify_memcpy_chk',
inlined from 'ip_vs_sync_conn_v0' at net/netfilter/ipvs/ip_vs_sync.c:606:3:
./include/linux/fortify-string.h:529:25: error: call to '__read_overflow2_field' declared with attribute warning: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Werror=attribute-warning]
529 | __read_overflow2_field(q_size_field, size);
|Compile tested only.
--- include/net/ip_vs.h | 6 ++++-- net/netfilter/ipvs/ip_vs_sync.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-)
include/net/ip_vs.h +4 -2
@@ -549,8 +549,10 @@ struct ip_vs_conn {*/ struct ip_vs_app *app;/* bound ip_vs_app object */ void *app_data;/* Application private data */ -struct ip_vs_seq in_seq;/* incoming seq. struct */ -struct ip_vs_seq out_seq;/* outgoing seq. struct */ +struct_group (sync_conn_opt, + struct ip_vs_seq in_seq; /* incoming seq. struct */ +struct ip_vs_seq out_seq;/* outgoing seq. struct */ + );const struct ip_vs_pe *pe;char *pe_data;
net/netfilter/ipvs/ip_vs_sync.c +1 -1
@@ -603,7 +603,7 @@ static void ip_vs_sync_conn_v0(struct netns_ipvs *ipvs, struct ip_vs_conn *cp,if (cp->flags &IP_VS_CONN_F_SEQ_MASK ) {struct ip_vs_sync_conn_options *opt = (struct ip_vs_sync_conn_options *)&s[1 ]; -memcpy (opt, &cp->in_seq,sizeof (*opt)); +memcpy (opt, &cp->sync_conn_opt,sizeof (*opt)); } m->nr_conns++;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 110/292 Bluetooth: btusb: Add new PID/VID 04ca:3801 for MT7663
In reply to Greg Kroah-HartmanFrom: Meng Tang <[email protected]>
[ Upstream commit 13209415d0e88396d99d346b184864834d70d68a ]
This bluetooth device is found in a combo WLAN/BT card for a MediaTek 7663.
Tested on Acer Aspire A315-24P Notebook
The device information:
T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 2 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=04ca ProdID=3801 Rev= 1.00 S: Manufacturer=MediaTek Inc. S: Product=Wireless_Device S: SerialNumber=000000000 C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA A: FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=01 I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=125us E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms I: If#= 1 Alt= 6 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 63 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 63 Ivl=1ms
--- drivers/bluetooth/btusb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/bluetooth/btusb.c +3 -0
@@ -549,6 +549,9 @@ static const struct usb_device_id blacklist_table[] = { { USB_DEVICE(0x043e, 0x310c), .driver_info = BTUSB_MEDIATEK |BTUSB_WIDEBAND_SPEECH | BTUSB_VALID_LE_STATES }, + { USB_DEVICE(0x04ca, 0x3801), .driver_info = BTUSB_MEDIATEK | +BTUSB_WIDEBAND_SPEECH | + BTUSB_VALID_LE_STATES }, /* Additional MediaTek MT7668 Bluetooth devices */ { USB_DEVICE(0x043e, 0x3109), .driver_info = BTUSB_MEDIATEK |
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 111/292 Bluetooth: Add new quirk for broken local ext features page 2
In reply to Greg Kroah-HartmanFrom: Vasily Khoruzhick <[email protected]>
[ Upstream commit 8194f1ef5a815aea815a91daf2c721eab2674f1f ]
Some adapters (e.g. RTL8723CS) advertise that they have more than 2 pages for local ext features, but they don't support any features declared in these pages. RTL8723CS reports max_page = 2 and declares support for sync train and secure connection, but it responds with either garbage or with error in status on corresponding commands.
--- include/net/bluetooth/hci.h | 7 +++++++ net/bluetooth/hci_event.c | 9 +++++++-- 2 files changed, 14 insertions(+), 2 deletions(-)
include/net/bluetooth/hci.h +7 -0
@@ -294,6 +294,13 @@ enum {* during the hdev->setup vendor callback. */ HCI_QUIRK_BROKEN_MWS_TRANSPORT_CONFIG , + +/* When this quirk is set, max_page for local extended features +* is set to 1, even if controller reports higher number. Some +* controllers (e.g. RTL8723CS) report more pages, but they +* don't actually support features declared there. +*/ + HCI_QUIRK_BROKEN_LOCAL_EXT_FEATURES_PAGE_2, };/* HCI device flags */
net/bluetooth/hci_event.c +7 -2
@@ -881,8 +881,13 @@ static u8 hci_cc_read_local_ext_features(struct hci_dev *hdev, void *data,if (rp->status)return rp->status; -if (hdev->max_page < rp->max_page) - hdev->max_page = rp->max_page; +if (hdev->max_page < rp->max_page) { +if (test_bit (HCI_QUIRK_BROKEN_LOCAL_EXT_FEATURES_PAGE_2 , + &hdev->quirks)) +bt_dev_warn (hdev,"broken local ext features page 2" ); +else + hdev->max_page = rp->max_page; + }if (rp->page <HCI_MAX_PAGES )memcpy (hdev->features[rp->page], rp->features,8 );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 112/292 Bluetooth: btrtl: add support for the RTL8723CS
In reply to Greg Kroah-HartmanFrom: Vasily Khoruzhick <[email protected]>
[ Upstream commit c0123cb6c4c7fc2a42ead6cd7d3e82b8e1c25c6f ]
The Realtek RTL8723CS is a SDIO WiFi chip. It also contains a Bluetooth module which is connected via UART to the host.
It shares lmp subversion with 8703B, so Realtek's userspace initialization tool (rtk_hciattach) differentiates varieties of RTL8723CS (CG, VF, XX) with RTL8703B using vendor's command to read chip type.
Also this chip declares support for some features it doesn't support so add a quirk to indicate that these features are broken.
--- drivers/bluetooth/btrtl.c | 120 +++++++++++++++++++++++++++++++++++-- drivers/bluetooth/btrtl.h | 5 ++ drivers/bluetooth/hci_h5.c | 4 ++ 3 files changed, 125 insertions(+), 4 deletions(-)
drivers/bluetooth/btrtl.c +116 -4
@@ -17,7 +17,11 @@#define VERSION "0.1" +#define RTL_CHIP_8723CS_CG 3 +#define RTL_CHIP_8723CS_VF 4 +#define RTL_CHIP_8723CS_XX 5#define RTL_EPATCH_SIGNATURE "Realtech" +#define RTL_ROM_LMP_8703B 0x8703#define RTL_ROM_LMP_8723A 0x1200#define RTL_ROM_LMP_8723B 0x8723#define RTL_ROM_LMP_8821A 0x8821
@@ -30,6 +34,7 @@#define IC_MATCH_FL_HCIREV (1 << 1)#define IC_MATCH_FL_HCIVER (1 << 2)#define IC_MATCH_FL_HCIBUS (1 << 3) +#define IC_MATCH_FL_CHIP_TYPE (1 << 4)#define IC_INFO (lmps, hcir, hciv, bus) \ .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_HCIREV | \ IC_MATCH_FL_HCIVER | IC_MATCH_FL_HCIBUS, \
@@ -59,6 +64,7 @@ struct id_table {__u16 hci_rev;__u8 hci_ver;__u8 hci_bus; +__u8 chip_type;bool config_needed;bool has_rom_version;bool has_msft_ext;
@@ -99,6 +105,39 @@ static const struct id_table ic_id_table[] = { .fw_name = "rtl_bt/rtl8723b_fw.bin", .cfg_name = "rtl_bt/rtl8723b_config" }, +/* 8723CS-CG */ + { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE | + IC_MATCH_FL_HCIBUS, + .lmp_subver = RTL_ROM_LMP_8703B, + .chip_type = RTL_CHIP_8723CS_CG, + .hci_bus = HCI_UART, + .config_needed = true, + .has_rom_version = true, + .fw_name = "rtl_bt/rtl8723cs_cg_fw.bin", + .cfg_name = "rtl_bt/rtl8723cs_cg_config" }, + + /* 8723CS-VF */ + { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE | + IC_MATCH_FL_HCIBUS, + .lmp_subver = RTL_ROM_LMP_8703B, + .chip_type = RTL_CHIP_8723CS_VF, + .hci_bus = HCI_UART, + .config_needed = true, + .has_rom_version = true, + .fw_name = "rtl_bt/rtl8723cs_vf_fw.bin", + .cfg_name = "rtl_bt/rtl8723cs_vf_config" }, + + /* 8723CS-XX */ + { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE | + IC_MATCH_FL_HCIBUS, + .lmp_subver = RTL_ROM_LMP_8703B, + .chip_type = RTL_CHIP_8723CS_XX, + .hci_bus = HCI_UART, + .config_needed = true, + .has_rom_version = true, + .fw_name = "rtl_bt/rtl8723cs_xx_fw.bin", + .cfg_name = "rtl_bt/rtl8723cs_xx_config" }, + /* 8723D */ { IC_INFO(RTL_ROM_LMP_8723B, 0xd, 0x8, HCI_USB), .config_needed = true,
@@ -208,7 +247,8 @@ static const struct id_table ic_id_table[] = { };static const struct id_table *btrtl_match_ic (u16 lmp_subver,u16 hci_rev, -u8 hci_ver,u8 hci_bus) +u8 hci_ver,u8 hci_bus, +u8 chip_type) {int i;
@@ -225,6 +265,9 @@ static const struct id_table *btrtl_match_ic(u16 lmp_subver, u16 hci_rev,if ((ic_id_table[i].match_flags &IC_MATCH_FL_HCIBUS ) && (ic_id_table[i].hci_bus != hci_bus))continue ; +if ((ic_id_table[i].match_flags &IC_MATCH_FL_CHIP_TYPE ) && + (ic_id_table[i].chip_type != chip_type)) +continue ;break ; }
@@ -307,6 +350,7 @@ static int rtlbt_parse_firmware(struct hci_dev *hdev, { RTL_ROM_LMP_8723B, 1 }, { RTL_ROM_LMP_8821A, 2 }, { RTL_ROM_LMP_8761A, 3 }, + { RTL_ROM_LMP_8703B, 7 }, { RTL_ROM_LMP_8822B, 8 }, { RTL_ROM_LMP_8723B, 9 }, /* 8723D */ { RTL_ROM_LMP_8821A, 10 }, /* 8821C */
@@ -587,6 +631,48 @@ static int btrtl_setup_rtl8723b(struct hci_dev *hdev,return ret; } +static bool rtl_has_chip_type (u16 lmp_subver) +{ +switch (lmp_subver) { +case RTL_ROM_LMP_8703B : +return true; +default : +break ; + } + +return false; +} + +static int rtl_read_chip_type (struct hci_dev *hdev,u8 *type) +{ +struct rtl_chip_type_evt *chip_type; +struct sk_buff *skb; +const unsigned char cmd_buf[] = {0x00 ,0x94 ,0xa0 ,0x00 ,0xb0 }; + +/* Read RTL chip type command */ + skb =__hci_cmd_sync (hdev,0xfc61 ,5 , cmd_buf,HCI_INIT_TIMEOUT ); +if (IS_ERR (skb)) { +rtl_dev_err (hdev,"Read chip type failed (%ld)" , +PTR_ERR (skb)); +return PTR_ERR (skb); + } + + chip_type =skb_pull_data (skb,sizeof (*chip_type)); +if (!chip_type) { +rtl_dev_err (hdev,"RTL chip type event length mismatch" ); +kfree_skb (skb); +return -EIO ; + } + +rtl_dev_info (hdev,"chip_type status=%x type=%x" , + chip_type->status, chip_type->type); + + *type = chip_type->type &0x0f ; + +kfree_skb (skb); +return 0 ; +} +void btrtl_free (struct btrtl_device_info *btrtl_dev) {kvfree (btrtl_dev->fw_data);
@@ -603,7 +689,7 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,struct hci_rp_read_local_version *resp;char cfg_name[40 ];u16 hci_rev, lmp_subver; -u8 hci_ver; +u8 hci_ver, chip_type =0 ;int ret;u16 opcode;u8 cmd[2 ];
@@ -629,8 +715,14 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev, hci_rev =le16_to_cpu (resp->hci_rev); lmp_subver =le16_to_cpu (resp->lmp_subver); +if (rtl_has_chip_type (lmp_subver)) { + ret =rtl_read_chip_type (hdev, &chip_type); +if (ret) + goto err_free; + } + btrtl_dev->ic_info =btrtl_match_ic (lmp_subver, hci_rev, hci_ver, - hdev->bus); + hdev->bus, chip_type);if (!btrtl_dev->ic_info) btrtl_dev->drop_fw = true;
@@ -673,7 +765,7 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev, lmp_subver =le16_to_cpu (resp->lmp_subver); btrtl_dev->ic_info =btrtl_match_ic (lmp_subver, hci_rev, hci_ver, - hdev->bus); + hdev->bus, chip_type); } out_free:kfree_skb (skb);
@@ -755,6 +847,7 @@ int btrtl_download_firmware(struct hci_dev *hdev,case RTL_ROM_LMP_8761A :case RTL_ROM_LMP_8822B :case RTL_ROM_LMP_8852A : +case RTL_ROM_LMP_8703B :return btrtl_setup_rtl8723b (hdev, btrtl_dev);default :rtl_dev_info (hdev,"assuming no firmware upload needed" );
@@ -788,6 +881,19 @@ void btrtl_set_quirks(struct hci_dev *hdev, struct btrtl_device_info *btrtl_dev)rtl_dev_dbg (hdev,"WBS supported not enabled." );break ; } + +switch (btrtl_dev->ic_info->lmp_subver) { +case RTL_ROM_LMP_8703B : +/* 8723CS reports two pages for local ext features, +* but it doesn't support any features from page 2 - +* it either responds with garbage or with error status +*/ +set_bit (HCI_QUIRK_BROKEN_LOCAL_EXT_FEATURES_PAGE_2 , + &hdev->quirks); +break ; +default : +break ; + } }EXPORT_SYMBOL_GPL (btrtl_set_quirks);
@@ -946,6 +1052,12 @@ MODULE_FIRMWARE("rtl_bt/rtl8723b_fw.bin");MODULE_FIRMWARE ("rtl_bt/rtl8723b_config.bin" );MODULE_FIRMWARE ("rtl_bt/rtl8723bs_fw.bin" );MODULE_FIRMWARE ("rtl_bt/rtl8723bs_config.bin" ); +MODULE_FIRMWARE ("rtl_bt/rtl8723cs_cg_fw.bin" ); +MODULE_FIRMWARE ("rtl_bt/rtl8723cs_cg_config.bin" ); +MODULE_FIRMWARE ("rtl_bt/rtl8723cs_vf_fw.bin" ); +MODULE_FIRMWARE ("rtl_bt/rtl8723cs_vf_config.bin" ); +MODULE_FIRMWARE ("rtl_bt/rtl8723cs_xx_fw.bin" ); +MODULE_FIRMWARE ("rtl_bt/rtl8723cs_xx_config.bin" );MODULE_FIRMWARE ("rtl_bt/rtl8723ds_fw.bin" );MODULE_FIRMWARE ("rtl_bt/rtl8723ds_config.bin" );MODULE_FIRMWARE ("rtl_bt/rtl8761a_fw.bin" );
drivers/bluetooth/btrtl.h +5 -0
@@ -14,6 +14,11 @@struct btrtl_device_info ; +struct rtl_chip_type_evt { +__u8 status; +__u8 type; +} __packed; +struct rtl_download_cmd {__u8 index;__u8 data[RTL_FRAG_LEN ];
drivers/bluetooth/hci_h5.c +4 -0
@@ -936,6 +936,8 @@ static int h5_btrtl_setup(struct h5 *h5) err =btrtl_download_firmware (h5->hu->hdev, btrtl_dev);/* Give the device some time before the hci-core sends it a reset */ usleep_range (10000 ,20000 ); +if (err) + goto out_free;btrtl_set_quirks (h5->hu->hdev, btrtl_dev);
@@ -1100,6 +1102,8 @@ static const struct of_device_id rtl_bluetooth_of_match[] = { .data = (const void *)&h5_data_rtl8822cs }, { .compatible = "realtek,rtl8723bs-bt", .data = (const void *)&h5_data_rtl8723bs }, + { .compatible = "realtek,rtl8723cs-bt", + .data = (const void *)&h5_data_rtl8723bs }, { .compatible = "realtek,rtl8723ds-bt", .data = (const void *)&h5_data_rtl8723bs },#endif
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 113/292 Bluetooth: Improve support for Actions Semi ATS2851 based devices
In reply to Greg Kroah-HartmanFrom: Raul Cheleguini <[email protected]>
[ Upstream commit 7c2b2d2d0cb658aa543e11e90ae95621d3cb5fe6 ]
Add two more quirks to resume the device initialization and basic operation as the device seems not to support "Read Transmit Power" and "Set Extended Scan Parameters".
< HCI Command: LE Read Transmit Power (0x08|0x004b) plen 0
Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4
LE Read Transmit Power (0x08|0x004b) ncmd 1
Status: Unknown HCI Command (0x01)< HCI Command: LE Set Extended Scan Parameters (0x08|0x0041) plen 8
Own address type: Random (0x01)
Filter policy: Accept all advertisement (0x00)
PHYs: 0x01
Entry 0: LE 1M
Type: Active (0x01)
Interval: 11.250 msec (0x0012)
Window: 11.250 msec (0x0012)Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4
LE Set Extended Scan Parameters (0x08|0x0041) ncmd 1
Status: Unknown HCI Command (0x01)--- drivers/bluetooth/btusb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btusb.c +2 -0
@@ -4019,6 +4019,8 @@ static int btusb_probe(struct usb_interface *intf,if (id->driver_info &BTUSB_ACTIONS_SEMI ) {/* Support is advertised, but not implemented */ set_bit (HCI_QUIRK_BROKEN_ERR_DATA_REPORTING , &hdev->quirks); +set_bit (HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER , &hdev->quirks); +set_bit (HCI_QUIRK_BROKEN_EXT_SCAN , &hdev->quirks); }if (!reset)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 114/292 Bluetooth: btrtl: check for NULL in btrtl_set_quirks()
In reply to Greg Kroah-HartmanFrom: Max Chou <[email protected]>
[ Upstream commit 253cf30e8d3d001850a95c4729d668f916b037ab ]
The btrtl_set_quirks() has accessed btrtl_dev->ic_info->lmp_subver since b8e482d02513. However, if installing a Realtek Bluetooth controller without the driver supported, it will hit the NULL point accessed.
Add a check for NULL to avoid the Kernel Oops.
--- drivers/bluetooth/btrtl.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/bluetooth/btrtl.c +3 -0
@@ -882,6 +882,9 @@ void btrtl_set_quirks(struct hci_dev *hdev, struct btrtl_device_info *btrtl_dev)break ; } +if (!btrtl_dev->ic_info) +return ; +switch (btrtl_dev->ic_info->lmp_subver) {case RTL_ROM_LMP_8703B :/* 8723CS reports two pages for local ext features,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 115/292 Bluetooth: btintel: Add LE States quirk support
In reply to Greg Kroah-HartmanFrom: Chethan T N <[email protected]>
[ Upstream commit 77f542b10c535c9a93bf8afdd2665524935807c2 ]
Basically all Intel controllers support both Central/Peripheral LE states.
This patch enables the LE States quirk by default on all Solar and Magnertor Intel controllers.
--- drivers/bluetooth/btintel.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/bluetooth/btintel.c +2 -3
@@ -2553,9 +2553,8 @@ static int btintel_setup_combined(struct hci_dev *hdev)*/ set_bit (HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED , &hdev->quirks); -/* Valid LE States quirk for GfP */ -if (INTEL_HW_VARIANT (ver_tlv.cnvi_bt) ==0x18 ) -set_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks); +/* Apply LE States quirk from solar onwards */ +set_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks);/* Setup MSFT Extension support */ btintel_set_msft_opcode(hdev,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 116/292 Bluetooth: hci_bcm: Fall back to getting bdaddr from EFI if not set
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 0d218c3642b9ccf71f44987cd03c19320f3bd918 ]
On some devices the BCM Bluetooth adapter does not have a valid bdaddr set.
btbcm.c currently sets HCI_QUIRK_INVALID_BDADDR to indicate when this is the case. But this requires users to manual setup a btaddr, by doing e.g.:
btmgmt -i hci0 public-addr 'B0:F1:EC:82:1D:B3'
Which means that Bluetooth will not work out of the box on such devices. To avoid this (where possible) hci_bcm sets: HCI_QUIRK_USE_BDADDR_PROPERTY which tries to get the bdaddr from devicetree.
But this only works on devicetree platforms. On UEFI based platforms there is a special Broadcom UEFI variable which when present contains the devices bdaddr, just like how there is another UEFI variable which contains wifi nvram contents including the wifi MAC address.
Add support for getting the bdaddr from this Broadcom UEFI variable, so that Bluetooth will work OOTB for users on devices where this UEFI variable is present.
This fixes Bluetooth not working on for example Asus T100HA 2-in-1s.
--- drivers/bluetooth/btbcm.c | 47 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-)
drivers/bluetooth/btbcm.c +44 -3
@@ -6,6 +6,7 @@* Copyright (C) 2015 Intel Corporation */ +#include <linux/efi.h> #include <linux/module.h> #include <linux/firmware.h> #include <linux/dmi.h>
@@ -34,6 +35,43 @@/* For kmalloc-ing the fw-name array instead of putting it on the stack */ typedef char bcm_fw_name [BCM_FW_NAME_LEN ]; +#ifdef CONFIG_EFI +static int btbcm_set_bdaddr_from_efi (struct hci_dev *hdev) +{ +efi_guid_t guid =EFI_GUID (0x74b00bd9 ,0x805a ,0x4d61 ,0xb5 ,0x1f , +0x43 ,0x26 ,0x81 ,0x23 ,0xd1 ,0x13 ); +bdaddr_t efi_bdaddr, bdaddr; +efi_status_t status; +unsigned long len; +int ret; + +if (!efi_rt_services_supported (EFI_RT_SUPPORTED_GET_VARIABLE )) +return -EOPNOTSUPP ; + + len =sizeof (efi_bdaddr); + status = efi.get_variable (L"BDADDR" , &guid,NULL , &len, &efi_bdaddr); +if (status !=EFI_SUCCESS ) +return -ENXIO ; + +if (len !=sizeof (efi_bdaddr)) +return -EIO ; + +baswap (&bdaddr, &efi_bdaddr); + + ret =btbcm_set_bdaddr (hdev, &bdaddr); +if (ret) +return ret; + +bt_dev_info (hdev,"BCM: Using EFI device address (%pMR)" , &bdaddr); +return 0 ; +} +#else +static int btbcm_set_bdaddr_from_efi (struct hci_dev *hdev) +{ +return -EOPNOTSUPP ; +} +#endif +int btbcm_check_bdaddr (struct hci_dev *hdev) {struct hci_rp_read_bd_addr *bda;
@@ -87,9 +125,12 @@ int btbcm_check_bdaddr(struct hci_dev *hdev) !bacmp(&bda->bdaddr, BDADDR_BCM4345C5) || !bacmp(&bda->bdaddr, BDADDR_BCM43430A0) || !bacmp(&bda->bdaddr, BDADDR_BCM43341B)) { -bt_dev_info (hdev,"BCM: Using default device address (%pMR)" , - &bda->bdaddr); -set_bit (HCI_QUIRK_INVALID_BDADDR , &hdev->quirks); +/* Try falling back to BDADDR EFI variable */ +if (btbcm_set_bdaddr_from_efi (hdev) !=0 ) { +bt_dev_info (hdev,"BCM: Using default device address (%pMR)" , + &bda->bdaddr); +set_bit (HCI_QUIRK_INVALID_BDADDR , &hdev->quirks); + } }kfree_skb (skb);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 117/292 Bluetooth: Add new quirk for broken set random RPA timeout for ATS2851
In reply to Greg Kroah-HartmanFrom: Raul Cheleguini <[email protected]>
[ Upstream commit 91b6d02ddcd113352bdd895990b252065c596de7 ]
The ATS2851 based controller advertises support for command "LE Set Random Private Address Timeout" but does not actually implement it, impeding the controller initialization.
Add the quirk HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT to unblock the controller initialization.
< HCI Command: LE Set Resolvable Private... (0x08|0x002e) plen 2
Timeout: 900 seconds
Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4
LE Set Resolvable Private Address Timeout (0x08|0x002e) ncmd 1
Status: Unknown HCI Command (0x01)--- drivers/bluetooth/btusb.c | 1 + include/net/bluetooth/hci.h | 8 ++++++++ net/bluetooth/hci_sync.c | 6 +++++- 3 files changed, 14 insertions(+), 1 deletion(-)
drivers/bluetooth/btusb.c +1 -0
@@ -4020,6 +4020,7 @@ static int btusb_probe(struct usb_interface *intf,/* Support is advertised, but not implemented */ set_bit (HCI_QUIRK_BROKEN_ERR_DATA_REPORTING , &hdev->quirks);set_bit (HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER , &hdev->quirks); +set_bit (HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT , &hdev->quirks);set_bit (HCI_QUIRK_BROKEN_EXT_SCAN , &hdev->quirks); }
include/net/bluetooth/hci.h +8 -0
@@ -301,6 +301,14 @@ enum {* don't actually support features declared there. */ HCI_QUIRK_BROKEN_LOCAL_EXT_FEATURES_PAGE_2 , + +/* +* When this quirk is set, the HCI_OP_LE_SET_RPA_TIMEOUT command is +* skipped during initialization. This is required for the Actions +* Semiconductor ATS2851 based controllers, which erroneously claims +* to support it. +*/ + HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT, };/* HCI device flags */
net/bluetooth/hci_sync.c +5 -1
@@ -4075,7 +4075,8 @@ static int hci_le_set_rpa_timeout_sync(struct hci_dev *hdev) {__le16 timeout =cpu_to_le16 (hdev->rpa_timeout); -if (!(hdev->commands[35 ] &0x04 )) +if (!(hdev->commands[35 ] &0x04 ) || +test_bit (HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT , &hdev->quirks))return 0 ; return __hci_cmd_sync_status(hdev, HCI_OP_LE_SET_RPA_TIMEOUT,
@@ -4515,6 +4516,9 @@ static const struct { "HCI Set Event Filter command not supported."),HCI_QUIRK_BROKEN (ENHANCED_SETUP_SYNC_CONN ,"HCI Enhanced Setup Synchronous Connection command is " +"advertised, but not supported." ), +HCI_QUIRK_BROKEN (SET_RPA_TIMEOUT , +"HCI LE Set Random Private Address Timeout command is " "advertised, but not supported.") };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 118/292 Bluetooth: L2CAP: fix "bad unlock balance" in l2cap_disconnect_rsp
In reply to Greg Kroah-HartmanFrom: Min Li <[email protected]>
[ Upstream commit 25e97f7b1866e6b8503be349eeea44bb52d661ce ]
conn->chan_lock isn't acquired before l2cap_get_chan_by_scid, if l2cap_get_chan_by_scid returns NULL, then 'bad unlock balance' is triggered.
--- net/bluetooth/l2cap_core.c | 1 - 1 file changed, 1 deletion(-)
net/bluetooth/l2cap_core.c +0 -1
@@ -4694,7 +4694,6 @@ static inline int l2cap_disconnect_rsp(struct l2cap_conn *conn, chan =l2cap_get_chan_by_scid (conn, scid);if (!chan) { -mutex_unlock (&conn->chan_lock);return 0 ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 119/292 Bluetooth: btrtl: Add the support for RTL8851B
In reply to Greg Kroah-HartmanFrom: Max Chou <[email protected]>
[ Upstream commit 7948fe1c92d92313eea5453f83deb7f0141355e8 ]
Add the support for RTL8851B BT controller on USB interface. The necessary firmware will be submitted to linux-firmware project.
Note that the Bluetooth devices WITH the VID=0x0bda would be set the feature quirk in btrtl_setup_realtek(). It's able to ignore the feature flag set for the specific VID and PID in blacklist_table[] of btusb.c. (check [1])
If Realtek Bluetooth chips WITHOUT the VID=0x0bda, it shall be added the feature flag for the specific VID and PID in blacklist_table[] of btusb.c. (check [2])
[1] '9ab9235fe5cf ("Bluetooth: btrtl: Enable WBS for the specific Realtek devices")'
[2] '73280f13c9bb ("Bluetooth: btusb: Add the more support IDs for
Realtek RTL8822CE")'
The device info from /sys/kernel/debug/usb/devices as below.
T: Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 33 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=0bda ProdID=b851 Rev= 0.00 S: Manufacturer=Realtek S: Product=802.11ax WLAN Adapter S: SerialNumber=00E04C885A01 C:* #Ifs= 3 Cfg#= 1 Atr=80 MxPwr=500mA A: FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=01 I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms I:* If#= 2 Alt= 0 #EPs= 8 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=09(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=0a(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=0b(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=0c(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/bluetooth/btrtl.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/bluetooth/btrtl.c +15 -0
@@ -28,6 +28,7 @@#define RTL_ROM_LMP_8761A 0x8761#define RTL_ROM_LMP_8822B 0x8822#define RTL_ROM_LMP_8852A 0x8852 +#define RTL_ROM_LMP_8851B 0x8851#define RTL_CONFIG_MAGIC 0x8723ab55#define IC_MATCH_FL_LMPSUBV (1 << 0)
@@ -56,6 +57,7 @@ enum btrtl_chip_id {CHIP_ID_8852A =18 ,CHIP_ID_8852B =20 ,CHIP_ID_8852C =25 , + CHIP_ID_8851B = 36, }; struct id_table {
@@ -244,6 +246,14 @@ static const struct id_table ic_id_table[] = { .has_msft_ext = true, .fw_name = "rtl_bt/rtl8852cu_fw.bin", .cfg_name = "rtl_bt/rtl8852cu_config" }, + +/* 8851B */ + { IC_INFO(RTL_ROM_LMP_8851B, 0xb, 0xc, HCI_USB), + .config_needed = false, + .has_rom_version = true, + .has_msft_ext = false, + .fw_name = "rtl_bt/rtl8851bu_fw.bin", + .cfg_name = "rtl_bt/rtl8851bu_config" }, }; static const struct id_table *btrtl_match_ic(u16 lmp_subver, u16 hci_rev,
@@ -359,6 +369,7 @@ static int rtlbt_parse_firmware(struct hci_dev *hdev, { RTL_ROM_LMP_8852A, 18 }, /* 8852A */ { RTL_ROM_LMP_8852A, 20 }, /* 8852B */ { RTL_ROM_LMP_8852A, 25 }, /* 8852C */ + { RTL_ROM_LMP_8851B, 36 }, /* 8851B */ }; min_size =sizeof (struct rtl_epatch_header ) +sizeof (extension_sig) +3 ;
@@ -848,6 +859,7 @@ int btrtl_download_firmware(struct hci_dev *hdev,case RTL_ROM_LMP_8822B :case RTL_ROM_LMP_8852A :case RTL_ROM_LMP_8703B : +case RTL_ROM_LMP_8851B :return btrtl_setup_rtl8723b (hdev, btrtl_dev);default :rtl_dev_info (hdev,"assuming no firmware upload needed" );
@@ -872,6 +884,7 @@ void btrtl_set_quirks(struct hci_dev *hdev, struct btrtl_device_info *btrtl_dev)case CHIP_ID_8852A :case CHIP_ID_8852B :case CHIP_ID_8852C : +case CHIP_ID_8851B :set_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks);set_bit (HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED , &hdev->quirks);hci_set_aosp_capable (hdev);
@@ -1075,3 +1088,5 @@ MODULE_FIRMWARE("rtl_bt/rtl8852bu_fw.bin");MODULE_FIRMWARE ("rtl_bt/rtl8852bu_config.bin" );MODULE_FIRMWARE ("rtl_bt/rtl8852cu_fw.bin" );MODULE_FIRMWARE ("rtl_bt/rtl8852cu_config.bin" ); +MODULE_FIRMWARE ("rtl_bt/rtl8851bu_fw.bin" ); +MODULE_FIRMWARE ("rtl_bt/rtl8851bu_config.bin" );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 120/292 staging: rtl8192e: Replace macro RTL_PCI_DEVICE with PCI_DEVICE
In reply to Greg Kroah-HartmanFrom: Philipp Hortmann <[email protected]>
[ Upstream commit fda2093860df4812d69052a8cf4997e53853a340 ]
Replace macro RTL_PCI_DEVICE with PCI_DEVICE to get rid of rtl819xp_ops which is empty.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 6 +++--- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 5 ----- 2 files changed, 3 insertions(+), 8 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +3 -3
@@ -48,9 +48,9 @@ static const struct rtl819x_ops rtl819xp_ops = { };static struct pci_device_id rtl8192_pci_id_tbl[] = { - {RTL_PCI_DEVICE (0x10ec ,0x8192 , rtl819xp_ops)}, - {RTL_PCI_DEVICE (0x07aa ,0x0044 , rtl819xp_ops)}, - {RTL_PCI_DEVICE (0x07aa ,0x0047 , rtl819xp_ops)}, + {PCI_DEVICE (0x10ec ,0x8192 )}, + {PCI_DEVICE (0x07aa ,0x0044 )}, + {PCI_DEVICE (0x07aa ,0x0047 )}, {} };
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -5
@@ -55,11 +55,6 @@#define IS_HARDWARE_TYPE_8192SE (_priv) \ (((struct r8192_priv *)rtllib_priv(dev))->card_8192 == NIC_8192SE) -#define RTL_PCI_DEVICE (vend, dev, cfg) \ - .vendor = (vend), .device = (dev), \ - .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, \ - .driver_data = (kernel_ulong_t)&(cfg) -#define TOTAL_CAM_ENTRY 32#define CAM_CONTENT_COUNT 8
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 121/292 HID: apple: Set the tilde quirk flag on the Geyser 4 and later
In reply to Greg Kroah-HartmanFrom: Alex Henrie <[email protected]>
[ Upstream commit c3388ddc74a863466c7c3fa24d3a9cea9c9bca53 ]
I recently tested several old MacBooks and as far as I can tell, all MacBooks that have an ISO keyboard have the tilde key quirk:
Product Model Year System CPU Shape Labels Country Quirky
============================================================================
05ac:021b A1181 2006 MacBook2,1 T5600 ISO British 13 Yes 05ac:021b A1181 2007 MacBook2,1 T7200 ISO Québécois 13 Yes 05ac:0229 A1181 2007 MacBook4,1 T8300 ANSI Usonian 33 No 05ac:022a A1181 2007 MacBook4,1 T8100 ISO English 13 Yes 05ac:022a A1181 2007 MacBook5,2 P7350 ISO Québécois 13 Yes 05ac:0237 A1278 2008 MacBook5,1 P7350 ISO Dutch 13 Yes 05ac:0237 A1278 2009 MacBook5,5 P7550 ISO British 13 Yes
The model number and year are from the laptop case. Since Apple printed the same model and year on many different laptops, the system name (as reported in the SMBIOS tables) and CPU form a more precise identifier.
--- drivers/hid/hid-apple.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/hid/hid-apple.c +9 -7
@@ -861,7 +861,8 @@ static const struct hid_device_id apple_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO), - .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, + .driver_data =APPLE_NUMLOCK_EMULATION |APPLE_HAS_FN | + APPLE_ISO_TILDE_QUIRK }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS), .driver_data =APPLE_NUMLOCK_EMULATION |APPLE_HAS_FN | APPLE_RDESC_JIS },
@@ -880,7 +881,8 @@ static const struct hid_device_id apple_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO), - .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, + .driver_data =APPLE_NUMLOCK_EMULATION |APPLE_HAS_FN | + APPLE_ISO_TILDE_QUIRK }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS), .driver_data =APPLE_NUMLOCK_EMULATION |APPLE_HAS_FN | APPLE_RDESC_JIS },
@@ -921,31 +923,31 @@ static const struct hid_device_id apple_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI), .driver_data = APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO), - .driver_data = APPLE_HAS_FN }, + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS), .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI), .driver_data = APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO), - .driver_data = APPLE_HAS_FN }, + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS), .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI), .driver_data = APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO), - .driver_data = APPLE_HAS_FN }, + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS), .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI), .driver_data = APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO), - .driver_data = APPLE_HAS_FN }, + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS), .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI), .driver_data = APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO), - .driver_data = APPLE_HAS_FN }, + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS), .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI),
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 122/292 staging: axis-fifo: initialize timeouts in init only
In reply to Greg Kroah-HartmanFrom: Khadija Kamran <[email protected]>
[ Upstream commit 752cbd8f191678e86aa754f795546b7f06b7f171 ]
Initialize the module parameters, read_timeout and write_timeout once in init().
Module parameters can only be set once and cannot be modified later, so we don't need to evaluate them again when passing the parameters to wait_event_interruptible_timeout().
Convert datatype of {read,write}_timeout from 'int' to 'long int' because implicit conversion of 'long int' to 'int' in statement '{read,write}_timeout = MAX_SCHEDULE_TIMEOUT' results in an overflow.
Change format specifier for {read,write}_timeout from %i to %li.
--- drivers/staging/axis-fifo/axis-fifo.c | 28 ++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-)
drivers/staging/axis-fifo/axis-fifo.c +17 -11
@@ -103,17 +103,17 @@* globals * ---------------------------- */ -static int read_timeout =1000 ;/* ms to wait before read() times out */ -static int write_timeout =1000 ;/* ms to wait before write() times out */ +static long read_timeout =1000 ;/* ms to wait before read() times out */ +static long write_timeout =1000 ;/* ms to wait before write() times out */ /* ---------------------------- * module command-line arguments * ---------------------------- */ -module_param (read_timeout, int,0444 ); +module_param (read_timeout, long,0444 );MODULE_PARM_DESC (read_timeout,"ms to wait before blocking read() timing out; set to -1 for no timeout" ); -module_param (write_timeout, int,0444 ); +module_param (write_timeout, long,0444 );MODULE_PARM_DESC (write_timeout,"ms to wait before blocking write() timing out; set to -1 for no timeout" );/* ----------------------------
@@ -384,9 +384,7 @@ static ssize_t axis_fifo_read(struct file *f, char __user *buf,mutex_lock (&fifo->read_lock); ret =wait_event_interruptible_timeout (fifo->read_queue,ioread32 (fifo->base_addr +XLLF_RDFO_OFFSET ), - (read_timeout >=0 ) ? -msecs_to_jiffies (read_timeout) : -MAX_SCHEDULE_TIMEOUT ); + read_timeout);if (ret <=0 ) {if (ret ==0 ) {
@@ -528,9 +526,7 @@ static ssize_t axis_fifo_write(struct file *f, const char __user *buf, ret =wait_event_interruptible_timeout (fifo->write_queue,ioread32 (fifo->base_addr +XLLF_TDFV_OFFSET ) >= words_to_write, - (write_timeout >=0 ) ? -msecs_to_jiffies (write_timeout) : -MAX_SCHEDULE_TIMEOUT ); + write_timeout);if (ret <=0 ) {if (ret ==0 ) {
@@ -948,7 +944,17 @@ static struct platform_driver axis_fifo_driver = {static int __init axis_fifo_init (void ) { -pr_info ("axis-fifo driver loaded with parameters read_timeout = %i, write_timeout = %i\n" , +if (read_timeout >=0 ) + read_timeout =msecs_to_jiffies (read_timeout); +else + read_timeout =MAX_SCHEDULE_TIMEOUT ; + +if (write_timeout >=0 ) + write_timeout =msecs_to_jiffies (write_timeout); +else + write_timeout =MAX_SCHEDULE_TIMEOUT ; + +pr_info ("axis-fifo driver loaded with parameters read_timeout = %li, write_timeout = %li\n" , read_timeout, write_timeout);return platform_driver_register (&axis_fifo_driver); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 123/292 ASoC: amd: yc: Add DMI entries to support HP OMEN 16-n0xxx (8A42)
In reply to Greg Kroah-HartmanFrom: Prajna Sariputra <[email protected]>
[ Upstream commit ee4281de4d60288b9c802bb0906061ec355ecef2 ]
This model requires an additional detection quirk to enable the internal microphone.
--- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -262,6 +262,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "OMEN by HP Gaming Laptop 16z-n000"), } }, + { + .driver_data = &acp6x_card, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"HP" ), + DMI_MATCH(DMI_BOARD_NAME, "8A42"), + } + }, { .driver_data = &acp6x_card, .matches = {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 124/292 HID: logitech-hidpp: Dont use the USB serial for USB devices
In reply to Greg Kroah-HartmanFrom: Bastien Nocera <[email protected]>
[ Upstream commit 7ad1fe0da0fa91bf920b79ab05ae97bfabecc4f4 ]
For devices that support the 0x0003 feature (Device Information) version 4, set the serial based on the output of that feature, rather than relying on the usbhid code setting the USB serial.
This should allow the serial when connected through USB to (nearly) match the one when connected through a unifying receiver.
For example, on the serials on a G903 wired/wireless mouse:
- Unifying: 4067-e8-ce-cd-45
- USB before patch: 017C385C3837
- USB after patch: c086-e8-ce-cd-45
--- drivers/hid/hid-logitech-hidpp.c | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
drivers/hid/hid-logitech-hidpp.c +51 -0
@@ -932,6 +932,55 @@ static int hidpp_root_get_protocol_version(struct hidpp_device *hidpp)return 0 ; } +/* -------------------------------------------------------------------------- */ +/* 0x0003: Device Information */ +/* -------------------------------------------------------------------------- */ + +#define HIDPP_PAGE_DEVICE_INFORMATION 0x0003 + +#define CMD_GET_DEVICE_INFO 0x00 + +static int hidpp_get_serial (struct hidpp_device *hidpp,u32 *serial) +{ +struct hidpp_report response; +u8 feature_type; +u8 feature_index; +int ret; + + ret =hidpp_root_get_feature (hidpp,HIDPP_PAGE_DEVICE_INFORMATION , + &feature_index, + &feature_type); +if (ret) +return ret; + + ret =hidpp_send_fap_command_sync (hidpp, feature_index, +CMD_GET_DEVICE_INFO , +NULL ,0 , &response); +if (ret) +return ret; + +/* See hidpp_unifying_get_serial() */ + *serial = *((u32 *)&response.rap.params[1 ]); +return 0 ; +} + +static int hidpp_serial_init (struct hidpp_device *hidpp) +{ +struct hid_device *hdev = hidpp->hid_dev; +u32 serial; +int ret; + + ret =hidpp_get_serial (hidpp, &serial); +if (ret) +return ret; + +snprintf (hdev->uniq,sizeof (hdev->uniq),"%04x-%4phD" , + hdev->product, &serial); +dbg_hid ("HID++ DeviceInformation: Got serial: %s\n" , hdev->uniq); + +return 0 ; +} +/* -------------------------------------------------------------------------- */ /* 0x0005: GetDeviceNameType */ /* -------------------------------------------------------------------------- */
@@ -4194,6 +4243,8 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id)if (hidpp->quirks &HIDPP_QUIRK_UNIFYING )hidpp_unifying_init (hidpp); +else if (hid_is_usb (hidpp->hid_dev)) +hidpp_serial_init (hidpp); connected =hidpp_root_get_protocol_version (hidpp) ==0 ;atomic_set (&hidpp->connected, connected);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 125/292 HID: logitech-hidpp: Reconcile USB and Unifying serials
In reply to Greg Kroah-HartmanFrom: Bastien Nocera <[email protected]>
[ Upstream commit 5b3691d15e04b6d5a32c915577b8dbc5cfb56382 ]
Now that USB HID++ devices can gather a serial number that matches the one that would be gathered when connected through a Unifying receiver, remove the last difference by dropping the product ID as devices usually have different product IDs when connected through USB or Unifying.
For example, on the serials on a G903 wired/wireless mouse:
- Unifying before patch: 4067-e8-ce-cd-45
- USB before patch: c086-e8-ce-cd-45
- Unifying and USB after patch: e8-ce-cd-45
--- drivers/hid/hid-logitech-hidpp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/hid/hid-logitech-hidpp.c +2 -4
@@ -838,8 +838,7 @@ static int hidpp_unifying_init(struct hidpp_device *hidpp)if (ret)return ret; -snprintf (hdev->uniq,sizeof (hdev->uniq),"%04x-%4phD" , - hdev->product, &serial); +snprintf (hdev->uniq,sizeof (hdev->uniq),"%4phD" , &serial);dbg_hid ("HID++ Unifying: Got serial: %s\n" , hdev->uniq); name =hidpp_unifying_get_name (hidpp);
@@ -974,8 +973,7 @@ static int hidpp_serial_init(struct hidpp_device *hidpp)if (ret)return ret; -snprintf (hdev->uniq,sizeof (hdev->uniq),"%04x-%4phD" , - hdev->product, &serial); +snprintf (hdev->uniq,sizeof (hdev->uniq),"%4phD" , &serial);dbg_hid ("HID++ DeviceInformation: Got serial: %s\n" , hdev->uniq);return 0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 126/292 spi: spi-imx: fix MX51_ECSPI_* macros when cs > 3
In reply to Greg Kroah-HartmanFrom: Kevin Groeneveld <[email protected]>
[ Upstream commit 87c614175bbf28d3fd076dc2d166bac759e41427 ]
When using gpio based chip select the cs value can go outside the range 0 – 3. The various MX51_ECSPI_* macros did not take this into consideration resulting in possible corruption of the configuration.
For example for any cs value over 3 the SCLKPHA bits would not be set and other values in the register possibly corrupted.
One way to fix this is to just mask the cs bits to 2 bits. This still allows all 4 native chip selects to work as well as gpio chip selects (which can use any of the 4 chip select configurations).
--- drivers/spi/spi-imx.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/spi/spi-imx.c +18 -6
@@ -253,6 +253,18 @@ static bool spi_imx_can_dma(struct spi_controller *controller, struct spi_devicereturn true; } +/* +* Note the number of natively supported chip selects for MX51 is 4. Some +* devices may have less actual SS pins but the register map supports 4. When +* using gpio chip selects the cs values passed into the macros below can go +* outside the range 0 - 3. We therefore need to limit the cs value to avoid +* corrupting bits outside the allocated locations. +* +* The simplest way to do this is to just mask the cs bits to 2 bits. This +* still allows all 4 native chip selects to work as well as gpio chip selects +* (which can use any of the 4 chip select configurations). +*/ +#define MX51_ECSPI_CTRL 0x08#define MX51_ECSPI_CTRL_ENABLE (1 << 0)#define MX51_ECSPI_CTRL_XCH (1 << 2)
@@ -261,16 +273,16 @@ static bool spi_imx_can_dma(struct spi_controller *controller, struct spi_device#define MX51_ECSPI_CTRL_DRCTL (drctl) ((drctl) << 16)#define MX51_ECSPI_CTRL_POSTDIV_OFFSET 8#define MX51_ECSPI_CTRL_PREDIV_OFFSET 12 -#define MX51_ECSPI_CTRL_CS (cs) ((cs) << 18) +#define MX51_ECSPI_CTRL_CS (cs) ((cs & 3) << 18)#define MX51_ECSPI_CTRL_BL_OFFSET 20#define MX51_ECSPI_CTRL_BL_MASK (0xfff << 20)#define MX51_ECSPI_CONFIG 0x0c -#define MX51_ECSPI_CONFIG_SCLKPHA (cs) (1 << ((cs) + 0)) -#define MX51_ECSPI_CONFIG_SCLKPOL (cs) (1 << ((cs) + 4)) -#define MX51_ECSPI_CONFIG_SBBCTRL (cs) (1 << ((cs) + 8)) -#define MX51_ECSPI_CONFIG_SSBPOL (cs) (1 << ((cs) + 12)) -#define MX51_ECSPI_CONFIG_SCLKCTL (cs) (1 << ((cs) + 20)) +#define MX51_ECSPI_CONFIG_SCLKPHA (cs) (1 << ((cs & 3) + 0)) +#define MX51_ECSPI_CONFIG_SCLKPOL (cs) (1 << ((cs & 3) + 4)) +#define MX51_ECSPI_CONFIG_SBBCTRL (cs) (1 << ((cs & 3) + 8)) +#define MX51_ECSPI_CONFIG_SSBPOL (cs) (1 << ((cs & 3) + 12)) +#define MX51_ECSPI_CONFIG_SCLKCTL (cs) (1 << ((cs & 3) + 20))#define MX51_ECSPI_INT 0x10#define MX51_ECSPI_INT_TEEN (1 << 0)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 127/292 usb: typec: ucsi: acpi: add quirk for ASUS Zenbook UM325
In reply to Greg Kroah-HartmanFrom: Samuel Čavoj <[email protected]>
[ Upstream commit 326e1c208f3f24d14b93f910b8ae32c94923d22c ]
On some ACPI platforms (namely the ASUS Zenbook UM325) the _DSM method must not be called after a notification is received but instead the mailbox should be read immediately from RAM. This is because the ACPI interrupt handler destroys the CCI in ERAM after copying to system memory, and when _DSM is later called to perform a second copy, it retrieves a garbage value.
Instead, the _DSM(read) method should only be called when necessary, i.e. for polling the state after reset and for retrieving the version. Other reads should not call _DSM and only peek into the RAM region.
This adds a separate read operation for the Zenbook that syncs the ACPI mailbox only with polled commands.
--- drivers/usb/typec/ucsi/ucsi_acpi.c | 44 ++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-)
drivers/usb/typec/ucsi/ucsi_acpi.c +42 -2
@@ -9,6 +9,7 @@#include <linux/platform_device.h> #include <linux/module.h> #include <linux/acpi.h> +#include <linux/dmi.h> #include "ucsi.h"
@@ -23,6 +24,7 @@ struct ucsi_acpi {struct completion complete;unsigned long flags;guid_t guid; +u64 cmd; };static int ucsi_acpi_dsm (struct ucsi_acpi *ua,int func)
@@ -62,6 +64,7 @@ static int ucsi_acpi_async_write(struct ucsi *ucsi, unsigned int offset,struct ucsi_acpi *ua =ucsi_get_drvdata (ucsi);memcpy (ua->base + offset, val, val_len); + ua->cmd = *(u64 *)val;return ucsi_acpi_dsm (ua,UCSI_DSM_FUNC_WRITE ); }
@@ -93,13 +96,46 @@ static const struct ucsi_operations ucsi_acpi_ops = { .async_write = ucsi_acpi_async_write }; +static int +ucsi_zenbook_read (struct ucsi *ucsi,unsigned int offset,void *val,size_t val_len) +{ +struct ucsi_acpi *ua =ucsi_get_drvdata (ucsi); +int ret; + +if (offset ==UCSI_VERSION ||UCSI_COMMAND (ua->cmd) ==UCSI_PPM_RESET ) { + ret =ucsi_acpi_dsm (ua,UCSI_DSM_FUNC_READ ); +if (ret) +return ret; + } + +memcpy (val, ua->base + offset, val_len); + +return 0 ; +} + +static const struct ucsi_operations ucsi_zenbook_ops = { + .read = ucsi_zenbook_read, + .sync_write = ucsi_acpi_sync_write, + .async_write = ucsi_acpi_async_write +}; + +static const struct dmi_system_id zenbook_dmi_id[] = { + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"ASUSTeK COMPUTER INC." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"ZenBook UX325UA_UM325UA" ), + }, + }, + { } +}; +static void ucsi_acpi_notify (acpi_handle handle,u32 event,void *data) {struct ucsi_acpi *ua = data;u32 cci;int ret; - ret =ucsi_acpi_read (ua->ucsi,UCSI_CCI , &cci,sizeof (cci)); + ret = ua->ucsi->ops->read (ua->ucsi,UCSI_CCI , &cci,sizeof (cci));if (ret)return ;
@@ -114,6 +150,7 @@ static void ucsi_acpi_notify(acpi_handle handle, u32 event, void *data)static int ucsi_acpi_probe (struct platform_device *pdev) {struct acpi_device *adev =ACPI_COMPANION (&pdev->dev); +const struct ucsi_operations *ops = &ucsi_acpi_ops;struct ucsi_acpi *ua;struct resource *res;acpi_status status;
@@ -143,7 +180,10 @@ static int ucsi_acpi_probe(struct platform_device *pdev)init_completion (&ua->complete); ua->dev = &pdev->dev; - ua->ucsi =ucsi_create (&pdev->dev, &ucsi_acpi_ops); +if (dmi_check_system (zenbook_dmi_id)) + ops = &ucsi_zenbook_ops; + + ua->ucsi =ucsi_create (&pdev->dev, ops);if (IS_ERR (ua->ucsi))return PTR_ERR (ua->ucsi);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 128/292 ALSA: hda: LNL: add HD Audio PCI ID
In reply to Greg Kroah-HartmanFrom: Fred Oh <[email protected]>
[ Upstream commit 714b2f025d767e7df1fe9da18bd70537d64cc157 ]
Add HD Audio PCI ID for Intel Lunarlake platform.
--- sound/pci/hda/hda_intel.c | 3 +++ 1 file changed, 3 insertions(+)
sound/pci/hda/hda_intel.c +3 -0
@@ -2528,6 +2528,9 @@ static const struct pci_device_id azx_ids[] = {/* Meteorlake-P */ { PCI_DEVICE(0x8086, 0x7e28), .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, + /* Lunarlake-P */ + { PCI_DEVICE(0x8086, 0xa828), + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, /* Broxton-P(Apollolake) */ { PCI_DEVICE(0x8086, 0x5a98), .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_BROXTON },
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 129/292 ASoC: amd: Add Dell G15 5525 to quirks list
In reply to Greg Kroah-HartmanFrom: Cem Kaya <[email protected]>
[ Upstream commit faf15233e59052f4d61cad2da6e56daf33124d96 ]
Add Dell G15 5525 Ryzen Edition to quirks list for acp6x so that internal mic works.
--- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -45,6 +45,13 @@ static struct snd_soc_card acp6x_card = { };static const struct dmi_system_id yc_acp_quirk_table[] = { + { + .driver_data = &acp6x_card, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"Dell Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"Dell G15 5525" ), + } + }, { .driver_data = &acp6x_card, .matches = {
Signature · 1 line
2.39.2