5.4.291-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainercover 5.4.291-rc1 review
This is the start of the stable review cycle for the 5.4.291 release. There are 328 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 Thu, 13 Mar 2025 14:56:14 +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/v5.x/stable-review/patch-5.4.291-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-5.4.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.4.291-rc1
Andy Shevchenko <[email protected]>
eeprom: digsy_mtc: Make GPIO lookup table match the device
Visweswara Tanuku <[email protected]>
slimbus: messaging: Free transaction ID in delayed interrupt scenario
Alexander Shishkin <[email protected]>
intel_th: pci: Add Panther Lake-P/U support
Alexander Shishkin <[email protected]>
intel_th: pci: Add Panther Lake-H support
Pawel Chmielewski <[email protected]>
intel_th: pci: Add Arrow Lake support
Phillip Lougher <[email protected]>
Squashfs: check the inode number is not the invalid value of zero
Andy Shevchenko <[email protected]>
xhci: pci: Fix indentation in the PCI device ID definitions
Prashanth K <[email protected]>
usb: gadget: Check bmAttributes only if configuration is valid
Marek Szyprowski <[email protected]>
usb: gadget: Fix setting self-powered state on suspend
Prashanth K <[email protected]>
usb: gadget: Set self-powered based on MaxPower and bmAttributes
AngeloGioacchino Del Regno <[email protected]>
usb: typec: tcpci_rt1711h: Unmask alert interrupts to fix functionality
Fedor Pchelkin <[email protected]>
usb: typec: ucsi: increase timeout for PPM reset operations
Nikita Zhandarovich <[email protected]>
usb: atm: cxacru: fix a flaw in existing endpoint checks
Claudiu Beznea <[email protected]>
usb: renesas_usbhs: Flush the notify_hotplug_work
Miao Li <[email protected]>
usb: quirks: Add DELAY_INIT and NO_LPM for Prolific Mass Storage Card Reader
Claudiu Beznea <[email protected]>
usb: renesas_usbhs: Use devm_usb_get_phy()
Claudiu Beznea <[email protected]>
usb: renesas_usbhs: Call clk_put()
Christian Heusel <[email protected]>
Revert "drivers/card_reader/rtsx_usb: Restore interrupt based detection"
Fabrizio Castro <[email protected]>
gpio: rcar: Fix missing of_node_put() call
Justin Iurman <[email protected]>
net: ipv6: fix missing dst ref drop in ila lwtunnel
Justin Iurman <[email protected]>
net: ipv6: fix dst ref loop in ila lwtunnel
Jason Xing <[email protected]>
net-timestamp: support TCP GSO case for a few missing flags
Oscar Maes <[email protected]>
vlan: enforce underlying device type
Jiayuan Chen <[email protected]>
ppp: Fix KMSAN uninit-value warning with bpf
Nikolay Aleksandrov <[email protected]>
be2net: fix sleeping while atomic bugs in be_ndo_bridge_getlink
Philipp Stanner <[email protected]>
drm/sched: Fix preprocessor guard
Xinghuo Chen <[email protected]>
hwmon: fix a NULL vs IS_ERR_OR_NULL() check in xgene_hwmon_probe()
Eric Dumazet <[email protected]>
llc: do not use skb_get() before dev_queue_xmit()
Erik Schumacher <[email protected]>
hwmon: (ad7314) Validate leading zero bits and return error
Maud Spierings <[email protected]>
hwmon: (ntc_thermistor) Fix the ncpXXxh103 sensor table
Titus Rwantare <[email protected]>
hwmon: (pmbus) Initialise page count in pmbus_identify()
Vitaliy Shevtsov <[email protected]>
caif_virtio: fix wrong pointer check in cfv_probe()
Antoine Tenart <[email protected]>
net: gso: fix ownership in __udp_gso_segment
Zhang Lixu <[email protected]>
HID: intel-ish-hid: Fix use-after-free issue in ishtp_hid_remove()
Yu-Chun Lin <[email protected]>
HID: google: fix unused variable warning under !CONFIG_ACPI
Johannes Berg <[email protected]>
wifi: iwlwifi: limit printed string from FW file
Hao Zhang <[email protected]>
mm/page_alloc: fix uninitialized variable
Haoxiang Li <[email protected]>
rapidio: fix an API misues when rio_add_net() fails
Haoxiang Li <[email protected]>
rapidio: add check for rio_add_net() in rio_scan_alloc_net()
Vitaliy Shevtsov <[email protected]>
wifi: nl80211: reject cooked mode if it is set along with other flags
Nikita Zhandarovich <[email protected]>
wifi: cfg80211: regulatory: improve invalid hints checking
Ahmed S. Darwish <[email protected]>
x86/cpu: Properly parse CPUID leaf 0x2 TLB descriptor 0x63
Ahmed S. Darwish <[email protected]>
x86/cpu: Validate CPUID leaf 0x2 EDX output
Ahmed S. Darwish <[email protected]>
x86/cacheinfo: Validate CPUID leaf 0x2 EDX output
Mingcong Bai <[email protected]>
platform/x86: thinkpad_acpi: Add battery quirk for ThinkPad X131e
Richard Thier <[email protected]>
drm/radeon: Fix rs400_gpu_init for ATI mobility radeon Xpress 200M
Kailang Yang <[email protected]>
ALSA: hda/realtek: update ALC222 depop optimize
Hoku Ishibe <[email protected]>
ALSA: hda: intel: Add Dell ALC3271 to power_save denylist
Daniil Dulov <[email protected]>
HID: appleir: Fix potential NULL dereference at raw event handle
Rob Herring (Arm) <[email protected]>
Revert "of: reserved-memory: Fix using wrong number of cells to get property 'alignment'"
Alex Deucher <[email protected]>
drm/amdgpu: disable BAR resize on Dell G5 SE
Ma Jun <[email protected]>
drm/amdgpu: Check extended configuration space register when system uses large bar
Alex Deucher <[email protected]>
drm/amdgpu: skip BAR resizing if the bios already did it
Christian Brauner <[email protected]>
acct: perform last write from workqueue
Yang Yang <[email protected]>
kernel/acct.c: use dedicated helper to access rlimit values
Hui Su <[email protected]>
kernel/acct.c: use #elif instead of #end and #elif
Gavrilov Ilia <[email protected]>
drop_monitor: fix incorrect initialization order
Quang Le <[email protected]>
pfifo_tail_enqueue: Drop new packet when sch->limit == 0
Thomas Gleixner <[email protected]>
sched/core: Prevent rescheduling when interrupts are disabled
Kaustabh Chakraborty <[email protected]>
phy: exynos5-usbdrd: fix MPLL_MULTIPLIER and SSC_REFCLKSEL masks in refclk
BH Hsieh <[email protected]>
phy: tegra: xusb: reset VBUS & ID OVERRIDE
Nikita Zhandarovich <[email protected]>
usbnet: gl620a: fix endpoint checking in genelink_bind()
Kan Liang <[email protected]>
perf/core: Fix low freq setting via IOC_PERIOD
Nikolay Kuratov <[email protected]>
ftrace: Avoid potential division by zero in function_stat_show()
Russell Senior <[email protected]>
x86/CPU: Fix warm boot hang regression on AMD SC1100 SoC systems
Harshal Chaudhari <[email protected]>
net: mvpp2: cls: Fixed Non IP flow, with vlan tag flow defination.
Philo Lu <[email protected]>
ipvs: Always clear ipvs_property flag in skb_scrub_packet()
Nicolas Frattaroli <[email protected]>
ASoC: es8328: fix route from DAC to output
Sean Anderson <[email protected]>
net: cadence: macb: Synchronize stats calculations
Ido Schimmel <[email protected]>
net: loopback: Avoid sending IP packets without an Ethernet header
Arnd Bergmann <[email protected]>
sunrpc: suppress warnings for unused procfs functions
Sven Eckelmann <[email protected]>
batman-adv: Drop unmanaged ELP metric worker
Sven Eckelmann <[email protected]>
batman-adv: Ignore neighbor throughput metrics in error case
Christian Brauner <[email protected]>
acct: block access to kernel internal filesystems
John Veness <[email protected]>
ALSA: hda/conexant: Add quirk for HP ProBook 450 G4 mute LED
Haoxiang Li <[email protected]>
nfp: bpf: Add check for nfp_app_ctrl_msg_alloc()
Sumit Garg <[email protected]>
tee: optee: Fix supplicant wait loop
Andrey Vatoropin <[email protected]>
power: supply: da9150-fg: fix potential overflow
Cong Wang <[email protected]>
flow_dissector: Fix port range key handling in BPF conversion
Cong Wang <[email protected]>
flow_dissector: Fix handling of mixed port and port-range keys
Maksym Glubokiy <[email protected]>
net: extract port range fields from fl_flow_key
Kuniyuki Iwashima <[email protected]>
geneve: Suppress list corruption splat in geneve_destroy_tunnels().
Kuniyuki Iwashima <[email protected]>
gtp: Suppress list corruption splat in gtp_net_exit_batch_rtnl().
Kuniyuki Iwashima <[email protected]>
geneve: Fix use-after-free in geneve_find_dev().
Christophe Leroy <[email protected]>
powerpc/code-patching: Fix KASAN hit by not flagging text patching area as VM_ALLOC
Kailang Yang <[email protected]>
ALSA: hda/realtek: Fixup ALC225 depop procedure
Kailang Yang <[email protected]>
ALSA: hda/realtek - Add type for ALC287
Christophe Leroy <[email protected]>
powerpc/64s: Rewrite __real_pte() and __rpte_to_hidx() as static inline
Michael Ellerman <[email protected]>
powerpc/64s/mm: Move __real_pte stubs into hash-4k.h
Jill Donahue <[email protected]>
USB: gadget: f_midi: f_midi_complete to call queue_work
Davidlohr Bueso <[email protected]>
usb/gadget: f_midi: Replace tasklet with work
Allen Pais <[email protected]>
usb/gadget: f_midi: convert tasklets to use new tasklet_setup() API
Selvarasu Ganesan <[email protected]>
usb: dwc3: Fix timeout issue during controller enter/exit from halt state
Wesley Cheng <[email protected]>
usb: dwc3: Increase DWC3 controller halt timeout
Chen Ridong <[email protected]>
memcg: fix soft lockup in the OOM process
Carlos Galo <[email protected]>
mm: update mark_victim tracepoints fields
Ignat Korchagin <[email protected]>
crypto: testmgr - some more fixes to RSA test vectors
Ignat Korchagin <[email protected]>
crypto: testmgr - populate RSA CRT parameters in RSA test vectors
lei he <[email protected]>
crypto: testmgr - fix version number of RSA tests
Lei He <[email protected]>
crypto: testmgr - Fix wrong test case of RSA
Lei He <[email protected]>
crypto: testmgr - fix wrong key length for pkcs1pad
Zijun Hu <[email protected]>
driver core: bus: Fix double free in driver API bus_register()
Long Li <[email protected]>
scsi: storvsc: Set correct data length for sending SCSI command without payload
Xin Long <[email protected]>
vlan: move dev_put into vlan_dev_uninit
Xin Long <[email protected]>
vlan: introduce vlan_dev_free_egress_priority
Stefan Berger <[email protected]>
ima: Fix use-after-free on a dentry's dname.name
Calvin Owens <[email protected]>
pps: Fix a use-after-free
Filipe Manana <[email protected]>
btrfs: avoid monopolizing a core when activating a swap file
Koichiro Den <[email protected]>
Revert "btrfs: avoid monopolizing a core when activating a swap file"
David Woodhouse <[email protected]>
x86/i8253: Disable PIT timer 0 when not in use
Jiaqing Zhao <[email protected]>
parport_pc: add support for ASIX AX99100
Jiaqing Zhao <[email protected]>
serial: 8250_pci: add support for ASIX AX99100
Jiaqing Zhao <[email protected]>
can: ems_pci: move ASIX AX99100 ids to pci_ids.h
Ryusuke Konishi <[email protected]>
nilfs2: protect access to buffers with no active references
Ryusuke Konishi <[email protected]>
nilfs2: do not force clear folio if buffer is referenced
Ryusuke Konishi <[email protected]>
nilfs2: do not output warnings when clearing dirty buffers
Ivan Kokshaysky <[email protected]>
alpha: replace hardcoded stack offsets with autogenerated ones
Eric Dumazet <[email protected]>
ndisc: extend RCU protection in ndisc_send_skb()
Eric Dumazet <[email protected]>
openvswitch: use RCU protection in ovs_vport_cmd_fill_info()
Eric Dumazet <[email protected]>
arp: use RCU protection in arp_xmit()
Eric Dumazet <[email protected]>
neighbour: use RCU protection in __neigh_notify()
Li Zetao <[email protected]>
neighbour: delete redundant judgment statements
Eric Dumazet <[email protected]>
ndisc: use RCU protection in ndisc_alloc_skb()
Eric Dumazet <[email protected]>
ipv6: use RCU protection in ip6_default_advmss()
Eric Dumazet <[email protected]>
ipv4: use RCU protection in inet_select_addr()
Eric Dumazet <[email protected]>
ipv4: use RCU protection in rt_is_expired()
Eric Dumazet <[email protected]>
net: add dev_net_rcu() helper
Jiri Pirko <[email protected]>
net: treat possible_net_t net pointer as an RCU one and add read_pnet_rcu()
Jiasheng Jiang <[email protected]>
regmap-irq: Add missing kfree()
Jann Horn <[email protected]>
partitions: mac: fix handling of bogus partition table
Wentao Liang <[email protected]>
gpio: stmpe: Check return value of stmpe_reg_read in stmpe_gpio_irq_sync_unlock
Ivan Kokshaysky <[email protected]>
alpha: align stack for page fault and user unaligned trap handlers
John Keeping <[email protected]>
serial: 8250: Fix fifo underflow on flush
Ivan Kokshaysky <[email protected]>
alpha: make stack 16-byte aligned (most cases)
Alexander Hölzl <[email protected]>
can: j1939: j1939_sk_send_loop(): fix unable to send messages with data length zero
Krzysztof Kozlowski <[email protected]>
can: c_can: fix unbalanced runtime PM disable in error path
Johan Hovold <[email protected]>
USB: serial: option: drop MeiG Smart defines
Fabio Porcedda <[email protected]>
USB: serial: option: fix Telit Cinterion FN990A name
Fabio Porcedda <[email protected]>
USB: serial: option: add Telit Cinterion FN990B compositions
Chester A. Unal <[email protected]>
USB: serial: option: add MeiG Smart SLM828
Jann Horn <[email protected]>
usb: cdc-acm: Fix handling of oversized fragments
Jann Horn <[email protected]>
usb: cdc-acm: Check control transfer buffer size before access
Marek Vasut <[email protected]>
USB: cdc-acm: Fill in Renesas R-Car D3 USB Download mode quirk
Alan Stern <[email protected]>
USB: hub: Ignore non-compliant devices with too many configs or interfaces
John Keeping <[email protected]>
usb: gadget: f_midi: fix MIDI Streaming descriptor lengths
Mathias Nyman <[email protected]>
USB: Add USB_QUIRK_NO_LPM quirk for sony xperia xz1 smartphone
Lei Huang <[email protected]>
USB: quirks: add USB_QUIRK_NO_LPM quirk for Teclast dist
Huacai Chen <[email protected]>
USB: pci-quirks: Fix HCCPARAMS register error for LS7A EHCI
Fabrice Gasnier <[email protected]>
usb: dwc2: gadget: remove of_node reference upon udc_stop
Guo Ren <[email protected]>
usb: gadget: udc: renesas_usb3: Fix compiler warning
Elson Roy Serrao <[email protected]>
usb: roles: set switch registered flag early on
Andy Strohman <[email protected]>
batman-adv: fix panic during interface removal
Hans de Goede <[email protected]>
ASoC: Intel: bytcr_rt5640: Add DMI quirk for Vexia Edu Atla 10 tablet 5V
Mike Marshall <[email protected]>
orangefs: fix a oob in orangefs_debug_write
Maksym Planeta <[email protected]>
Grab mm lock before grabbing pt lock
Ramesh Thomas <[email protected]>
vfio/pci: Enable iowrite64 and ioread64 for vfio pci
Arnd Bergmann <[email protected]>
media: cxd2841er: fix 64-bit division on gcc-9
Juergen Gross <[email protected]>
x86/xen: allow larger contiguous memory regions in PV guests
Petr Tesarik <[email protected]>
xen: remove a confusing comment on auto-translated guest I/O
Artur Weber <[email protected]>
gpio: bcm-kona: Add missing newline to dev_err format string
Artur Weber <[email protected]>
gpio: bcm-kona: Make sure GPIO bits are unlocked when requesting IRQ
Artur Weber <[email protected]>
gpio: bcm-kona: Fix GPIO lock/unlock for banks above bank 0
Radu Rendec <[email protected]>
arm64: cacheinfo: Avoid out-of-bounds write to cacheinfo array
Eric Dumazet <[email protected]>
team: better TEAM_OPTION_TYPE_STRING validation
Eric Dumazet <[email protected]>
vrf: use RCU protection in l3mdev_l3_out()
Eric Dumazet <[email protected]>
ndisc: ndisc_send_redirect() must use dev_get_by_index_rcu()
Charles Han <[email protected]>
HID: multitouch: Add NULL check in mt_input_configured
Su Yue <[email protected]>
ocfs2: check dir i_size in ocfs2_find_entry
WangYuli <[email protected]>
MIPS: ftrace: Declare ftrace_get_parent_ra_addr() as static
Thomas Weißschuh <[email protected]>
ptp: Ensure info->enable callback is always set
Paul Fertser <[email protected]>
net/ncsi: wait for the last response to Deselect Package before configuring channel
Ekansh Gupta <[email protected]>
misc: fastrpc: Fix registered buffer page address
Ivan Stepchenko <[email protected]>
mtd: onenand: Fix uninitialized retlen in do_otp_read()
Dan Carpenter <[email protected]>
NFC: nci: Add bounds checking in nci_hci_create_pipe()
Nikita Zhandarovich <[email protected]>
nilfs2: fix possible int overflows in nilfs_fiemap()
Matthew Wilcox (Oracle) <[email protected]>
ocfs2: handle a symlink read error correctly
Heming Zhao <[email protected]>
ocfs2: fix incorrect CPU endianness conversion causing mount failure
Alex Williamson <[email protected]>
vfio/platform: check the bounds of read/write syscalls
Jennifer Berringer <[email protected]>
nvmem: core: improve range check for nvmem_cell_write()
Bartosz Golaszewski <[email protected]>
crypto: qce - unregister previously registered algos in error path
Bartosz Golaszewski <[email protected]>
crypto: qce - fix goto jump in error path
Ricardo Ribalda <[email protected]>
media: uvcvideo: Remove redundant NULL assignment
Ricardo Ribalda <[email protected]>
media: uvcvideo: Fix event flags in uvc_ctrl_send_events
Sam Bobrowicz <[email protected]>
media: ov5640: fix get_light_freq on auto
Krzysztof Kozlowski <[email protected]>
soc: qcom: smem_state: fix missing of_node_put in error path
Nathan Chancellor <[email protected]>
kbuild: Move -Wenum-enum-conversion to W=2
Narayana Murty N <[email protected]>
powerpc/pseries/eeh: Fix get PE state translation
Claudiu Beznea <[email protected]>
serial: sh-sci: Do not probe the serial port if its slot in sci_ports[] is in use
Claudiu Beznea <[email protected]>
serial: sh-sci: Drop __initdata macro for port_cfg
Stephan Gerhold <[email protected]>
soc: qcom: socinfo: Avoid out of bounds read of serial number
Thinh Nguyen <[email protected]>
usb: gadget: f_tcm: Don't prepare BOT write request twice
Thinh Nguyen <[email protected]>
usb: gadget: f_tcm: ep_autoconfig with fullspeed endpoint
Thinh Nguyen <[email protected]>
usb: gadget: f_tcm: Decrement command ref count on cleanup
Thinh Nguyen <[email protected]>
usb: gadget: f_tcm: Translate error to sense
Marcel Hamer <[email protected]>
wifi: brcmfmac: fix NULL pointer dereference in brcmf_txfinalize()
Heiko Stuebner <[email protected]>
HID: hid-sensor-hub: don't use stale platform-data on remove
Zijun Hu <[email protected]>
of: reserved-memory: Fix using wrong number of cells to get property 'alignment'
Zijun Hu <[email protected]>
of: Fix of_find_node_opts_by_path() handling of alias+path+options
Zijun Hu <[email protected]>
of: Correct child specifier used as input of the 2nd nexus node
Kuan-Wei Chiu <[email protected]>
perf bench: Fix undefined behavior in cmpworker()
Anastasia Belova <[email protected]>
clk: qcom: clk-rpmh: prevent integer overflow in recalc_rate
Gabor Juhos <[email protected]>
clk: qcom: clk-alpha-pll: fix alpha mode configuration
Fedor Pchelkin <[email protected]>
Bluetooth: L2CAP: handle NULL sock pointer in l2cap_sock_alloc
Haoxiang Li <[email protected]>
drm/komeda: Add check for komeda_get_layer_fourcc_list()
David Hildenbrand <[email protected]>
KVM: s390: vsie: fix some corner-cases when grabbing vsie pages
Sean Christopherson <[email protected]>
KVM: Explicitly verify target vCPU is online in kvm_get_vcpu()
Jakob Unterwurzacher <[email protected]>
arm64: dts: rockchip: increase gmac rx_delay on rk3399-puma
Dan Carpenter <[email protected]>
binfmt_flat: Fix integer overflow bug on 32 bit systems
Thomas Zimmermann <[email protected]>
m68k: vga: Fix I/O defines
Heiko Carstens <[email protected]>
s390/futex: Fix FUTEX_OP_ANDN implementation
Alexander Sverdlin <[email protected]>
leds: lp8860: Write full EEPROM, not only half of it
Viresh Kumar <[email protected]>
cpufreq: s3c64xx: Fix compilation warning
Willem de Bruijn <[email protected]>
tun: revert fix group permission check
Cong Wang <[email protected]>
netem: Update sch->q.qlen before qdisc_tree_reduce_backlog()
Eric Dumazet <[email protected]>
net: rose: lock the socket in rose_bind()
Yan Zhai <[email protected]>
udp: gso: do not drop small packets when PMTU reduces
Lenny Szubowicz <[email protected]>
tg3: Disable tg3 PCIe AER on system reboot
Hans Verkuil <[email protected]>
gpu: drm_dp_cec: fix broken CEC adapter properties check
Prasad Pandit <[email protected]>
firmware: iscsi_ibft: fix ISCSI_IBFT Kconfig entry
Daniel Wagner <[email protected]>
nvme: handle connectivity loss in nvme_set_queue_count
Michal Pecio <[email protected]>
usb: xhci: Fix NULL pointer dereference on certain command aborts
Hardik Gajjar <[email protected]>
usb: xhci: Add timeout argument in address_device USB HCD callback
Nikita Zhandarovich <[email protected]>
net: usb: rtl8150: enable basic endpoint checking
Emil Renner Berthing <[email protected]>
net: usb: rtl8150: use new tasklet API
Romain Perier <[email protected]>
tasklet: Introduce new initialization API
Thomas Weißschuh <[email protected]>
kbuild: userprogs: use correct lld when linking through clang
Toke Høiland-Jørgensen <[email protected]>
sched: sch_cake: add bounds checks to host bulk flow fairness counts
Ricardo Ribalda <[email protected]>
media: uvcvideo: Remove dangling pointers
Ricardo Ribalda <[email protected]>
media: uvcvideo: Only save async fh if success
Ryusuke Konishi <[email protected]>
nilfs2: handle errors that nilfs_prepare_chunk() may return
Ryusuke Konishi <[email protected]>
nilfs2: eliminate staggered calls to kunmap in nilfs_rename
Ryusuke Konishi <[email protected]>
nilfs2: move page release outside of nilfs_delete_entry and nilfs_set_link
Ralf Schlatterbeck <[email protected]>
spi-mxs: Fix chipselect glitch
Xi Ruoyao <[email protected]>
x86/mm: Don't disable PCID when INVLPG has been fixed by microcode
Borislav Petkov <[email protected]>
APEI: GHES: Have GHES honor the panic= setting
Even Xu <[email protected]>
HID: Wacom: Add PCI Wacom device support
Hans de Goede <[email protected]>
mfd: lpc_ich: Add another Gemini Lake ISA bridge PCI device-id
Tetsuo Handa <[email protected]>
tomoyo: don't emit warning in tomoyo_write_control()
Dmitry Antipov <[email protected]>
wifi: brcmsmac: add gain range check to wlc_phy_iqcal_gainparams_nphy()
Shawn Lin <[email protected]>
mmc: core: Respect quirk_max_rate for non-UHS SDIO card
Stas Sergeev <[email protected]>
tun: fix group permission check
Kuan-Wei Chiu <[email protected]>
printk: Fix signed integer overflow when defining LOG_BUF_LEN_MAX
Yazen Ghannam <[email protected]>
x86/amd_nb: Restrict init function to AMD-based systems
Suleiman Souhlal <[email protected]>
sched: Don't try to catch up excess steal time.
Josef Bacik <[email protected]>
btrfs: convert BUG_ON in btrfs_reloc_cow_block() to proper error handling
Filipe Manana <[email protected]>
btrfs: fix use-after-free when attempting to join an aborted transaction
Qu Wenruo <[email protected]>
btrfs: output the reason for open_ctree() failure
Thinh Nguyen <[email protected]>
usb: gadget: f_tcm: Don't free command immediately
Laurent Pinchart <[email protected]>
media: uvcvideo: Fix double free in error path
Alan Stern <[email protected]>
HID: core: Fix assumption that Resolution Multipliers must be in Logical Collections
Jos Wang <[email protected]>
usb: typec: tcpm: set SRC_SEND_CAPABILITIES timeout to PD_T_SENDER_RESPONSE
Sean Rhodes <[email protected]>
drivers/card_reader/rtsx_usb: Restore interrupt based detection
Ricardo B. Marliere <[email protected]>
ktest.pl: Check kernelrelease return in get_version
Chuck Lever <[email protected]>
NFSD: Reset cb_seq_status after NFS4ERR_DELAY
Lin Yujun <[email protected]>
hexagon: Fix unbalanced spinlock in die()
Willem de Bruijn <[email protected]>
hexagon: fix using plain integer as NULL pointer warning in cmpxchg
Masahiro Yamada <[email protected]>
genksyms: fix memory leak when the same symbol is read from *.symref file
Masahiro Yamada <[email protected]>
genksyms: fix memory leak when the same symbol is added from source
Kory Maincent <[email protected]>
net: sh_eth: Fix missing rtnl lock in suspend/resume path
Michal Luczaj <[email protected]>
vsock: Allow retrying on connect() failure
Howard Chu <[email protected]>
perf trace: Fix runtime error of index out of bounds
Chenyuan Yang <[email protected]>
net: davicom: fix UAF in dm9000_drv_remove
Eric Dumazet <[email protected]>
net: rose: fix timer races against user threads
Wentao Liang <[email protected]>
PM: hibernate: Add error handling for syscore_suspend()
Eric Dumazet <[email protected]>
ipmr: do not call mr_mfc_uses_dev() for unres entries
Dheeraj Reddy Jonnalagadda <[email protected]>
net: fec: implement TSO descriptor cleanup
pangliyuan <[email protected]>
ubifs: skip dumping tnc tree when zroot is null
Oleksij Rempel <[email protected]>
rtc: pcf85063: fix potential OOB write in PCF85063 NVMEM read
Joe Hattori <[email protected]>
dmaengine: ti: edma: fix OF node reference leaks in edma_driver
Sebastian Andrzej Siewior <[email protected]>
module: Extend the preempt disabled section in dereference_symbol_descriptor().
Su Yue <[email protected]>
ocfs2: mark dquot as inactive if failed to start trans while releasing dquot
Guixin Liu <[email protected]>
scsi: ufs: bsg: Delete bsg_dev when setting up bsg fails
Paul Menzel <[email protected]>
scsi: mpt3sas: Set ioc->manu_pg11.EEDPTagMode directly to 1
Joe Hattori <[email protected]>
staging: media: imx: fix OF node leak in imx_media_add_of_subdevs()
Ricardo Ribalda <[email protected]>
media: uvcvideo: Propagate buf->error to userspace
Jiasheng Jiang <[email protected]>
media: camif-core: Add check for clk_enable()
Jiasheng Jiang <[email protected]>
media: mipi-csis: Add check for clk_enable()
Zijun Hu <[email protected]>
PCI: endpoint: Destroy the EPC device in devm_pci_epc_destroy()
Chen Ni <[email protected]>
media: lmedm04: Handle errors for lme2510_int_read
Malcolm Priestley <[email protected]>
media: lmedm04: Use GFP_KERNEL for URB allocation/submission.
Oliver Neukum <[email protected]>
media: rc: iguanair: handle timeouts
Joe Hattori <[email protected]>
fbdev: omapfb: Fix an OF node leak in dss_of_port_get_parent_device()
Rafał Miłecki <[email protected]>
ARM: dts: mediatek: mt7623: fix IR nodename
Chen-Yu Tsai <[email protected]>
arm64: dts: mediatek: mt8173-evb: Fix MT6397 PMIC sub-node names
Chen-Yu Tsai <[email protected]>
arm64: dts: mediatek: mt8173-evb: Drop regulator-compatible property
Dan Carpenter <[email protected]>
rdma/cxgb4: Prevent potential integer overflow on 32bit
Leon Romanovsky <[email protected]>
RDMA/mlx4: Avoid false error about access to uninitialized gids array
Puranjay Mohan <[email protected]>
bpf: Send signals asynchronously if !preemptible
Jiachen Zhang <[email protected]>
perf report: Fix misleading help message about --demangle
Arnaldo Carvalho de Melo <[email protected]>
perf top: Don't complain about lack of vmlinux when not resolving some kernel samples
Thomas Weißschuh <[email protected]>
padata: fix sysfs store callback check
Ba Jing <[email protected]>
ktest.pl: Remove unused declarations in run_bisect_test function
Zhongqiu Han <[email protected]>
perf header: Fix one memory leakage in process_bpf_prog_info()
Zhongqiu Han <[email protected]>
perf header: Fix one memory leakage in process_bpf_btf()
George Lander <[email protected]>
ASoC: sun4i-spdif: Add clock multiplier settings
Marco Leogrande <[email protected]>
tools/testing/selftests/bpf/test_tc_tunnel.sh: Fix wait for server bind
Jamal Hadi Salim <[email protected]>
net: sched: Disallow replacing of child qdisc from one parent to another
Maher Sanalla <[email protected]>
net/mlxfw: Drop hard coded max FW flash image size
Liu Jian <[email protected]>
net: let net.core.dev_weight always be non-zero
Bo Gan <[email protected]>
clk: analogbits: Fix incorrect calculation of vco rate delta
Dmitry V. Levin <[email protected]>
selftests: harness: fix printing of mismatch values in __EXPECT()
Kees Cook <[email protected]>
selftests/harness: Display signed values correctly
Andreas Kemnade <[email protected]>
wifi: wlcore: fix unbalanced pm_runtime calls
Joe Hattori <[email protected]>
regulator: of: Implement the unwind path of of_regulator_match()
Octavian Purdila <[email protected]>
team: prevent adding a device which is already a team device lower
He Rongguang <[email protected]>
cpupower: fix TSC MHz calculation
Thadeu Lima de Souza Cascardo <[email protected]>
wifi: rtlwifi: pci: wait for firmware loading before releasing memory
Thadeu Lima de Souza Cascardo <[email protected]>
wifi: rtlwifi: fix memory leaks and invalid access at probe error path
Thadeu Lima de Souza Cascardo <[email protected]>
wifi: rtlwifi: remove unused check_buddy_priv
Dmitry Antipov <[email protected]>
wifi: rtlwifi: remove unused dualmac control leftovers
Dmitry Antipov <[email protected]>
wifi: rtlwifi: remove unused timer and related code
Jakob Koschel <[email protected]>
rtlwifi: replace usage of found with dedicated list iterator variable
Neil Armstrong <[email protected]>
dt-bindings: mmc: controller: clarify the address-cells description
Thadeu Lima de Souza Cascardo <[email protected]>
wifi: rtlwifi: usb: fix workqueue leak when probe fails
Thadeu Lima de Souza Cascardo <[email protected]>
wifi: rtlwifi: rtl8192se: rise completion of firmware loading as last step
Larry Finger <[email protected]>
rtlwifi: rtl8192se Rename RT_TRACE to rtl_dbg
Thadeu Lima de Souza Cascardo <[email protected]>
wifi: rtlwifi: do not complete firmware loading needlessly
Charles Han <[email protected]>
ipmi: ipmb: Add check devm_kasprintf() returned value
Ivan Stepchenko <[email protected]>
drm/amdgpu: Fix potential NULL pointer dereference in atomctrl_get_smc_sclk_range_table
Sui Jingfeng <[email protected]>
drm/etnaviv: Fix page property being used for non writecombine buffers
Randy Dunlap <[email protected]>
partitions: ldm: remove the initial kernel-doc notation
Yu Kuai <[email protected]>
nbd: don't allow reconnect after disconnect
David Howells <[email protected]>
afs: Fix directory format encoding struct
Kees Cook <[email protected]>
overflow: Allow mixed type arguments
Keith Busch <[email protected]>
overflow: Correct check_shl_overflow() comment
Kees Cook <[email protected]>
overflow: Add __must_check attribute to check_*() helpers
Ben Hutchings <[email protected]>
udf: Fix use of check_add_overflow() with mixed type arguments
Ben Hutchings <[email protected]>
perf cs-etm: Add missing variable in cs_etm__process_queues()
-------------
Diffstat:
.../devicetree/bindings/mmc/mmc-controller.yaml | 2 +- Makefile | 9 +- arch/alpha/include/uapi/asm/ptrace.h | 2 + arch/alpha/kernel/asm-offsets.c | 2 + arch/alpha/kernel/entry.S | 24 +-- arch/alpha/kernel/traps.c | 2 +- arch/alpha/mm/fault.c | 4 +- arch/arm/boot/dts/mt7623.dtsi | 2 +- arch/arm64/boot/dts/mediatek/mt8173-evb.dts | 25 +-- arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi | 2 +- arch/arm64/kernel/cacheinfo.c | 12 +- arch/hexagon/include/asm/cmpxchg.h | 2 +- arch/hexagon/kernel/traps.c | 4 +- arch/m68k/include/asm/vga.h | 8 +- arch/mips/kernel/ftrace.c | 2 +- arch/powerpc/include/asm/book3s/64/hash-4k.h | 28 +++ arch/powerpc/include/asm/book3s/64/pgtable.h | 26 --- arch/powerpc/lib/code-patching.c | 2 +- arch/powerpc/platforms/pseries/eeh_pseries.c | 6 +- arch/s390/include/asm/futex.h | 2 +- arch/s390/kvm/vsie.c | 25 ++- arch/x86/kernel/amd_nb.c | 4 + arch/x86/kernel/cpu/cacheinfo.c | 2 +- arch/x86/kernel/cpu/cyrix.c | 4 +- arch/x86/kernel/cpu/intel.c | 52 +++-- arch/x86/kernel/i8253.c | 11 +- arch/x86/mm/init.c | 32 +-- arch/x86/xen/mmu_pv.c | 79 +++++-- block/partitions/ldm.h | 2 +- block/partitions/mac.c | 18 +- crypto/testmgr.h | 227 +++++++++++++++------ drivers/acpi/apei/ghes.c | 10 +- drivers/base/bus.c | 2 + drivers/base/regmap/regmap-irq.c | 2 + drivers/block/nbd.c | 1 + drivers/char/ipmi/ipmb_dev_int.c | 3 + drivers/clk/analogbits/wrpll-cln28hpc.c | 2 +- drivers/clk/qcom/clk-alpha-pll.c | 2 + drivers/clk/qcom/clk-rpmh.c | 2 +- drivers/clocksource/i8253.c | 13 +- drivers/cpufreq/s3c64xx-cpufreq.c | 11 +- drivers/crypto/qce/core.c | 13 +- drivers/dma/ti/edma.c | 3 +- drivers/firmware/Kconfig | 2 +- drivers/gpio/gpio-bcm-kona.c | 71 +++++-- drivers/gpio/gpio-rcar.c | 7 +- drivers/gpio/gpio-stmpe.c | 15 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 16 ++ drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c | 2 + .../drm/arm/display/komeda/komeda_wb_connector.c | 4 + drivers/gpu/drm/drm_dp_cec.c | 14 +- drivers/gpu/drm/etnaviv/etnaviv_gem.c | 16 +- drivers/gpu/drm/radeon/r300.c | 3 +- drivers/gpu/drm/radeon/radeon_asic.h | 1 + drivers/gpu/drm/radeon/rs400.c | 18 +- drivers/gpu/drm/scheduler/gpu_scheduler_trace.h | 4 +- drivers/hid/hid-appleir.c | 2 +- drivers/hid/hid-core.c | 2 + drivers/hid/hid-google-hammer.c | 2 + drivers/hid/hid-multitouch.c | 5 +- drivers/hid/hid-sensor-hub.c | 21 +- drivers/hid/intel-ish-hid/ishtp-hid.c | 4 +- drivers/hid/wacom_wac.c | 5 + drivers/hwmon/ad7314.c | 10 + drivers/hwmon/ntc_thermistor.c | 66 +++--- drivers/hwmon/pmbus/pmbus.c | 2 + drivers/hwmon/xgene-hwmon.c | 2 +- drivers/hwtracing/intel_th/pci.c | 15 ++ drivers/infiniband/hw/cxgb4/device.c | 6 +- drivers/infiniband/hw/mlx4/main.c | 6 +- drivers/leds/leds-lp8860.c | 2 +- drivers/media/dvb-frontends/cxd2841er.c | 8 +- drivers/media/i2c/ov5640.c | 1 + drivers/media/platform/exynos4-is/mipi-csis.c | 10 +- drivers/media/platform/s3c-camif/camif-core.c | 13 +- drivers/media/rc/iguanair.c | 4 +- drivers/media/usb/dvb-usb-v2/lmedm04.c | 14 +- drivers/media/usb/uvc/uvc_ctrl.c | 85 ++++++-- drivers/media/usb/uvc/uvc_queue.c | 3 +- drivers/media/usb/uvc/uvc_status.c | 1 + drivers/media/usb/uvc/uvc_v4l2.c | 2 + drivers/media/usb/uvc/uvcvideo.h | 9 +- drivers/mfd/lpc_ich.c | 3 +- drivers/misc/eeprom/digsy_mtc_eeprom.c | 2 +- drivers/misc/fastrpc.c | 2 +- drivers/mmc/core/sdio.c | 2 + drivers/mtd/nand/onenand/onenand_base.c | 1 + drivers/net/caif/caif_virtio.c | 2 +- drivers/net/can/c_can/c_can_platform.c | 5 +- drivers/net/ethernet/broadcom/tg3.c | 58 ++++++ drivers/net/ethernet/cadence/macb.h | 2 + drivers/net/ethernet/cadence/macb_main.c | 12 +- drivers/net/ethernet/davicom/dm9000.c | 3 +- drivers/net/ethernet/emulex/benet/be.h | 2 +- drivers/net/ethernet/emulex/benet/be_cmds.c | 197 +++++++++--------- drivers/net/ethernet/emulex/benet/be_main.c | 2 +- drivers/net/ethernet/freescale/fec_main.c | 31 ++- drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c | 2 +- drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c | 2 - drivers/net/ethernet/netronome/nfp/bpf/cmsg.c | 2 + drivers/net/ethernet/renesas/sh_eth.c | 4 + drivers/net/geneve.c | 16 +- drivers/net/gtp.c | 5 - drivers/net/loopback.c | 14 ++ drivers/net/ppp/ppp_generic.c | 28 ++- drivers/net/team/team.c | 11 +- drivers/net/tun.c | 2 +- drivers/net/usb/gl620a.c | 4 +- drivers/net/usb/rtl8150.c | 28 ++- .../wireless/broadcom/brcm80211/brcmfmac/core.c | 5 + .../broadcom/brcm80211/brcmsmac/phy/phy_n.c | 3 + drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 2 +- drivers/net/wireless/realtek/rtlwifi/base.c | 36 +--- drivers/net/wireless/realtek/rtlwifi/base.h | 2 - drivers/net/wireless/realtek/rtlwifi/pci.c | 65 +----- .../net/wireless/realtek/rtlwifi/rtl8192se/dm.c | 42 ++-- .../net/wireless/realtek/rtlwifi/rtl8192se/fw.c | 40 ++-- .../net/wireless/realtek/rtlwifi/rtl8192se/hw.c | 157 +++++++------- .../net/wireless/realtek/rtlwifi/rtl8192se/led.c | 10 +- .../net/wireless/realtek/rtlwifi/rtl8192se/phy.c | 211 ++++++++++--------- .../net/wireless/realtek/rtlwifi/rtl8192se/rf.c | 70 +++---- .../net/wireless/realtek/rtlwifi/rtl8192se/sw.c | 11 +- .../net/wireless/realtek/rtlwifi/rtl8192se/trx.c | 10 +- drivers/net/wireless/realtek/rtlwifi/usb.c | 2 +- drivers/net/wireless/realtek/rtlwifi/wifi.h | 23 --- drivers/net/wireless/ti/wlcore/main.c | 10 +- drivers/nvme/host/core.c | 8 +- drivers/nvmem/core.c | 2 + drivers/of/base.c | 8 +- drivers/parport/parport_pc.c | 5 + drivers/pci/endpoint/pci-epc-core.c | 2 +- drivers/phy/samsung/phy-exynos5-usbdrd.c | 12 +- drivers/phy/tegra/xusb-tegra186.c | 11 + drivers/platform/x86/thinkpad_acpi.c | 1 + drivers/power/supply/da9150-fg.c | 4 +- drivers/pps/clients/pps-gpio.c | 4 +- drivers/pps/clients/pps-ktimer.c | 4 +- drivers/pps/clients/pps-ldisc.c | 6 +- drivers/pps/clients/pps_parport.c | 4 +- drivers/pps/kapi.c | 10 +- drivers/pps/kc.c | 10 +- drivers/pps/pps.c | 127 ++++++------ drivers/ptp/ptp_clock.c | 8 + drivers/rapidio/devices/rio_mport_cdev.c | 3 +- drivers/rapidio/rio-scan.c | 5 +- drivers/regulator/of_regulator.c | 14 +- drivers/rtc/rtc-pcf85063.c | 11 +- drivers/scsi/mpt3sas/mpt3sas_base.c | 3 +- drivers/scsi/storvsc_drv.c | 1 + drivers/scsi/ufs/ufs_bsg.c | 1 + drivers/slimbus/messaging.c | 5 +- drivers/soc/qcom/smem_state.c | 3 +- drivers/soc/qcom/socinfo.c | 2 +- drivers/spi/spi-mxs.c | 3 +- drivers/staging/media/imx/imx-media-of.c | 8 +- drivers/tee/optee/supp.c | 35 +--- drivers/tty/serial/8250/8250.h | 2 + drivers/tty/serial/8250/8250_dma.c | 16 ++ drivers/tty/serial/8250/8250_pci.c | 10 + drivers/tty/serial/8250/8250_port.c | 9 + drivers/tty/serial/sh-sci.c | 25 ++- drivers/usb/atm/cxacru.c | 13 +- drivers/usb/class/cdc-acm.c | 28 ++- drivers/usb/core/hub.c | 13 +- drivers/usb/core/quirks.c | 10 + drivers/usb/dwc2/gadget.c | 1 + drivers/usb/dwc3/gadget.c | 37 +++- drivers/usb/gadget/composite.c | 17 +- drivers/usb/gadget/function/f_midi.c | 22 +- drivers/usb/gadget/function/f_tcm.c | 54 ++--- drivers/usb/gadget/udc/renesas_usb3.c | 2 +- drivers/usb/host/pci-quirks.c | 9 + drivers/usb/host/xhci-mem.c | 2 + drivers/usb/host/xhci-pci.c | 8 +- drivers/usb/host/xhci-ring.c | 12 +- drivers/usb/host/xhci.c | 23 ++- drivers/usb/host/xhci.h | 9 +- drivers/usb/renesas_usbhs/common.c | 6 +- drivers/usb/renesas_usbhs/mod_gadget.c | 2 +- drivers/usb/roles/class.c | 5 +- drivers/usb/serial/option.c | 49 +++-- drivers/usb/typec/tcpm/tcpci_rt1711h.c | 11 + drivers/usb/typec/tcpm/tcpm.c | 2 +- drivers/usb/typec/ucsi/ucsi.c | 2 +- drivers/vfio/pci/vfio_pci_rdwr.c | 1 + drivers/vfio/platform/vfio_platform_common.c | 10 + drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 1 + fs/afs/xdr_fs.h | 2 +- fs/binfmt_flat.c | 2 +- fs/btrfs/inode.c | 4 +- fs/btrfs/relocation.c | 14 +- fs/btrfs/super.c | 2 +- fs/btrfs/transaction.c | 4 +- fs/nfsd/nfs4callback.c | 1 + fs/nilfs2/dir.c | 24 +-- fs/nilfs2/inode.c | 10 +- fs/nilfs2/mdt.c | 6 +- fs/nilfs2/namei.c | 37 ++-- fs/nilfs2/nilfs.h | 10 +- fs/nilfs2/page.c | 55 ++--- fs/nilfs2/page.h | 4 +- fs/nilfs2/segment.c | 4 +- fs/ocfs2/dir.c | 25 ++- fs/ocfs2/quota_global.c | 5 + fs/ocfs2/super.c | 2 +- fs/ocfs2/symlink.c | 5 +- fs/orangefs/orangefs-debugfs.c | 4 +- fs/squashfs/inode.c | 5 +- fs/ubifs/debug.c | 22 +- fs/udf/super.c | 2 +- include/linux/i8253.h | 1 + include/linux/interrupt.h | 28 ++- include/linux/kallsyms.h | 2 +- include/linux/kvm_host.h | 9 + include/linux/netdevice.h | 6 + include/linux/overflow.h | 101 +++++---- include/linux/pci_ids.h | 4 + include/linux/pps_kernel.h | 3 +- include/linux/usb/hcd.h | 5 +- include/net/flow_dissector.h | 16 ++ include/net/flow_offload.h | 6 + include/net/l3mdev.h | 2 + include/net/net_namespace.h | 15 +- include/trace/events/oom.h | 36 +++- kernel/acct.c | 141 ++++++++----- kernel/events/core.c | 17 +- kernel/padata.c | 2 +- kernel/power/hibernate.c | 7 +- kernel/printk/printk.c | 2 +- kernel/sched/core.c | 8 +- kernel/softirq.c | 18 +- kernel/trace/bpf_trace.c | 2 +- kernel/trace/ftrace.c | 27 ++- mm/memcontrol.c | 7 +- mm/oom_kill.c | 14 +- mm/page_alloc.c | 1 + net/8021q/vlan.c | 3 +- net/8021q/vlan.h | 2 +- net/8021q/vlan_dev.c | 15 +- net/8021q/vlan_netlink.c | 7 +- net/batman-adv/bat_v.c | 2 - net/batman-adv/bat_v_elp.c | 116 ++++++++--- net/batman-adv/bat_v_elp.h | 2 - net/batman-adv/types.h | 3 - net/bluetooth/l2cap_sock.c | 3 +- net/can/j1939/socket.c | 4 +- net/can/j1939/transport.c | 5 +- net/core/drop_monitor.c | 39 ++-- net/core/flow_dissector.c | 49 +++-- net/core/flow_offload.c | 7 + net/core/neighbour.c | 11 +- net/core/skbuff.c | 2 +- net/core/sysctl_net_core.c | 5 +- net/ipv4/arp.c | 4 +- net/ipv4/devinet.c | 3 +- net/ipv4/ipmr_base.c | 3 - net/ipv4/route.c | 8 +- net/ipv4/tcp_offload.c | 11 +- net/ipv4/udp.c | 4 +- net/ipv4/udp_offload.c | 8 +- net/ipv6/ila/ila_lwt.c | 4 +- net/ipv6/ndisc.c | 28 +-- net/ipv6/route.c | 7 +- net/ipv6/udp.c | 4 +- net/llc/llc_s_ac.c | 49 +++-- net/ncsi/ncsi-manage.c | 13 +- net/nfc/nci/hci.c | 2 + net/openvswitch/datapath.c | 12 +- net/rose/af_rose.c | 24 ++- net/rose/rose_timer.c | 15 ++ net/sched/cls_flower.c | 8 +- net/sched/sch_api.c | 4 + net/sched/sch_cake.c | 140 +++++++------ net/sched/sch_fifo.c | 3 + net/sched/sch_netem.c | 2 +- net/sunrpc/cache.c | 10 +- net/vmw_vsock/af_vsock.c | 5 + net/wireless/nl80211.c | 5 + net/wireless/reg.c | 3 +- scripts/Makefile.extrawarn | 5 +- scripts/genksyms/genksyms.c | 11 +- scripts/genksyms/genksyms.h | 2 +- scripts/genksyms/parse.y | 18 +- security/integrity/ima/ima_api.c | 16 +- security/integrity/ima/ima_template_lib.c | 17 +- security/tomoyo/common.c | 2 +- sound/pci/hda/hda_intel.c | 2 + sound/pci/hda/patch_conexant.c | 1 + sound/pci/hda/patch_realtek.c | 86 +++++++- sound/soc/codecs/es8328.c | 15 +- sound/soc/intel/boards/bytcr_rt5640.c | 17 +- sound/soc/sunxi/sun4i-spdif.c | 7 + tools/perf/bench/epoll-wait.c | 7 +- tools/perf/builtin-report.c | 2 +- tools/perf/builtin-top.c | 2 +- tools/perf/builtin-trace.c | 6 +- tools/perf/util/cs-etm.c | 2 +- tools/perf/util/env.c | 5 +- tools/perf/util/env.h | 2 +- tools/perf/util/header.c | 8 +- .../cpupower/utils/idle_monitor/mperf_monitor.c | 15 +- tools/testing/ktest/ktest.pl | 7 +- tools/testing/selftests/bpf/test_tc_tunnel.sh | 1 + tools/testing/selftests/kselftest_harness.h | 42 +++- tools/testing/selftests/net/udpgso.c | 26 +++ 305 files changed, 3058 insertions(+), 1680 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/328 perf cs-etm: Add missing variable in cs_etm__process_queues()
5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
Commit 5afd032961e8 "perf cs-etm: Don't flush when packet_queue fills up" uses i as a loop counter in cs_etm__process_queues(). It was backported to the 5.4 and 5.10 stable branches, but the i variable doesn't exist there as it was only added in 5.15.
Declare i with the expected type.
--- tools/perf/util/cs-etm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/cs-etm.c +1 -1
@@ -2139,7 +2139,7 @@ static int cs_etm__process_timeless_queustatic int cs_etm__process_queues (struct cs_etm_auxtrace *etm) {int ret =0 ; -unsigned int cs_queue_nr, queue_nr; +unsigned int cs_queue_nr, queue_nr, i;u8 trace_chan_id;u64 timestamp;struct auxtrace_queue *queue;
Greg Kroah-Hartman
maintainerPATCH 2/328 udf: Fix use of check_add_overflow() with mixed type arguments
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
Commit ebbe26fd54a9 "udf: Avoid excessive partition lengths" introduced a use of check_add_overflow() with argument types u32, size_t, and u32 *.
This was backported to the 5.x stable branches, where in 64-bit configurations it results in a build error (with older compilers) or a warning. Before commit d219d2a9a92e "overflow: Allow mixed type arguments", which went into Linux 6.1, mixed type arguments are not supported. That cannot be backported to 5.4 or 5.10 as it would raise the minimum compiler version for these kernel versions.
Add a cast to make the argument types compatible.
--- fs/udf/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/udf/super.c +1 -1
@@ -1160,7 +1160,7 @@ static int udf_fill_partdesc_info(struct map->s_partition_flags |=UDF_PART_FLAG_UNALLOC_BITMAP ;/* Check whether math over bitmap won't overflow. */ if (check_add_overflow (map->s_partition_len, -sizeof (struct spaceBitmapDesc ) <<3 , + (u32)(sizeof (struct spaceBitmapDesc ) <<3 ), &sum)) {udf_err (sb,"Partition %d is too long (%u)\n" , p_index, map->s_partition_len);
Greg Kroah-Hartman
maintainerPATCH 3/328 overflow: Add __must_check attribute to check_*() helpers
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
commit 9b80e4c4ddaca3501177ed41e49d0928ba2122a8 upstream.
Since the destination variable of the check_*_overflow() helpers will contain a wrapped value on failure, it would be best to make sure callers really did check the return result of the helper. Adjust the macros to use a bool-wrapping static inline that is marked with __must_check. This means the macros can continue to have their type-agnostic behavior while gaining the function attribute (that cannot be applied directly to macros).
--- include/linux/overflow.h | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-)
include/linux/overflow.h +24 -15
@@ -44,6 +44,16 @@#define is_non_negative (a) ((a) > 0 || (a) == 0)#define is_negative (a) (!(is_non_negative(a))) +/* +* Allows for effectively applying __must_check to a macro so we can have +* both the type-agnostic benefits of the macros while also being able to +* enforce that the return value is, in fact, checked. +*/ +static inline bool __must_check __must_check_overflow (bool overflow) +{ +return unlikely (overflow); +} +#ifdef COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW /* * For simplicity and code hygiene, the fallback code below insists on
@@ -53,32 +63,32 @@* alias for __builtin_add_overflow, but add type checks similar to * below. */ -#define check_add_overflow (a, b, d) ({ \ +#define check_add_overflow (a, b, d) __must_check_overflow(({ \ typeof(a) __a = (a); \ typeof(b) __b = (b); \ typeof(d) __d = (d); \ (void) (&__a == &__b); \ (void) (&__a == __d); \ __builtin_add_overflow(__a, __b, __d); \ -}) +})) -#define check_sub_overflow (a, b, d) ({ \ +#define check_sub_overflow (a, b, d) __must_check_overflow(({ \ typeof(a) __a = (a); \ typeof(b) __b = (b); \ typeof(d) __d = (d); \ (void) (&__a == &__b); \ (void) (&__a == __d); \ __builtin_sub_overflow(__a, __b, __d); \ -}) +})) -#define check_mul_overflow (a, b, d) ({ \ +#define check_mul_overflow (a, b, d) __must_check_overflow(({ \ typeof(a) __a = (a); \ typeof(b) __b = (b); \ typeof(d) __d = (d); \ (void) (&__a == &__b); \ (void) (&__a == __d); \ __builtin_mul_overflow(__a, __b, __d); \ -}) +}))#else
@@ -191,21 +201,20 @@ }) -#define check_add_overflow (a, b, d) \ +#define check_add_overflow (a, b, d) __must_check_overflow( \ __builtin_choose_expr(is_signed_type(typeof(a)), \ __signed_add_overflow(a, b, d), \ - __unsigned_add_overflow(a, b, d)) + __unsigned_add_overflow(a, b, d))) -#define check_sub_overflow (a, b, d) \ +#define check_sub_overflow (a, b, d) __must_check_overflow( \ __builtin_choose_expr(is_signed_type(typeof(a)), \ __signed_sub_overflow(a, b, d), \ - __unsigned_sub_overflow(a, b, d)) + __unsigned_sub_overflow(a, b, d))) -#define check_mul_overflow (a, b, d) \ +#define check_mul_overflow (a, b, d) __must_check_overflow( \ __builtin_choose_expr(is_signed_type(typeof(a)), \ __signed_mul_overflow(a, b, d), \ - __unsigned_mul_overflow(a, b, d)) - + __unsigned_mul_overflow(a, b, d)))#endif /* COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW */
@@ -228,7 +237,7 @@* '*d' will hold the results of the attempted shift, but is not * considered "safe for use" if false is returned. */ -#define check_shl_overflow (a, s, d) ({ \ +#define check_shl_overflow (a, s, d) __must_check_overflow(({ \ typeof(a) _a = a; \ typeof(s) _s = s; \ typeof(d) _d = d; \
@@ -238,7 +247,7 @@ *_d = (_a_full << _to_shift); \ (_to_shift != _s ||is_negative (*_d) ||is_negative (_a) || \ (*_d >> _to_shift) != _a); \ -}) +}))/** * size_mul() - Calculate size_t multiplication with saturation at SIZE_MAX
Greg Kroah-Hartman
maintainerPATCH 4/328 overflow: Correct check_shl_overflow() comment
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keith Busch <[email protected]>
commit 4578be130a6470d85ff05b13b75a00e6224eeeeb upstream.
A 'false' return means the value was safely set, so the comment should say 'true' for when it is not considered safe.
--- include/linux/overflow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/overflow.h +1 -1
@@ -235,7 +235,7 @@ static inline bool __must_check __must_c* - 'a << s' sets the sign bit, if any, in '*d'. * * '*d' will hold the results of the attempted shift, but is not -* considered "safe for use" if false is returned. +* considered "safe for use" if true is returned. */ #define check_shl_overflow (a, s, d) __must_check_overflow(({ \ typeof(a) _a = a; \
Greg Kroah-Hartman
maintainerPATCH 5/328 overflow: Allow mixed type arguments
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
commit d219d2a9a92e39aa92799efe8f2aa21259b6dd82 upstream.
When the check_[op]_overflow() helpers were introduced, all arguments were required to be the same type to make the fallback macros simpler. However, now that the fallback macros have been removed[1], it is fine to allow mixed types, which makes using the helpers much more useful, as they can be used to test for type-based overflows (e.g. adding two large ints but storing into a u8), as would be handy in the drm core[2].
Remove the restriction, and add additional self-tests that exercise some of the mixed-type overflow cases, and double-check for accidental macro side-effects.
[1] https://git.kernel.org/linus/4eb6bd55cfb22ffc20652732340c4962f3ac9a91
[2] https://lore.kernel.org/lkml/[email protected]
--- include/linux/overflow.h | 72 ++++++++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 31 deletions(-)
include/linux/overflow.h +41 -31
@@ -55,40 +55,50 @@ static inline bool __must_check __must_c }#ifdef COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW -/* -* For simplicity and code hygiene, the fallback code below insists on -* a, b and *d having the same type (similar to the min() and max() -* macros), whereas gcc's type-generic overflow checkers accept -* different types. Hence we don't just make check_add_overflow an -* alias for __builtin_add_overflow, but add type checks similar to -* below. +/** check_add_overflow() - Calculate addition with overflow checking +* +* @a: first addend +* @b: second addend +* @d: pointer to store sum +* +* Returns 0 on success. +* +* *@d holds the results of the attempted addition, but is not considered +* "safe for use" on a non-zero return value, which indicates that the +* sum has overflowed or been truncated. */ -#define check_add_overflow (a, b, d) __must_check_overflow(({ \ - typeof(a) __a = (a); \ - typeof(b) __b = (b); \ - typeof(d) __d = (d); \ - (void) (&__a == &__b); \ - (void) (&__a == __d); \ - __builtin_add_overflow(__a, __b, __d); \ -})) +#define check_add_overflow (a, b, d) \ + __must_check_overflow(__builtin_add_overflow(a, b, d)) -#define check_sub_overflow (a, b, d) __must_check_overflow(({ \ - typeof(a) __a = (a); \ - typeof(b) __b = (b); \ - typeof(d) __d = (d); \ - (void) (&__a == &__b); \ - (void) (&__a == __d); \ - __builtin_sub_overflow(__a, __b, __d); \ -})) +/** check_sub_overflow() - Calculate subtraction with overflow checking +* +* @a: minuend; value to subtract from +* @b: subtrahend; value to subtract from @a +* @d: pointer to store difference +* +* Returns 0 on success. +* +* *@d holds the results of the attempted subtraction, but is not considered +* "safe for use" on a non-zero return value, which indicates that the +* difference has underflowed or been truncated. +*/ +#define check_sub_overflow (a, b, d) \ + __must_check_overflow(__builtin_sub_overflow(a, b, d)) -#define check_mul_overflow (a, b, d) __must_check_overflow(({ \ - typeof(a) __a = (a); \ - typeof(b) __b = (b); \ - typeof(d) __d = (d); \ - (void) (&__a == &__b); \ - (void) (&__a == __d); \ - __builtin_mul_overflow(__a, __b, __d); \ -})) +/** check_mul_overflow() - Calculate multiplication with overflow checking +* +* @a: first factor +* @b: second factor +* @d: pointer to store product +* +* Returns 0 on success. +* +* *@d holds the results of the attempted multiplication, but is not +* considered "safe for use" on a non-zero return value, which indicates +* that the product has overflowed or been truncated. +*/ +#define check_mul_overflow (a, b, d) \ + __must_check_overflow(__builtin_mul_overflow(a, b, d))#else
Greg Kroah-Hartman
maintainerPATCH 6/328 afs: Fix directory format encoding struct
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 07a10767853adcbdbf436dc91393b729b52c4e81 ]
The AFS directory format structure, union afs_xdr_dir_block::meta, has too many alloc counter slots declared and so pushes the hash table along and over the data. This doesn't cause a problem at the moment because I'm currently ignoring the hash table and only using the correct number of alloc_ctrs in the code anyway. In future, however, I should start using the hash table to try and speed up afs_lookup().
Fix this by using the correct constant to declare the counter array.
--- fs/afs/xdr_fs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/afs/xdr_fs.h +1 -1
@@ -82,7 +82,7 @@ union afs_xdr_dir_block {struct {struct afs_xdr_dir_hdr hdr; -u8 alloc_ctrs[AFS_DIR_MAX_BLOCKS ]; +u8 alloc_ctrs[AFS_DIR_BLOCKS_WITH_CTR ];__be16 hashtable[AFS_DIR_HASHTBL_SIZE ]; } meta;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 7/328 nbd: dont allow reconnect after disconnect
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
[ Upstream commit 844b8cdc681612ff24df62cdefddeab5772fadf1 ]
Following process can cause nbd_config UAF:
1) grab nbd_config temporarily;
2) nbd_genl_disconnect() flush all recv_work() and release the initial reference:
nbd_genl_disconnect
nbd_disconnect_and_put
nbd_disconnect
flush_workqueue(nbd->recv_workq)
if (test_and_clear_bit(NBD_RT_HAS_CONFIG_REF, ...))
nbd_config_put
-> due to step 1), reference is still not zero3) nbd_genl_reconfigure() queue recv_work() again;
nbd_genl_reconfigure
config = nbd_get_config_unlocked(nbd)
if (!config)
-> succeed
if (!test_bit(NBD_RT_BOUND, ...))
-> succeed
nbd_reconnect_socket
queue_work(nbd->recv_workq, &args->work)
4) step 1) release the reference;
5) Finially, recv_work() will trigger UAF:
recv_work
nbd_config_put(nbd)
-> nbd_config is freed
atomic_dec(&config->recv_threads)
-> UAF
Fix the problem by clearing NBD_RT_BOUND in nbd_genl_disconnect(), so that nbd_genl_reconfigure() will fail.
--- drivers/block/nbd.c | 1 + 1 file changed, 1 insertion(+)
drivers/block/nbd.c +1 -0
@@ -2039,6 +2039,7 @@ static void nbd_disconnect_and_put(struct nbd_device *nbd)flush_workqueue (nbd->recv_workq);nbd_clear_que (nbd); nbd->task_setup =NULL ; +clear_bit (NBD_RT_BOUND , &nbd->config->runtime_flags);mutex_unlock (&nbd->config_lock); if (test_and_clear_bit(NBD_RT_HAS_CONFIG_REF,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 8/328 partitions: ldm: remove the initial kernel-doc notation
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit e494e451611a3de6ae95f99e8339210c157d70fb ]
Remove the file's first comment describing what the file is. This comment is not in kernel-doc format so it causes a kernel-doc warning.
ldm.h:13: warning: expecting prototype for ldm(). Prototype was for _FS_PT_LDM_H_() instead
--- block/partitions/ldm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/partitions/ldm.h +1 -1
@@ -1,5 +1,5 @@// SPDX-License-Identifier: GPL-2.0-or-later -/** +/* * ldm - Part of the Linux-NTFS project. * * Copyright (C) 2001,2002 Richard Russon <[email protected]>
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 9/328 drm/etnaviv: Fix page property being used for non writecombine buffers
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sui Jingfeng <[email protected]>
[ Upstream commit 834f304192834d6f0941954f3277ae0ba11a9a86 ]
In the etnaviv_gem_vmap_impl() function, the driver vmap whatever buffers with write combine(WC) page property, this is incorrect. Cached buffers should be mapped with the cached page property and uncached buffers should be mapped with the uncached page property.
--- drivers/gpu/drm/etnaviv/etnaviv_gem.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/etnaviv/etnaviv_gem.c +14 -2
@@ -350,6 +350,7 @@ void *etnaviv_gem_vmap(struct drm_gem_object *obj)static void *etnaviv_gem_vmap_impl (struct etnaviv_gem_object *obj) {struct page **pages; +pgprot_t prot;lockdep_assert_held (&obj->lock);
@@ -357,8 +358,19 @@ static void *etnaviv_gem_vmap_impl(struct etnaviv_gem_object *obj)if (IS_ERR (pages))return NULL ; -return vmap (pages, obj->base.size >>PAGE_SHIFT , -VM_MAP ,pgprot_writecombine (PAGE_KERNEL )); +switch (obj->flags &ETNA_BO_CACHE_MASK ) { +case ETNA_BO_CACHED : + prot =PAGE_KERNEL ; +break ; +case ETNA_BO_UNCACHED : + prot =pgprot_noncached (PAGE_KERNEL ); +break ; +case ETNA_BO_WC : +default : + prot =pgprot_writecombine (PAGE_KERNEL ); + } + +return vmap (pages, obj->base.size >>PAGE_SHIFT ,VM_MAP , prot); }static inline enum dma_data_direction etnaviv_op_to_dma_dir (u32 op)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 10/328 drm/amdgpu: Fix potential NULL pointer dereference in atomctrl_get_smc_sclk_range_table
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Stepchenko <[email protected]>
[ Upstream commit 357445e28ff004d7f10967aa93ddb4bffa5c3688 ]
The function atomctrl_get_smc_sclk_range_table() does not check the return value of smu_atom_get_data_table(). If smu_atom_get_data_table() fails to retrieve SMU_Info table, it returns NULL which is later dereferenced.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
In practice this should never happen as this code only gets called on polaris chips and the vbios data table will always be present on those chips.
--- drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c +2 -0
@@ -1369,6 +1369,8 @@ int atomctrl_get_smc_sclk_range_table(struct pp_hwmgr *hwmgr, struct pp_atom_ctrGetIndexIntoMasterTable (DATA , SMU_Info), &size, &frev, &crev); +if (!psmu_info) +return -EINVAL ;for (i =0 ; i < psmu_info->ucSclkEntryNum; i++) { table->entry[i].ucVco_setting = psmu_info->asSclkFcwRangeEntry[i].ucVco_setting;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 11/328 ipmi: ipmb: Add check devm_kasprintf() returned value
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Han <[email protected]>
[ Upstream commit 2378bd0b264ad3a1f76bd957caf33ee0c7945351 ]
devm_kasprintf() can return a NULL pointer on failure but this returned value is not checked.
Message-ID: <[email protected]>
--- drivers/char/ipmi/ipmb_dev_int.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/char/ipmi/ipmb_dev_int.c +3 -0
@@ -309,6 +309,9 @@ static int ipmb_probe(struct i2c_client *client, ipmb_dev->miscdev.name =devm_kasprintf (&client->dev,GFP_KERNEL ,"%s%d" ,"ipmb-" , client->adapter->nr); +if (!ipmb_dev->miscdev.name) +return -ENOMEM ; + ipmb_dev->miscdev.fops = &ipmb_fops; ipmb_dev->miscdev.parent = &client->dev; ret =misc_register (&ipmb_dev->miscdev);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 12/328 wifi: rtlwifi: do not complete firmware loading needlessly
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thadeu Lima de Souza Cascardo <[email protected]>
[ Upstream commit e73e11d303940119e41850a0452a0deda2cc4eb5 ]
The only code waiting for completion is driver removal, which will not be called when probe returns a failure. So this completion is unnecessary.
--- drivers/net/wireless/realtek/rtlwifi/pci.c | 1 - drivers/net/wireless/realtek/rtlwifi/usb.c | 1 - 2 files changed, 2 deletions(-)
drivers/net/wireless/realtek/rtlwifi/pci.c +0 -1
@@ -2282,7 +2282,6 @@ int rtl_pci_probe(struct pci_dev *pdev,pci_iounmap (pdev, (void __iomem *)rtlpriv->io.pci_mem_start);pci_release_regions (pdev); -complete (&rtlpriv->firmware_loading_complete); fail1:if (hw)
drivers/net/wireless/realtek/rtlwifi/usb.c +0 -1
@@ -1083,7 +1083,6 @@ int rtl_usb_probe(struct usb_interface *intf, error_out2:_rtl_usb_io_handler_release (hw);usb_put_dev (udev); -complete (&rtlpriv->firmware_loading_complete);kfree (rtlpriv->usb_data);return -ENODEV ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 13/328 rtlwifi: rtl8192se Rename RT_TRACE to rtl_dbg
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
[ Upstream commit fca8218d33f3f425aed1ca5d3e796ceb9cdfd0ee ]
Change the misleading macro name to one that is more descriptive for rtl8192se. Changes suggested by ckeckpatch.pl have been made.
Stable-dep-of: 8559a9e0c457 ("wifi: rtlwifi: rtl8192se: rise completion of firmware loading as last step")
--- .../wireless/realtek/rtlwifi/rtl8192se/dm.c | 42 ++-- .../wireless/realtek/rtlwifi/rtl8192se/fw.c | 40 ++-- .../wireless/realtek/rtlwifi/rtl8192se/hw.c | 157 +++++++------ .../wireless/realtek/rtlwifi/rtl8192se/led.c | 10 +- .../wireless/realtek/rtlwifi/rtl8192se/phy.c | 211 +++++++++--------- .../wireless/realtek/rtlwifi/rtl8192se/rf.c | 70 +++--- .../wireless/realtek/rtlwifi/rtl8192se/sw.c | 4 +- .../wireless/realtek/rtlwifi/rtl8192se/trx.c | 10 +- 8 files changed, 271 insertions(+), 273 deletions(-)
drivers/net/wireless/realtek/rtlwifi/rtl8192se/dm.c +21 -21
@@ -144,10 +144,10 @@ static void _rtl92s_dm_txpowertracking_callback_thermalmeter( thermalvalue = (u8 )rtl_get_rfreg (hw,RF90_PATH_A ,RF_T_METER ,0x1f ); -RT_TRACE (rtlpriv,COMP_POWER_TRACKING ,DBG_LOUD , -"Readback Thermal Meter = 0x%x pre thermal meter 0x%x eeprom_thermal meter 0x%x\n" , - thermalvalue, - rtlpriv->dm.thermalvalue, rtlefuse->eeprom_thermalmeter); +rtl_dbg (rtlpriv,COMP_POWER_TRACKING ,DBG_LOUD , +"Readback Thermal Meter = 0x%x pre thermal meter 0x%x eeprom_thermal meter 0x%x\n" , + thermalvalue, + rtlpriv->dm.thermalvalue, rtlefuse->eeprom_thermalmeter);if (thermalvalue) { rtlpriv->dm.thermalvalue = thermalvalue;
@@ -158,8 +158,8 @@ static void _rtl92s_dm_txpowertracking_callback_thermalmeter( (rtlpriv->efuse.thermalmeter[0 ] <<8 ) | (thermalvalue << 16)); -RT_TRACE (rtlpriv,COMP_POWER_TRACKING ,DBG_LOUD , -"Write to FW Thermal Val = 0x%x\n" , fw_cmd); +rtl_dbg (rtlpriv,COMP_POWER_TRACKING ,DBG_LOUD , +"Write to FW Thermal Val = 0x%x\n" , fw_cmd);rtl_write_dword (rtlpriv,WFM5 , fw_cmd);rtl92s_phy_chk_fwcmd_iodone (hw);
@@ -264,10 +264,10 @@ static void _rtl92s_dm_refresh_rateadaptive_mask(struct ieee80211_hw *hw) }if (ra->pre_ratr_state != ra->ratr_state) { -RT_TRACE (rtlpriv,COMP_RATE ,DBG_LOUD , -"RSSI = %ld RSSI_LEVEL = %d PreState = %d, CurState = %d\n" , - rtlpriv->dm.undec_sm_pwdb, ra->ratr_state, - ra->pre_ratr_state, ra->ratr_state); +rtl_dbg (rtlpriv,COMP_RATE ,DBG_LOUD , +"RSSI = %ld RSSI_LEVEL = %d PreState = %d, CurState = %d\n" , + rtlpriv->dm.undec_sm_pwdb, ra->ratr_state, + ra->pre_ratr_state, ra->ratr_state);rcu_read_lock (); sta =rtl_find_sta (hw, mac->bssid);
@@ -576,8 +576,8 @@ static void _rtl92s_dm_dynamic_txpower(struct ieee80211_hw *hw)if ((mac->link_state <MAC80211_LINKED ) && (rtlpriv->dm.entry_min_undec_sm_pwdb ==0 )) { -RT_TRACE (rtlpriv,COMP_POWER ,DBG_TRACE , -"Not connected to any\n" ); +rtl_dbg (rtlpriv,COMP_POWER ,DBG_TRACE , +"Not connected to any\n" ); rtlpriv->dm.dynamic_txhighpower_lvl =TX_HIGHPWR_LEVEL_NORMAL ;
@@ -588,21 +588,21 @@ static void _rtl92s_dm_dynamic_txpower(struct ieee80211_hw *hw)if (mac->link_state >=MAC80211_LINKED ) {if (mac->opmode ==NL80211_IFTYPE_ADHOC ) { undec_sm_pwdb = rtlpriv->dm.entry_min_undec_sm_pwdb; -RT_TRACE (rtlpriv,COMP_POWER ,DBG_LOUD , -"AP Client PWDB = 0x%lx\n" , - undec_sm_pwdb); +rtl_dbg (rtlpriv,COMP_POWER ,DBG_LOUD , +"AP Client PWDB = 0x%lx\n" , + undec_sm_pwdb); }else { undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb; -RT_TRACE (rtlpriv,COMP_POWER ,DBG_LOUD , -"STA Default Port PWDB = 0x%lx\n" , - undec_sm_pwdb); +rtl_dbg (rtlpriv,COMP_POWER ,DBG_LOUD , +"STA Default Port PWDB = 0x%lx\n" , + undec_sm_pwdb); } }else { undec_sm_pwdb = rtlpriv->dm.entry_min_undec_sm_pwdb; -RT_TRACE (rtlpriv,COMP_POWER ,DBG_LOUD , -"AP Ext Port PWDB = 0x%lx\n" , - undec_sm_pwdb); +rtl_dbg (rtlpriv,COMP_POWER ,DBG_LOUD , +"AP Ext Port PWDB = 0x%lx\n" , + undec_sm_pwdb); } txpwr_threshold_lv2 =TX_POWER_NEAR_FIELD_THRESH_LVL2 ;
drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.c +20 -20
@@ -39,8 +39,8 @@ static bool _rtl92s_firmware_enable_cpu(struct ieee80211_hw *hw) do { cpustatus = rtl_read_byte(rtlpriv, TCR); if (cpustatus & IMEM_RDY) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "IMEM Ready after CPU has refilled\n"); + rtl_dbg(rtlpriv, COMP_INIT, DBG_LOUD, + "IMEM Ready after CPU has refilled\n"); break; }
@@ -195,8 +195,8 @@ static bool _rtl92s_firmware_checkready(struct ieee80211_hw *hw,short pollingcnt =1000 ;bool rtstatus = true; -RT_TRACE (rtlpriv,COMP_INIT ,DBG_LOUD , -"LoadStaus(%d)\n" , loadfw_status); +rtl_dbg (rtlpriv,COMP_INIT ,DBG_LOUD , +"LoadStaus(%d)\n" , loadfw_status); firmware->fwstatus = (enum fw_status )loadfw_status;
@@ -256,9 +256,9 @@ static bool _rtl92s_firmware_checkready(struct ieee80211_hw *hw, goto status_check_fail; } -RT_TRACE (rtlpriv,COMP_INIT ,DBG_LOUD , -"DMEM code download success, cpustatus(%#x)\n" , - cpustatus); +rtl_dbg (rtlpriv,COMP_INIT ,DBG_LOUD , +"DMEM code download success, cpustatus(%#x)\n" , + cpustatus);/* Prevent Delay too much and being scheduled out */ /* Polling Load Firmware ready */
@@ -270,9 +270,9 @@ static bool _rtl92s_firmware_checkready(struct ieee80211_hw *hw,udelay (40 ); }while (pollingcnt--); -RT_TRACE (rtlpriv,COMP_INIT ,DBG_LOUD , -"Polling Load Firmware ready, cpustatus(%x)\n" , - cpustatus); +rtl_dbg (rtlpriv,COMP_INIT ,DBG_LOUD , +"Polling Load Firmware ready, cpustatus(%x)\n" , + cpustatus);if (((cpustatus &LOAD_FW_READY ) !=LOAD_FW_READY ) || (pollingcnt <=0 )) {
@@ -290,8 +290,8 @@ static bool _rtl92s_firmware_checkready(struct ieee80211_hw *hw,rtl_write_dword (rtlpriv,RCR , (tmpu4b |RCR_APPFCS |RCR_APP_ICV |RCR_APP_MIC )); -RT_TRACE (rtlpriv,COMP_INIT ,DBG_LOUD , -"Current RCR settings(%#x)\n" , tmpu4b); +rtl_dbg (rtlpriv,COMP_INIT ,DBG_LOUD , +"Current RCR settings(%#x)\n" , tmpu4b);/* Set to normal mode. */ rtl_write_byte (rtlpriv,LBKMD_SEL ,LBK_NORMAL );
@@ -304,9 +304,9 @@ static bool _rtl92s_firmware_checkready(struct ieee80211_hw *hw, } status_check_fail: -RT_TRACE (rtlpriv,COMP_INIT ,DBG_LOUD , -"loadfw_status(%d), rtstatus(%x)\n" , - loadfw_status, rtstatus); +rtl_dbg (rtlpriv,COMP_INIT ,DBG_LOUD , +"loadfw_status(%d), rtstatus(%x)\n" , + loadfw_status, rtstatus);return rtstatus; }
@@ -337,11 +337,11 @@ int rtl92s_download_fw(struct ieee80211_hw *hw) firmware->firmwareversion =byte (pfwheader->version,0 ); firmware->pfwheader->fwpriv.hci_sel =1 ;/* pcie */ -RT_TRACE (rtlpriv,COMP_INIT ,DBG_LOUD , -"signature:%x, version:%x, size:%x, imemsize:%x, sram size:%x\n" , - pfwheader->signature, - pfwheader->version, pfwheader->dmem_size, - pfwheader->img_imem_size, pfwheader->img_sram_size); +rtl_dbg (rtlpriv,COMP_INIT ,DBG_LOUD , +"signature:%x, version:%x, size:%x, imemsize:%x, sram size:%x\n" , + pfwheader->signature, + pfwheader->version, pfwheader->dmem_size, + pfwheader->img_imem_size, pfwheader->img_sram_size);/* 2. Retrieve IMEM image. */ if ((pfwheader->img_imem_size == 0) || (pfwheader->img_imem_size >
drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.c +78 -79
337 lines not on this page · raw message
drivers/net/wireless/realtek/rtlwifi/rtl8192se/led.c +5 -5
@@ -27,8 +27,8 @@ void rtl92se_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)u8 ledcfg;struct rtl_priv *rtlpriv =rtl_priv (hw); -RT_TRACE (rtlpriv,COMP_LED ,DBG_LOUD ,"LedAddr:%X ledpin=%d\n" , -LEDCFG , pled->ledpin); +rtl_dbg (rtlpriv,COMP_LED ,DBG_LOUD ,"LedAddr:%X ledpin=%d\n" , +LEDCFG , pled->ledpin); ledcfg =rtl_read_byte (rtlpriv,LEDCFG );
@@ -57,8 +57,8 @@ void rtl92se_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) rtlpriv =rtl_priv (hw);if (!rtlpriv || rtlpriv->max_fw_size)return ; -RT_TRACE (rtlpriv,COMP_LED ,DBG_LOUD ,"LedAddr:%X ledpin=%d\n" , -LEDCFG , pled->ledpin); +rtl_dbg (rtlpriv,COMP_LED ,DBG_LOUD ,"LedAddr:%X ledpin=%d\n" , +LEDCFG , pled->ledpin); ledcfg =rtl_read_byte (rtlpriv,LEDCFG );
@@ -119,7 +119,7 @@ void rtl92se_led_control(struct ieee80211_hw *hw, enum led_ctl_mode ledaction) ledaction == LED_CTL_POWER_ON)) {return ; } -RT_TRACE (rtlpriv,COMP_LED ,DBG_LOUD ,"ledaction %d\n" , ledaction); +rtl_dbg (rtlpriv,COMP_LED ,DBG_LOUD ,"ledaction %d\n" , ledaction);_rtl92se_sw_led_control (hw, ledaction); }
drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c +105 -106
455 lines not on this page · raw message
drivers/net/wireless/realtek/rtlwifi/rtl8192se/rf.c +35 -35
133 lines not on this page · raw message
drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c +2 -2
@@ -66,8 +66,8 @@ static void rtl92se_fw_cb(const struct firmware *firmware, void *context)struct rt_firmware *pfirmware =NULL ;char *fw_name ="rtlwifi/rtl8192sefw.bin" ; -RT_TRACE (rtlpriv,COMP_ERR ,DBG_LOUD , -"Firmware callback routine entered!\n" ); +rtl_dbg (rtlpriv,COMP_ERR ,DBG_LOUD , +"Firmware callback routine entered!\n" );complete (&rtlpriv->firmware_loading_complete);if (!firmware) {pr_err ("Firmware %s not available\n" , fw_name);
drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.c +5 -5
@@ -333,8 +333,8 @@ void rtl92se_tx_fill_desc(struct ieee80211_hw *hw,u8 bw_40 =0 ;if (pci_dma_mapping_error (rtlpci->pdev, mapping)) { -RT_TRACE (rtlpriv,COMP_SEND ,DBG_TRACE , -"DMA mapping error\n" ); +rtl_dbg (rtlpriv,COMP_SEND ,DBG_TRACE , +"DMA mapping error\n" );return ; }if (mac->opmode ==NL80211_IFTYPE_STATION ) {
@@ -487,7 +487,7 @@ void rtl92se_tx_fill_desc(struct ieee80211_hw *hw,/* DOWRD 8 */ SET_TX_DESC_TX_BUFFER_ADDRESS (pdesc, mapping); -RT_TRACE (rtlpriv,COMP_SEND ,DBG_TRACE ,"\n" ); +rtl_dbg (rtlpriv,COMP_SEND ,DBG_TRACE ,"\n" ); } void rtl92se_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc,
@@ -502,8 +502,8 @@ void rtl92se_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, PCI_DMA_TODEVICE);if (pci_dma_mapping_error (rtlpci->pdev, mapping)) { -RT_TRACE (rtlpriv,COMP_SEND ,DBG_TRACE , -"DMA mapping error\n" ); +rtl_dbg (rtlpriv,COMP_SEND ,DBG_TRACE , +"DMA mapping error\n" );return ; }/* Clear all status */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 14/328 wifi: rtlwifi: rtl8192se: rise completion of firmware loading as last step
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thadeu Lima de Souza Cascardo <[email protected]>
[ Upstream commit 8559a9e0c457729fe3edb3176bbf7c7874f482b0 ]
Just like in commit 4dfde294b979 ("rtlwifi: rise completion at the last step of firmware callback"), only signal completion once the function is finished. Otherwise, the module removal waiting for the completion could free the memory that the callback will still use before returning.
--- drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c +4 -3
@@ -68,22 +68,23 @@ static void rtl92se_fw_cb(const struct firmware *firmware, void *context)rtl_dbg (rtlpriv,COMP_ERR ,DBG_LOUD ,"Firmware callback routine entered!\n" ); -complete (&rtlpriv->firmware_loading_complete);if (!firmware) {pr_err ("Firmware %s not available\n" , fw_name); rtlpriv->max_fw_size =0 ; -return ; + goto exit; }if (firmware->size > rtlpriv->max_fw_size) {pr_err ("Firmware is too big!\n" ); rtlpriv->max_fw_size =0 ;release_firmware (firmware); -return ; + goto exit; } pfirmware = (struct rt_firmware *)rtlpriv->rtlhal.pfirmware;memcpy (pfirmware->sz_fw_tmpbuffer, firmware->data, firmware->size); pfirmware->sz_fw_tmpbufferlen = firmware->size;release_firmware (firmware); +exit: +complete (&rtlpriv->firmware_loading_complete); }static int rtl92s_init_sw_vars (struct ieee80211_hw *hw)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 15/328 wifi: rtlwifi: usb: fix workqueue leak when probe fails
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thadeu Lima de Souza Cascardo <[email protected]>
[ Upstream commit f79bc5c67867c19ce2762e7934c20dbb835ed82c ]
rtl_init_core creates a workqueue that is then assigned to rtl_wq. rtl_deinit_core does not destroy it. It is left to rtl_usb_deinit, which must be called in the probe error path.
--- drivers/net/wireless/realtek/rtlwifi/usb.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/realtek/rtlwifi/usb.c +1 -0
@@ -1079,6 +1079,7 @@ int rtl_usb_probe(struct usb_interface *intf,return 0 ; error_out: +rtl_usb_deinit (hw);rtl_deinit_core (hw); error_out2:_rtl_usb_io_handler_release (hw);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 16/328 dt-bindings: mmc: controller: clarify the address-cells description
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neil Armstrong <[email protected]>
[ Upstream commit b2b8e93ec00b8110cb37cbde5400d5abfdaed6a7 ]
The term "slot ID" has nothing to do with the SDIO function number which is specified in the reg property of the subnodes, rephrase the description to be more accurate.
Message-ID: <20241128-topic-amlogic-arm32-upstream-bindings-fixes-convert-meson-mx-sdio-v4-1-11d9f9200a59@linaro.org>
--- Documentation/devicetree/bindings/mmc/mmc-controller.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/mmc/mmc-controller.yaml +1 -1
@@ -21,7 +21,7 @@ properties: "#address-cells": const: 1 description: | - The cell is the slot ID if a function subnode is used. + The cell is the SDIO function number if a function subnode is used. "#size-cells": const: 0
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 17/328 rtlwifi: replace usage of found with dedicated list iterator variable
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakob Koschel <[email protected]>
[ Upstream commit a0ff2a87194a968b9547fd4d824a09092171d1ea ]
To move the list iterator variable into the list_for_each_entry_*() macro in the future it should be avoided to use the list iterator variable after the loop body.
To *never* use the list iterator variable after the loop it was concluded to use a separate iterator variable instead of a found boolean [1].
This removes the need to use a found variable and simply checking if the variable was set, can determine if the break/goto was hit.
Stable-dep-of: 2fdac64c3c35 ("wifi: rtlwifi: remove unused check_buddy_priv")
--- drivers/net/wireless/realtek/rtlwifi/base.c | 13 ++++++------- drivers/net/wireless/realtek/rtlwifi/pci.c | 15 +++++++-------- 2 files changed, 13 insertions(+), 15 deletions(-)
drivers/net/wireless/realtek/rtlwifi/base.c +6 -7
@@ -1995,8 +1995,7 @@ void rtl_collect_scan_list(struct ieee80211_hw *hw, struct sk_buff *skb)struct rtl_mac *mac =rtl_mac (rtl_priv (hw));unsigned long flags; -struct rtl_bssid_entry *entry; -bool entry_found = false; +struct rtl_bssid_entry *entry =NULL , *iter;/* check if it is scanning */ if (!mac->act_scanning)
@@ -2009,10 +2008,10 @@ void rtl_collect_scan_list(struct ieee80211_hw *hw, struct sk_buff *skb)spin_lock_irqsave (&rtlpriv->locks.scan_list_lock, flags); -list_for_each_entry (entry, &rtlpriv->scan_list.list, list) { -if (memcmp (entry->bssid, hdr->addr3,ETH_ALEN ) ==0 ) { -list_del_init (&entry->list); - entry_found = true; +list_for_each_entry (iter, &rtlpriv->scan_list.list, list) { +if (memcmp (iter->bssid, hdr->addr3,ETH_ALEN ) ==0 ) { +list_del_init (&iter->list); + entry = iter;rtl_dbg (rtlpriv,COMP_SCAN ,DBG_LOUD ,"Update BSSID=%pM to scan list (total=%d)\n" , hdr->addr3, rtlpriv->scan_list.num);
@@ -2020,7 +2019,7 @@ void rtl_collect_scan_list(struct ieee80211_hw *hw, struct sk_buff *skb) } } -if (!entry_found) { +if (!entry) { entry =kmalloc (sizeof (*entry),GFP_ATOMIC );if (!entry)
drivers/net/wireless/realtek/rtlwifi/pci.c +7 -8
@@ -300,14 +300,13 @@ static bool rtl_pci_check_buddy_priv(struct ieee80211_hw *hw, {struct rtl_priv *rtlpriv =rtl_priv (hw);struct rtl_pci_priv *pcipriv =rtl_pcipriv (hw); -bool find_buddy_priv = false; -struct rtl_priv *tpriv; +struct rtl_priv *tpriv =NULL , *iter;struct rtl_pci_priv *tpcipriv =NULL ;if (!list_empty (&rtlpriv->glb_var->glb_priv_list)) { -list_for_each_entry (tpriv, &rtlpriv->glb_var->glb_priv_list, +list_for_each_entry (iter, &rtlpriv->glb_var->glb_priv_list, list) { - tpcipriv = (struct rtl_pci_priv *)tpriv->priv; + tpcipriv = (struct rtl_pci_priv *)iter->priv;rtl_dbg (rtlpriv,COMP_INIT ,DBG_LOUD ,"pcipriv->ndis_adapter.funcnumber %x\n" , pcipriv->ndis_adapter.funcnumber);
@@ -321,19 +320,19 @@ static bool rtl_pci_check_buddy_priv(struct ieee80211_hw *hw, tpcipriv->ndis_adapter.devnumber && pcipriv->ndis_adapter.funcnumber != tpcipriv->ndis_adapter.funcnumber) { - find_buddy_priv = true; + tpriv = iter;break ; } } }rtl_dbg (rtlpriv,COMP_INIT ,DBG_LOUD , -"find_buddy_priv %d\n" , find_buddy_priv); +"find_buddy_priv %d\n" , tpriv !=NULL ); -if (find_buddy_priv) +if (tpriv) *buddy_priv = tpriv; -return find_buddy_priv; +return tpriv !=NULL ; } static void rtl_pci_parse_configuration(struct pci_dev *pdev,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 18/328 wifi: rtlwifi: remove unused timer and related code
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Antipov <[email protected]>
[ Upstream commit 358b94f0a7cadd2ec7824531d54dadaa8b71de04 ]
Drop unused 'dualmac_easyconcurrent_retrytimer' of 'struct rtl_works', corresponding 'rtl_easy_concurrent_retrytimer_callback()' handler, 'dualmac_easy_concurrent' function pointer of 'struct rtl_hal_ops' and related call to 'timer_setup()' in '_rtl_init_deferred_work()'.
Stable-dep-of: 2fdac64c3c35 ("wifi: rtlwifi: remove unused check_buddy_priv")
--- drivers/net/wireless/realtek/rtlwifi/base.c | 16 +--------------- drivers/net/wireless/realtek/rtlwifi/base.h | 1 - drivers/net/wireless/realtek/rtlwifi/wifi.h | 2 -- 3 files changed, 1 insertion(+), 18 deletions(-)
drivers/net/wireless/realtek/rtlwifi/base.c +1 -15
@@ -448,8 +448,7 @@ static int _rtl_init_deferred_work(struct ieee80211_hw *hw)/* <1> timer */ timer_setup (&rtlpriv->works.watchdog_timer, rtl_watch_dog_timer_callback,0 ); -timer_setup (&rtlpriv->works.dualmac_easyconcurrent_retrytimer, - rtl_easy_concurrent_retrytimer_callback,0 ); +/* <2> work queue */ rtlpriv->works.hw = hw; rtlpriv->works.rtl_wq = wq;
@@ -2378,19 +2377,6 @@ void rtl_c2hcmd_wq_callback(void *data)rtl_c2hcmd_launcher (hw,1 ); } -void rtl_easy_concurrent_retrytimer_callback (struct timer_list *t) -{ -struct rtl_priv *rtlpriv = -from_timer (rtlpriv, t, works.dualmac_easyconcurrent_retrytimer); -struct ieee80211_hw *hw = rtlpriv->hw; -struct rtl_priv *buddy_priv = rtlpriv->buddy_priv; - -if (buddy_priv ==NULL ) -return ; - - rtlpriv->cfg->ops->dualmac_easy_concurrent (hw); -} -/********************************************************* * * frame process functions
drivers/net/wireless/realtek/rtlwifi/base.h +0 -1
@@ -127,7 +127,6 @@ int rtl_send_smps_action(struct ieee80211_hw *hw,u8 *rtl_find_ie (u8 *data,unsigned int len,u8 ie);void rtl_recognize_peer (struct ieee80211_hw *hw,u8 *data,unsigned int len);u8 rtl_tid_to_ac (u8 tid); -void rtl_easy_concurrent_retrytimer_callback (struct timer_list *t);extern struct rtl_global_var rtl_global_var;void rtl_phy_scan_operation_backup (struct ieee80211_hw *hw,u8 operation);
drivers/net/wireless/realtek/rtlwifi/wifi.h +0 -2
@@ -2302,7 +2302,6 @@ struct rtl_hal_ops { u32 regaddr, u32 bitmask, u32 data);void (*linked_set_reg)(struct ieee80211_hw *hw);void (*chk_switch_dmdp)(struct ieee80211_hw *hw); -void (*dualmac_easy_concurrent)(struct ieee80211_hw *hw);void (*dualmac_switch_to_dmdp)(struct ieee80211_hw *hw);bool (*phy_rf6052_config)(struct ieee80211_hw *hw); void (*phy_rf6052_set_cck_txpower)(struct ieee80211_hw *hw,
@@ -2468,7 +2467,6 @@ struct rtl_works {/*timer */ struct timer_list watchdog_timer; -struct timer_list dualmac_easyconcurrent_retrytimer;struct timer_list fw_clockoff_timer;struct timer_list fast_antenna_training_timer;/*task */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 19/328 wifi: rtlwifi: remove unused dualmac control leftovers
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Antipov <[email protected]>
[ Upstream commit 557123259200b30863e1b6a8f24a8c8060b6fc1d ]
Remove 'struct rtl_dualmac_easy_concurrent_ctl' of 'struct rtl_priv' and related code in '_rtl_pci_tx_chk_waitq()'.
Stable-dep-of: 2fdac64c3c35 ("wifi: rtlwifi: remove unused check_buddy_priv")
--- drivers/net/wireless/realtek/rtlwifi/pci.c | 5 ----- drivers/net/wireless/realtek/rtlwifi/wifi.h | 9 --------- 2 files changed, 14 deletions(-)
drivers/net/wireless/realtek/rtlwifi/pci.c +0 -5
@@ -443,11 +443,6 @@ static void _rtl_pci_tx_chk_waitq(struct ieee80211_hw *hw)if (!rtlpriv->rtlhal.earlymode_enable)return ; -if (rtlpriv->dm.supp_phymode_switch && - (rtlpriv->easy_concurrent_ctl.switch_in_process || - (rtlpriv->buddy_priv && - rtlpriv->buddy_priv->easy_concurrent_ctl.switch_in_process))) -return ;/* we just use em for BE/BK/VI/VO */ for (tid =7 ; tid >=0 ; tid--) {u8 hw_queue = ac_to_hwq[rtl_tid_to_ac (tid)];
drivers/net/wireless/realtek/rtlwifi/wifi.h +0 -9
@@ -2498,14 +2498,6 @@ struct rtl_debug {#define MIMO_PS_DYNAMIC 1#define MIMO_PS_NOLIMIT 3 -struct rtl_dualmac_easy_concurrent_ctl { -enum band_type currentbandtype_backfordmdp; -bool close_bbandrf_for_dmsp; -bool change_to_dmdp; -bool change_to_dmsp; -bool switch_in_process; -}; -struct rtl_dmsp_ctl {bool activescan_for_slaveofdmsp;bool scan_for_anothermac_fordmsp;
@@ -2746,7 +2738,6 @@ struct rtl_priv {struct list_head list;struct rtl_priv *buddy_priv;struct rtl_global_var *glb_var; -struct rtl_dualmac_easy_concurrent_ctl easy_concurrent_ctl;struct rtl_dmsp_ctl dmsp_ctl;struct rtl_locks locks;struct rtl_works works;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 20/328 wifi: rtlwifi: remove unused check_buddy_priv
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thadeu Lima de Souza Cascardo <[email protected]>
[ Upstream commit 2fdac64c3c35858aa8ac5caa70b232e03456e120 ]
Commit 2461c7d60f9f ("rtlwifi: Update header file") introduced a global list of private data structures.
Later on, commit 26634c4b1868 ("rtlwifi Modify existing bits to match vendor version 2013.02.07") started adding the private data to that list at probe time and added a hook, check_buddy_priv to find the private data from a similar device.
However, that function was never used.
Besides, though there is a lock for that list, it is never used. And when the probe fails, the private data is never removed from the list. This would cause a second probe to access freed memory.
Remove the unused hook, structures and members, which will prevent the potential race condition on the list and its corruption during a second probe when probe fails.
--- drivers/net/wireless/realtek/rtlwifi/base.c | 7 ---- drivers/net/wireless/realtek/rtlwifi/base.h | 1 - drivers/net/wireless/realtek/rtlwifi/pci.c | 44 --------------------- drivers/net/wireless/realtek/rtlwifi/wifi.h | 12 ------ 4 files changed, 64 deletions(-)
drivers/net/wireless/realtek/rtlwifi/base.c +0 -7
@@ -2722,9 +2722,6 @@ MODULE_AUTHOR("Larry Finger <[email protected]>");MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("Realtek 802.11n PCI wireless core" ); -struct rtl_global_var rtl_global_var = {}; -EXPORT_SYMBOL_GPL (rtl_global_var); -static int __init rtl_core_module_init (void ) {BUILD_BUG_ON (TX_PWR_BY_RATE_NUM_RATE <TX_PWR_BY_RATE_NUM_SECTION );
@@ -2738,10 +2735,6 @@ static int __init rtl_core_module_init(void)/* add debugfs */ rtl_debugfs_add_topdir (); -/* init some global vars */ -INIT_LIST_HEAD (&rtl_global_var.glb_priv_list); -spin_lock_init (&rtl_global_var.glb_list_lock); -return 0 ; }
drivers/net/wireless/realtek/rtlwifi/base.h +0 -1
@@ -127,7 +127,6 @@ int rtl_send_smps_action(struct ieee80211_hw *hw,u8 *rtl_find_ie (u8 *data,unsigned int len,u8 ie);void rtl_recognize_peer (struct ieee80211_hw *hw,u8 *data,unsigned int len);u8 rtl_tid_to_ac (u8 tid); -extern struct rtl_global_var rtl_global_var;void rtl_phy_scan_operation_backup (struct ieee80211_hw *hw,u8 operation);#endif
drivers/net/wireless/realtek/rtlwifi/pci.c +0 -44
74 lines not on this page · raw message
drivers/net/wireless/realtek/rtlwifi/wifi.h +0 -12
@@ -2337,8 +2337,6 @@ struct rtl_intf_ops {void (*read_efuse_byte)(struct ieee80211_hw *hw,u16 _offset,u8 *pbuf);int (*adapter_start)(struct ieee80211_hw *hw);void (*adapter_stop)(struct ieee80211_hw *hw); -bool (*check_buddy_priv)(struct ieee80211_hw *hw, -struct rtl_priv **buddy_priv); int (*adapter_tx)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
@@ -2582,14 +2580,6 @@ struct dig_t {u32 rssi_max; }; -struct rtl_global_var { -/* from this list we can get -* other adapter's rtl_priv -*/ -struct list_head glb_priv_list; -spinlock_t glb_list_lock; -}; -#define IN_4WAY_TIMEOUT_TIME (30 * MSEC_PER_SEC)/* 30 seconds */ struct rtl_btc_info {
@@ -2735,9 +2725,7 @@ struct rtl_scan_list {struct rtl_priv {struct ieee80211_hw *hw;struct completion firmware_loading_complete; -struct list_head list;struct rtl_priv *buddy_priv; -struct rtl_global_var *glb_var;struct rtl_dmsp_ctl dmsp_ctl;struct rtl_locks locks;struct rtl_works works;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 21/328 wifi: rtlwifi: fix memory leaks and invalid access at probe error path
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thadeu Lima de Souza Cascardo <[email protected]>
[ Upstream commit e7ceefbfd8d447abc8aca8ab993a942803522c06 ]
Deinitialize at reverse order when probe fails.
When init_sw_vars fails, rtl_deinit_core should not be called, specially now that it destroys the rtl_wq workqueue.
And call rtl_pci_deinit and deinit_sw_vars, otherwise, memory will be leaked.
Remove pci_set_drvdata call as it will already be cleaned up by the core driver code and could lead to memory leaks too. cf. commit 8d450935ae7f ("wireless: rtlwifi: remove unnecessary pci_set_drvdata()") and commit 3d86b93064c7 ("rtlwifi: Fix PCI probe error path orphaned memory").
--- drivers/net/wireless/realtek/rtlwifi/pci.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/net/wireless/realtek/rtlwifi/pci.c +8 -5
@@ -2177,7 +2177,7 @@ int rtl_pci_probe(struct pci_dev *pdev,if (rtlpriv->cfg->ops->init_sw_vars (hw)) {pr_err ("Can't init_sw_vars\n" ); err = -ENODEV ; - goto fail3; + goto fail2; } rtlpriv->cfg->ops->init_sw_leds (hw);
@@ -2195,14 +2195,14 @@ int rtl_pci_probe(struct pci_dev *pdev, err =rtl_pci_init (hw, pdev);if (err) {pr_err ("Failed to init PCI\n" ); - goto fail3; + goto fail4; } err =ieee80211_register_hw (hw);if (err) {pr_err ("Can't register mac80211 hw.\n" ); err = -ENODEV ; - goto fail3; + goto fail5; } rtlpriv->mac80211.mac80211_registered =1 ;
@@ -2225,9 +2225,12 @@ int rtl_pci_probe(struct pci_dev *pdev,set_bit (RTL_STATUS_INTERFACE_START , &rtlpriv->status);return 0 ; -fail3: -pci_set_drvdata (pdev,NULL ); +fail5: +rtl_pci_deinit (hw); +fail4:rtl_deinit_core (hw); +fail3: + rtlpriv->cfg->ops->deinit_sw_vars (hw); fail2:if (rtlpriv->io.pci_mem_start !=0 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 22/328 wifi: rtlwifi: pci: wait for firmware loading before releasing memory
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thadeu Lima de Souza Cascardo <[email protected]>
[ Upstream commit b59b86c5d08be7d761c04affcbcec8184738c200 ]
At probe error path, the firmware loading work may have already been queued. In such a case, it will try to access memory allocated by the probe function, which is about to be released. In such paths, wait for the firmware worker to finish before releasing memory.
--- drivers/net/wireless/realtek/rtlwifi/pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/realtek/rtlwifi/pci.c +1 -0
@@ -2230,6 +2230,7 @@ int rtl_pci_probe(struct pci_dev *pdev, fail4:rtl_deinit_core (hw); fail3: +wait_for_completion (&rtlpriv->firmware_loading_complete); rtlpriv->cfg->ops->deinit_sw_vars (hw); fail2:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 23/328 cpupower: fix TSC MHz calculation
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: He Rongguang <[email protected]>
[ Upstream commit 9d6c0e58514f8b57cd9c2c755e41623d6a966025 ]
Commit 'cpupower: Make TSC read per CPU for Mperf monitor' (c2adb1877b7) changes TSC counter reads per cpu, but left time diff global (from start of all cpus to end of all cpus), thus diff(time) is too large for a cpu's tsc counting, resulting in far less than acutal TSC_Mhz and thus cpupower monitor showing far less than actual cpu realtime frequency.
/proc/cpuinfo shows frequency:
cat /proc/cpuinfo | egrep -e 'processor' -e 'MHz'
...
processor : 171
cpu MHz : 4108.498
...
before fix (System 100% busy):
| Mperf || Idle_Stats CPU| C0 | Cx | Freq || POLL | C1 | C2 171| 0.77| 99.23| 2279|| 0.00| 0.00| 0.00
after fix (System 100% busy):
| Mperf || Idle_Stats CPU| C0 | Cx | Freq || POLL | C1 | C2 171| 0.46| 99.54| 4095|| 0.00| 0.00| 0.00
--- .../cpupower/utils/idle_monitor/mperf_monitor.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
tools/power/cpupower/utils/idle_monitor/mperf_monitor.c +9 -6
@@ -29,7 +29,7 @@ static int mperf_get_count_percent(unsigned int self_id, double *percent, unsigned int cpu);static int mperf_get_count_freq (unsigned int id,unsigned long long *count,unsigned int cpu); -static struct timespec time_start, time_end; +static struct timespec *time_start, *time_end;static cstate_t mperf_cstates[MPERF_CSTATE_COUNT ] = { {
@@ -135,7 +135,7 @@ static int mperf_get_count_percent(unsigned int id, double *percent,dprint ("%s: TSC Ref - mperf_diff: %llu, tsc_diff: %llu\n" , mperf_cstates[id].name, mperf_diff, tsc_diff); }else if (max_freq_mode ==MAX_FREQ_SYSFS ) { - timediff = max_frequency *timespec_diff_us (time_start, time_end); + timediff = max_frequency *timespec_diff_us (time_start[cpu], time_end[cpu]); *percent =100.0 * mperf_diff / timediff;dprint ("%s: MAXFREQ - mperf_diff: %llu, time_diff: %llu\n" , mperf_cstates[id].name, mperf_diff, timediff);
@@ -168,7 +168,7 @@ static int mperf_get_count_freq(unsigned int id, unsigned long long *count,if (max_freq_mode ==MAX_FREQ_TSC_REF ) {/* Calculate max_freq from TSC count */ tsc_diff = tsc_at_measure_end[cpu] - tsc_at_measure_start[cpu]; - time_diff =timespec_diff_us (time_start, time_end); + time_diff =timespec_diff_us (time_start[cpu], time_end[cpu]); max_frequency = tsc_diff / time_diff; }
@@ -187,9 +187,8 @@ static int mperf_start(void) {int cpu; -clock_gettime (CLOCK_REALTIME , &time_start); -for (cpu =0 ; cpu < cpu_count; cpu++) { +clock_gettime (CLOCK_REALTIME , &time_start[cpu]);mperf_get_tsc (&tsc_at_measure_start[cpu]);mperf_init_stats (cpu); }
@@ -204,9 +203,9 @@ static int mperf_stop(void)for (cpu =0 ; cpu < cpu_count; cpu++) {mperf_measure_stats (cpu);mperf_get_tsc (&tsc_at_measure_end[cpu]); +clock_gettime (CLOCK_REALTIME , &time_end[cpu]); } -clock_gettime (CLOCK_REALTIME , &time_end);return 0 ; }
@@ -307,6 +306,8 @@ struct cpuidle_monitor *mperf_register(void) aperf_current_count =calloc (cpu_count,sizeof (unsigned long long )); tsc_at_measure_start =calloc (cpu_count,sizeof (unsigned long long )); tsc_at_measure_end =calloc (cpu_count,sizeof (unsigned long long )); + time_start =calloc (cpu_count,sizeof (struct timespec )); + time_end =calloc (cpu_count,sizeof (struct timespec )); mperf_monitor.name_len =strlen (mperf_monitor.name);return &mperf_monitor; }
@@ -319,6 +320,8 @@ void mperf_unregister(void)free (aperf_current_count);free (tsc_at_measure_start);free (tsc_at_measure_end); +free (time_start); +free (time_end);free (is_valid); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 24/328 team: prevent adding a device which is already a team device lower
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Octavian Purdila <[email protected]>
[ Upstream commit 3fff5da4ca2164bb4d0f1e6cd33f6eb8a0e73e50 ]
Prevent adding a device which is already a team device lower, e.g. adding veth0 if vlan1 was already added and veth0 is a lower of vlan1.
This is not useful in practice and can lead to recursive locking:
$ ip link add veth0 type veth peer name veth1 $ ip link set veth0 up $ ip link set veth1 up $ ip link add link veth0 name veth0.1 type vlan protocol 802.1Q id 1 $ ip link add team0 type team $ ip link set veth0.1 down $ ip link set veth0.1 master team0 team0: Port device veth0.1 added $ ip link set veth0 down $ ip link set veth0 master team0
============================================
WARNING: possible recursive locking detected
6.13.0-rc2-virtme-00441-ga14a429069bb #46 Not tainted
--------------------------------------------
ip/7684 is trying to acquire lock:ffff888016848e00 (team->team_lock_key){+.+.}-{4:4}, at: team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973)
but task is already holding lock:ffff888016848e00 (team->team_lock_key){+.+.}-{4:4}, at: team_add_slave (drivers/net/team/team_core.c:1147 drivers/net/team/team_core.c:1977)
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----lock(team->team_lock_key);lock(team->team_lock_key);
*** DEADLOCK ***
May be due to missing lock nesting notation
2 locks held by ip/7684:
stack backtrace: CPU: 3 UID: 0 PID: 7684 Comm: ip Not tainted 6.13.0-rc2-virtme-00441-ga14a429069bb #46 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: <TASK>
dump_stack_lvl (lib/dump_stack.c:122)
print_deadlock_bug.cold (kernel/locking/lockdep.c:3040) __lock_acquire (kernel/locking/lockdep.c:3893 kernel/locking/lockdep.c:5226) ? netlink_broadcast_filtered (net/netlink/af_netlink.c:1548)
lock_acquire.part.0 (kernel/locking/lockdep.c:467 kernel/locking/lockdep.c:5851) ? team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973) ? trace_lock_acquire (./include/trace/events/lock.h:24 (discriminator 2)) ? team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973) ? lock_acquire (kernel/locking/lockdep.c:5822) ? team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973) __mutex_lock (kernel/locking/mutex.c:587 kernel/locking/mutex.c:735) ? team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973) ? team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973) ? fib_sync_up (net/ipv4/fib_semantics.c:2167) ? team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973) team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973)
notifier_call_chain (kernel/notifier.c:85) call_netdevice_notifiers_info (net/core/dev.c:1996) __dev_notify_flags (net/core/dev.c:8993)
? __dev_change_flags (net/core/dev.c:8975) dev_change_flags (net/core/dev.c:9027) vlan_device_event (net/8021q/vlan.c:85 net/8021q/vlan.c:470) ? br_device_event (net/bridge/br.c:143) notifier_call_chain (kernel/notifier.c:85) call_netdevice_notifiers_info (net/core/dev.c:1996)
dev_open (net/core/dev.c:1519 net/core/dev.c:1505) team_add_slave (drivers/net/team/team_core.c:1219 drivers/net/team/team_core.c:1977)
? __pfx_team_add_slave (drivers/net/team/team_core.c:1972) do_set_master (net/core/rtnetlink.c:2917) do_setlink.isra.0 (net/core/rtnetlink.c:3117)
--- drivers/net/team/team.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/team/team.c +7 -0
@@ -1165,6 +1165,13 @@ static int team_port_add(struct team *team, struct net_device *port_dev,return -EBUSY ; } +if (netdev_has_upper_dev (port_dev, dev)) { +NL_SET_ERR_MSG (extack,"Device is already a lower device of the team interface" ); +netdev_err (dev,"Device %s is already a lower device of the team interface\n" , + portname); +return -EBUSY ; + } +if (port_dev->features &NETIF_F_VLAN_CHALLENGED &&vlan_uses_dev (dev)) {NL_SET_ERR_MSG (extack,"Device is VLAN challenged and team device has VLAN set up" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 25/328 regulator: of: Implement the unwind path of of_regulator_match()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Hattori <[email protected]>
[ Upstream commit dddca3b2fc676113c58b04aaefe84bfb958ac83e ]
of_regulator_match() does not release the OF node reference in the error path, resulting in an OF node leak. Therefore, call of_node_put() on the obtained nodes before returning the EINVAL error.
Since it is possible that some drivers call this function and do not exit on failure, such as s2mps11_pmic_driver, clear the init_data and of_node in the error path.
This was reported by an experimental verification tool that I am developing. As I do not have access to actual devices nor the QEMU board configuration to test drivers that call this function, no runtime test was able to be performed.
--- drivers/regulator/of_regulator.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/regulator/of_regulator.c +13 -1
@@ -377,7 +377,7 @@ int of_regulator_match(struct device *dev, struct device_node *node,"failed to parse DT for regulator %pOFn\n" , child);of_node_put (child); -return -EINVAL ; + goto err_put; } match->of_node =of_node_get (child); count++;
@@ -386,6 +386,18 @@ int of_regulator_match(struct device *dev, struct device_node *node, }return count; + +err_put: +for (i =0 ; i < num_matches; i++) { +struct of_regulator_match *match = &matches[i]; + + match->init_data =NULL ; +if (match->of_node) { +of_node_put (match->of_node); + match->of_node =NULL ; + } + } +return -EINVAL ; }EXPORT_SYMBOL_GPL (of_regulator_match);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 26/328 wifi: wlcore: fix unbalanced pm_runtime calls
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Kemnade <[email protected]>
[ Upstream commit 996c934c8c196144af386c4385f61fcd5349af28 ]
If firmware boot failes, runtime pm is put too often:
[12092.708099] wlcore: ERROR firmware boot failed despite 3 retries [12092.708099] wl18xx_driver wl18xx.1.auto: Runtime PM usage count underflow!
Fix that by redirecting all error gotos before runtime_get so that runtime is not put.
--- drivers/net/wireless/ti/wlcore/main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/ti/wlcore/main.c +5 -5
@@ -2546,24 +2546,24 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,if (test_bit (WL1271_FLAG_RECOVERY_IN_PROGRESS , &wl->flags) ||test_bit (WLVIF_FLAG_INITIALIZED , &wlvif->flags)) { ret = -EBUSY ; - goto out; + goto out_unlock; } ret =wl12xx_init_vif_data (wl, vif);if (ret <0 ) - goto out; + goto out_unlock; wlvif->wl = wl; role_type =wl12xx_get_role_type (wl, wlvif);if (role_type ==WL12XX_INVALID_ROLE_TYPE ) { ret = -EINVAL ; - goto out; + goto out_unlock; } ret =wlcore_allocate_hw_queue_base (wl, wlvif);if (ret <0 ) - goto out; + goto out_unlock;/* * TODO: after the nvs issue will be solved, move this block
@@ -2578,7 +2578,7 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw, ret =wl12xx_init_fw (wl);if (ret <0 ) - goto out; + goto out_unlock; }/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 27/328 selftests/harness: Display signed values correctly
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit d088c92802549fc1cf77a12a4e3986160d63662a ]
Since forever the harness output for signed value tests have reported unsigned values to avoid casting. Instead, actually test the variable types and perform the correct casts and choose the correct format specifiers.
Stable-dep-of: 02bc220dc6dc ("selftests: harness: fix printing of mismatch values in __EXPECT()")
--- tools/testing/selftests/kselftest_harness.h | 42 ++++++++++++++++++--- 1 file changed, 37 insertions(+), 5 deletions(-)
tools/testing/selftests/kselftest_harness.h +37 -5
@@ -603,17 +603,49 @@if (_metadata->passed && _metadata->step <255 ) \ _metadata->step++; +#define is_signed_type (var) (!!(((__typeof__(var))(-1)) < (__typeof__(var))1)) +#define __EXPECT (_expected, _expected_str, _seen, _seen_str, _t, _assert) do { \/* Avoid multiple evaluation of the cases */ \__typeof__ (_expected) __exp = (_expected); \__typeof__ (_seen) __seen = (_seen); \if (_assert)__INC_STEP (_metadata); \ if (!(__exp _t __seen)) { \ -unsigned long long __exp_print = (uintptr_t )__exp; \ -unsigned long long __seen_print = (uintptr_t )__seen; \ -__TH_LOG ("Expected %s (%llu) %s %s (%llu)" , \ - _expected_str, __exp_print, #_t, \ - _seen_str, __seen_print); \ +/* Report with actual signedness to avoid weird output. */ \ +switch (is_signed_type (__exp) *2 +is_signed_type (__seen)) { \ +case 0 : { \ +unsigned long long __exp_print = (uintptr_t )__exp; \ +unsigned long long __seen_print = (uintptr_t )__seen; \ +__TH_LOG ("Expected %s (%llu) %s %s (%llu)" , \ + _expected_str, __exp_print, #_t, \ + _seen_str, __seen_print); \ +break ; \ + } \ +case 1 : { \ +unsigned long long __exp_print = (uintptr_t )__exp; \ +long long __seen_print = (intptr_t )__seen; \ +__TH_LOG ("Expected %s (%llu) %s %s (%lld)" , \ + _expected_str, __exp_print, #_t, \ + _seen_str, __seen_print); \ +break ; \ + } \ +case 2 : { \ +long long __exp_print = (intptr_t )__exp; \ +unsigned long long __seen_print = (uintptr_t )__seen; \ +__TH_LOG ("Expected %s (%lld) %s %s (%llu)" , \ + _expected_str, __exp_print, #_t, \ + _seen_str, __seen_print); \ +break ; \ + } \ +case 3 : { \ +long long __exp_print = (intptr_t )__exp; \ +long long __seen_print = (intptr_t )__seen; \ +__TH_LOG ("Expected %s (%lld) %s %s (%lld)" , \ + _expected_str, __exp_print, #_t, \ + _seen_str, __seen_print); \ +break ; \ + } \ + } \ _metadata->passed =0 ; \/* Ensure the optional handler is triggered */ \ _metadata->trigger =1 ; \
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 28/328 selftests: harness: fix printing of mismatch values in __EXPECT()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry V. Levin <[email protected]>
[ Upstream commit 02bc220dc6dc7c56edc4859bc5dd2c08b95d5fb5 ]
intptr_t and uintptr_t are not big enough types on 32-bit architectures when printing 64-bit values, resulting to the following incorrect diagnostic output:
# get_syscall_info.c:209:get_syscall_info:Expected exp_args[2] (3134324433) == info.entry.args[1] (3134324433)
Replace intptr_t and uintptr_t with intmax_t and uintmax_t, respectively. With this fix, the same test produces more usable diagnostic output:
# get_syscall_info.c:209:get_syscall_info:Expected exp_args[2] (3134324433) == info.entry.args[1] (18446744072548908753)
--- tools/testing/selftests/kselftest_harness.h | 24 ++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-)
tools/testing/selftests/kselftest_harness.h +12 -12
@@ -614,33 +614,33 @@/* Report with actual signedness to avoid weird output. */ \switch (is_signed_type (__exp) *2 +is_signed_type (__seen)) { \case 0 : { \ -unsigned long long __exp_print = (uintptr_t )__exp; \ -unsigned long long __seen_print = (uintptr_t )__seen; \ -__TH_LOG ("Expected %s (%llu) %s %s (%llu)" , \ +uintmax_t __exp_print = (uintmax_t )__exp; \ +uintmax_t __seen_print = (uintmax_t )__seen; \ +__TH_LOG ("Expected %s (%ju) %s %s (%ju)" , \ _expected_str, __exp_print, #_t, \ _seen_str, __seen_print); \break ; \ } \case 1 : { \ -unsigned long long __exp_print = (uintptr_t )__exp; \ -long long __seen_print = (intptr_t )__seen; \ -__TH_LOG ("Expected %s (%llu) %s %s (%lld)" , \ +uintmax_t __exp_print = (uintmax_t )__exp; \ +intmax_t __seen_print = (intmax_t )__seen; \ +__TH_LOG ("Expected %s (%ju) %s %s (%jd)" , \ _expected_str, __exp_print, #_t, \ _seen_str, __seen_print); \break ; \ } \case 2 : { \ -long long __exp_print = (intptr_t )__exp; \ -unsigned long long __seen_print = (uintptr_t )__seen; \ -__TH_LOG ("Expected %s (%lld) %s %s (%llu)" , \ +intmax_t __exp_print = (intmax_t )__exp; \ +uintmax_t __seen_print = (uintmax_t )__seen; \ +__TH_LOG ("Expected %s (%jd) %s %s (%ju)" , \ _expected_str, __exp_print, #_t, \ _seen_str, __seen_print); \break ; \ } \case 3 : { \ -long long __exp_print = (intptr_t )__exp; \ -long long __seen_print = (intptr_t )__seen; \ -__TH_LOG ("Expected %s (%lld) %s %s (%lld)" , \ +intmax_t __exp_print = (intmax_t )__exp; \ +intmax_t __seen_print = (intmax_t )__seen; \ +__TH_LOG ("Expected %s (%jd) %s %s (%jd)" , \ _expected_str, __exp_print, #_t, \ _seen_str, __seen_print); \break ; \
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 29/328 clk: analogbits: Fix incorrect calculation of vco rate delta
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bo Gan <[email protected]>
[ Upstream commit d7f12857f095ef38523399d47e68787b357232f6 ]
In wrpll_configure_for_rate() we try to determine the best PLL configuration for a target rate. However, in the loop where we try values of R, we should compare the derived vco with target_vco_rate. However, we were in fact comparing it with target_rate, which is actually after Q shift. This is incorrect, and sometimes can result in suboptimal clock rates. Fix it.
--- drivers/clk/analogbits/wrpll-cln28hpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/analogbits/wrpll-cln28hpc.c +1 -1
@@ -287,7 +287,7 @@ int wrpll_configure_for_rate(struct wrpll_cfg *c, u32 target_rate, vco = vco_pre * f; } - delta =abs (target_rate - vco); + delta =abs (target_vco_rate - vco);if (delta < best_delta) { best_delta = delta; best_r = r;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 30/328 net: let net.core.dev_weight always be non-zero
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Jian <[email protected]>
[ Upstream commit d1f9f79fa2af8e3b45cffdeef66e05833480148a ]
The following problem was encountered during stability test:
(NULL net_device): NAPI poll function process_backlog+0x0/0x530 \
returned 1, exceeding its budget of 0.
------------[ cut here ]------------ list_add double add: new=ffff88905f746f48, prev=ffff88905f746f48, \ next=ffff88905f746e40. WARNING: CPU: 18 PID: 5462 at lib/list_debug.c:35 \ __list_add_valid_or_report+0xf3/0x130 CPU: 18 UID: 0 PID: 5462 Comm: ping Kdump: loaded Not tainted 6.13.0-rc7+ RIP: 0010:__list_add_valid_or_report+0xf3/0x130 Call Trace: ? __warn+0xcd/0x250 ? __list_add_valid_or_report+0xf3/0x130 enqueue_to_backlog+0x923/0x1070 netif_rx_internal+0x92/0x2b0 __netif_rx+0x15/0x170 loopback_xmit+0x2ef/0x450 dev_hard_start_xmit+0x103/0x490 __dev_queue_xmit+0xeac/0x1950 ip_finish_output2+0x6cc/0x1620 ip_output+0x161/0x270 ip_push_pending_frames+0x155/0x1a0 raw_sendmsg+0xe13/0x1550 __sys_sendto+0x3bf/0x4e0 __x64_sys_sendto+0xdc/0x1b0 do_syscall_64+0x5b/0x170 entry_SYSCALL_64_after_hwframe+0x76/0x7e
The reproduction command is as follows:
sysctl -w net.core.dev_weight=0
ping 127.0.0.1
This is because when the napi's weight is set to 0, process_backlog() may return 0 and clear the NAPI_STATE_SCHED bit of napi->state, causing this napi to be re-polled in net_rx_action() until __do_softirq() times out. Since the NAPI_STATE_SCHED bit has been cleared, napi_schedule_rps() can be retriggered in enqueue_to_backlog(), causing this issue.
Making the napi's weight always non-zero solves this problem.
Triggering this issue requires system-wide admin (setting is not namespaced).
--- net/core/sysctl_net_core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/core/sysctl_net_core.c +4 -1
@@ -242,7 +242,7 @@ static int proc_do_dev_weight(struct ctl_table *table, int write,int ret, weight;mutex_lock (&dev_weight_mutex); - ret =proc_dointvec (table, write, buffer, lenp, ppos); + ret =proc_dointvec_minmax (table, write, buffer, lenp, ppos);if (!ret && write) { weight =READ_ONCE (weight_p);WRITE_ONCE (dev_rx_weight, weight * dev_weight_rx_bias);
@@ -356,6 +356,7 @@ static struct ctl_table net_core_table[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_do_dev_weight, + .extra1 = SYSCTL_ONE, }, { .procname = "dev_weight_rx_bias",
@@ -363,6 +364,7 @@ static struct ctl_table net_core_table[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_do_dev_weight, + .extra1 = SYSCTL_ONE, }, { .procname = "dev_weight_tx_bias",
@@ -370,6 +372,7 @@ static struct ctl_table net_core_table[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_do_dev_weight, + .extra1 = SYSCTL_ONE, }, { .procname = "netdev_max_backlog",
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 31/328 net/mlxfw: Drop hard coded max FW flash image size
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maher Sanalla <[email protected]>
[ Upstream commit 70d81f25cc92cc4e914516c9935ae752f27d78ad ]
Currently, mlxfw kernel module limits FW flash image size to be 10MB at most, preventing the ability to burn recent BlueField-3 FW that exceeds the said size limit.
Thus, drop the hard coded limit. Instead, rely on FW's max_component_size threshold that is reported in MCQI register as the size limit for FW image.
--- drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c +0 -2
@@ -14,7 +14,6 @@#define MLXFW_FSM_STATE_WAIT_TIMEOUT_MS 30000#define MLXFW_FSM_STATE_WAIT_ROUNDS \ (MLXFW_FSM_STATE_WAIT_TIMEOUT_MS / MLXFW_FSM_STATE_WAIT_CYCLE_MS) -#define MLXFW_FSM_MAX_COMPONENT_SIZE (10 * (1 << 20))static const char *const mlxfw_fsm_state_err_str[] = { [MLXFW_FSM_STATE_ERR_ERROR] =
@@ -111,7 +110,6 @@ static int mlxfw_flash_component(struct mlxfw_dev *mlxfw_dev,if (err)return err; - comp_max_size =min_t (u32, comp_max_size,MLXFW_FSM_MAX_COMPONENT_SIZE );if (comp->data_size > comp_max_size) {pr_err ("Component %d is of size %d which is bigger than limit %d\n" , comp->index, comp->data_size, comp_max_size);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 32/328 net: sched: Disallow replacing of child qdisc from one parent to another
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit bc50835e83f60f56e9bec2b392fb5544f250fb6f ]
Lion Ackermann was able to create a UAF which can be abused for privilege escalation with the following script
Step 1. create root qdisc
tc qdisc add dev lo root handle 1:0 drr
step2. a class for packet aggregation do demonstrate uaf tc class add dev lo classid 1:1 drr
step3. a class for nesting
tc class add dev lo classid 1:2 drr
step4. a class to graft qdisc to
tc class add dev lo classid 1:3 drr
step5.
tc qdisc add dev lo parent 1:1 handle 2:0 plug limit 1024
step6.
tc qdisc add dev lo parent 1:2 handle 3:0 drr
step7.
tc class add dev lo classid 3:1 drr
step 8.
tc qdisc add dev lo parent 3:1 handle 4:0 pfifo
step 9. Display the class/qdisc layout
tc class ls dev lo
class drr 1:1 root leaf 2: quantum 64Kb
class drr 1:2 root leaf 3: quantum 64Kb
class drr 3:1 root leaf 4: quantum 64Kb
tc qdisc ls
qdisc drr 1: dev lo root refcnt 2
qdisc plug 2: dev lo parent 1:1
qdisc pfifo 4: dev lo parent 3:1 limit 1000p
qdisc drr 3: dev lo parent 1:2
step10. trigger the bug <=== prevented by this patch tc qdisc replace dev lo parent 1:3 handle 4:0
step 11. Redisplay again the qdiscs/classes
tc class ls dev lo
class drr 1:1 root leaf 2: quantum 64Kb
class drr 1:2 root leaf 3: quantum 64Kb
class drr 1:3 root leaf 4: quantum 64Kb
class drr 3:1 root leaf 4: quantum 64Kb
tc qdisc ls
qdisc drr 1: dev lo root refcnt 2
qdisc plug 2: dev lo parent 1:1
qdisc pfifo 4: dev lo parent 3:1 refcnt 2 limit 1000p qdisc drr 3: dev lo parent 1:2
Observe that a) parent for 4:0 does not change despite the replace request. There can only be one parent. b) refcount has gone up by two for 4:0 and
c) both class 1:3 and 3:1 are pointing to it.
Step 12. send one packet to plug
echo "" | socat -u STDIN UDP4-DATAGRAM:127.0.0.1:8888,priority=$((0x10001)) step13. send one packet to the grafted fifo
echo "" | socat -u STDIN UDP4-DATAGRAM:127.0.0.1:8888,priority=$((0x10003))
step14. lets trigger the uaf
tc class delete dev lo classid 1:3
tc class delete dev lo classid 1:1
The semantics of "replace" is for a del/add _on the same node_ and not a delete from one node(3:1) and add to another node (1:3) as in step10. While we could "fix" with a more complex approach there could be consequences to expectations so the patch takes the preventive approach of "disallow such config".
Joint work with Lion Ackermann <[email protected]>
--- net/sched/sch_api.c | 4 ++++ 1 file changed, 4 insertions(+)
net/sched/sch_api.c +4 -0
@@ -1593,6 +1593,10 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, q =qdisc_lookup (dev, tcm->tcm_handle);if (!q) goto create_n_graft; +if (q->parent != tcm->tcm_parent) { +NL_SET_ERR_MSG (extack,"Cannot move an existing qdisc to a different parent" ); +return -EINVAL ; + }if (n->nlmsg_flags &NLM_F_EXCL ) {NL_SET_ERR_MSG (extack,"Exclusivity flag on, cannot override" );return -EEXIST ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 33/328 tools/testing/selftests/bpf/test_tc_tunnel.sh: Fix wait for server bind
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marco Leogrande <[email protected]>
[ Upstream commit e2f0791124a1b6ca8d570110cbd487969d9d41ef ]
Commit f803bcf9208a ("selftests/bpf: Prevent client connect before server bind in test_tc_tunnel.sh") added code that waits for the netcat server to start before the netcat client attempts to connect to it. However, not all calls to 'server_listen' were guarded.
This patch adds the existing 'wait_for_port' guard after the remaining call to 'server_listen'.
--- tools/testing/selftests/bpf/test_tc_tunnel.sh | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/test_tc_tunnel.sh +1 -0
@@ -286,6 +286,7 @@ else client_connect verify_data server_listen + wait_for_port ${port} ${netcat_opt} fi # bpf_skb_net_shrink does not take tunnel flags yet, cannot update L3.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 34/328 ASoC: sun4i-spdif: Add clock multiplier settings
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: George Lander <[email protected]>
[ Upstream commit 0a2319308de88b9e819c0b43d0fccd857123eb31 ]
There have been intermittent issues with the SPDIF output on H3 and H2+ devices which has been fixed by setting the s_clk to 4 times the audio pll.
Add a quirk for the clock multiplier as not every supported SoC requires it. Without the multiplier, the audio at normal sampling rates was distorted and did not play at higher sampling rates.
--- sound/soc/sunxi/sun4i-spdif.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/sunxi/sun4i-spdif.c +7 -0
@@ -175,6 +175,7 @@ struct sun4i_spdif_quirks {unsigned int reg_dac_txdata;bool has_reset;unsigned int val_fctl_ftx; +unsigned int mclk_multiplier; };struct sun4i_spdif_dev {
@@ -311,6 +312,7 @@ static int sun4i_spdif_hw_params(struct snd_pcm_substream *substream,default :return -EINVAL ; } + mclk *= host->quirks->mclk_multiplier; ret =clk_set_rate (host->spdif_clk, mclk);if (ret <0 ) {
@@ -345,6 +347,7 @@ static int sun4i_spdif_hw_params(struct snd_pcm_substream *substream,default :return -EINVAL ; } + mclk_div *= host->quirks->mclk_multiplier; reg_val =0 ; reg_val |=SUN4I_SPDIF_TXCFG_ASS ;
@@ -427,24 +430,28 @@ static struct snd_soc_dai_driver sun4i_spdif_dai = {static const struct sun4i_spdif_quirks sun4i_a10_spdif_quirks = { .reg_dac_txdata =SUN4I_SPDIF_TXFIFO , .val_fctl_ftx =SUN4I_SPDIF_FCTL_FTX , + .mclk_multiplier =1 , };static const struct sun4i_spdif_quirks sun6i_a31_spdif_quirks = { .reg_dac_txdata =SUN4I_SPDIF_TXFIFO , .val_fctl_ftx =SUN4I_SPDIF_FCTL_FTX , .has_reset = true, + .mclk_multiplier =1 , };static const struct sun4i_spdif_quirks sun8i_h3_spdif_quirks = { .reg_dac_txdata =SUN8I_SPDIF_TXFIFO , .val_fctl_ftx =SUN4I_SPDIF_FCTL_FTX , .has_reset = true, + .mclk_multiplier =4 , };static const struct sun4i_spdif_quirks sun50i_h6_spdif_quirks = { .reg_dac_txdata =SUN8I_SPDIF_TXFIFO , .val_fctl_ftx =SUN50I_H6_SPDIF_FCTL_FTX , .has_reset = true, + .mclk_multiplier =1 , };static const struct of_device_id sun4i_spdif_of_match[] = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 35/328 perf header: Fix one memory leakage in process_bpf_btf()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhongqiu Han <[email protected]>
[ Upstream commit 875d22980a062521beed7b5df71fb13a1af15d83 ]
If __perf_env__insert_btf() returns false due to a duplicate btf node insertion, the temporary node will leak. Add a check to ensure the memory is freed if the function returns false.
--- tools/perf/util/header.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/header.c +2 -1
@@ -2777,7 +2777,8 @@ static int process_bpf_btf(struct feat_fd *ff, void *data __maybe_unused)if (__do_read (ff, node->data, data_size)) goto out; -__perf_env__insert_btf (env, node); +if (!__perf_env__insert_btf (env, node)) +free (node); node =NULL ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 36/328 perf header: Fix one memory leakage in process_bpf_prog_info()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhongqiu Han <[email protected]>
[ Upstream commit a7da6c7030e1aec32f0a41c7b4fa70ec96042019 ]
Function __perf_env__insert_bpf_prog_info() will return without inserting bpf prog info node into perf env again due to a duplicate bpf prog info node insertion, causing the temporary info_linear and info_node memory to leak. Modify the return type of this function to bool and add a check to ensure the memory is freed if the function returns false.
--- tools/perf/util/env.c | 5 +++-- tools/perf/util/env.h | 2 +- tools/perf/util/header.c | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-)
tools/perf/util/env.c +3 -2
@@ -21,7 +21,7 @@ void perf_env__insert_bpf_prog_info(struct perf_env *env,up_write (&env->bpf_progs.lock); } -void __perf_env__insert_bpf_prog_info (struct perf_env *env,struct bpf_prog_info_node *info_node) +bool __perf_env__insert_bpf_prog_info (struct perf_env *env,struct bpf_prog_info_node *info_node) {__u32 prog_id = info_node->info_linear->info.id;struct bpf_prog_info_node *node;
@@ -39,13 +39,14 @@ void __perf_env__insert_bpf_prog_info(struct perf_env *env, struct bpf_prog_info p = &(*p)->rb_right; }else {pr_debug ("duplicated bpf prog info %u\n" , prog_id); -return ; +return false; } }rb_link_node (&info_node->rb_node, parent, p);rb_insert_color (&info_node->rb_node, &env->bpf_progs.infos); env->bpf_progs.infos_cnt++; +return true; } struct bpf_prog_info_node *perf_env__find_bpf_prog_info(struct perf_env *env,
tools/perf/util/env.h +1 -1
@@ -117,7 +117,7 @@ const char *perf_env__raw_arch(struct perf_env *env);int perf_env__nr_cpus_avail (struct perf_env *env);void perf_env__init (struct perf_env *env); -void __perf_env__insert_bpf_prog_info (struct perf_env *env, +bool __perf_env__insert_bpf_prog_info (struct perf_env *env,struct bpf_prog_info_node *info_node);void perf_env__insert_bpf_prog_info (struct perf_env *env,struct bpf_prog_info_node *info_node);
tools/perf/util/header.c +4 -1
@@ -2724,7 +2724,10 @@ static int process_bpf_prog_info(struct feat_fd *ff, void *data __maybe_unused)/* after reading from file, translate offset to address */ bpf_program__bpil_offs_to_addr (info_linear); info_node->info_linear = info_linear; -__perf_env__insert_bpf_prog_info (env, info_node); +if (!__perf_env__insert_bpf_prog_info (env, info_node)) { +free (info_linear); +free (info_node); + } }up_write (&env->bpf_progs.lock);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 37/328 ktest.pl: Remove unused declarations in run_bisect_test function
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ba Jing <[email protected]>
[ Upstream commit 776735b954f49f85fd19e1198efa421fae2ad77c ]
Since $output and $ret are not used in the subsequent code, the declarations should be removed.
--- tools/testing/ktest/ktest.pl | 2 -- 1 file changed, 2 deletions(-)
tools/testing/ktest/ktest.pl +0 -2
@@ -2861,8 +2861,6 @@ sub run_bisect_test { my $failed = 0; my $result; - my $output; - my $ret; $in_bisect = 1;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 38/328 padata: fix sysfs store callback check
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
[ Upstream commit 9ff6e943bce67d125781fe4780a5d6f072dc44c0 ]
padata_sysfs_store() was copied from padata_sysfs_show() but this check was not adapted. Today there is no attribute which can fail this check, but if there is one it may as well be correct.
--- kernel/padata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/padata.c +1 -1
@@ -940,7 +940,7 @@ static ssize_t padata_sysfs_store(struct kobject *kobj, struct attribute *attr, pinst =kobj2pinst (kobj); pentry =attr2pentry (attr); -if (pentry->show) +if (pentry->store) ret = pentry->store (pinst, attr, buf, count);return ret;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 39/328 perf top: Dont complain about lack of vmlinux when not resolving some kernel samples
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 058b38ccd2af9e5c95590b018e8425fa148d7aca ]
Recently we got a case where a kernel sample wasn't being resolved due to a bug that was not setting the end address on kernel functions implemented in assembly (see Link: tag), and then those were not being found by machine__resolve() -> map__find_symbol().
So we ended up with:
# perf top --stdio PerfTop: 0 irqs/s kernel: 0% exact: 0% lost: 0/0 drop: 0/0 [cycles/P] -----------------------------------------------------------------------
Warning:
A vmlinux file was not found.
Kernel samples will not be resolved.
^Z
[1]+ Stopped perf top --stdio
#
But then resolving all other kernel symbols.
So just fixup the logic to only print that warning when there are no symbols in the kernel map.
--- tools/perf/builtin-top.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-top.c +1 -1
@@ -796,7 +796,7 @@ static void perf_event__process_sample(struct perf_tool *tool,* invalid --vmlinux ;-) */ if (!machine->kptr_restrict_warned && !top->vmlinux_warned && -__map__is_kernel (al.map) &&map__has_symbols (al.map)) { +__map__is_kernel (al.map) && !map__has_symbols (al.map)) {if (symbol_conf.vmlinux_name) {char serr[256 ];dso__strerror_load (al.map->dso, serr,sizeof (serr));
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 40/328 perf report: Fix misleading help message about --demangle
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiachen Zhang <[email protected]>
[ Upstream commit ac0ac75189a4d6a29a2765a7adbb62bc6cc650c7 ]
The wrong help message may mislead users. This commit fixes it.
--- tools/perf/builtin-report.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-report.c +1 -1
@@ -1175,7 +1175,7 @@ int cmd_report(int argc, const char **argv)OPT_STRING (0 ,"objdump" , &report.annotation_opts.objdump_path,"path" ,"objdump binary to use for disassembly and annotations" ),OPT_BOOLEAN (0 ,"demangle" , &symbol_conf.demangle, -"Disable symbol demangling" ), +"Symbol demangling. Enabled by default, use --no-demangle to disable." ),OPT_BOOLEAN (0 ,"demangle-kernel" , &symbol_conf.demangle_kernel,"Enable kernel symbol demangling" ), OPT_BOOLEAN(0, "mem-mode", &report.mem_mode, "mem access profile"),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 41/328 bpf: Send signals asynchronously if !preemptible
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Puranjay Mohan <[email protected]>
[ Upstream commit 87c544108b612512b254c8f79aa5c0a8546e2cc4 ]
BPF programs can execute in all kinds of contexts and when a program running in a non-preemptible context uses the bpf_send_signal() kfunc, it will cause issues because this kfunc can sleep.
Change irqs_disabled() to !preemptible().
--- kernel/trace/bpf_trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/bpf_trace.c +1 -1
@@ -653,7 +653,7 @@ BPF_CALL_1(bpf_send_signal, u32, sig)if (unlikely (is_global_init (current)))return -EPERM ; -if (irqs_disabled ()) { +if (!preemptible ()) {/* Do an early check on signal validity. Otherwise, * the error is lost in deferred irq_work. */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 42/328 RDMA/mlx4: Avoid false error about access to uninitialized gids array
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
[ Upstream commit 1f53d88cbb0dcc7df235bf6611ae632b254fccd8 ]
Smatch generates the following false error report:drivers/infiniband/hw/mlx4/main.c:393 mlx4_ib_del_gid() error: uninitialized symbol 'gids'.
Traditionally, we are not changing kernel code and asking people to fix the tools. However in this case, the fix can be done by simply rearranging the code to be more clear.
--- drivers/infiniband/hw/mlx4/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/hw/mlx4/main.c +3 -3
@@ -384,10 +384,10 @@ static int mlx4_ib_del_gid(const struct ib_gid_attr *attr, void **context) }spin_unlock_bh (&iboe->lock); -if (!ret && hw_update) { +if (gids) ret =mlx4_ib_update_gids (gids, ibdev, attr->port_num); -kfree (gids); - } + +kfree (gids);return ret; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 43/328 rdma/cxgb4: Prevent potential integer overflow on 32bit
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit bd96a3935e89486304461a21752f824fc25e0f0b ]
The "gl->tot_len" variable is controlled by the user. It comes from process_responses(). On 32bit systems, the "gl->tot_len + sizeof(struct cpl_pass_accept_req) + sizeof(struct rss_header)" addition could have an integer wrapping bug. Use size_add() to prevent this.
--- drivers/infiniband/hw/cxgb4/device.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/infiniband/hw/cxgb4/device.c +4 -2
@@ -1114,8 +1114,10 @@ static inline struct sk_buff *copy_gl_to_skb_pkt(const struct pkt_gl *gl,* The math here assumes sizeof cpl_pass_accept_req >= sizeof * cpl_rx_pkt. */ - skb =alloc_skb (gl->tot_len +sizeof (struct cpl_pass_accept_req ) + -sizeof (struct rss_header ) - pktshift,GFP_ATOMIC ); + skb =alloc_skb (size_add (gl->tot_len, +sizeof (struct cpl_pass_accept_req ) + +sizeof (struct rss_header )) - pktshift, +GFP_ATOMIC );if (unlikely (!skb))return NULL ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 44/328 arm64: dts: mediatek: mt8173-evb: Drop regulator-compatible property
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
[ Upstream commit a6d5983e40f5d5b219337569cdd269727f5a3e2e ]
The "regulator-compatible" property has been deprecated since 2012 in commit 13511def87b9 ("regulator: deprecate regulator-compatible DT property"), which is so old it's not even mentioned in the converted regulator bindings YAML file. It is also not listed in the MT6397 regulator bindings. Having them present produces a whole bunch of validation errors:
Unevaluated properties are not allowed ('regulator-compatible' was unexpected)
Drop the "regulator-compatible" property from the board dts. The property values are the same as the node name, so everything should continue to work.
--- arch/arm64/boot/dts/mediatek/mt8173-evb.dts | 23 --------------------- 1 file changed, 23 deletions(-)
arch/arm64/boot/dts/mediatek/mt8173-evb.dts +0 -23
@@ -307,7 +307,6 @@ compatible = "mediatek,mt6397-regulator"; mt6397_vpca15_reg: buck_vpca15 { - regulator-compatible = "buck_vpca15"; regulator-name = "vpca15"; regulator-min-microvolt = < 700000>; regulator-max-microvolt = <1350000>;
@@ -316,7 +315,6 @@ }; mt6397_vpca7_reg: buck_vpca7 { - regulator-compatible = "buck_vpca7"; regulator-name = "vpca7"; regulator-min-microvolt = < 700000>; regulator-max-microvolt = <1350000>;
@@ -325,7 +323,6 @@ }; mt6397_vsramca15_reg: buck_vsramca15 { - regulator-compatible = "buck_vsramca15"; regulator-name = "vsramca15"; regulator-min-microvolt = < 700000>; regulator-max-microvolt = <1350000>;
@@ -334,7 +331,6 @@ }; mt6397_vsramca7_reg: buck_vsramca7 { - regulator-compatible = "buck_vsramca7"; regulator-name = "vsramca7"; regulator-min-microvolt = < 700000>; regulator-max-microvolt = <1350000>;
@@ -343,7 +339,6 @@ }; mt6397_vcore_reg: buck_vcore { - regulator-compatible = "buck_vcore"; regulator-name = "vcore"; regulator-min-microvolt = < 700000>; regulator-max-microvolt = <1350000>;
@@ -352,7 +347,6 @@ }; mt6397_vgpu_reg: buck_vgpu { - regulator-compatible = "buck_vgpu"; regulator-name = "vgpu"; regulator-min-microvolt = < 700000>; regulator-max-microvolt = <1350000>;
@@ -361,7 +355,6 @@ }; mt6397_vdrm_reg: buck_vdrm { - regulator-compatible = "buck_vdrm"; regulator-name = "vdrm"; regulator-min-microvolt = <1200000>; regulator-max-microvolt = <1400000>;
@@ -370,7 +363,6 @@ }; mt6397_vio18_reg: buck_vio18 { - regulator-compatible = "buck_vio18"; regulator-name = "vio18"; regulator-min-microvolt = <1620000>; regulator-max-microvolt = <1980000>;
@@ -379,19 +371,16 @@ }; mt6397_vtcxo_reg: ldo_vtcxo { - regulator-compatible = "ldo_vtcxo"; regulator-name = "vtcxo"; regulator-always-on; }; mt6397_va28_reg: ldo_va28 { - regulator-compatible = "ldo_va28"; regulator-name = "va28"; regulator-always-on; }; mt6397_vcama_reg: ldo_vcama { - regulator-compatible = "ldo_vcama"; regulator-name = "vcama"; regulator-min-microvolt = <1500000>; regulator-max-microvolt = <2800000>;
@@ -399,18 +388,15 @@ }; mt6397_vio28_reg: ldo_vio28 { - regulator-compatible = "ldo_vio28"; regulator-name = "vio28"; regulator-always-on; }; mt6397_vusb_reg: ldo_vusb { - regulator-compatible = "ldo_vusb"; regulator-name = "vusb"; }; mt6397_vmc_reg: ldo_vmc { - regulator-compatible = "ldo_vmc"; regulator-name = "vmc"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <3300000>;
@@ -418,7 +404,6 @@ }; mt6397_vmch_reg: ldo_vmch { - regulator-compatible = "ldo_vmch"; regulator-name = "vmch"; regulator-min-microvolt = <3000000>; regulator-max-microvolt = <3300000>;
@@ -426,7 +411,6 @@ }; mt6397_vemc_3v3_reg: ldo_vemc3v3 { - regulator-compatible = "ldo_vemc3v3"; regulator-name = "vemc_3v3"; regulator-min-microvolt = <3000000>; regulator-max-microvolt = <3300000>;
@@ -434,7 +418,6 @@ }; mt6397_vgp1_reg: ldo_vgp1 { - regulator-compatible = "ldo_vgp1"; regulator-name = "vcamd"; regulator-min-microvolt = <1220000>; regulator-max-microvolt = <3300000>;
@@ -442,7 +425,6 @@ }; mt6397_vgp2_reg: ldo_vgp2 { - regulator-compatible = "ldo_vgp2"; regulator-name = "vcamio"; regulator-min-microvolt = <1000000>; regulator-max-microvolt = <3300000>;
@@ -450,7 +432,6 @@ }; mt6397_vgp3_reg: ldo_vgp3 { - regulator-compatible = "ldo_vgp3"; regulator-name = "vcamaf"; regulator-min-microvolt = <1200000>; regulator-max-microvolt = <3300000>;
@@ -458,7 +439,6 @@ }; mt6397_vgp4_reg: ldo_vgp4 { - regulator-compatible = "ldo_vgp4"; regulator-name = "vgp4"; regulator-min-microvolt = <1200000>; regulator-max-microvolt = <3300000>;
@@ -466,7 +446,6 @@ }; mt6397_vgp5_reg: ldo_vgp5 { - regulator-compatible = "ldo_vgp5"; regulator-name = "vgp5"; regulator-min-microvolt = <1200000>; regulator-max-microvolt = <3000000>;
@@ -474,7 +453,6 @@ }; mt6397_vgp6_reg: ldo_vgp6 { - regulator-compatible = "ldo_vgp6"; regulator-name = "vgp6"; regulator-min-microvolt = <1200000>; regulator-max-microvolt = <3300000>;
@@ -482,7 +460,6 @@ }; mt6397_vibr_reg: ldo_vibr { - regulator-compatible = "ldo_vibr"; regulator-name = "vibr"; regulator-min-microvolt = <1300000>; regulator-max-microvolt = <3300000>;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 45/328 arm64: dts: mediatek: mt8173-evb: Fix MT6397 PMIC sub-node names
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
[ Upstream commit 9545ba142865b9099d43c972b9ebcf463606499a ]
The MT6397 PMIC bindings specify exact names for its sub-nodes. The names used in the current dts don't match, causing a validation error.
Fix up the names. Also drop the label for the regulators node, since any reference should be against the individual regulator sub-nodes.
--- arch/arm64/boot/dts/mediatek/mt8173-evb.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/mediatek/mt8173-evb.dts +1 -1
@@ -303,7 +303,7 @@ interrupt-controller; #interrupt-cells = <2>; - mt6397regulator: mt6397regulator { + regulators { compatible = "mediatek,mt6397-regulator"; mt6397_vpca15_reg: buck_vpca15 {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 46/328 ARM: dts: mediatek: mt7623: fix IR nodename
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafał Miłecki <[email protected]>
[ Upstream commit 90234cf9b37c57201a24b78c217a91a8af774109 ]
Fix following validation error:arch/arm/boot/dts/mediatek/mt7623a-rfb-emmc.dtb: cir@10013000: $nodename:0: 'cir@10013000' does not match '^ir(-receiver)?(@[a-f0-9]+)?$'
from schema $id: http://devicetree.org/schemas/media/mediatek,mt7622-cir.yaml#
--- arch/arm/boot/dts/mt7623.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/mt7623.dtsi +1 -1
@@ -320,7 +320,7 @@ clock-names = "spi", "wrap"; }; - cir: cir@10013000 { + cir: ir-receiver@10013000 { compatible = "mediatek,mt7623-cir"; reg = <0 0x10013000 0 0x1000>; interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_LOW>;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 47/328 fbdev: omapfb: Fix an OF node leak in dss_of_port_get_parent_device()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Hattori <[email protected]>
[ Upstream commit de124b61e179e690277116e6be512e4f422b5dd8 ]
dss_of_port_get_parent_device() leaks an OF node reference when i >= 2 and struct device_node *np is present. Since of_get_next_parent() obtains a reference of the returned OF node, call of_node_put() before returning NULL.
This was found by an experimental verifier that I am developing, and no runtime test was able to be performed due to that lack of actual devices.
--- drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/fbdev/omap2/omapfb/dss/dss-of.c +1 -0
@@ -102,6 +102,7 @@ struct device_node *dss_of_port_get_parent_device(struct device_node *port) np =of_get_next_parent (np); } +of_node_put (np);return NULL ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 48/328 media: rc: iguanair: handle timeouts
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
[ Upstream commit b98d5000c50544f14bacb248c34e5219fbe81287 ]
In case of a timeout the IO must be cancelled or the next IO using the URB will fail and/or overwrite an operational URB.
The automatic bisection fails because it arrives
at a commit that correctly lets the test case run
without an error.
--- drivers/media/rc/iguanair.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/rc/iguanair.c +3 -1
@@ -200,8 +200,10 @@ static int iguanair_send(struct iguanair *ir, unsigned size)if (rc)return rc; -if (wait_for_completion_timeout (&ir->completion,TIMEOUT ) ==0 ) +if (wait_for_completion_timeout (&ir->completion,TIMEOUT ) ==0 ) { +usb_kill_urb (ir->urb_out);return -ETIMEDOUT ; + }return rc; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 49/328 media: lmedm04: Use GFP_KERNEL for URB allocation/submission.
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
[ Upstream commit add5861769f912af0181f5fbd79dbf19c8211c20 ]
lme2510_int_read is not atomically called so use GFP_KERNEL for usb_alloc_urb and usb_submit_urb which is the first in the chain of interrupt submissions.
Stable-dep-of: a2836d3fe220 ("media: lmedm04: Handle errors for lme2510_int_read")
--- drivers/media/usb/dvb-usb-v2/lmedm04.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/usb/dvb-usb-v2/lmedm04.c +2 -2
@@ -373,7 +373,7 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap)struct lme2510_state *lme_int =adap_to_priv (adap);struct usb_host_endpoint *ep; - lme_int->lme_urb =usb_alloc_urb (0 ,GFP_ATOMIC ); + lme_int->lme_urb =usb_alloc_urb (0 ,GFP_KERNEL );if (lme_int->lme_urb ==NULL )return -ENOMEM ;
@@ -393,7 +393,7 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap)if (usb_endpoint_type (&ep->desc) ==USB_ENDPOINT_XFER_BULK ) lme_int->lme_urb->pipe =usb_rcvbulkpipe (d->udev,0xa ); -usb_submit_urb (lme_int->lme_urb,GFP_ATOMIC ); +usb_submit_urb (lme_int->lme_urb,GFP_KERNEL );info ("INT Interrupt Service Started" );return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 50/328 media: lmedm04: Handle errors for lme2510_int_read
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ni <[email protected]>
[ Upstream commit a2836d3fe220220ff8c495ca9722f89cea8a67e7 ]
Add check for the return value of usb_pipe_endpoint() and usb_submit_urb() in order to catch the errors.
--- drivers/media/usb/dvb-usb-v2/lmedm04.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/media/usb/dvb-usb-v2/lmedm04.c +11 -1
@@ -372,6 +372,7 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap)struct dvb_usb_device *d =adap_to_d (adap);struct lme2510_state *lme_int =adap_to_priv (adap);struct usb_host_endpoint *ep; +int ret; lme_int->lme_urb =usb_alloc_urb (0 ,GFP_KERNEL );
@@ -389,11 +390,20 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap)/* Quirk of pipe reporting PIPE_BULK but behaves as interrupt */ ep =usb_pipe_endpoint (d->udev, lme_int->lme_urb->pipe); +if (!ep) { +usb_free_urb (lme_int->lme_urb); +return -ENODEV ; + }if (usb_endpoint_type (&ep->desc) ==USB_ENDPOINT_XFER_BULK ) lme_int->lme_urb->pipe =usb_rcvbulkpipe (d->udev,0xa ); -usb_submit_urb (lme_int->lme_urb,GFP_KERNEL ); + ret =usb_submit_urb (lme_int->lme_urb,GFP_KERNEL ); +if (ret) { +usb_free_urb (lme_int->lme_urb); +return ret; + } +info ("INT Interrupt Service Started" );return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 51/328 PCI: endpoint: Destroy the EPC device in devm_pci_epc_destroy()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
[ Upstream commit d4929755e4d02bd3de3ae5569dab69cb9502c54f ]
The devm_pci_epc_destroy() comment says destroys the EPC device, but it does not actually do that since devres_destroy() does not call devm_pci_epc_release(), and it also can not fully undo what the API devm_pci_epc_create() does, so it is faulty.
Fortunately, the faulty API has not been used by current kernel tree. Use devres_release() instead of devres_destroy() so the EPC device will be released.
--- drivers/pci/endpoint/pci-epc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/endpoint/pci-epc-core.c +1 -1
@@ -578,7 +578,7 @@ void devm_pci_epc_destroy(struct device *dev, struct pci_epc *epc) {int r; - r =devres_destroy (dev, devm_pci_epc_release, devm_pci_epc_match, + r =devres_release (dev, devm_pci_epc_release, devm_pci_epc_match, epc);dev_WARN_ONCE (dev, r,"couldn't find PCI EPC resource\n" ); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 52/328 media: mipi-csis: Add check for clk_enable()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
[ Upstream commit 125ad1aeec77eb55273b420be6894b284a01e4b6 ]
Add check for the return value of clk_enable() to gurantee the success.
--- drivers/media/platform/exynos4-is/mipi-csis.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/media/platform/exynos4-is/mipi-csis.c +8 -2
@@ -941,13 +941,19 @@ static int s5pcsis_pm_resume(struct device *dev, bool runtime) state->supplies); goto unlock; } -clk_enable (state->clock[CSIS_CLK_GATE ]); + ret =clk_enable (state->clock[CSIS_CLK_GATE ]); +if (ret) { +phy_power_off (state->phy); +regulator_bulk_disable (CSIS_NUM_SUPPLIES , + state->supplies); + goto unlock; + } }if (state->flags &ST_STREAMING )s5pcsis_start_stream (state); state->flags &= ~ST_SUSPENDED ; - unlock: +unlock:mutex_unlock (&state->lock);return ret ? -EAGAIN :0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 53/328 media: camif-core: Add check for clk_enable()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
[ Upstream commit 77ed2470ac09c2b0a33cf3f98cc51d18ba9ed976 ]
Add check for the return value of clk_enable() to gurantee the success.
--- drivers/media/platform/s3c-camif/camif-core.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/media/platform/s3c-camif/camif-core.c +11 -2
@@ -529,10 +529,19 @@ static int s3c_camif_remove(struct platform_device *pdev)static int s3c_camif_runtime_resume (struct device *dev) {struct camif_dev *camif =dev_get_drvdata (dev); +int ret; + + ret =clk_enable (camif->clock[CLK_GATE ]); +if (ret) +return ret; -clk_enable (camif->clock[CLK_GATE ]);/* null op on s3c244x */ -clk_enable (camif->clock[CLK_CAM ]); + ret =clk_enable (camif->clock[CLK_CAM ]); +if (ret) { +clk_disable (camif->clock[CLK_GATE ]); +return ret; + } +return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 54/328 media: uvcvideo: Propagate buf->error to userspace
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
[ Upstream commit 87ce177654e388451850905a1d376658aebe8699 ]
Now we return VB2_BUF_STATE_DONE for valid and invalid frames. Propagate the correct value, so the user can know if the frame is valid or not via struct v4l2_buffer->flags.
--- drivers/media/usb/uvc/uvc_queue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_queue.c +2 -1
@@ -486,7 +486,8 @@ static void uvc_queue_buffer_complete(struct kref *ref) buf->state = buf->error ?UVC_BUF_STATE_ERROR :UVC_BUF_STATE_DONE ;vb2_set_plane_payload (&buf->buf.vb2_buf,0 , buf->bytesused); -vb2_buffer_done (&buf->buf.vb2_buf,VB2_BUF_STATE_DONE ); +vb2_buffer_done (&buf->buf.vb2_buf, buf->error ?VB2_BUF_STATE_ERROR : +VB2_BUF_STATE_DONE ); }/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 55/328 staging: media: imx: fix OF node leak in imx_media_add_of_subdevs()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Hattori <[email protected]>
[ Upstream commit 094f5c315f756b19198e6c401aa821ac0e868750 ]
imx_media_add_of_subdevs() calls of_parse_phandle() and passes the obtained node to imx_media_of_add_csi(). The passed node is used in v4l2_async_nf_add_fwnode(), which increments the refcount of the node. Therefore, while the current implementation only releases the node when imx_media_of_add_csi() fails, but should always release it. Call of_node_put() right after imx_media_of_add_csi().
--- drivers/staging/media/imx/imx-media-of.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/staging/media/imx/imx-media-of.c +2 -6
@@ -55,23 +55,19 @@ int imx_media_add_of_subdevs(struct imx_media_dev *imxmd,break ; ret =imx_media_of_add_csi (imxmd, csi_np); +of_node_put (csi_np);if (ret) {/* unavailable or already added is not an error */ if (ret == -ENODEV || ret == -EEXIST ) { -of_node_put (csi_np);continue ; }/* other error, can't continue */ - goto err_out; +return ret; } }return 0 ; - -err_out: -of_node_put (csi_np); -return ret; }EXPORT_SYMBOL_GPL (imx_media_add_of_subdevs);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 56/328 scsi: mpt3sas: Set ioc->manu_pg11.EEDPTagMode directly to 1
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Menzel <[email protected]>
[ Upstream commit ad7c3c0cb8f61d6d5a48b83e62ca4a9fd2f26153 ]
Currently, the code does:
if (x == 0) {
x &= ~0x3;
x |= 0x1;
}Zeroing bits 0 and 1 of a variable that is 0 is not necessary. So directly set the variable to 1.
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +1 -2
@@ -4627,8 +4627,7 @@ _base_static_config_pages(struct MPT3SAS_ADAPTER *ioc)if (!ioc->is_gen35_ioc && ioc->manu_pg11.EEDPTagMode ==0 ) {pr_err ("%s: overriding NVDATA EEDPTagMode setting\n" , ioc->name); - ioc->manu_pg11.EEDPTagMode &= ~0x3 ; - ioc->manu_pg11.EEDPTagMode |=0x1 ; + ioc->manu_pg11.EEDPTagMode =0x1 ;mpt3sas_config_set_manufacturing_pg11 (ioc, &mpi_reply, &ioc->manu_pg11); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 57/328 scsi: ufs: bsg: Delete bsg_dev when setting up bsg fails
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guixin Liu <[email protected]>
[ Upstream commit fcf247deb3c3e1c6be5774e3fa03bbd018eff1a9 ]
We should remove the bsg device when bsg_setup_queue() fails to release the resources.
--- drivers/scsi/ufs/ufs_bsg.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/ufs/ufs_bsg.c +1 -0
@@ -213,6 +213,7 @@ int ufs_bsg_probe(struct ufs_hba *hba) q =bsg_setup_queue (bsg_dev,dev_name (bsg_dev), ufs_bsg_request,NULL ,0 );if (IS_ERR (q)) { ret =PTR_ERR (q); +device_del (bsg_dev); goto out; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 58/328 ocfs2: mark dquot as inactive if failed to start trans while releasing dquot
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Su Yue <[email protected]>
[ Upstream commit 276c61385f6bc3223a5ecd307cf4aba2dfbb9a31 ]
While running fstests generic/329, the kernel workqueue quota_release_workfn is dead looping in calling ocfs2_release_dquot(). The ocfs2 state is already readonly but ocfs2_release_dquot wants to start a transaction but fails and returns.
=====================================================================
[ 2918.123602 ][ T275 ] On-disk corruption discovered. Please run fsck.ocfs2 once the filesystem is unmounted.
[ 2918.124034 ][ T275 ] (kworker/u135:1,275,11):ocfs2_release_dquot:765
ERROR: status = -30
[ 2918.124452 ][ T275 ] (kworker/u135:1,275,11):ocfs2_release_dquot:795
ERROR: status = -30
[ 2918.124883 ][ T275 ] (kworker/u135:1,275,11):ocfs2_start_trans:357
ERROR: status = -30
[ 2918.125276 ][ T275 ] OCFS2: abort (device dm-0): ocfs2_start_trans:
Detected aborted journal
[ 2918.125710 ][ T275 ] On-disk corruption discovered. Please run fsck.ocfs2 once the filesystem is unmounted.
=====================================================================
ocfs2_release_dquot() is much like dquot_release(), which is called by ext4 to handle similar situation. So here fix it by marking the dquot as inactive like what dquot_release() does.
--- fs/ocfs2/quota_global.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/ocfs2/quota_global.c +5 -0
@@ -749,6 +749,11 @@ static int ocfs2_release_dquot(struct dquot *dquot) handle =ocfs2_start_trans (osb,ocfs2_calc_qdel_credits (dquot->dq_sb, dquot->dq_id.type));if (IS_ERR (handle)) { +/* +* Mark dquot as inactive to avoid endless cycle in +* quota_release_workfn(). +*/ +clear_bit (DQ_ACTIVE_B , &dquot->dq_flags); status =PTR_ERR (handle);mlog_errno (status); goto out_ilock;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 59/328 module: Extend the preempt disabled section in dereference_symbol_descriptor().
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit a145c848d69f9c6f32008d8319edaa133360dd74 ]
dereference_symbol_descriptor() needs to obtain the module pointer belonging to pointer in order to resolve that pointer.
The returned mod pointer is obtained under RCU-sched/ preempt_disable() guarantees and needs to be used within this section to ensure that the module is not removed in the meantime.
Extend the preempt_disable() section to also cover dereference_module_function_descriptor().
--- include/linux/kallsyms.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/kallsyms.h +1 -1
@@ -63,10 +63,10 @@ static inline void *dereference_symbol_descriptor(void *ptr)preempt_disable (); mod =__module_address ((unsigned long )ptr); -preempt_enable ();if (mod) ptr =dereference_module_function_descriptor (mod, ptr); +preempt_enable ();#endif return ptr; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 60/328 dmaengine: ti: edma: fix OF node reference leaks in edma_driver
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Hattori <[email protected]>
[ Upstream commit e883c64778e5a9905fce955681f8ee38c7197e0f ]
The .probe() of edma_driver calls of_parse_phandle_with_fixed_args() but does not release the obtained OF nodes. Thus add a of_node_put() call.
This bug was found by an experimental verification tool that I am developing.
--- drivers/dma/ti/edma.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/dma/ti/edma.c +1 -2
@@ -217,7 +217,6 @@ struct edma_desc {struct edma_cc ;struct edma_tc { -struct device_node *node;u16 id; };
@@ -2414,13 +2413,13 @@ static int edma_probe(struct platform_device *pdev)if (ret || i == ecc->num_tc)break ; - ecc->tc_list[i].node = tc_args.np; ecc->tc_list[i].id = i; queue_priority_mapping[i][1 ] = tc_args.args[0 ];if (queue_priority_mapping[i][1 ] > lowest_priority) { lowest_priority = queue_priority_mapping[i][1 ]; info->default_queue = i; } +of_node_put (tc_args.np); } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 61/328 rtc: pcf85063: fix potential OOB write in PCF85063 NVMEM read
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleksij Rempel <[email protected]>
[ Upstream commit 3ab8c5ed4f84fa20cd16794fe8dc31f633fbc70c ]
The nvmem interface supports variable buffer sizes, while the regmap interface operates with fixed-size storage. If an nvmem client uses a buffer size less than 4 bytes, regmap_read will write out of bounds as it expects the buffer to point at an unsigned int.
Fix this by using an intermediary unsigned int to hold the value.
--- drivers/rtc/rtc-pcf85063.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/rtc/rtc-pcf85063.c +10 -1
@@ -332,7 +332,16 @@ static const struct rtc_class_ops pcf85063_rtc_ops_alarm = {static int pcf85063_nvmem_read (void *priv,unsigned int offset,void *val,size_t bytes) { -return regmap_read (priv,PCF85063_REG_RAM , val); +unsigned int tmp; +int ret; + + ret =regmap_read (priv,PCF85063_REG_RAM , &tmp); +if (ret <0 ) +return ret; + + *(u8 *)val = tmp; + +return 0 ; } static int pcf85063_nvmem_write(void *priv, unsigned int offset,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 62/328 ubifs: skip dumping tnc tree when zroot is null
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: pangliyuan <[email protected]>
[ Upstream commit bdb0ca39e0acccf6771db49c3f94ed787d05f2d7 ]
Clearing slab cache will free all znode in memory and make c->zroot.znode = NULL, then dumping tnc tree will access c->zroot.znode which cause null pointer dereference.
--- fs/ubifs/debug.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
fs/ubifs/debug.c +13 -9
@@ -925,16 +925,20 @@ void ubifs_dump_tnc(struct ubifs_info *c)pr_err ("\n" );pr_err ("(pid %d) start dumping TNC tree\n" , current->pid); - znode =ubifs_tnc_levelorder_next (c, c->zroot.znode,NULL ); - level = znode->level; -pr_err ("== Level %d ==\n" , level); -while (znode) { -if (level != znode->level) { - level = znode->level; -pr_err ("== Level %d ==\n" , level); +if (c->zroot.znode) { + znode =ubifs_tnc_levelorder_next (c, c->zroot.znode,NULL ); + level = znode->level; +pr_err ("== Level %d ==\n" , level); +while (znode) { +if (level != znode->level) { + level = znode->level; +pr_err ("== Level %d ==\n" , level); + } +ubifs_dump_znode (c, znode); + znode =ubifs_tnc_levelorder_next (c, c->zroot.znode, znode); } -ubifs_dump_znode (c, znode); - znode =ubifs_tnc_levelorder_next (c, c->zroot.znode, znode); + }else { +pr_err ("empty TNC tree in memory\n" ); }pr_err ("(pid %d) finish dumping TNC tree\n" , current->pid); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 63/328 net: fec: implement TSO descriptor cleanup
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dheeraj Reddy Jonnalagadda <[email protected]>
[ Upstream commit 61dc1fd9205bc9d9918aa933a847b08e80b4dc20 ]
Implement cleanup of descriptors in the TSO error path of fec_enet_txq_submit_tso(). The cleanup
- Unmaps DMA buffers for data descriptors skipping TSO header
- Clears all buffer descriptors
- Handles extended descriptors by clearing cbd_esc when enabled
--- drivers/net/ethernet/freescale/fec_main.c | 31 ++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-)
drivers/net/ethernet/freescale/fec_main.c +30 -1
@@ -732,6 +732,8 @@ static int fec_enet_txq_submit_tso(struct fec_enet_priv_tx_q *txq,int hdr_len =skb_transport_offset (skb) +tcp_hdrlen (skb);int total_len, data_left;struct bufdesc *bdp = txq->bd.cur; +struct bufdesc *tmp_bdp; +struct bufdesc_ex *ebdp;struct tso_t tso;unsigned int index =0 ;int ret;
@@ -805,7 +807,34 @@ static int fec_enet_txq_submit_tso(struct fec_enet_priv_tx_q *txq,return 0 ; err_release: -/* TODO: Release all used data descriptors for TSO */ +/* Release all used data descriptors for TSO */ + tmp_bdp = txq->bd.cur; + +while (tmp_bdp != bdp) { +/* Unmap data buffers */ +if (tmp_bdp->cbd_bufaddr && + !IS_TSO_HEADER (txq,fec32_to_cpu (tmp_bdp->cbd_bufaddr))) +dma_unmap_single (&fep->pdev->dev, +fec32_to_cpu (tmp_bdp->cbd_bufaddr), +fec16_to_cpu (tmp_bdp->cbd_datlen), +DMA_TO_DEVICE ); + +/* Clear standard buffer descriptor fields */ + tmp_bdp->cbd_sc =0 ; + tmp_bdp->cbd_datlen =0 ; + tmp_bdp->cbd_bufaddr =0 ; + +/* Handle extended descriptor if enabled */ +if (fep->bufdesc_ex) { + ebdp = (struct bufdesc_ex *)tmp_bdp; + ebdp->cbd_esc =0 ; + } + + tmp_bdp =fec_enet_get_nextdesc (tmp_bdp, &txq->bd); + } + +dev_kfree_skb_any (skb); +return ret; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 64/328 ipmr: do not call mr_mfc_uses_dev() for unres entries
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 15a901361ec3fb1c393f91880e1cbf24ec0a88bd ]
syzbot found that calling mr_mfc_uses_dev() for unres entries would crash [1], because c->mfc_un.res.minvif / c->mfc_un.res.maxvif alias to "struct sk_buff_head unresolved", which contain two pointers.
This code never worked, lets remove it.
[1]
Unable to handle kernel paging request at virtual address ffff5fff2d536613 KASAN: maybe wild-memory-access in range [0xfffefff96a9b3098-0xfffefff96a9b309f] Modules linked in: CPU: 1 UID: 0 PID: 7321 Comm: syz.0.16 Not tainted 6.13.0-rc7-syzkaller-g1950a0af2d55 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : mr_mfc_uses_dev net/ipv4/ipmr_base.c:290 [inline] pc : mr_table_dump+0x5a4/0x8b0 net/ipv4/ipmr_base.c:334 lr : mr_mfc_uses_dev net/ipv4/ipmr_base.c:289 [inline] lr : mr_table_dump+0x694/0x8b0 net/ipv4/ipmr_base.c:334 Call trace: mr_mfc_uses_dev net/ipv4/ipmr_base.c:290 [inline] (P) mr_table_dump+0x5a4/0x8b0 net/ipv4/ipmr_base.c:334 (P) mr_rtm_dumproute+0x254/0x454 net/ipv4/ipmr_base.c:382 ipmr_rtm_dumproute+0x248/0x4b4 net/ipv4/ipmr.c:2648 rtnl_dump_all+0x2e4/0x4e8 net/core/rtnetlink.c:4327 rtnl_dumpit+0x98/0x1d0 net/core/rtnetlink.c:6791 netlink_dump+0x4f0/0xbc0 net/netlink/af_netlink.c:2317 netlink_recvmsg+0x56c/0xe64 net/netlink/af_netlink.c:1973 sock_recvmsg_nosec net/socket.c:1033 [inline] sock_recvmsg net/socket.c:1055 [inline] sock_read_iter+0x2d8/0x40c net/socket.c:1125 new_sync_read fs/read_write.c:484 [inline] vfs_read+0x740/0x970 fs/read_write.c:565 ksys_read+0x15c/0x26c fs/read_write.c:708
--- net/ipv4/ipmr_base.c | 3 --- 1 file changed, 3 deletions(-)
net/ipv4/ipmr_base.c +0 -3
@@ -321,9 +321,6 @@ int mr_table_dump(struct mr_table *mrt, struct sk_buff *skb,list_for_each_entry (mfc, &mrt->mfc_unres_queue, list) {if (e < s_e) goto next_entry2; -if (filter->dev && - !mr_mfc_uses_dev (mrt, mfc, filter->dev)) - goto next_entry2; err =fill (mrt, skb,NETLINK_CB (cb->skb).portid, cb->nlh->nlmsg_seq, mfc,RTM_NEWROUTE , flags);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 65/328 PM: hibernate: Add error handling for syscore_suspend()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit e20a70c572539a486dbd91b225fa6a194a5e2122 ]
In hibernation_platform_enter(), the code did not check the return value of syscore_suspend(), potentially leading to a situation where syscore_resume() would be called even if syscore_suspend() failed. This could cause unpredictable behavior or system instability.
Modify the code sequence in question to properly handle errors returned by syscore_suspend(). If an error occurs in the suspend path, the code now jumps to label 'Enable_irqs' skipping the syscore_resume() call and only enabling interrupts after setting the system state to SYSTEM_RUNNING.
--- kernel/power/hibernate.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/power/hibernate.c +6 -1
@@ -578,7 +578,11 @@ int hibernation_platform_enter(void)local_irq_disable (); system_state =SYSTEM_SUSPEND ; -syscore_suspend (); + + error =syscore_suspend (); +if (error) + goto Enable_irqs; +if (pm_wakeup_pending ()) { error = -EAGAIN ; goto Power_up;
@@ -590,6 +594,7 @@ int hibernation_platform_enter(void) Power_up:syscore_resume (); + Enable_irqs: system_state =SYSTEM_RUNNING ;local_irq_enable ();
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 66/328 net: rose: fix timer races against user threads
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 5de7665e0a0746b5ad7943554b34db8f8614a196 ]
Rose timers only acquire the socket spinlock, without checking if the socket is owned by one user thread.
Add a check and rearm the timers if needed.
BUG: KASAN: slab-use-after-free in rose_timer_expiry+0x31d/0x360 net/rose/rose_timer.c:174 Read of size 2 at addr ffff88802f09b82a by task swapper/0/0 CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.13.0-rc5-syzkaller-00172-gd1bf27c4e176 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: <IRQ> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x169/0x550 mm/kasan/report.c:489 kasan_report+0x143/0x180 mm/kasan/report.c:602 rose_timer_expiry+0x31d/0x360 net/rose/rose_timer.c:174 call_timer_fn+0x187/0x650 kernel/time/timer.c:1793 expire_timers kernel/time/timer.c:1844 [inline] __run_timers kernel/time/timer.c:2418 [inline] __run_timer_base+0x66a/0x8e0 kernel/time/timer.c:2430 run_timer_base kernel/time/timer.c:2439 [inline] run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2449 handle_softirqs+0x2d4/0x9b0 kernel/softirq.c:561 __do_softirq kernel/softirq.c:595 [inline] invoke_softirq kernel/softirq.c:435 [inline] __irq_exit_rcu+0xf7/0x220 kernel/softirq.c:662 irq_exit_rcu+0x9/0x30 kernel/softirq.c:678 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1049 [inline] sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1049 </IRQ>
--- net/rose/rose_timer.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
net/rose/rose_timer.c +15 -0
@@ -122,6 +122,10 @@ static void rose_heartbeat_expiry(struct timer_list *t)struct rose_sock *rose =rose_sk (sk);bh_lock_sock (sk); +if (sock_owned_by_user (sk)) { +sk_reset_timer (sk, &sk->sk_timer, jiffies +HZ /20 ); + goto out; + }switch (rose->state) {case ROSE_STATE_0 :/* Magic here: If we listen() and a new link dies before it
@@ -152,6 +156,7 @@ static void rose_heartbeat_expiry(struct timer_list *t) }rose_start_heartbeat (sk); +out:bh_unlock_sock (sk);sock_put (sk); }
@@ -162,6 +167,10 @@ static void rose_timer_expiry(struct timer_list *t)struct sock *sk = &rose->sock;bh_lock_sock (sk); +if (sock_owned_by_user (sk)) { +sk_reset_timer (sk, &rose->timer, jiffies +HZ /20 ); + goto out; + }switch (rose->state) {case ROSE_STATE_1 :/* T1 */ case ROSE_STATE_4 :/* T2 */
@@ -182,6 +191,7 @@ static void rose_timer_expiry(struct timer_list *t) }break ; } +out:bh_unlock_sock (sk);sock_put (sk); }
@@ -192,6 +202,10 @@ static void rose_idletimer_expiry(struct timer_list *t)struct sock *sk = &rose->sock;bh_lock_sock (sk); +if (sock_owned_by_user (sk)) { +sk_reset_timer (sk, &rose->idletimer, jiffies +HZ /20 ); + goto out; + }rose_clear_queues (sk);rose_write_internal (sk,ROSE_CLEAR_REQUEST );
@@ -207,6 +221,7 @@ static void rose_idletimer_expiry(struct timer_list *t) sk->sk_state_change (sk);sock_set_flag (sk,SOCK_DEAD ); } +out:bh_unlock_sock (sk);sock_put (sk); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 67/328 net: davicom: fix UAF in dm9000_drv_remove
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chenyuan Yang <[email protected]>
[ Upstream commit 19e65c45a1507a1a2926649d2db3583ed9d55fd9 ]
dm is netdev private data and it cannot be
used after free_netdev() call. Using dm after free_netdev() can cause UAF bug. Fix it by moving free_netdev() at the end of the function.
This is similar to the issue fixed in commit ad297cd2db89 ("net: qcom/emac: fix UAF in emac_remove").
This bug is detected by our static analysis tool.
--- drivers/net/ethernet/davicom/dm9000.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/davicom/dm9000.c +2 -1
@@ -1781,10 +1781,11 @@ dm9000_drv_remove(struct platform_device *pdev)unregister_netdev (ndev);dm9000_release_board (pdev, dm); -free_netdev (ndev);/* free device structure */ if (dm->power_supply)regulator_disable (dm->power_supply); +free_netdev (ndev);/* free device structure */ +dev_dbg (&pdev->dev,"released and freed device\n" );return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 68/328 perf trace: Fix runtime error of index out of bounds
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Howard Chu <[email protected]>
[ Upstream commit c7b87ce0dd10b64b68a0b22cb83bbd556e28fe81 ]
libtraceevent parses and returns an array of argument fields, sometimes larger than RAW_SYSCALL_ARGS_NUM (6) because it includes "__syscall_nr", idx will traverse to index 6 (7th element) whereas sc->fmt->arg holds 6 elements max, creating an out-of-bounds access. This runtime error is found by UBsan. The error message:
$ sudo UBSAN_OPTIONS=print_stacktrace=1 ./perf trace -a --max-events=1
builtin-trace.c:1966:35: runtime error: index 6 out of bounds for type 'syscall_arg_fmt [6]'
#0 0x5c04956be5fe in syscall__alloc_arg_fmts /home/howard/hw/linux-perf/tools/perf/builtin-trace.c:1966
#1 0x5c04956c0510 in trace__read_syscall_info /home/howard/hw/linux-perf/tools/perf/builtin-trace.c:2110
#2 0x5c04956c372b in trace__syscall_info /home/howard/hw/linux-perf/tools/perf/builtin-trace.c:2436
#3 0x5c04956d2f39 in trace__init_syscalls_bpf_prog_array_maps /home/howard/hw/linux-perf/tools/perf/builtin-trace.c:3897
#4 0x5c04956d6d25 in trace__run /home/howard/hw/linux-perf/tools/perf/builtin-trace.c:4335
#5 0x5c04956e112e in cmd_trace /home/howard/hw/linux-perf/tools/perf/builtin-trace.c:5502
#6 0x5c04956eda7d in run_builtin /home/howard/hw/linux-perf/tools/perf/perf.c:351
#7 0x5c04956ee0a8 in handle_internal_command /home/howard/hw/linux-perf/tools/perf/perf.c:404
#8 0x5c04956ee37f in run_argv /home/howard/hw/linux-perf/tools/perf/perf.c:448
#9 0x5c04956ee8e9 in main /home/howard/hw/linux-perf/tools/perf/perf.c:556
#10 0x79eb3622a3b7 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
#11 0x79eb3622a47a in __libc_start_main_impl ../csu/libc-start.c:360
#12 0x5c04955422d4 in _start (/home/howard/hw/linux-perf/tools/perf/perf+0x4e02d4) (BuildId: 5b6cab2d59e96a4341741765ad6914a4d784dbc6)0.000 ( 0.014 ms): Chrome_ChildIO/117244 write(fd: 238, buf: !, count: 1) = 1
--- tools/perf/builtin-trace.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/builtin-trace.c +5 -1
@@ -1582,8 +1582,12 @@ static int trace__read_syscall_info(struct trace *trace, int id)return PTR_ERR (sc->tp_format); } +/* +* The tracepoint format contains __syscall_nr field, so it's one more +* than the actual number of syscall arguments. +*/ if (syscall__alloc_arg_fmts (sc,IS_ERR (sc->tp_format) ? -RAW_SYSCALL_ARGS_NUM : sc->tp_format->format.nr_fields)) +RAW_SYSCALL_ARGS_NUM : sc->tp_format->format.nr_fields -1 ))return -ENOMEM ; sc->args = sc->tp_format->format.fields;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 69/328 vsock: Allow retrying on connect() failure
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Luczaj <[email protected]>
[ Upstream commit aa388c72113b7458127b709bdd7d3628af26e9b4 ]
sk_err is set when a (connectible) connect() fails. Effectively, this makes an otherwise still healthy SS_UNCONNECTED socket impossible to use for any subsequent connection attempts.
Clear sk_err upon trying to establish a connection.
--- net/vmw_vsock/af_vsock.c | 5 +++++ 1 file changed, 5 insertions(+)
net/vmw_vsock/af_vsock.c +5 -0
@@ -1185,6 +1185,11 @@ static int vsock_stream_connect(struct socket *sock, struct sockaddr *addr,if (err <0 ) goto out; +/* sk_err might have been set as a result of an earlier +* (failed) connect attempt. +*/ + sk->sk_err =0 ; +/* Mark sock as connecting and set the error code to in * progress in case this is a non-blocking connect. */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 70/328 net: sh_eth: Fix missing rtnl lock in suspend/resume path
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kory Maincent <[email protected]>
[ Upstream commit b95102215a8d0987789715ce11c0d4ec031cbfbe ]
Fix the suspend/resume path by ensuring the rtnl lock is held where required. Calls to sh_eth_close, sh_eth_open and wol operations must be performed under the rtnl lock to prevent conflicts with ongoing ndo operations.
--- drivers/net/ethernet/renesas/sh_eth.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/renesas/sh_eth.c +4 -0
@@ -3496,10 +3496,12 @@ static int sh_eth_suspend(struct device *dev)netif_device_detach (ndev); +rtnl_lock ();if (mdp->wol_enabled) ret =sh_eth_wol_setup (ndev);else ret =sh_eth_close (ndev); +rtnl_unlock ();return ret; }
@@ -3513,10 +3515,12 @@ static int sh_eth_resume(struct device *dev)if (!netif_running (ndev))return 0 ; +rtnl_lock ();if (mdp->wol_enabled) ret =sh_eth_wol_restore (ndev);else ret =sh_eth_open (ndev); +rtnl_unlock ();if (ret <0 )return ret;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 71/328 genksyms: fix memory leak when the same symbol is added from source
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit 45c9c4101d3d2fdfa00852274bbebba65fcc3cf2 ]
When a symbol that is already registered is added again, __add_symbol() returns without freeing the symbol definition, making it unreachable.
The following test cases demonstrate different memory leak points.
[Test Case 1]
Forward declaration with exactly the same definition
$ cat foo.c
#include <linux/export.h>
void foo(void);
void foo(void) {}
EXPORT_SYMBOL(foo);[Test Case 2]
Forward declaration with a different definition (e.g. attribute)
$ cat foo.c
#include <linux/export.h>
void foo(void);
__attribute__((__section__(".ref.text"))) void foo(void) {}
EXPORT_SYMBOL(foo);[Test Case 3]
Preserving an overridden symbol (compile with KBUILD_PRESERVE=1)
$ cat foo.c
#include <linux/export.h>
void foo(void);
void foo(void) { }
EXPORT_SYMBOL(foo);$ cat foo.symref override foo void foo ( int )
The memory leaks in Test Case 1 and 2 have existed since the introduction of genksyms into the kernel tree. [1]
The memory leak in Test Case 3 was introduced by commit 5dae9a550a74 ("genksyms: allow to ignore symbol checksum changes").
When multiple init_declarators are reduced to an init_declarator_list, the decl_spec must be duplicated. Otherwise, the following Test Case 4 would result in a double-free bug.
[Test Case 4]
$ cat foo.c #include <linux/export.h>
extern int foo, bar;
int foo, bar; EXPORT_SYMBOL(foo);
In this case, 'foo' and 'bar' share the same decl_spec, 'int'. It must be unshared before being passed to add_symbol().
--- scripts/genksyms/genksyms.c | 3 +++ scripts/genksyms/parse.y | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-)
scripts/genksyms/genksyms.c +3 -0
@@ -241,6 +241,7 @@ static struct symbol *__add_symbol(const char *name, enum symbol_type type, "unchanged\n"); } sym->is_declared =1 ; +free_list (defn,NULL );return sym; }else if (!sym->is_declared) {if (sym->is_override && flag_preserve) {
@@ -249,6 +250,7 @@ static struct symbol *__add_symbol(const char *name, enum symbol_type type,print_type_name (type, name);fprintf (stderr," modversion change\n" ); sym->is_declared =1 ; +free_list (defn,NULL );return sym; }else { status = is_unknown_symbol(sym) ?
@@ -256,6 +258,7 @@ static struct symbol *__add_symbol(const char *name, enum symbol_type type, } }else {error_with_pos ("redefinition of %s" , name); +free_list (defn,NULL );return sym; }break ;
scripts/genksyms/parse.y +12 -2
@@ -149,14 +149,19 @@ simple_declaration: ; init_declarator_list_opt: - /* empty */ { $$ = NULL; } - | init_declarator_list + /* empty */ { $$ = NULL; } + | init_declarator_list { free_list(decl_spec, NULL); $$ = $1; } ; init_declarator_list: init_declarator { struct string_list *decl = *$1; *$1 = NULL; + + /* avoid sharing among multiple init_declarators */ + if (decl_spec) + decl_spec = copy_list_range(decl_spec, NULL); + add_symbol(current_name, is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl, is_extern); current_name = NULL;
@@ -167,6 +172,11 @@ init_declarator_list: *$3 = NULL; free_list(*$2, NULL); *$2 = decl_spec; + + /* avoid sharing among multiple init_declarators */ + if (decl_spec) + decl_spec = copy_list_range(decl_spec, NULL); + add_symbol(current_name, is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl, is_extern); current_name = NULL;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 72/328 genksyms: fix memory leak when the same symbol is read from *.symref file
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit be2fa44b5180a1f021efb40c55fdf63c249c3209 ]
When a symbol that is already registered is read again from *.symref file, __add_symbol() removes the previous one from the hash table without freeing it.
[Test Case]
$ cat foo.c
#include <linux/export.h>
void foo(void);
void foo(void) {}
EXPORT_SYMBOL(foo);$ cat foo.symref foo void foo ( void ) foo void foo ( void )
When a symbol is removed from the hash table, it must be freed along with its ->name and ->defn members. However, sym->name cannot be freed because it is sometimes shared with node->string, but not always. If sym->name and node->string share the same memory, free(sym->name) could lead to a double-free bug.
To resolve this issue, always assign a strdup'ed string to sym->name.
--- scripts/genksyms/genksyms.c | 8 ++++++-- scripts/genksyms/genksyms.h | 2 +- scripts/genksyms/parse.y | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-)
scripts/genksyms/genksyms.c +6 -2
@@ -274,11 +274,15 @@ static struct symbol *__add_symbol(const char *name, enum symbol_type type,break ; } } + +free_list (sym->defn,NULL ); +free (sym->name); +free (sym); --nsyms; } sym =xmalloc (sizeof (*sym)); - sym->name = name; + sym->name =xstrdup (name); sym->type = type; sym->defn = defn; sym->expansion_trail =NULL ;
@@ -485,7 +489,7 @@ static void read_reference(FILE *f) defn = def; def =read_node (f); } - subsym =add_reference_symbol (xstrdup (sym->string), sym->tag, + subsym =add_reference_symbol (sym->string, sym->tag, defn, is_extern); subsym->is_override = is_override;free_node (sym);
scripts/genksyms/genksyms.h +1 -1
@@ -32,7 +32,7 @@ struct string_list {struct symbol {struct symbol *hash_next; -const char *name; +char *name;enum symbol_type type;struct string_list *defn;struct symbol *expansion_trail;
scripts/genksyms/parse.y +2 -2
@@ -479,12 +479,12 @@ enumerator_list: enumerator: IDENT { - const char *name = strdup((*$1)->string); + const char *name = (*$1)->string; add_symbol(name, SYM_ENUM_CONST, NULL, 0); } | IDENT '=' EXPRESSION_PHRASE { - const char *name = strdup((*$1)->string); + const char *name = (*$1)->string; struct string_list *expr = copy_list_range(*$3, *$2); add_symbol(name, SYM_ENUM_CONST, expr, 0); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 73/328 hexagon: fix using plain integer as NULL pointer warning in cmpxchg
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Willem de Bruijn <[email protected]>
[ Upstream commit 8a20030038742b9915c6d811a4e6c14b126cafb4 ]
Sparse reports
net/ipv4/inet_diag.c:1511:17: sparse: sparse: Using plain integer as NULL pointer
Due to this code calling cmpxchg on a non-integer type struct inet_diag_handler *
return !cmpxchg((const struct inet_diag_handler**)&inet_diag_table[type],
NULL, h) ? 0 : -EEXIST;
While hexagon's cmpxchg assigns an integer value to a variable of this type.
__typeof__(*(ptr)) __oldval = 0;
Update this assignment to cast 0 to the correct type.
The original issue is easily reproduced at head with the below block, and is absent after this change.
make LLVM=1 ARCH=hexagon defconfig
make C=1 LLVM=1 ARCH=hexagon net/ipv4/inet_diag.o
--- arch/hexagon/include/asm/cmpxchg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/hexagon/include/asm/cmpxchg.h +1 -1
@@ -56,7 +56,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr,__typeof__ (ptr) __ptr = (ptr); \ __typeof__(*(ptr)) __old = (old); \ __typeof__(*(ptr)) __new = (new); \ - __typeof__(*(ptr)) __oldval = 0; \ + __typeof__(*(ptr)) __oldval = (__typeof__(*(ptr))) 0; \ \ asmvolatile ( \ "1: %0 = memw_locked(%1);\n" \
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 74/328 hexagon: Fix unbalanced spinlock in die()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lin Yujun <[email protected]>
[ Upstream commit 03410e87563a122075c3721acc7d5510e41d8332 ]
die executes holding the spinlock of &die.lock and unlock it after printing the oops message.
However in the code if the notify_die() returns NOTIFY_STOP , die() exit with returning 1 but never unlocked the spinlock.
Fix this by adding spin_unlock_irq(&die.lock) before returning.
--- arch/hexagon/kernel/traps.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/hexagon/kernel/traps.c +3 -1
@@ -202,8 +202,10 @@ int die(const char *str, struct pt_regs *regs, long err)printk (KERN_EMERG "Oops: %s[#%d]:\n" , str, ++die.counter);if (notify_die (DIE_OOPS , str, regs, err,pt_cause (regs),SIGSEGV ) == -NOTIFY_STOP ) +NOTIFY_STOP ) { +spin_unlock_irq (&die.lock);return 1 ; + }print_modules ();show_regs (regs);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 75/328 NFSD: Reset cb_seq_status after NFS4ERR_DELAY
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
commit 961b4b5e86bf56a2e4b567f81682defa5cba957e upstream.
I noticed that once an NFSv4.1 callback operation gets a NFS4ERR_DELAY status on CB_SEQUENCE and then the connection is lost, the callback client loops, resending it indefinitely.
The switch arm in nfsd4_cb_sequence_done() that handles NFS4ERR_DELAY uses rpc_restart_call() to rearm the RPC state machine for the retransmit, but that path does not call the rpc_prepare_call callback again. Thus cb_seq_status is set to -10008 by the first NFS4ERR_DELAY result, but is never set back to 1 for the retransmits.
nfsd4_cb_sequence_done() thinks it's getting nothing but a long series of CB_SEQUENCE NFS4ERR_DELAY replies.
--- fs/nfsd/nfs4callback.c | 1 + 1 file changed, 1 insertion(+)
fs/nfsd/nfs4callback.c +1 -0
@@ -1060,6 +1060,7 @@ static bool nfsd4_cb_sequence_done(struc ret = false;break ;case -NFS4ERR_DELAY : + cb->cb_seq_status =1 ;if (!rpc_restart_call (task)) goto out;
Greg Kroah-Hartman
maintainerPATCH 76/328 ktest.pl: Check kernelrelease return in get_version
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo B. Marliere <[email protected]>
commit a4e17a8f239a545c463f8ec27db4ed6e74b31841 upstream.
In the case of a test that uses the special option ${KERNEL_VERSION} in one of its settings but has no configuration available in ${OUTPUT_DIR}, for example if it's a new empty directory, then the make kernelrelease call will fail and the subroutine will chomp an empty string, silently. Fix that by adding an empty configuration and retrying.
--- tools/testing/ktest/ktest.pl | 5 +++++ 1 file changed, 5 insertions(+)
tools/testing/ktest/ktest.pl +5 -0
@@ -2319,6 +2319,11 @@ sub get_version { return if ($have_version); doprint "$make kernelrelease ... "; $version = `$make -s kernelrelease | tail -1`; + if (!length($version)) { + run_command "$make allnoconfig" or return 0; + doprint "$make kernelrelease ... "; + $version = `$make -s kernelrelease | tail -1`; + } chomp($version); doprint "$version\n"; $have_version = 1;
Greg Kroah-Hartman
maintainerPATCH 77/328 drivers/card_reader/rtsx_usb: Restore interrupt based detection
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Rhodes <[email protected]>
commit 235b630eda072d7e7b102ab346d6b8a2c028a772 upstream.
This commit reintroduces interrupt-based card detection previously used in the rts5139 driver. This functionality was removed in commit 00d8521dcd23 ("staging: remove rts5139 driver code").
Reintroducing this mechanism fixes presence detection for certain card readers, which with the current driver, will taken approximately 20 seconds to enter S3 as mmc_rescan has to be frozen.
--- drivers/misc/cardreader/rtsx_usb.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/misc/cardreader/rtsx_usb.c +15 -0
@@ -286,6 +286,7 @@ static int rtsx_usb_get_status_with_bulkint rtsx_usb_get_card_status (struct rtsx_ucr *ucr,u16 *status) {int ret; +u8 interrupt_val =0 ;u16 *buf;if (!status)
@@ -308,6 +309,20 @@ int rtsx_usb_get_card_status(struct rtsx ret =rtsx_usb_get_status_with_bulk (ucr, status); } +rtsx_usb_read_register (ucr,CARD_INT_PEND , &interrupt_val); +/* Cross check presence with interrupts */ +if (*status &XD_CD ) +if (!(interrupt_val &XD_INT )) + *status &= ~XD_CD ; + +if (*status &SD_CD ) +if (!(interrupt_val &SD_INT )) + *status &= ~SD_CD ; + +if (*status &MS_CD ) +if (!(interrupt_val &MS_INT )) + *status &= ~MS_CD ; +/* usb_control_msg may return positive when success */ if (ret <0 )return ret;
Greg Kroah-Hartman
maintainerPATCH 78/328 usb: typec: tcpm: set SRC_SEND_CAPABILITIES timeout to PD_T_SENDER_RESPONSE
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jos Wang <[email protected]>
commit 2eb3da037c2c20fa30bc502bc092479b2a1aaae2 upstream.
As PD2.0 spec ("8.3.3.2.3 PE_SRC_Send_Capabilities state"), after the Source receives the GoodCRC Message from the Sink in response to the Source_Capabilities message, it should start the SenderResponseTimer, after the timer times out, the state machine transitions to the HARD_RESET state.
--- drivers/usb/typec/tcpm/tcpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/typec/tcpm/tcpm.c +1 -1
@@ -3035,7 +3035,7 @@ static void run_state_machine(struct tcp port->caps_count =0 ; port->pd_capable = true;tcpm_set_state_cond (port,SRC_SEND_CAPABILITIES_TIMEOUT , -PD_T_SEND_SOURCE_CAP ); +PD_T_SENDER_RESPONSE ); }break ;case SRC_SEND_CAPABILITIES_TIMEOUT :
Greg Kroah-Hartman
maintainerPATCH 79/328 HID: core: Fix assumption that Resolution Multipliers must be in Logical Collections
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 64f2657b579343cf923aa933f08074e6258eb07b upstream.
A report in 2019 by the syzbot fuzzer was found to be connected to two errors in the HID core associated with Resolution Multipliers. One of the errors was fixed by commit ea427a222d8b ("HID: core: Fix deadloop in hid_apply_multiplier."), but the other has not been fixed.
This error arises because hid_apply_multipler() assumes that every Resolution Multiplier control is contained in a Logical Collection, i.e., there's no way the routine can ever set multiplier_collection to NULL. This is in spite of the fact that the function starts with a big comment saying:
* "The Resolution Multiplier control must be contained in the same
* Logical Collection as the control(s) to which it is to be applied.
...
* If no Logical Collection is
* defined, the Resolution Multiplier is associated with all
* controls in the report."
* HID Usage Table, v1.12, Section 4.3.1, p30
*
* Thus, search from the current collection upwards until we find a
* logical collection...
The comment and the code overlook the possibility that none of the collections found may be a Logical Collection.
The fix is to set the multiplier_collection pointer to NULL if the collection found isn't a Logical Collection.
--- drivers/hid/hid-core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hid/hid-core.c +2 -0
@@ -1117,6 +1117,8 @@ static void hid_apply_multiplier(structwhile (multiplier_collection->parent_idx !=-1 && multiplier_collection->type !=HID_COLLECTION_LOGICAL ) multiplier_collection = &hid->collection[multiplier_collection->parent_idx]; +if (multiplier_collection->type !=HID_COLLECTION_LOGICAL ) + multiplier_collection =NULL ; effective_multiplier =hid_calculate_multiplier (hid, multiplier);
Greg Kroah-Hartman
maintainerPATCH 80/328 media: uvcvideo: Fix double free in error path
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laurent Pinchart <[email protected]>
commit c6ef3a7fa97ec823a1e1af9085cf13db9f7b3bac upstream.
If the uvc_status_init() function fails to allocate the int_urb, it will free the dev->status pointer but doesn't reset the pointer to NULL. This results in the kfree() call in uvc_status_cleanup() trying to double-free the memory. Fix it by resetting the dev->status pointer to NULL after freeing it.
Reviewed by: Ricardo Ribalda <[email protected]>
--- drivers/media/usb/uvc/uvc_status.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/usb/uvc/uvc_status.c +1 -0
@@ -269,6 +269,7 @@ int uvc_status_init(struct uvc_device *d dev->int_urb =usb_alloc_urb (0 ,GFP_KERNEL );if (dev->int_urb ==NULL ) {kfree (dev->status); + dev->status =NULL ;return -ENOMEM ; }
Greg Kroah-Hartman
maintainerPATCH 81/328 usb: gadget: f_tcm: Dont free command immediately
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit c225d006a31949d673e646d585d9569bc28feeb9 upstream.
Don't prematurely free the command. Wait for the status completion of the sense status. It can be freed then. Otherwise we will double-free the command.
--- drivers/usb/gadget/function/f_tcm.c | 2 -- 1 file changed, 2 deletions(-)
drivers/usb/gadget/function/f_tcm.c +0 -2
@@ -1064,7 +1064,6 @@ static void usbg_cmd_work(struct work_st out:transport_send_check_condition_and_sense (se_cmd,TCM_UNSUPPORTED_SCSI_OPCODE ,1 ); -transport_generic_free_cmd (&cmd->se_cmd,0 ); } static struct usbg_cmd *usbg_get_cmd(struct f_uas *fu,
@@ -1194,7 +1193,6 @@ static void bot_cmd_work(struct work_str out:transport_send_check_condition_and_sense (se_cmd,TCM_UNSUPPORTED_SCSI_OPCODE ,1 ); -transport_generic_free_cmd (&cmd->se_cmd,0 ); } static int bot_submit_command(struct f_uas *fu,
Greg Kroah-Hartman
maintainerPATCH 82/328 btrfs: output the reason for open_ctree() failure
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
commit d0f038104fa37380e2a725e669508e43d0c503e9 upstream.
There is a recent ML report that mounting a large fs backed by hardware RAID56 controller (with one device missing) took too much time, and systemd seems to kill the mount attempt.
In that case, the only error message is:
BTRFS error (device sdj): open_ctree failed
There is no reason on why the failure happened, making it very hard to understand the reason.
At least output the error number (in the particular case it should be -EINTR) to provide some clue.
--- fs/btrfs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/super.c +1 -1
@@ -1217,7 +1217,7 @@ static int btrfs_fill_super(struct super err =open_ctree (sb, fs_devices, (char *)data);if (err) { -btrfs_err (fs_info,"open_ctree failed" ); +btrfs_err (fs_info,"open_ctree failed: %d" , err);return err; }
Greg Kroah-Hartman
maintainerPATCH 83/328 btrfs: fix use-after-free when attempting to join an aborted transaction
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit e2f0943cf37305dbdeaf9846e3c941451bcdef63 ]
When we are trying to join the current transaction and if it's aborted, we read its 'aborted' field after unlocking fs_info->trans_lock and without holding any extra reference count on it. This means that a concurrent task that is aborting the transaction may free the transaction before we read its 'aborted' field, leading to a use-after-free.
Fix this by reading the 'aborted' field while holding fs_info->trans_lock since any freeing task must first acquire that lock and set fs_info->running_transaction to NULL before freeing the transaction.
This was reported by syzbot and Dmitry with the following stack traces from KASAN:
==================================================================
BUG: KASAN: slab-use-after-free in join_transaction+0xd9b/0xda0 fs/btrfs/transaction.c:278
Read of size 4 at addr ffff888011839024 by task kworker/u4:9/1128
CPU: 0 UID: 0 PID: 1128 Comm: kworker/u4:9 Not tainted 6.13.0-rc7-syzkaller-00019-gc45323b7560e #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Workqueue: events_unbound btrfs_async_reclaim_data_space
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0x169/0x550 mm/kasan/report.c:489
kasan_report+0x143/0x180 mm/kasan/report.c:602
join_transaction+0xd9b/0xda0 fs/btrfs/transaction.c:278
start_transaction+0xaf8/0x1670 fs/btrfs/transaction.c:697
flush_space+0x448/0xcf0 fs/btrfs/space-info.c:803
btrfs_async_reclaim_data_space+0x159/0x510 fs/btrfs/space-info.c:1321
process_one_work kernel/workqueue.c:3236 [inline]
process_scheduled_works+0xa66/0x1840 kernel/workqueue.c:3317
worker_thread+0x870/0xd30 kernel/workqueue.c:3398
kthread+0x2f0/0x390 kernel/kthread.c:389
ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
</TASK>
Allocated by task 5315:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
__kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:394
kasan_kmalloc include/linux/kasan.h:260 [inline]
__kmalloc_cache_noprof+0x243/0x390 mm/slub.c:4329
kmalloc_noprof include/linux/slab.h:901 [inline]
join_transaction+0x144/0xda0 fs/btrfs/transaction.c:308
start_transaction+0xaf8/0x1670 fs/btrfs/transaction.c:697
btrfs_create_common+0x1b2/0x2e0 fs/btrfs/inode.c:6572
lookup_open fs/namei.c:3649 [inline]
open_last_lookups fs/namei.c:3748 [inline]
path_openat+0x1c03/0x3590 fs/namei.c:3984
do_filp_open+0x27f/0x4e0 fs/namei.c:4014
do_sys_openat2+0x13e/0x1d0 fs/open.c:1402
do_sys_open fs/open.c:1417 [inline]
__do_sys_creat fs/open.c:1495 [inline]
__se_sys_creat fs/open.c:1489 [inline]
__x64_sys_creat+0x123/0x170 fs/open.c:1489
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Freed by task 5336:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:582
poison_slab_object mm/kasan/common.c:247 [inline]
__kasan_slab_free+0x59/0x70 mm/kasan/common.c:264
kasan_slab_free include/linux/kasan.h:233 [inline]
slab_free_hook mm/slub.c:2353 [inline]
slab_free mm/slub.c:4613 [inline]
kfree+0x196/0x430 mm/slub.c:4761
cleanup_transaction fs/btrfs/transaction.c:2063 [inline]
btrfs_commit_transaction+0x2c97/0x3720 fs/btrfs/transaction.c:2598
insert_balance_item+0x1284/0x20b0 fs/btrfs/volumes.c:3757
btrfs_balance+0x992/0x10c0 fs/btrfs/volumes.c:4633
btrfs_ioctl_balance+0x493/0x7c0 fs/btrfs/ioctl.c:3670
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:906 [inline]
__se_sys_ioctl+0xf5/0x170 fs/ioctl.c:892
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
The buggy address belongs to the object at ffff888011839000
which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 36 bytes inside of
freed 2048-byte region [ffff888011839000, ffff888011839800)
The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11838
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000040 ffff88801ac42000 ffffea0000493400 dead000000000002
raw: 0000000000000000 0000000000080008 00000001f5000000 0000000000000000
head: 00fff00000000040 ffff88801ac42000 ffffea0000493400 dead000000000002
head: 0000000000000000 0000000000080008 00000001f5000000 0000000000000000
head: 00fff00000000003 ffffea0000460e01 ffffffffffffffff 0000000000000000
head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 57, tgid 57 (kworker/0:2), ts 67248182943, free_ts 67229742023
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1558
prep_new_page mm/page_alloc.c:1566 [inline]
get_page_from_freelist+0x365c/0x37a0 mm/page_alloc.c:3476
__alloc_pages_noprof+0x292/0x710 mm/page_alloc.c:4753
alloc_pages_mpol_noprof+0x3e1/0x780 mm/mempolicy.c:2269
alloc_slab_page+0x6a/0x110 mm/slub.c:2423
allocate_slab+0x5a/0x2b0 mm/slub.c:2589
new_slab mm/slub.c:2642 [inline]
___slab_alloc+0xc27/0x14a0 mm/slub.c:3830
__slab_alloc+0x58/0xa0 mm/slub.c:3920
__slab_alloc_node mm/slub.c:3995 [inline]
slab_alloc_node mm/slub.c:4156 [inline]
__do_kmalloc_node mm/slub.c:4297 [inline]
__kmalloc_node_track_caller_noprof+0x2e9/0x4c0 mm/slub.c:4317
kmalloc_reserve+0x111/0x2a0 net/core/skbuff.c:609
__alloc_skb+0x1f3/0x440 net/core/skbuff.c:678
alloc_skb include/linux/skbuff.h:1323 [inline]
alloc_skb_with_frags+0xc3/0x820 net/core/skbuff.c:6612
sock_alloc_send_pskb+0x91a/0xa60 net/core/sock.c:2884
sock_alloc_send_skb include/net/sock.h:1803 [inline]
mld_newpack+0x1c3/0xaf0 net/ipv6/mcast.c:1747
add_grhead net/ipv6/mcast.c:1850 [inline]
add_grec+0x1492/0x19a0 net/ipv6/mcast.c:1988
mld_send_cr net/ipv6/mcast.c:2114 [inline]
mld_ifc_work+0x691/0xd90 net/ipv6/mcast.c:2651
page last free pid 5300 tgid 5300 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1127 [inline]
free_unref_page+0xd3f/0x1010 mm/page_alloc.c:2659
__slab_free+0x2c2/0x380 mm/slub.c:4524
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x9a/0x140 mm/kasan/quarantine.c:179
kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286
__kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:329
kasan_slab_alloc include/linux/kasan.h:250 [inline]
slab_post_alloc_hook mm/slub.c:4119 [inline]
slab_alloc_node mm/slub.c:4168 [inline]
__do_kmalloc_node mm/slub.c:4297 [inline]
__kmalloc_noprof+0x236/0x4c0 mm/slub.c:4310
kmalloc_noprof include/linux/slab.h:905 [inline]
kzalloc_noprof include/linux/slab.h:1037 [inline]
fib_create_info+0xc14/0x25b0 net/ipv4/fib_semantics.c:1435
fib_table_insert+0x1f6/0x1f20 net/ipv4/fib_trie.c:1231
fib_magic+0x3d8/0x620 net/ipv4/fib_frontend.c:1112
fib_add_ifaddr+0x40c/0x5e0 net/ipv4/fib_frontend.c:1156
fib_netdev_event+0x375/0x490 net/ipv4/fib_frontend.c:1494
notifier_call_chain+0x1a5/0x3f0 kernel/notifier.c:85
__dev_notify_flags+0x207/0x400
dev_change_flags+0xf0/0x1a0 net/core/dev.c:9045
do_setlink+0xc90/0x4210 net/core/rtnetlink.c:3109
rtnl_changelink net/core/rtnetlink.c:3723 [inline]
__rtnl_newlink net/core/rtnetlink.c:3875 [inline]
rtnl_newlink+0x1bb6/0x2210 net/core/rtnetlink.c:4012
Memory state around the buggy address:
ffff888011838f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888011838f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888011839000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888011839080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888011839100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================--- fs/btrfs/transaction.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/transaction.c +3 -1
@@ -174,8 +174,10 @@ static noinline int join_transaction(struct btrfs_fs_info *fs_info, cur_trans = fs_info->running_transaction;if (cur_trans) {if (TRANS_ABORTED (cur_trans)) { +const int abort_error = cur_trans->aborted; +spin_unlock (&fs_info->trans_lock); -return cur_trans->aborted; +return abort_error; }if (btrfs_blocked_trans_types[cur_trans->state] & type) {spin_unlock (&fs_info->trans_lock);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 84/328 btrfs: convert BUG_ON in btrfs_reloc_cow_block() to proper error handling
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit 6a4730b325aaa48f7a5d5ba97aff0a955e2d9cec ]
This BUG_ON is meant to catch backref cache problems, but these can arise from either bugs in the backref cache or corruption in the extent tree. Fix it to be a proper error.
--- fs/btrfs/relocation.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
fs/btrfs/relocation.c +12 -2
@@ -4789,8 +4789,18 @@ int btrfs_reloc_cow_block(struct btrfs_trans_handle *trans,WARN_ON (!first_cow && level ==0 ); node = rc->backref_cache.path[level]; -BUG_ON (node->bytenr != buf->start && - node->new_bytenr != buf->start); + +/* +* If node->bytenr != buf->start and node->new_bytenr != +* buf->start then we've got the wrong backref node for what we +* expected to see here and the cache is incorrect. +*/ +if (unlikely (node->bytenr != buf->start && node->new_bytenr != buf->start)) { +btrfs_err (fs_info, +"bytenr %llu was found but our backref cache was expecting %llu or %llu" , + buf->start, node->bytenr, node->new_bytenr); +return -EUCLEAN ; + }drop_node_buffer (node);extent_buffer_get (cow);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 85/328 sched: Dont try to catch up excess steal time.
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suleiman Souhlal <[email protected]>
[ Upstream commit 108ad0999085df2366dd9ef437573955cb3f5586 ]
When steal time exceeds the measured delta when updating clock_task, we currently try to catch up the excess in future updates. However, this results in inaccurate run times for the future things using clock_task, in some situations, as they end up getting additional steal time that did not actually happen.
This is because there is a window between reading the elapsed time in update_rq_clock() and sampling the steal time in update_rq_clock_task(). If the VCPU gets preempted between those two points, any additional steal time is accounted to the outgoing task even though the calculated delta did not actually contain any of that "stolen" time. When this race happens, we can end up with steal time that exceeds the calculated delta, and the previous code would try to catch up that excess steal time in future clock updates, which is given to the next, incoming task, even though it did not actually have any time stolen.
This behavior is particularly bad when steal time can be very long, which we've seen when trying to extend steal time to contain the duration that the host was suspended [0]. When this happens, clock_task stays frozen, during which the running task stays running for the whole duration, since its run time doesn't increase.
However the race can happen even under normal operation.
Ideally we would read the elapsed cpu time and the steal time atomically, to prevent this race from happening in the first place, but doing so is non-trivial.
Since the time between those two points isn't otherwise accounted anywhere, neither to the outgoing task nor the incoming task (because the "end of outgoing task" and "start of incoming task" timestamps are the same), I would argue that the right thing to do is to simply drop any excess steal time, in order to prevent these issues.
[0] https://lore.kernel.org/kvm/[email protected]/
--- kernel/sched/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/sched/core.c +4 -2
@@ -176,13 +176,15 @@ static void update_rq_clock_task(struct rq *rq, s64 delta)#endif #ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING if (static_key_false ((¶virt_steal_rq_enabled))) { - steal =paravirt_steal_clock (cpu_of (rq)); +u64 prev_steal; + + steal = prev_steal =paravirt_steal_clock (cpu_of (rq)); steal -= rq->prev_steal_time_rq;if (unlikely (steal > delta)) steal = delta; - rq->prev_steal_time_rq += steal; + rq->prev_steal_time_rq = prev_steal; delta -= steal; }#endif
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 86/328 x86/amd_nb: Restrict init function to AMD-based systems
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yazen Ghannam <[email protected]>
[ Upstream commit bee9e840609cc67d0a7d82f22a2130fb7a0a766d ]
The code implicitly operates on AMD-based systems by matching on PCI IDs. However, the use of these IDs is going away.
Add an explicit CPU vendor check instead of relying on PCI IDs.
--- arch/x86/kernel/amd_nb.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/kernel/amd_nb.c +4 -0
@@ -538,6 +538,10 @@ static __init void fix_erratum_688(void)static __init int init_amd_nbs (void ) { +if (boot_cpu_data.x86_vendor !=X86_VENDOR_AMD && + boot_cpu_data.x86_vendor !=X86_VENDOR_HYGON ) +return 0 ; +amd_cache_northbridges ();amd_cache_gart ();
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 87/328 printk: Fix signed integer overflow when defining LOG_BUF_LEN_MAX
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuan-Wei Chiu <[email protected]>
[ Upstream commit 3d6f83df8ff2d5de84b50377e4f0d45e25311c7a ]
Shifting 1 << 31 on a 32-bit int causes signed integer overflow, which leads to undefined behavior. To prevent this, cast 1 to u32 before performing the shift, ensuring well-defined behavior.
This change explicitly avoids any potential overflow by ensuring that the shift occurs on an unsigned 32-bit integer.
--- kernel/printk/printk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/printk/printk.c +1 -1
@@ -457,7 +457,7 @@ static u32 clear_idx;/* record buffer */ #define LOG_ALIGN __alignof__(struct printk_log)#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) -#define LOG_BUF_LEN_MAX (u32)(1 << 31) +#define LOG_BUF_LEN_MAX ((u32)1 << 31)static char __log_buf[__LOG_BUF_LEN]__aligned(LOG_ALIGN) ;static char *log_buf = __log_buf;static u32 log_buf_len = __LOG_BUF_LEN;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 88/328 tun: fix group permission check
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stas Sergeev <[email protected]>
[ Upstream commit 3ca459eaba1bf96a8c7878de84fa8872259a01e3 ]
Currently tun checks the group permission even if the user have matched. Besides going against the usual permission semantic, this has a very interesting implication: if the tun group is not among the supplementary groups of the tun user, then effectively no one can access the tun device. CAP_SYS_ADMIN still can, but its the same as not setting the tun ownership.
This patch relaxes the group checking so that either the user match or the group match is enough. This avoids the situation when no one can access the device even though the ownership is properly set.
Also I simplified the logic by removing the redundant inversions:tun_not_capable() --> !tun_capable()
--- drivers/net/tun.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/tun.c +9 -5
@@ -636,14 +636,18 @@ static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb,return ret; } -static inline bool tun_not_capable (struct tun_struct *tun) +static inline bool tun_capable (struct tun_struct *tun) {const struct cred *cred =current_cred ();struct net *net =dev_net (tun->dev); -return ((uid_valid (tun->owner) && !uid_eq (cred->euid, tun->owner)) || - (gid_valid (tun->group) && !in_egroup_p (tun->group))) && - !ns_capable (net->user_ns,CAP_NET_ADMIN ); +if (ns_capable (net->user_ns,CAP_NET_ADMIN )) +return 1 ; +if (uid_valid (tun->owner) &&uid_eq (cred->euid, tun->owner)) +return 1 ; +if (gid_valid (tun->group) &&in_egroup_p (tun->group)) +return 1 ; +return 0 ; }static void tun_set_real_num_queues (struct tun_struct *tun)
@@ -2838,7 +2842,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) !!(tun->flags & IFF_MULTI_QUEUE))return -EINVAL ; -if (tun_not_capable (tun)) +if (!tun_capable (tun))return -EPERM ; err =security_tun_dev_open (tun->security);if (err <0 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 89/328 mmc: core: Respect quirk_max_rate for non-UHS SDIO card
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shawn Lin <[email protected]>
[ Upstream commit a2a44f8da29352f76c99c6904ee652911b8dc7dd ]
The card-quirk was added to limit the clock-rate for a card with UHS-mode support, although let's respect the quirk for non-UHS mode too, to make the behaviour consistent.
Message-ID: <[email protected]>
--- drivers/mmc/core/sdio.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mmc/core/sdio.c +2 -0
@@ -379,6 +379,8 @@ static unsigned mmc_sdio_get_max_clock(struct mmc_card *card)if (card->type ==MMC_TYPE_SD_COMBO ) max_dtr =min (max_dtr,mmc_sd_get_max_clock (card)); + max_dtr =min_not_zero (max_dtr, card->quirk_max_rate); +return max_dtr; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 90/328 wifi: brcmsmac: add gain range check to wlc_phy_iqcal_gainparams_nphy()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Antipov <[email protected]>
[ Upstream commit 3f4a0948c3524ae50f166dbc6572a3296b014e62 ]
In 'wlc_phy_iqcal_gainparams_nphy()', add gain range check to WARN() instead of possible out-of-bounds 'tbl_iqcal_gainparams_nphy' access. Compile tested only.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c +3 -0
@@ -23445,6 +23445,9 @@ wlc_phy_iqcal_gainparams_nphy(struct brcms_phy *pi, u16 core_no, } } +if (WARN_ON (k ==NPHY_IQCAL_NUMGAINS )) +return ; + params->txgm = tbl_iqcal_gainparams_nphy[band_idx][k][1 ]; params->pga = tbl_iqcal_gainparams_nphy[band_idx][k][2 ]; params->pad = tbl_iqcal_gainparams_nphy[band_idx][k][3 ];
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 91/328 tomoyo: dont emit warning in tomoyo_write_control()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
[ Upstream commit 3df7546fc03b8f004eee0b9e3256369f7d096685 ]
syzbot is reporting too large allocation warning at tomoyo_write_control(), for one can write a very very long line without new line character. To fix this warning, I use __GFP_NOWARN rather than checking for KMALLOC_MAX_SIZE, for practically a valid line should be always shorter than 32KB where the "too small to fail" memory-allocation rule applies.
One might try to write a valid line that is longer than 32KB, but such request will likely fail with -ENOMEM. Therefore, I feel that separately returning -EINVAL when a line is longer than KMALLOC_MAX_SIZE is redundant. There is no need to distinguish over-32KB and over-KMALLOC_MAX_SIZE.
--- security/tomoyo/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/tomoyo/common.c +1 -1
@@ -2674,7 +2674,7 @@ ssize_t tomoyo_write_control(struct tomoyo_io_buffer *head,if (head->w.avail >= head->writebuf_size -1 ) {const int len = head->writebuf_size *2 ; -char *cp =kzalloc (len,GFP_NOFS ); +char *cp =kzalloc (len,GFP_NOFS | __GFP_NOWARN);if (!cp) { error = -ENOMEM ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 92/328 mfd: lpc_ich: Add another Gemini Lake ISA bridge PCI device-id
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 1e89d21f8189d286f80b900e1b7cf57cb1f3037e ]
On N4100 / N4120 Gemini Lake SoCs the ISA bridge PCI device-id is 31e8 rather the 3197 found on e.g. the N4000 / N4020.
While at fix the existing GLK PCI-id table entry breaking the table being sorted by device-id.
--- drivers/mfd/lpc_ich.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mfd/lpc_ich.c +2 -1
@@ -685,8 +685,9 @@ static const struct pci_device_id lpc_ich_ids[] = { { PCI_VDEVICE(INTEL, 0x2917), LPC_ICH9ME}, { PCI_VDEVICE(INTEL, 0x2918), LPC_ICH9}, { PCI_VDEVICE(INTEL, 0x2919), LPC_ICH9M}, - { PCI_VDEVICE(INTEL, 0x3197), LPC_GLK}, { PCI_VDEVICE(INTEL, 0x2b9c), LPC_COUGARMOUNTAIN}, + { PCI_VDEVICE(INTEL, 0x3197), LPC_GLK}, + { PCI_VDEVICE(INTEL, 0x31e8), LPC_GLK}, { PCI_VDEVICE(INTEL, 0x3a14), LPC_ICH10DO}, { PCI_VDEVICE(INTEL, 0x3a16), LPC_ICH10R}, { PCI_VDEVICE(INTEL, 0x3a18), LPC_ICH10},
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 93/328 HID: Wacom: Add PCI Wacom device support
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Even Xu <[email protected]>
[ Upstream commit c4c123504a65583e3689b3de04a61dc5272e453a ]
Add PCI device ID of wacom device into driver support list.
--- drivers/hid/wacom_wac.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hid/wacom_wac.c +5 -0
@@ -4851,6 +4851,10 @@ static const struct wacom_features wacom_features_0x94 = HID_DEVICE(BUS_I2C, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\ .driver_data = (kernel_ulong_t)&wacom_features_##prod +#define PCI_DEVICE_WACOM (prod) \ + HID_DEVICE(BUS_PCI, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\ + .driver_data = (kernel_ulong_t)&wacom_features_##prod +#define USB_DEVICE_LENOVO (prod) \ HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, prod), \ .driver_data = (kernel_ulong_t)&wacom_features_##prod
@@ -5020,6 +5024,7 @@ const struct hid_device_id wacom_ids[] = { { USB_DEVICE_WACOM(HID_ANY_ID) }, { I2C_DEVICE_WACOM(HID_ANY_ID) }, + { PCI_DEVICE_WACOM(HID_ANY_ID) }, { BT_DEVICE_WACOM(HID_ANY_ID) }, { } };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 94/328 APEI: GHES: Have GHES honor the panic= setting
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Borislav Petkov <[email protected]>
[ Upstream commit 5c0e00a391dd0099fe95991bb2f962848d851916 ]
The GHES driver overrides the panic= setting by force-rebooting the system after a fatal hw error has been reported. The intent being that such an error would be reported earlier.
However, this is not optimal when a hard-to-debug issue requires long time to reproduce and when that happens, the box will get rebooted after 30 seconds and thus destroy the whole hw context of when the error happened.
So rip out the default GHES panic timeout and honor the global one.
In the panic disabled (panic=0) case, the error will still be logged to dmesg for later inspection and if panic after a hw error is really required, then that can be controlled the usual way - use panic= on the cmdline or set it in the kernel .config's CONFIG_PANIC_TIMEOUT.
--- drivers/acpi/apei/ghes.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/acpi/apei/ghes.c +5 -5
@@ -128,8 +128,6 @@ static unsigned long ghes_estatus_pool_sstatic struct ghes_estatus_cache *ghes_estatus_caches[GHES_ESTATUS_CACHES_SIZE ];static atomic_t ghes_estatus_cache_alloced; -static int ghes_panic_timeout__read_mostly =30 ; -static void __iomem *ghes_map (u64 pfn,enum fixed_addresses fixmap_idx) {phys_addr_t paddr;
@@ -707,14 +705,16 @@ static void __ghes_panic(struct ghes *ghstruct acpi_hest_generic_status *estatus, u64 buf_paddr, enum fixed_addresses fixmap_idx) { + const char *msg = GHES_PFX "Fatal hardware error"; +__ghes_print_estatus (KERN_EMERG , ghes->generic, estatus);ghes_clear_estatus (ghes, estatus, buf_paddr, fixmap_idx); -/* reboot to log the error! */ if (!panic_timeout) - panic_timeout = ghes_panic_timeout; -panic ("Fatal hardware error!" ); +pr_emerg ("%s but panic disabled\n" , msg); + +panic (msg); }static int ghes_proc (struct ghes *ghes)
Greg Kroah-Hartman
maintainerPATCH 95/328 x86/mm: Dont disable PCID when INVLPG has been fixed by microcode
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xi Ruoyao <[email protected]>
commit f24f669d03f884a6ef95cca84317d0f329e93961 upstream.
Per the "Processor Specification Update" documentations referred by the intel-microcode-20240312 release note, this microcode release has fixed the issue for all affected models.
So don't disable PCID if the microcode is new enough. The precise minimum microcode revision fixing the issue was provided by Pawan Intel.
[ dhansen: comment and changelog tweaks ]
--- arch/x86/mm/init.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-)
arch/x86/mm/init.c +19 -13
@@ -211,33 +211,39 @@ static void __init probe_page_size_mask( } } -#define INTEL_MATCH (_model) { .vendor = X86_VENDOR_INTEL, \ - .family = 6, \ - .model = _model, \ - } +#define INTEL_MATCH (_model, ucode) { .vendor = X86_VENDOR_INTEL, \ + .family = 6, \ + .model = _model, \ + .driver_data = ucode, \ + }/* -* INVLPG may not properly flush Global entries -* on these CPUs when PCIDs are enabled. +* INVLPG may not properly flush Global entries on +* these CPUs. New microcode fixes the issue. */ static const struct x86_cpu_id invlpg_miss_ids[] = { -INTEL_MATCH (INTEL_FAM6_ALDERLAKE ), -INTEL_MATCH (INTEL_FAM6_ALDERLAKE_L ), -INTEL_MATCH (INTEL_FAM6_ALDERLAKE_N ), -INTEL_MATCH (INTEL_FAM6_RAPTORLAKE ), -INTEL_MATCH (INTEL_FAM6_RAPTORLAKE_P ), -INTEL_MATCH (INTEL_FAM6_RAPTORLAKE_S ), +INTEL_MATCH (INTEL_FAM6_ALDERLAKE ,0x2e ), +INTEL_MATCH (INTEL_FAM6_ALDERLAKE_L ,0x42c ), +INTEL_MATCH (INTEL_FAM6_ALDERLAKE_N ,0x11 ), +INTEL_MATCH (INTEL_FAM6_RAPTORLAKE ,0x118 ), +INTEL_MATCH (INTEL_FAM6_RAPTORLAKE_P ,0x4117 ), +INTEL_MATCH (INTEL_FAM6_RAPTORLAKE_S ,0x2e ), {} };static void setup_pcid (void ) { +const struct x86_cpu_id *invlpg_miss_match; +if (!IS_ENABLED (CONFIG_X86_64 ))return ;if (!boot_cpu_has (X86_FEATURE_PCID ))return ; -if (x86_match_cpu (invlpg_miss_ids)) { + invlpg_miss_match =x86_match_cpu (invlpg_miss_ids); + +if (invlpg_miss_match && + boot_cpu_data.microcode < invlpg_miss_match->driver_data) {pr_info ("Incomplete global flushes, disabling PCID" );setup_clear_cpu_cap (X86_FEATURE_PCID );return ;
Greg Kroah-Hartman
maintainerPATCH 96/328 spi-mxs: Fix chipselect glitch
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ralf Schlatterbeck <[email protected]>
commit 269e31aecdd0b70f53a05def79480f15cbcc0fd6 upstream.
There was a change in the mxs-dma engine that uses a new custom flag. The change was not applied to the mxs spi driver.
This results in chipselect being deasserted too early.
This fixes the chipselect problem by using the new flag in the mxs-spi driver.
--- drivers/spi/spi-mxs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/spi-mxs.c +2 -1
@@ -40,6 +40,7 @@#include <linux/spi/spi.h> #include <linux/spi/mxs-spi.h> #include <trace/events/spi.h> +#include <linux/dma/mxs-dma.h> #define DRIVER_NAME "mxs-spi"
@@ -253,7 +254,7 @@ static int mxs_spi_txrx_dma(struct mxs_s desc =dmaengine_prep_slave_sg (ssp->dmach, &dma_xfer[sg_count].sg,1 , (flags &TXRX_WRITE ) ?DMA_MEM_TO_DEV :DMA_DEV_TO_MEM , -DMA_PREP_INTERRUPT |DMA_CTRL_ACK ); +DMA_PREP_INTERRUPT |MXS_DMA_CTRL_WAIT4END );if (!desc) { dev_err(ssp->dev,
Greg Kroah-Hartman
maintainerPATCH 97/328 nilfs2: move page release outside of nilfs_delete_entry and nilfs_set_link
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit 584db20c181f5e28c0386d7987406ace7fbd3e49 upstream.
Patch series "nilfs2: Folio conversions for directory paths".
This series applies page->folio conversions to nilfs2 directory operations. This reduces hidden compound_head() calls and also converts deprecated kmap calls to kmap_local in the directory code.
Although nilfs2 does not yet support large folios, Matthew has done his best here to include support for large folios, which will be needed for devices with large block sizes.
This series corresponds to the second half of the original post [1], but with two complementary patches inserted at the beginning and some adjustments, to prevent a kmap_local constraint violation found during testing with highmem mapping.
[1] https://lkml.kernel.org/r/[email protected]
I have reviewed all changes and tested this for regular and small block sizes, both on machines with and without highmem mapping. No issues found.
This patch (of 17):
In a few directory operations, the call to nilfs_put_page() for a page obtained using nilfs_find_entry() or nilfs_dotdot() is hidden in nilfs_set_link() and nilfs_delete_entry(), making it difficult to track page release and preventing change of its call position.
By moving nilfs_put_page() out of these functions, this makes the page get/put correspondence clearer and makes it easier to swap nilfs_put_page() calls (and kunmap calls within them) when modifying multiple directory entries simultaneously in nilfs_rename().
Also, update comments for nilfs_set_link() and nilfs_delete_entry() to reflect changes in their behavior.
To make nilfs_put_page() visible from namei.c, this moves its definition to nilfs.h and replaces existing equivalents to use it, but the exposure of that definition is temporary and will be removed on a later kmap -> kmap_local conversion.
Stable-dep-of: ee70999a988b ("nilfs2: handle errors that nilfs_prepare_chunk() may return")
--- fs/nilfs2/dir.c | 11 +---------- fs/nilfs2/namei.c | 13 +++++++------ fs/nilfs2/nilfs.h | 6 ++++++ 3 files changed, 14 insertions(+), 16 deletions(-)
fs/nilfs2/dir.c +1 -10
@@ -64,12 +64,6 @@ static inline unsigned int nilfs_chunk_sreturn inode->i_sb->s_blocksize; } -static inline void nilfs_put_page (struct page *page) -{ -kunmap (page); -put_page (page); -} -/* * Return the offset into page `page_nr' of the last valid * byte in that page, plus one.
@@ -450,7 +444,6 @@ int nilfs_inode_by_name(struct inode *direturn 0 ; } -/* Releases the page */ void nilfs_set_link (struct inode *dir,struct nilfs_dir_entry *de,struct page *page,struct inode *inode) {
@@ -465,7 +458,6 @@ void nilfs_set_link(struct inode *dir, s de->inode =cpu_to_le64 (inode->i_ino);nilfs_set_de_type (de, inode);nilfs_commit_chunk (page, mapping, from, to); -nilfs_put_page (page); dir->i_mtime = dir->i_ctime =current_time (dir); }
@@ -569,7 +561,7 @@ out_unlock:/* * nilfs_delete_entry deletes a directory entry by merging it with the -* previous entry. Page is up-to-date. Releases the page. +* previous entry. Page is up-to-date. */ int nilfs_delete_entry (struct nilfs_dir_entry *dir,struct page *page) {
@@ -605,7 +597,6 @@ int nilfs_delete_entry(struct nilfs_dir_nilfs_commit_chunk (page, mapping, from, to); inode->i_ctime = inode->i_mtime =current_time (inode); out: -nilfs_put_page (page);return err; }
fs/nilfs2/namei.c +7 -6
@@ -295,6 +295,7 @@ static int nilfs_do_unlink(struct inodeset_nlink (inode,1 ); } err =nilfs_delete_entry (de, page); +nilfs_put_page (page);if (err) goto out;
@@ -403,6 +404,7 @@ static int nilfs_rename(struct inode *ol goto out_dir; }nilfs_set_link (new_dir, new_de, new_page, old_inode); +nilfs_put_page (new_page);nilfs_mark_inode_dirty (new_dir); new_inode->i_ctime =current_time (new_inode);if (dir_de)
@@ -426,9 +428,11 @@ static int nilfs_rename(struct inode *ol old_inode->i_ctime =current_time (old_inode);nilfs_delete_entry (old_de, old_page); +nilfs_put_page (old_page);if (dir_de) {nilfs_set_link (old_inode, dir_de, dir_page, new_dir); +nilfs_put_page (dir_page);drop_nlink (old_dir); }nilfs_mark_inode_dirty (old_dir);
@@ -438,13 +442,10 @@ static int nilfs_rename(struct inode *olreturn err; out_dir: -if (dir_de) { -kunmap (dir_page); -put_page (dir_page); - } +if (dir_de) +nilfs_put_page (dir_page); out_old: -kunmap (old_page); -put_page (old_page); +nilfs_put_page (old_page); out:nilfs_transaction_abort (old_dir->i_sb);return err;
fs/nilfs2/nilfs.h +6 -0
@@ -243,6 +243,12 @@ extern struct nilfs_dir_entry *nilfs_dotextern void nilfs_set_link (struct inode *,struct nilfs_dir_entry *,struct page *,struct inode *); +static inline void nilfs_put_page (struct page *page) +{ +kunmap (page); +put_page (page); +} +/* file.c */ extern int nilfs_sync_file (struct file *,loff_t ,loff_t ,int );
Greg Kroah-Hartman
maintainerPATCH 98/328 nilfs2: eliminate staggered calls to kunmap in nilfs_rename
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit 8cf57c6df818f58fdad16a909506be213623a88e upstream.
In nilfs_rename(), calls to nilfs_put_page() to release pages obtained with nilfs_find_entry() or nilfs_dotdot() are alternated in the normal path.
When replacing the kernel memory mapping method from kmap to kmap_local_{page,folio}, this violates the constraint on the calling order of kunmap_local().
Swap the order of nilfs_put_page calls where the kmap sections of multiple pages overlap so that they are nested, allowing direct replacement of nilfs_put_page() -> unmap_and_put_page().
Without this reordering, that replacement will cause a kernel WARNING in kunmap_local_indexed() on architectures with high memory mapping.
Stable-dep-of: ee70999a988b ("nilfs2: handle errors that nilfs_prepare_chunk() may return")
--- fs/nilfs2/namei.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/nilfs2/namei.c +2 -1
@@ -428,13 +428,14 @@ static int nilfs_rename(struct inode *ol old_inode->i_ctime =current_time (old_inode);nilfs_delete_entry (old_de, old_page); -nilfs_put_page (old_page);if (dir_de) {nilfs_set_link (old_inode, dir_de, dir_page, new_dir);nilfs_put_page (dir_page);drop_nlink (old_dir); } +nilfs_put_page (old_page); +nilfs_mark_inode_dirty (old_dir);nilfs_mark_inode_dirty (old_inode);
Greg Kroah-Hartman
maintainerPATCH 99/328 nilfs2: handle errors that nilfs_prepare_chunk() may return
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit ee70999a988b8abc3490609142f50ebaa8344432 upstream.
Patch series "nilfs2: fix issues with rename operations".
This series fixes BUG_ON check failures reported by syzbot around rename operations, and a minor behavioral issue where the mtime of a child directory changes when it is renamed instead of moved.
This patch (of 2):
The directory manipulation routines nilfs_set_link() and nilfs_delete_entry() rewrite the directory entry in the folio/page previously read by nilfs_find_entry(), so error handling is omitted on the assumption that nilfs_prepare_chunk(), which prepares the buffer for rewriting, will always succeed for these. And if an error is returned, it triggers the legacy BUG_ON() checks in each routine.
This assumption is wrong, as proven by syzbot: the buffer layer called by nilfs_prepare_chunk() may call nilfs_get_block() if necessary, which may fail due to metadata corruption or other reasons. This has been there all along, but improved sanity checks and error handling may have made it more reproducible in fuzzing tests.
Fix this issue by adding missing error paths in nilfs_set_link(), nilfs_delete_entry(), and their caller nilfs_rename().
--- fs/nilfs2/dir.c | 13 ++++++++++--- fs/nilfs2/namei.c | 29 +++++++++++++++-------------- fs/nilfs2/nilfs.h | 4 ++-- 3 files changed, 27 insertions(+), 19 deletions(-)
fs/nilfs2/dir.c +10 -3
@@ -444,7 +444,7 @@ int nilfs_inode_by_name(struct inode *direturn 0 ; } -void nilfs_set_link (struct inode *dir,struct nilfs_dir_entry *de, +int nilfs_set_link (struct inode *dir,struct nilfs_dir_entry *de,struct page *page,struct inode *inode) {unsigned int from = (char *)de - (char *)page_address (page);
@@ -454,11 +454,15 @@ void nilfs_set_link(struct inode *dir, slock_page (page); err =nilfs_prepare_chunk (page, from, to); -BUG_ON (err); +if (unlikely (err)) { +unlock_page (page); +return err; + } de->inode =cpu_to_le64 (inode->i_ino);nilfs_set_de_type (de, inode);nilfs_commit_chunk (page, mapping, from, to); dir->i_mtime = dir->i_ctime =current_time (dir); +return 0 ; }/*
@@ -590,7 +594,10 @@ int nilfs_delete_entry(struct nilfs_dir_ from = (char *)pde - (char *)page_address (page);lock_page (page); err =nilfs_prepare_chunk (page, from, to); -BUG_ON (err); +if (unlikely (err)) { +unlock_page (page); + goto out; + }if (pde) pde->rec_len =nilfs_rec_len_to_disk (to - from); dir->inode =0 ;
fs/nilfs2/namei.c +15 -14
@@ -403,8 +403,10 @@ static int nilfs_rename(struct inode *ol err =PTR_ERR (new_de); goto out_dir; } -nilfs_set_link (new_dir, new_de, new_page, old_inode); + err =nilfs_set_link (new_dir, new_de, new_page, old_inode);nilfs_put_page (new_page); +if (unlikely (err)) + goto out_dir;nilfs_mark_inode_dirty (new_dir); new_inode->i_ctime =current_time (new_inode);if (dir_de)
@@ -427,28 +429,27 @@ static int nilfs_rename(struct inode *ol*/ old_inode->i_ctime =current_time (old_inode); -nilfs_delete_entry (old_de, old_page); - -if (dir_de) { -nilfs_set_link (old_inode, dir_de, dir_page, new_dir); -nilfs_put_page (dir_page); -drop_nlink (old_dir); + err =nilfs_delete_entry (old_de, old_page); +if (likely (!err)) { +if (dir_de) { + err =nilfs_set_link (old_inode, dir_de, dir_page, + new_dir); +drop_nlink (old_dir); + } +nilfs_mark_inode_dirty (old_dir); } -nilfs_put_page (old_page); - -nilfs_mark_inode_dirty (old_dir);nilfs_mark_inode_dirty (old_inode); - err =nilfs_transaction_commit (old_dir->i_sb); -return err; - out_dir:if (dir_de)nilfs_put_page (dir_page); out_old:nilfs_put_page (old_page); out: -nilfs_transaction_abort (old_dir->i_sb); +if (likely (!err)) + err =nilfs_transaction_commit (old_dir->i_sb); +else +nilfs_transaction_abort (old_dir->i_sb);return err; }
fs/nilfs2/nilfs.h +2 -2
@@ -240,8 +240,8 @@ nilfs_find_entry(struct inode *, const sextern int nilfs_delete_entry (struct nilfs_dir_entry *,struct page *);extern int nilfs_empty_dir (struct inode *);extern struct nilfs_dir_entry *nilfs_dotdot (struct inode *,struct page **); -extern void nilfs_set_link (struct inode *,struct nilfs_dir_entry *, -struct page *,struct inode *); +int nilfs_set_link (struct inode *dir,struct nilfs_dir_entry *de, +struct page *page,struct inode *inode);static inline void nilfs_put_page (struct page *page) {
Greg Kroah-Hartman
maintainerPATCH 100/328 media: uvcvideo: Only save async fh if success
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit d9fecd096f67a4469536e040a8a10bbfb665918b upstream.
Now we keep a reference to the active fh for any call to uvc_ctrl_set, regardless if it is an actual set or if it is a just a try or if the device refused the operation.
We should only keep the file handle if the device actually accepted applying the operation.
---
--- drivers/media/usb/uvc/uvc_ctrl.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/media/usb/uvc/uvc_ctrl.c +10 -6
@@ -1528,7 +1528,9 @@ int uvc_ctrl_begin(struct uvc_video_chai }static int uvc_ctrl_commit_entity (struct uvc_device *dev, -struct uvc_entity *entity,int rollback) +struct uvc_fh *handle, +struct uvc_entity *entity, +int rollback) {struct uvc_control *ctrl;unsigned int i;
@@ -1572,6 +1574,10 @@ static int uvc_ctrl_commit_entity(structif (ret <0 )return ret; + +if (!rollback && handle && + ctrl->info.flags &UVC_CTRL_FLAG_ASYNCHRONOUS ) + ctrl->handle = handle; }return 0 ;
@@ -1587,7 +1593,8 @@ int __uvc_ctrl_commit(struct uvc_fh *han/* Find the control. */ list_for_each_entry (entity, &chain->entities, chain) { - ret =uvc_ctrl_commit_entity (chain->dev, entity, rollback); + ret =uvc_ctrl_commit_entity (chain->dev, handle, entity, + rollback);if (ret <0 ) goto done; }
@@ -1711,9 +1718,6 @@ int uvc_ctrl_set(struct uvc_fh *handle, mapping->set (mapping, value,uvc_ctrl_data (ctrl,UVC_CTRL_DATA_CURRENT )); -if (ctrl->info.flags &UVC_CTRL_FLAG_ASYNCHRONOUS ) - ctrl->handle = handle; - ctrl->dirty =1 ; ctrl->modified =1 ;return 0 ;
@@ -2042,7 +2046,7 @@ int uvc_ctrl_restore_values(struct uvc_d ctrl->dirty =1 ; } - ret =uvc_ctrl_commit_entity (dev, entity,0 ); + ret =uvc_ctrl_commit_entity (dev,NULL , entity,0 );if (ret <0 )return ret; }
Greg Kroah-Hartman
maintainerPATCH 101/328 media: uvcvideo: Remove dangling pointers
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit 221cd51efe4565501a3dbf04cc011b537dcce7fb upstream.
When an async control is written, we copy a pointer to the file handle that started the operation. That pointer will be used when the device is done. Which could be anytime in the future.
If the user closes that file descriptor, its structure will be freed, and there will be one dangling pointer per pending async control, that the driver will try to use.
Clean all the dangling pointers during release().
To avoid adding a performance penalty in the most common case (no async operation), a counter has been introduced with some logic to make sure that it is properly handled.
--- drivers/media/usb/uvc/uvc_ctrl.c | 63 +++++++++++++++++++++++++++++++++++++-- drivers/media/usb/uvc/uvc_v4l2.c | 2 + drivers/media/usb/uvc/uvcvideo.h | 9 ++++- 3 files changed, 71 insertions(+), 3 deletions(-)
drivers/media/usb/uvc/uvc_ctrl.c +61 -2
@@ -1306,6 +1306,40 @@ static void uvc_ctrl_send_slave_event(stuvc_ctrl_send_event (chain, handle, ctrl, mapping, val, changes); } +static void uvc_ctrl_set_handle (struct uvc_fh *handle,struct uvc_control *ctrl, +struct uvc_fh *new_handle) +{ +lockdep_assert_held (&handle->chain->ctrl_mutex); + +if (new_handle) { +if (ctrl->handle) +dev_warn_ratelimited (&handle->stream->dev->udev->dev, +"UVC non compliance: Setting an async control with a pending operation." ); + +if (new_handle == ctrl->handle) +return ; + +if (ctrl->handle) { +WARN_ON (!ctrl->handle->pending_async_ctrls); +if (ctrl->handle->pending_async_ctrls) + ctrl->handle->pending_async_ctrls--; + } + + ctrl->handle = new_handle; + handle->pending_async_ctrls++; +return ; + } + +/* Cannot clear the handle for a control not owned by us.*/ +if (WARN_ON (ctrl->handle != handle)) +return ; + + ctrl->handle =NULL ; +if (WARN_ON (!handle->pending_async_ctrls)) +return ; + handle->pending_async_ctrls--; +} +void uvc_ctrl_status_event (struct uvc_video_chain *chain,struct uvc_control *ctrl,const u8 *data) {
@@ -1316,7 +1350,8 @@ void uvc_ctrl_status_event(struct uvc_vimutex_lock (&chain->ctrl_mutex); handle = ctrl->handle; - ctrl->handle =NULL ; +if (handle) +uvc_ctrl_set_handle (handle, ctrl,NULL );list_for_each_entry (mapping, &ctrl->info.mappings, list) {s32 value =__uvc_ctrl_get_value (mapping, data);
@@ -1577,7 +1612,7 @@ static int uvc_ctrl_commit_entity(structif (!rollback && handle && ctrl->info.flags &UVC_CTRL_FLAG_ASYNCHRONOUS ) - ctrl->handle = handle; +uvc_ctrl_set_handle (handle, ctrl, handle); }return 0 ;
@@ -2378,6 +2413,30 @@ int uvc_ctrl_init_device(struct uvc_devireturn 0 ; } +void uvc_ctrl_cleanup_fh (struct uvc_fh *handle) +{ +struct uvc_entity *entity; + +mutex_lock (&handle->chain->ctrl_mutex); + +if (!handle->pending_async_ctrls) { +mutex_unlock (&handle->chain->ctrl_mutex); +return ; + } + +list_for_each_entry (entity, &handle->chain->dev->entities, list) { +unsigned int i; +for (i =0 ; i < entity->ncontrols; ++i) { +if (entity->controls[i].handle != handle) +continue ; +uvc_ctrl_set_handle (handle, &entity->controls[i],NULL ); + } + } + +WARN_ON (handle->pending_async_ctrls); +mutex_unlock (&handle->chain->ctrl_mutex); +} +/* * Cleanup device controls. */
drivers/media/usb/uvc/uvc_v4l2.c +2 -0
@@ -589,6 +589,8 @@ static int uvc_v4l2_release(struct fileuvc_trace (UVC_TRACE_CALLS ,"uvc_v4l2_release\n" ); +uvc_ctrl_cleanup_fh (handle); +/* Only free resources if this is a privileged handle. */ if (uvc_has_privileges (handle))uvc_queue_release (&stream->queue);
drivers/media/usb/uvc/uvcvideo.h +8 -1
@@ -447,7 +447,11 @@ struct uvc_video_chain {struct uvc_entity *processing;/* Processing unit */ struct uvc_entity *selector;/* Selector unit */ -struct mutex ctrl_mutex;/* Protects ctrl.info */ +struct mutex ctrl_mutex;/* +* Protects ctrl.info, +* ctrl.handle and +* uvc_fh.pending_async_ctrls +*/ struct v4l2_prio_state prio;/* V4L2 priority state */ u32 caps;/* V4L2 chain-wide caps */
@@ -693,6 +697,7 @@ struct uvc_fh {struct uvc_video_chain *chain;struct uvc_streaming *stream;enum uvc_handle_state state; +unsigned int pending_async_ctrls; };struct uvc_driver {
@@ -865,6 +870,8 @@ int uvc_ctrl_set(struct uvc_fh *handle,int uvc_xu_ctrl_query (struct uvc_video_chain *chain,struct uvc_xu_control_query *xqry); +void uvc_ctrl_cleanup_fh (struct uvc_fh *handle); +/* Utility functions */ void uvc_simplify_fraction (u32 *numerator,u32 *denominator,unsigned int n_terms,unsigned int threshold);
Greg Kroah-Hartman
maintainerPATCH 102/328 sched: sch_cake: add bounds checks to host bulk flow fairness counts
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Toke Høiland-Jørgensen <[email protected]>
commit 737d4d91d35b5f7fa5bb442651472277318b0bfd upstream.
Even though we fixed a logic error in the commit cited below, syzbot still managed to trigger an underflow of the per-host bulk flow counters, leading to an out of bounds memory access.
To avoid any such logic errors causing out of bounds memory accesses, this commit factors out all accesses to the per-host bulk flow counters to a series of helpers that perform bounds-checking before any increments and decrements. This also has the benefit of improving readability by moving the conditional checks for the flow mode into these helpers, instead of having them spread out throughout the code (which was the cause of the original logic error).
As part of this change, the flow quantum calculation is consolidated into a helper function, which means that the dithering applied to the ost load scaling is now applied both in the DRR rotation and when a sparse flow's quantum is first initiated. The only user-visible effect of this is that the maximum packet size that can be sent while a flow stays sparse will now vary with +/- one byte in some cases. This should not make a noticeable difference in practice, and thus it's not worth complicating the code to preserve the old behaviour.
--- net/sched/sch_cake.c | 140 +++++++++++++++++++++++++++------------------------ 1 file changed, 75 insertions(+), 65 deletions(-)
net/sched/sch_cake.c +75 -65
@@ -622,6 +622,63 @@ static bool cake_ddst(int flow_mode)return (flow_mode &CAKE_FLOW_DUAL_DST ) ==CAKE_FLOW_DUAL_DST ; } +static void cake_dec_srchost_bulk_flow_count (struct cake_tin_data *q, +struct cake_flow *flow, +int flow_mode) +{ +if (likely (cake_dsrc (flow_mode) && + q->hosts[flow->srchost].srchost_bulk_flow_count)) + q->hosts[flow->srchost].srchost_bulk_flow_count--; +} + +static void cake_inc_srchost_bulk_flow_count (struct cake_tin_data *q, +struct cake_flow *flow, +int flow_mode) +{ +if (likely (cake_dsrc (flow_mode) && + q->hosts[flow->srchost].srchost_bulk_flow_count <CAKE_QUEUES )) + q->hosts[flow->srchost].srchost_bulk_flow_count++; +} + +static void cake_dec_dsthost_bulk_flow_count (struct cake_tin_data *q, +struct cake_flow *flow, +int flow_mode) +{ +if (likely (cake_ddst (flow_mode) && + q->hosts[flow->dsthost].dsthost_bulk_flow_count)) + q->hosts[flow->dsthost].dsthost_bulk_flow_count--; +} + +static void cake_inc_dsthost_bulk_flow_count (struct cake_tin_data *q, +struct cake_flow *flow, +int flow_mode) +{ +if (likely (cake_ddst (flow_mode) && + q->hosts[flow->dsthost].dsthost_bulk_flow_count <CAKE_QUEUES )) + q->hosts[flow->dsthost].dsthost_bulk_flow_count++; +} + +static u16 cake_get_flow_quantum (struct cake_tin_data *q, +struct cake_flow *flow, +int flow_mode) +{ +u16 host_load =1 ; + +if (cake_dsrc (flow_mode)) + host_load =max (host_load, + q->hosts[flow->srchost].srchost_bulk_flow_count); + +if (cake_ddst (flow_mode)) + host_load =max (host_load, + q->hosts[flow->dsthost].dsthost_bulk_flow_count); + +/* The shifted prandom_u32() is a way to apply dithering to avoid +* accumulating roundoff errors +*/ +return (q->flow_quantum * quantum_div[host_load] + + (prandom_u32 () >>16 )) >>16 ; +} +static u32 cake_hash (struct cake_tin_data *q,const struct sk_buff *skb,int flow_mode,u16 flow_override,u16 host_override) {
@@ -753,10 +810,8 @@ skip_hash: allocate_dst =cake_ddst (flow_mode);if (q->flows[outer_hash + k].set ==CAKE_SET_BULK ) { -if (allocate_src) - q->hosts[q->flows[reduced_hash].srchost].srchost_bulk_flow_count--; -if (allocate_dst) - q->hosts[q->flows[reduced_hash].dsthost].dsthost_bulk_flow_count--; +cake_dec_srchost_bulk_flow_count (q, &q->flows[outer_hash + k], flow_mode); +cake_dec_dsthost_bulk_flow_count (q, &q->flows[outer_hash + k], flow_mode); } found:/* reserve queue for future packets in same flow */
@@ -781,9 +836,10 @@ found: q->hosts[outer_hash + k].srchost_tag = srchost_hash; found_src: srchost_idx = outer_hash + k; -if (q->flows[reduced_hash].set ==CAKE_SET_BULK ) - q->hosts[srchost_idx].srchost_bulk_flow_count++; q->flows[reduced_hash].srchost = srchost_idx; + +if (q->flows[reduced_hash].set ==CAKE_SET_BULK ) +cake_inc_srchost_bulk_flow_count (q, &q->flows[reduced_hash], flow_mode); }if (allocate_dst) {
@@ -804,9 +860,10 @@ found_src: q->hosts[outer_hash + k].dsthost_tag = dsthost_hash; found_dst: dsthost_idx = outer_hash + k; -if (q->flows[reduced_hash].set ==CAKE_SET_BULK ) - q->hosts[dsthost_idx].dsthost_bulk_flow_count++; q->flows[reduced_hash].dsthost = dsthost_idx; + +if (q->flows[reduced_hash].set ==CAKE_SET_BULK ) +cake_inc_dsthost_bulk_flow_count (q, &q->flows[reduced_hash], flow_mode); } }
@@ -1821,10 +1878,6 @@ static s32 cake_enqueue(struct sk_buff */* flowchain */ if (!flow->set || flow->set ==CAKE_SET_DECAYING ) { -struct cake_host *srchost = &b->hosts[flow->srchost]; -struct cake_host *dsthost = &b->hosts[flow->dsthost]; -u16 host_load =1 ; -if (!flow->set) {list_add_tail (&flow->flowchain, &b->new_flows); }else {
@@ -1834,18 +1887,8 @@ static s32 cake_enqueue(struct sk_buff * flow->set =CAKE_SET_SPARSE ; b->sparse_flow_count++; -if (cake_dsrc (q->flow_mode)) - host_load =max (host_load, srchost->srchost_bulk_flow_count); - -if (cake_ddst (q->flow_mode)) - host_load =max (host_load, dsthost->dsthost_bulk_flow_count); - - flow->deficit = (b->flow_quantum * - quantum_div[host_load]) >>16 ; + flow->deficit =cake_get_flow_quantum (b, flow, q->flow_mode); }else if (flow->set ==CAKE_SET_SPARSE_WAIT ) { -struct cake_host *srchost = &b->hosts[flow->srchost]; -struct cake_host *dsthost = &b->hosts[flow->dsthost]; -/* this flow was empty, accounted as a sparse flow, but actually * in the bulk rotation. */
@@ -1853,12 +1896,8 @@ static s32 cake_enqueue(struct sk_buff * b->sparse_flow_count--; b->bulk_flow_count++; -if (cake_dsrc (q->flow_mode)) - srchost->srchost_bulk_flow_count++; - -if (cake_ddst (q->flow_mode)) - dsthost->dsthost_bulk_flow_count++; - +cake_inc_srchost_bulk_flow_count (b, flow, q->flow_mode); +cake_inc_dsthost_bulk_flow_count (b, flow, q->flow_mode); }if (q->buffer_used > q->buffer_max_used)
@@ -1915,13 +1954,11 @@ static struct sk_buff *cake_dequeue(stru {struct cake_sched_data *q =qdisc_priv (sch);struct cake_tin_data *b = &q->tins[q->cur_tin]; -struct cake_host *srchost, *dsthost;ktime_t now =ktime_get ();struct cake_flow *flow;struct list_head *head;bool first_flow = true;struct sk_buff *skb; -u16 host_load;u64 delay;u32 len;
@@ -2021,11 +2058,6 @@ retry: q->cur_flow = flow - b->flows; first_flow = false; -/* triple isolation (modified DRR++) */ - srchost = &b->hosts[flow->srchost]; - dsthost = &b->hosts[flow->dsthost]; - host_load =1 ; -/* flow isolation (DRR++) */ if (flow->deficit <=0 ) {/* Keep all flows with deficits out of the sparse and decaying
@@ -2037,11 +2069,8 @@ retry: b->sparse_flow_count--; b->bulk_flow_count++; -if (cake_dsrc (q->flow_mode)) - srchost->srchost_bulk_flow_count++; - -if (cake_ddst (q->flow_mode)) - dsthost->dsthost_bulk_flow_count++; +cake_inc_srchost_bulk_flow_count (b, flow, q->flow_mode); +cake_inc_dsthost_bulk_flow_count (b, flow, q->flow_mode); flow->set =CAKE_SET_BULK ; }else {
@@ -2053,19 +2082,7 @@ retry: } } -if (cake_dsrc (q->flow_mode)) - host_load =max (host_load, srchost->srchost_bulk_flow_count); - -if (cake_ddst (q->flow_mode)) - host_load =max (host_load, dsthost->dsthost_bulk_flow_count); - -WARN_ON (host_load >CAKE_QUEUES ); - -/* The shifted prandom_u32() is a way to apply dithering to -* avoid accumulating roundoff errors -*/ - flow->deficit += (b->flow_quantum * quantum_div[host_load] + - (prandom_u32 () >>16 )) >>16 ; + flow->deficit +=cake_get_flow_quantum (b, flow, q->flow_mode);list_move_tail (&flow->flowchain, &b->old_flows); goto retry;
@@ -2089,11 +2106,8 @@ retry:if (flow->set ==CAKE_SET_BULK ) { b->bulk_flow_count--; -if (cake_dsrc (q->flow_mode)) - srchost->srchost_bulk_flow_count--; - -if (cake_ddst (q->flow_mode)) - dsthost->dsthost_bulk_flow_count--; +cake_dec_srchost_bulk_flow_count (b, flow, q->flow_mode); +cake_dec_dsthost_bulk_flow_count (b, flow, q->flow_mode); b->decaying_flow_count++; } else if (flow->set == CAKE_SET_SPARSE ||
@@ -2111,12 +2125,8 @@ retry:else if (flow->set ==CAKE_SET_BULK ) { b->bulk_flow_count--; -if (cake_dsrc (q->flow_mode)) - srchost->srchost_bulk_flow_count--; - -if (cake_ddst (q->flow_mode)) - dsthost->dsthost_bulk_flow_count--; - +cake_dec_srchost_bulk_flow_count (b, flow, q->flow_mode); +cake_dec_dsthost_bulk_flow_count (b, flow, q->flow_mode); }else b->decaying_flow_count--;
Greg Kroah-Hartman
maintainerPATCH 103/328 kbuild: userprogs: use correct lld when linking through clang
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Thomas Wei�schuh" <[email protected]>
commit dfc1b168a8c4b376fa222b27b97c2c4ad4b786e1 upstream.
The userprog infrastructure links objects files through $(CC). Either explicitly by manually calling $(CC) on multiple object files or implicitly by directly compiling a source file to an executable. The documentation at Documentation/kbuild/llvm.rst indicates that ld.lld would be used for linking if LLVM=1 is specified.
However clang instead will use either a globally installed cross linker from $PATH called ${target}-ld or fall back to the system linker, which probably does not support crosslinking.
For the normal kernel build this is not an issue because the linker is always executed directly, without the compiler being involved.
Explicitly pass --ld-path to clang so $(LD) is respected.
As clang 13.0.1 is required to build the kernel, this option is available.
[nathan: use cc-option for 6.6 and older, as those trees support back to
clang-11]
--- Makefile | 5 +++++ 1 file changed, 5 insertions(+)
Makefile +5 -0
@@ -956,6 +956,11 @@ ifeq ($(CONFIG_RELR),y) LDFLAGS_vmlinux += --pack-dyn-relocs=relr --use-android-relr-tags endif +# userspace programs are linked via the compiler, use the correct linker +ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_LD_IS_LLD),yy) +KBUILD_USERLDFLAGS += $(call cc-option, --ld-path=$(LD)) +endif + # make the checker run with the right architecture CHECKFLAGS += --arch=$(ARCH)
Greg Kroah-Hartman
maintainerPATCH 104/328 tasklet: Introduce new initialization API
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Romain Perier <[email protected]>
[ Upstream commit 12cc923f1ccc1df467e046b02a72c2b3b321b6a2 ]
Nowadays, modern kernel subsystems that use callbacks pass the data structure associated with a given callback as argument to the callback. The tasklet subsystem remains one which passes an arbitrary unsigned long to the callback function. This has several problems:
- This keeps an extra field for storing the argument in each tasklet data structure, it bloats the tasklet_struct structure with a redundant .data field
- No type checking can be performed on this argument. Instead of using container_of() like other callback subsystems, it forces callbacks to do explicit type cast of the unsigned long argument into the required object type.
- Buffer overflows can overwrite the .func and the .data field, so an attacker can easily overwrite the function and its first argument to whatever it wants.
Add a new tasklet initialization API, via DECLARE_TASKLET() and tasklet_setup(), which will replace the existing ones.
This work is greatly inspired by the timer_struct conversion series, see commit e99e88a9d2b0 ("treewide: setup_timer() -> timer_setup()")
To avoid problems with both -Wcast-function-type (which is enabled in the kernel via -Wextra is several subsystems), and with mismatched function prototypes when build with Control Flow Integrity enabled, this adds the "use_callback" member to let the tasklet caller choose which union member to call through. Once all old API uses are removed, this and the .data member will be removed as well. (On 64-bit this does not grow the struct size as the new member fills the hole after atomic_t, which is also "int" sized.)
Stable-dep-of: 90b7f2961798 ("net: usb: rtl8150: enable basic endpoint checking")
--- include/linux/interrupt.h | 28 +++++++++++++++++++++++++++- kernel/softirq.c | 18 +++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-)
include/linux/interrupt.h +27 -1
@@ -575,6 +575,9 @@ static inline struct task_struct *this_cpu_ksoftirqd(void)/* Tasklets --- multithreaded analogue of BHs. +This API is deprecated. Please consider using threaded IRQs instead: +https://lore.kernel.org/lkml/[email protected] +Main feature differing them of generic softirqs: tasklet is running only on one CPU simultaneously.
@@ -598,10 +601,31 @@ struct tasklet_structstruct tasklet_struct *next;unsigned long state;atomic_t count; -void (*func)(unsigned long ); +bool use_callback; +union { +void (*func)(unsigned long data); +void (*callback)(struct tasklet_struct *t); + };unsigned long data; }; +#define DECLARE_TASKLET (name, _callback) \ +struct tasklet_struct name = { \ + .count = ATOMIC_INIT(0), \ + .callback = _callback, \ + .use_callback = true, \ +} + +#define DECLARE_TASKLET_DISABLED (name, _callback) \ +struct tasklet_struct name = { \ + .count = ATOMIC_INIT(1), \ + .callback = _callback, \ + .use_callback = true, \ +} + +#define from_tasklet (var, callback_tasklet, tasklet_fieldname) \ + container_of(callback_tasklet, typeof(*var), tasklet_fieldname) +#define DECLARE_TASKLET_OLD (name, _func) \ struct tasklet_struct name = { \ .count = ATOMIC_INIT(0), \
@@ -681,6 +705,8 @@ extern void tasklet_kill(struct tasklet_struct *t);extern void tasklet_kill_immediate (struct tasklet_struct *t,unsigned int cpu);extern void tasklet_init (struct tasklet_struct *t,void (*func)(unsigned long ),unsigned long data); +extern void tasklet_setup (struct tasklet_struct *t, +void (*callback)(struct tasklet_struct *));/* * Autoprobing for irqs:
kernel/softirq.c +17 -1
@@ -520,7 +520,10 @@ static void tasklet_action_common(struct softirq_action *a,if (!test_and_clear_bit (TASKLET_STATE_SCHED , &t->state))BUG (); - t->func (t->data); +if (t->use_callback) + t->callback (t); +else + t->func (t->data);tasklet_unlock (t);continue ; }
@@ -546,6 +549,18 @@ static __latent_entropy void tasklet_hi_action(struct softirq_action *a)tasklet_action_common (a,this_cpu_ptr (&tasklet_hi_vec),HI_SOFTIRQ ); } +void tasklet_setup (struct tasklet_struct *t, +void (*callback)(struct tasklet_struct *)) +{ + t->next =NULL ; + t->state =0 ; +atomic_set (&t->count,0 ); + t->callback = callback; + t->use_callback = true; + t->data =0 ; +} +EXPORT_SYMBOL (tasklet_setup); +void tasklet_init (struct tasklet_struct *t,void (*func)(unsigned long ),unsigned long data) {
@@ -553,6 +568,7 @@ void tasklet_init(struct tasklet_struct *t, t->state =0 ;atomic_set (&t->count,0 ); t->func = func; + t->use_callback = false; t->data = data; }EXPORT_SYMBOL (tasklet_init);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 105/328 net: usb: rtl8150: use new tasklet API
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emil Renner Berthing <[email protected]>
[ Upstream commit 1999ad32d4ff00581007543adffc465694b2e77b ]
This converts the driver to use the new tasklet API introduced in commit 12cc923f1ccc ("tasklet: Introduce new initialization API")
Stable-dep-of: 90b7f2961798 ("net: usb: rtl8150: enable basic endpoint checking")
--- drivers/net/usb/rtl8150.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/usb/rtl8150.c +3 -3
@@ -597,9 +597,9 @@ static void free_skb_pool(rtl8150_t *dev)dev_kfree_skb (dev->rx_skb_pool[i]); } -static void rx_fixup (unsigned long data) +static void rx_fixup (struct tasklet_struct *t) { -struct rtl8150 *dev = (struct rtl8150 *)data; +struct rtl8150 *dev =from_tasklet (dev, t, tl);struct sk_buff *skb;int status;
@@ -899,7 +899,7 @@ static int rtl8150_probe(struct usb_interface *intf,return -ENOMEM ; } -tasklet_init (&dev->tl, rx_fixup, (unsigned long )dev); +tasklet_setup (&dev->tl, rx_fixup);spin_lock_init (&dev->rx_pool_lock); dev->udev = udev;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 106/328 net: usb: rtl8150: enable basic endpoint checking
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Zhandarovich <[email protected]>
[ Upstream commit 90b7f2961798793275b4844348619b622f983907 ]
Syzkaller reports [1] encountering a common issue of utilizing a wrong usb endpoint type during URB submitting stage. This, in turn, triggers a warning shown below.
For now, enable simple endpoint checking (specifically, bulk and interrupt eps, testing control one is not essential) to mitigate the issue with a view to do other related cosmetic changes later, if they are necessary.
[1] Syzkaller report:
usb 1-1: BOGUS urb xfer, pipe 3 != type 1
WARNING: CPU: 1 PID: 2586 at drivers/usb/core/urb.c:503 usb_submit_urb+0xe4b/0x1730 driv> Modules linked in: CPU: 1 UID: 0 PID: 2586 Comm: dhcpcd Not tainted 6.11.0-rc4-syzkaller-00069-gfc88bb11617> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 RIP: 0010:usb_submit_urb+0xe4b/0x1730 drivers/usb/core/urb.c:503 Code: 84 3c 02 00 00 e8 05 e4 fc fc 4c 89 ef e8 fd 25 d7 fe 45 89 e0 89 e9 4c 89 f2 48 8> RSP: 0018:ffffc9000441f740 EFLAGS: 00010282 RAX: 0000000000000000 RBX: ffff888112487a00 RCX: ffffffff811a99a9 RDX: ffff88810df6ba80 RSI: ffffffff811a99b6 RDI: 0000000000000001 RBP: 0000000000000003 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000001 R13: ffff8881023bf0a8 R14: ffff888112452a20 R15: ffff888112487a7c FS: 00007fc04eea5740(0000) GS:ffff8881f6300000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f0a1de9f870 CR3: 000000010dbd0000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> rtl8150_open+0x300/0xe30 drivers/net/usb/rtl8150.c:733 __dev_open+0x2d4/0x4e0 net/core/dev.c:1474 __dev_change_flags+0x561/0x720 net/core/dev.c:8838 dev_change_flags+0x8f/0x160 net/core/dev.c:8910 devinet_ioctl+0x127a/0x1f10 net/ipv4/devinet.c:1177 inet_ioctl+0x3aa/0x3f0 net/ipv4/af_inet.c:1003 sock_do_ioctl+0x116/0x280 net/socket.c:1222 sock_ioctl+0x22e/0x6c0 net/socket.c:1341 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:907 [inline] __se_sys_ioctl fs/ioctl.c:893 [inline] __x64_sys_ioctl+0x193/0x220 fs/ioctl.c:893 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fc04ef73d49
...
This change has not been tested on real hardware.
--- drivers/net/usb/rtl8150.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/net/usb/rtl8150.c +22 -0
@@ -71,6 +71,14 @@#define MSR_SPEED (1<<3)#define MSR_LINK (1<<2) +/* USB endpoints */ +enum rtl8150_usb_ep { +RTL8150_USB_EP_CONTROL =0 , +RTL8150_USB_EP_BULK_IN =1 , +RTL8150_USB_EP_BULK_OUT =2 , +RTL8150_USB_EP_INT_IN =3 , +}; +/* Interrupt pipe data */ #define INT_TSR 0x00#define INT_RSR 0x01
@@ -886,6 +894,13 @@ static int rtl8150_probe(struct usb_interface *intf,struct usb_device *udev =interface_to_usbdev (intf);rtl8150_t *dev;struct net_device *netdev; +static const u8 bulk_ep_addr[] = { +RTL8150_USB_EP_BULK_IN |USB_DIR_IN , +RTL8150_USB_EP_BULK_OUT |USB_DIR_OUT , +0 }; +static const u8 int_ep_addr[] = { +RTL8150_USB_EP_INT_IN |USB_DIR_IN , +0 }; netdev =alloc_etherdev (sizeof (rtl8150_t));if (!netdev)
@@ -899,6 +914,13 @@ static int rtl8150_probe(struct usb_interface *intf,return -ENOMEM ; } +/* Verify that all required endpoints are present */ +if (!usb_check_bulk_endpoints (intf, bulk_ep_addr) || + !usb_check_int_endpoints (intf, int_ep_addr)) { +dev_err (&intf->dev,"couldn't find required endpoints\n" ); + goto out; + } +tasklet_setup (&dev->tl, rx_fixup);spin_lock_init (&dev->rx_pool_lock);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 107/328 usb: xhci: Add timeout argument in address_device USB HCD callback
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hardik Gajjar <[email protected]>
[ Upstream commit a769154c7cac037914ba375ae88aae55b2c853e0 ]
- The HCD address_device callback now accepts a user-defined timeout value in milliseconds, providing better control over command execution times.
- The default timeout value for the address_device command has been set to 5000 ms, aligning with the USB 3.2 specification. However, this timeout can be adjusted as needed.
- The xhci_setup_device function has been updated to accept the timeout value, allowing it to specify the maximum wait time for the command operation to complete.
- The hub driver has also been updated to accommodate the newly added timeout parameter during the SET_ADDRESS request.
Stable-dep-of: 1e0a19912adb ("usb: xhci: Fix NULL pointer dereference on certain command aborts")
--- drivers/usb/core/hub.c | 2 +- drivers/usb/host/xhci-mem.c | 2 ++ drivers/usb/host/xhci-ring.c | 11 ++++++----- drivers/usb/host/xhci.c | 23 ++++++++++++++++------- drivers/usb/host/xhci.h | 9 +++++++-- include/linux/usb/hcd.h | 5 +++-- 6 files changed, 35 insertions(+), 17 deletions(-)
drivers/usb/core/hub.c +1 -1
@@ -4551,7 +4551,7 @@ static int hub_set_address(struct usb_device *udev, int devnum)if (udev->state !=USB_STATE_DEFAULT )return -EINVAL ;if (hcd->driver->address_device) - retval = hcd->driver->address_device (hcd, udev); + retval = hcd->driver->address_device (hcd, udev,USB_CTRL_SET_TIMEOUT );else retval = usb_control_msg(udev, usb_sndaddr0pipe(), USB_REQ_SET_ADDRESS, 0, devnum, 0,
drivers/usb/host/xhci-mem.c +2 -0
@@ -1766,6 +1766,8 @@ struct xhci_command *xhci_alloc_command(struct xhci_hcd *xhci, } command->status =0 ; +/* set default timeout to 5000 ms */ + command->timeout_ms =XHCI_CMD_DEFAULT_TIMEOUT ;INIT_LIST_HEAD (&command->cmd_list);return command; }
drivers/usb/host/xhci-ring.c +6 -5
@@ -285,9 +285,10 @@ void xhci_ring_cmd_db(struct xhci_hcd *xhci)readl (&xhci->dba->doorbell[0 ]); } -static bool xhci_mod_cmd_timer (struct xhci_hcd *xhci,unsigned long delay) +static bool xhci_mod_cmd_timer (struct xhci_hcd *xhci) { -return mod_delayed_work (system_wq, &xhci->cmd_timer, delay); +return mod_delayed_work (system_wq, &xhci->cmd_timer, +msecs_to_jiffies (xhci->current_cmd->timeout_ms)); }static struct xhci_command *xhci_next_queued_cmd (struct xhci_hcd *xhci)
@@ -331,7 +332,7 @@ static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci,if ((xhci->cmd_ring->dequeue != xhci->cmd_ring->enqueue) && !(xhci->xhc_state &XHCI_STATE_DYING )) { xhci->current_cmd = cur_cmd; -xhci_mod_cmd_timer (xhci,XHCI_CMD_DEFAULT_TIMEOUT ); +xhci_mod_cmd_timer (xhci);xhci_ring_cmd_db (xhci); } }
@@ -1561,7 +1562,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,if (!list_is_singular (&xhci->cmd_list)) { xhci->current_cmd =list_first_entry (&cmd->cmd_list, struct xhci_command, cmd_list); -xhci_mod_cmd_timer (xhci,XHCI_CMD_DEFAULT_TIMEOUT ); +xhci_mod_cmd_timer (xhci); }else if (xhci->current_cmd == cmd) { xhci->current_cmd =NULL ; }
@@ -4096,7 +4097,7 @@ static int queue_command(struct xhci_hcd *xhci, struct xhci_command *cmd,/* if there are no other commands queued we start the timeout timer */ if (list_empty (&xhci->cmd_list)) { xhci->current_cmd = cmd; -xhci_mod_cmd_timer (xhci,XHCI_CMD_DEFAULT_TIMEOUT ); +xhci_mod_cmd_timer (xhci); }list_add_tail (&cmd->cmd_list, &xhci->cmd_list);
drivers/usb/host/xhci.c +16 -7
@@ -4105,12 +4105,18 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev)return 0 ; } -/* -* Issue an Address Device command and optionally send a corresponding -* SetAddress request to the device. +/** +* xhci_setup_device - issues an Address Device command to assign a unique +* USB bus address. +* @hcd: USB host controller data structure. +* @udev: USB dev structure representing the connected device. +* @setup: Enum specifying setup mode: address only or with context. +* @timeout_ms: Max wait time (ms) for the command operation to complete. +* +* Return: 0 if successful; otherwise, negative error code. */ static int xhci_setup_device (struct usb_hcd *hcd,struct usb_device *udev, -enum xhci_setup_dev setup) +enum xhci_setup_dev setup,unsigned int timeout_ms) {const char *act = setup ==SETUP_CONTEXT_ONLY ?"context" :"address" ;unsigned long flags;
@@ -4167,6 +4173,7 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, } command->in_ctx = virt_dev->in_ctx; + command->timeout_ms = timeout_ms; slot_ctx =xhci_get_slot_ctx (xhci, virt_dev->in_ctx); ctrl_ctx =xhci_get_input_control_ctx (virt_dev->in_ctx);
@@ -4295,14 +4302,16 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev,return ret; } -static int xhci_address_device (struct usb_hcd *hcd,struct usb_device *udev) +static int xhci_address_device (struct usb_hcd *hcd,struct usb_device *udev, +unsigned int timeout_ms) { -return xhci_setup_device (hcd, udev,SETUP_CONTEXT_ADDRESS ); +return xhci_setup_device (hcd, udev,SETUP_CONTEXT_ADDRESS , timeout_ms); }static int xhci_enable_device (struct usb_hcd *hcd,struct usb_device *udev) { -return xhci_setup_device (hcd, udev,SETUP_CONTEXT_ONLY ); +return xhci_setup_device (hcd, udev,SETUP_CONTEXT_ONLY , +XHCI_CMD_DEFAULT_TIMEOUT ); }/*
drivers/usb/host/xhci.h +7 -2
@@ -815,6 +815,8 @@ struct xhci_command {struct completion *completion;union xhci_trb *command_trb;struct list_head cmd_list; +/* xHCI command response timeout in milliseconds */ +unsigned int timeout_ms; };/* drop context bitmasks */
@@ -1550,8 +1552,11 @@ struct xhci_td {bool urb_length_set; }; -/* xHCI command default timeout value */ -#define XHCI_CMD_DEFAULT_TIMEOUT (5 * HZ) +/* +* xHCI command default timeout value in milliseconds. +* USB 3.2 spec, section 9.2.6.1 +*/ +#define XHCI_CMD_DEFAULT_TIMEOUT 5000/* command descriptor */ struct xhci_cd {
include/linux/usb/hcd.h +3 -2
@@ -385,8 +385,9 @@ struct hc_driver {* or bandwidth constraints. */ void (*reset_bandwidth)(struct usb_hcd *,struct usb_device *); -/* Returns the hardware-chosen device address */ -int (*address_device)(struct usb_hcd *,struct usb_device *udev); +/* Set the hardware-chosen device address */ +int (*address_device)(struct usb_hcd *,struct usb_device *udev, +unsigned int timeout_ms);/* prepares the hardware to send commands to the device */ int (*enable_device)(struct usb_hcd *,struct usb_device *udev);/* Notifies the HCD after a hub descriptor is fetched.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 108/328 usb: xhci: Fix NULL pointer dereference on certain command aborts
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Pecio <[email protected]>
[ Upstream commit 1e0a19912adb68a4b2b74fd77001c96cd83eb073 ]
If a command is queued to the final usable TRB of a ring segment, the enqueue pointer is advanced to the subsequent link TRB and no further. If the command is later aborted, when the abort completion is handled the dequeue pointer is advanced to the first TRB of the next segment.
If no further commands are queued, xhci_handle_stopped_cmd_ring() sees the ring pointers unequal and assumes that there is a pending command, so it calls xhci_mod_cmd_timer() which crashes if cur_cmd was NULL.
Don't attempt timer setup if cur_cmd is NULL. The subsequent doorbell ring likely is unnecessary too, but it's harmless. Leave it alone.
This is probably Bug 219532, but no confirmation has been received.
The issue has been independently reproduced and confirmed fixed using a USB MCU programmed to NAK the Status stage of SET_ADDRESS forever. Everything continued working normally after several prevented crashes.
--- drivers/usb/host/xhci-ring.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-ring.c +2 -1
@@ -332,7 +332,8 @@ static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci,if ((xhci->cmd_ring->dequeue != xhci->cmd_ring->enqueue) && !(xhci->xhc_state &XHCI_STATE_DYING )) { xhci->current_cmd = cur_cmd; -xhci_mod_cmd_timer (xhci); +if (cur_cmd) +xhci_mod_cmd_timer (xhci);xhci_ring_cmd_db (xhci); } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 109/328 nvme: handle connectivity loss in nvme_set_queue_count
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Wagner <[email protected]>
[ Upstream commit 294b2b7516fd06a8dd82e4a6118f318ec521e706 ]
When the set feature attempts fails with any NVME status code set in nvme_set_queue_count, the function still report success. Though the numbers of queues set to 0. This is done to support controllers in degraded state (the admin queue is still up and running but no IO queues).
Though there is an exception. When nvme_set_features reports an host path error, nvme_set_queue_count should propagate this error as the connectivity is lost, which means also the admin queue is not working anymore.
--- drivers/nvme/host/core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +7 -1
@@ -1251,7 +1251,13 @@ int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count) status =nvme_set_features (ctrl,NVME_FEAT_NUM_QUEUES , q_count,NULL ,0 , &result); -if (status <0 ) + +/* +* It's either a kernel error or the host observed a connection +* lost. In either case it's not possible communicate with the +* controller and thus enter the error code path. +*/ +if (status <0 || status ==NVME_SC_HOST_PATH_ERROR )return status;/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 110/328 firmware: iscsi_ibft: fix ISCSI_IBFT Kconfig entry
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prasad Pandit <[email protected]>
[ Upstream commit e1e17a1715982201034024863efbf238bee2bdf9 ]
Fix ISCSI_IBFT Kconfig entry, replace tab with a space character.
--- drivers/firmware/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/Kconfig +1 -1
@@ -170,7 +170,7 @@ config ISCSI_IBFT select ISCSI_BOOT_SYSFS select ISCSI_IBFT_FIND if X86 depends on ACPI && SCSI && SCSI_LOWLEVEL - default n + default n help This option enables support for detection and exposing of iSCSI Boot Firmware Table (iBFT) via sysfs to userspace. If you wish to
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 111/328 gpu: drm_dp_cec: fix broken CEC adapter properties check
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
[ Upstream commit 6daaae5ff7f3b23a2dacc9c387ff3d4f95b67cad ]
If the hotplug detect of a display is low for longer than one second (configurable through drm_dp_cec_unregister_delay), then the CEC adapter is unregistered since we assume the display was disconnected. If the HPD went low for less than one second, then we check if the properties of the CEC adapter have changed, since that indicates that we actually switch to new hardware and we have to unregister the old CEC device and register a new one.
Unfortunately, the test for changed properties was written poorly, and after a new CEC capability was added to the CEC core code the test always returned true (i.e. the properties had changed).
As a result the CEC device was unregistered and re-registered for every HPD toggle. If the CEC remote controller integration was also enabled (CONFIG_MEDIA_CEC_RC was set), then the corresponding input device was also unregistered and re-registered. As a result the input device in /sys would keep incrementing its number, e.g.:
/sys/devices/pci0000:00/0000:00:08.1/0000:e7:00.0/rc/rc0/input20
Since short HPD toggles are common, the number could over time get into the thousands.
While not a serious issue (i.e. nothing crashes), it is not intended to work that way.
This patch changes the test so that it only checks for the single CEC capability that can actually change, and it ignores any other capabilities, so this is now safe as well if new caps are added in the future.
With the changed test the bit under #ifndef CONFIG_MEDIA_CEC_RC can be dropped as well, so that's a nice cleanup.
--- drivers/gpu/drm/drm_dp_cec.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/gpu/drm/drm_dp_cec.c +3 -11
@@ -303,16 +303,6 @@ void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const struct edid *edid)if (!aux->transfer)return ; -#ifndef CONFIG_MEDIA_CEC_RC -/* -* CEC_CAP_RC is part of CEC_CAP_DEFAULTS, but it is stripped by -* cec_allocate_adapter() if CONFIG_MEDIA_CEC_RC is undefined. -* -* Do this here as well to ensure the tests against cec_caps are -* correct. -*/ - cec_caps &= ~CEC_CAP_RC ; -#endif cancel_delayed_work_sync (&aux->cec.unregister_work);mutex_lock (&aux->cec.lock);
@@ -329,7 +319,9 @@ void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const struct edid *edid) num_las =CEC_MAX_LOG_ADDRS ;if (aux->cec.adap) { -if (aux->cec.adap->capabilities == cec_caps && +/* Check if the adapter properties have changed */ +if ((aux->cec.adap->capabilities &CEC_CAP_MONITOR_ALL ) == + (cec_caps &CEC_CAP_MONITOR_ALL ) && aux->cec.adap->available_log_addrs == num_las) {/* Unchanged, so just set the phys addr */ cec_s_phys_addr_from_edid (aux->cec.adap, edid);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 112/328 tg3: Disable tg3 PCIe AER on system reboot
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lenny Szubowicz <[email protected]>
[ Upstream commit e0efe83ed325277bb70f9435d4d9fc70bebdcca8 ]
Disable PCIe AER on the tg3 device on system reboot on a limited list of Dell PowerEdge systems. This prevents a fatal PCIe AER event on the tg3 device during the ACPI _PTS (prepare to sleep) method for S5 on those systems. The _PTS is invoked by acpi_enter_sleep_state_prep() as part of the kernel's reboot sequence as a result of commit 38f34dba806a ("PM: ACPI: reboot: Reinstate S5 for reboot").
There was an earlier fix for this problem by commit 2ca1c94ce0b6 ("tg3: Disable tg3 device on system reboot to avoid triggering AER"). But it was discovered that this earlier fix caused a reboot hang when some Dell PowerEdge servers were booted via ipxe. To address this reboot hang, the earlier fix was essentially reverted by commit 9fc3bc764334 ("tg3: power down device only on SYSTEM_POWER_OFF"). This re-exposed the tg3 PCIe AER on reboot problem.
This fix is not an ideal solution because the root cause of the AER is in system firmware. Instead, it's a targeted work-around in the tg3 driver.
Note also that the PCIe AER must be disabled on the tg3 device even if the system is configured to use "firmware first" error handling.
V3:
- Fix sparse warning on improper comparison of pdev->current_state
- Adhere to netdev comment style
--- drivers/net/ethernet/broadcom/tg3.c | 58 +++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+)
drivers/net/ethernet/broadcom/tg3.c +58 -0
@@ -55,6 +55,7 @@#include <linux/hwmon.h> #include <linux/hwmon-sysfs.h> #include <linux/crc32poly.h> +#include <linux/dmi.h> #include <net/checksum.h> #include <net/ip.h>
@@ -18192,6 +18193,50 @@ static int tg3_resume(struct device *device) static SIMPLE_DEV_PM_OPS(tg3_pm_ops, tg3_suspend, tg3_resume); +/* Systems where ACPI _PTS (Prepare To Sleep) S5 will result in a fatal +* PCIe AER event on the tg3 device if the tg3 device is not, or cannot +* be, powered down. +*/ +static const struct dmi_system_id tg3_restart_aer_quirk_table[] = { + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"PowerEdge R440" ), + }, + }, + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"PowerEdge R540" ), + }, + }, + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"PowerEdge R640" ), + }, + }, + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"PowerEdge R650" ), + }, + }, + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"PowerEdge R740" ), + }, + }, + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"PowerEdge R750" ), + }, + }, + {} +}; +static void tg3_shutdown (struct pci_dev *pdev) {struct net_device *dev =pci_get_drvdata (pdev);
@@ -18208,6 +18253,19 @@ static void tg3_shutdown(struct pci_dev *pdev)if (system_state ==SYSTEM_POWER_OFF )tg3_power_down (tp); +else if (system_state ==SYSTEM_RESTART && +dmi_first_match (tg3_restart_aer_quirk_table) && + pdev->current_state != PCI_D3cold && + pdev->current_state !=PCI_UNKNOWN ) { +/* Disable PCIe AER on the tg3 to avoid a fatal +* error during this system restart. +*/ +pcie_capability_clear_word (pdev,PCI_EXP_DEVCTL , +PCI_EXP_DEVCTL_CERE | +PCI_EXP_DEVCTL_NFERE | +PCI_EXP_DEVCTL_FERE | +PCI_EXP_DEVCTL_URRE ); + }rtnl_unlock ();
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 113/328 udp: gso: do not drop small packets when PMTU reduces
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yan Zhai <[email protected]>
[ Upstream commit 235174b2bed88501fda689c113c55737f99332d8 ]
Commit 4094871db1d6 ("udp: only do GSO if # of segs > 1") avoided GSO for small packets. But the kernel currently dismisses GSO requests only after checking MTU/PMTU on gso_size. This means any packets, regardless of their payload sizes, could be dropped when PMTU becomes smaller than requested gso_size. We encountered this issue in production and it caused a reliability problem that new QUIC connection cannot be established before PMTU cache expired, while non GSO sockets still worked fine at the same time.
Ideally, do not check any GSO related constraints when payload size is smaller than requested gso_size, and return EMSGSIZE instead of EINVAL on MTU/PMTU check failure to be more specific on the error cause.
--- net/ipv4/udp.c | 4 ++-- net/ipv6/udp.c | 4 ++-- tools/testing/selftests/net/udpgso.c | 26 ++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 4 deletions(-)
net/ipv4/udp.c +2 -2
@@ -849,9 +849,9 @@ static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4,const int hlen =skb_network_header_len (skb) +sizeof (struct udphdr ); -if (hlen + cork->gso_size > cork->fragsize) { +if (hlen +min (datalen, cork->gso_size) > cork->fragsize) {kfree_skb (skb); -return -EINVAL ; +return -EMSGSIZE ; }if (datalen > cork->gso_size *UDP_MAX_SEGMENTS ) {kfree_skb (skb);
net/ipv6/udp.c +2 -2
@@ -1141,9 +1141,9 @@ static int udp_v6_send_skb(struct sk_buff *skb, struct flowi6 *fl6,const int hlen =skb_network_header_len (skb) +sizeof (struct udphdr ); -if (hlen + cork->gso_size > cork->fragsize) { +if (hlen +min (datalen, cork->gso_size) > cork->fragsize) {kfree_skb (skb); -return -EINVAL ; +return -EMSGSIZE ; }if (datalen > cork->gso_size *UDP_MAX_SEGMENTS ) {kfree_skb (skb);
tools/testing/selftests/net/udpgso.c +26 -0
@@ -94,6 +94,19 @@ struct testcase testcases_v4[] = { .gso_len = CONST_MSS_V4, .r_num_mss = 1, }, + { + /* datalen <= MSS < gso_len: will fall back to no GSO */ + .tlen = CONST_MSS_V4, + .gso_len = CONST_MSS_V4 + 1, + .r_num_mss = 0, + .r_len_last = CONST_MSS_V4, + }, + { + /* MSS < datalen < gso_len: fail */ + .tlen = CONST_MSS_V4 + 1, + .gso_len = CONST_MSS_V4 + 2, + .tfail = true, + }, { /* send a single MSS + 1B */ .tlen = CONST_MSS_V4 + 1,
@@ -197,6 +210,19 @@ struct testcase testcases_v6[] = { .gso_len = CONST_MSS_V6, .r_num_mss = 1, }, + { + /* datalen <= MSS < gso_len: will fall back to no GSO */ + .tlen = CONST_MSS_V6, + .gso_len = CONST_MSS_V6 + 1, + .r_num_mss = 0, + .r_len_last = CONST_MSS_V6, + }, + { + /* MSS < datalen < gso_len: fail */ + .tlen = CONST_MSS_V6 + 1, + .gso_len = CONST_MSS_V6 + 2, + .tfail = true + }, { /* send a single MSS + 1B */ .tlen = CONST_MSS_V6 + 1,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 114/328 net: rose: lock the socket in rose_bind()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit a1300691aed9ee852b0a9192e29e2bdc2411a7e6 ]
syzbot reported a soft lockup in rose_loopback_timer(), with a repro calling bind() from multiple threads.
rose_bind() must lock the socket to avoid this issue.
--- net/rose/af_rose.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
net/rose/af_rose.c +16 -8
@@ -678,11 +678,9 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)struct net_device *dev;ax25_address *source;ax25_uid_assoc *user; +int err = -EINVAL ;int n; -if (!sock_flag (sk,SOCK_ZAPPED )) -return -EINVAL ; -if (addr_len !=sizeof (struct sockaddr_rose ) && addr_len !=sizeof (struct full_sockaddr_rose ))return -EINVAL ;
@@ -695,8 +693,15 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)if ((unsigned int ) addr->srose_ndigis >ROSE_MAX_DIGIS )return -EINVAL ; -if ((dev =rose_dev_get (&addr->srose_addr)) ==NULL ) -return -EADDRNOTAVAIL ; +lock_sock (sk); + +if (!sock_flag (sk,SOCK_ZAPPED )) + goto out_release; + + err = -EADDRNOTAVAIL ; + dev =rose_dev_get (&addr->srose_addr); +if (!dev) + goto out_release; source = &addr->srose_call;
@@ -707,7 +712,8 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) }else {if (ax25_uid_policy && !capable (CAP_NET_BIND_SERVICE )) {dev_put (dev); -return -EACCES ; + err = -EACCES ; + goto out_release; } rose->source_call = *source; }
@@ -729,8 +735,10 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)rose_insert_socket (sk);sock_reset_flag (sk,SOCK_ZAPPED ); - -return 0 ; + err =0 ; +out_release: +release_sock (sk); +return err; }static int rose_connect (struct socket *sock,struct sockaddr *uaddr,int addr_len,int flags)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 115/328 netem: Update sch->q.qlen before qdisc_tree_reduce_backlog()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cong Wang <[email protected]>
[ Upstream commit 638ba5089324796c2ee49af10427459c2de35f71 ]
qdisc_tree_reduce_backlog() notifies parent qdisc only if child qdisc becomes empty, therefore we need to reduce the backlog of the child qdisc before calling it. Otherwise it would miss the opportunity to call cops->qlen_notify(), in the case of DRR, it resulted in UAF since DRR uses ->qlen_notify() to maintain its active list.
--- net/sched/sch_netem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_netem.c +1 -1
@@ -739,9 +739,9 @@ static struct sk_buff *netem_dequeue(struct Qdisc *sch)if (err !=NET_XMIT_SUCCESS ) {if (net_xmit_drop_count (err))qdisc_qstats_drop (sch); -qdisc_tree_reduce_backlog (sch,1 , pkt_len); sch->qstats.backlog -= pkt_len; sch->q.qlen--; +qdisc_tree_reduce_backlog (sch,1 , pkt_len); } goto tfifo_dequeue; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 116/328 tun: revert fix group permission check
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Willem de Bruijn <[email protected]>
[ Upstream commit a70c7b3cbc0688016810bb2e0b9b8a0d6a530045 ]
This reverts commit 3ca459eaba1bf96a8c7878de84fa8872259a01e3.
The blamed commit caused a regression when neither tun->owner nor tun->group is set. This is intended to be allowed, but now requires CAP_NET_ADMIN.
Discussion in the referenced thread pointed out that the original issue that prompted this patch can be resolved in userspace.
The relaxed access control may also make a device accessible when it previously wasn't, while existing users may depend on it to not be.
This is a clean pure git revert, except for fixing the indentation on the gid_valid line that checkpatch correctly flagged.
--- drivers/net/tun.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/net/tun.c +5 -9
@@ -636,18 +636,14 @@ static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb,return ret; } -static inline bool tun_capable (struct tun_struct *tun) +static inline bool tun_not_capable (struct tun_struct *tun) {const struct cred *cred =current_cred ();struct net *net =dev_net (tun->dev); -if (ns_capable (net->user_ns,CAP_NET_ADMIN )) -return 1 ; -if (uid_valid (tun->owner) &&uid_eq (cred->euid, tun->owner)) -return 1 ; -if (gid_valid (tun->group) &&in_egroup_p (tun->group)) -return 1 ; -return 0 ; +return ((uid_valid (tun->owner) && !uid_eq (cred->euid, tun->owner)) || + (gid_valid (tun->group) && !in_egroup_p (tun->group))) && + !ns_capable (net->user_ns,CAP_NET_ADMIN ); }static void tun_set_real_num_queues (struct tun_struct *tun)
@@ -2842,7 +2838,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) !!(tun->flags & IFF_MULTI_QUEUE))return -EINVAL ; -if (!tun_capable (tun)) +if (tun_not_capable (tun))return -EPERM ; err =security_tun_dev_open (tun->security);if (err <0 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 117/328 cpufreq: s3c64xx: Fix compilation warning
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viresh Kumar <[email protected]>
commit 43855ac61483cb914f060851535ea753c094b3e0 upstream.
The driver generates following warning when regulator support isn't enabled in the kernel. Fix it.
drivers/cpufreq/s3c64xx-cpufreq.c: In function 's3c64xx_cpufreq_set_target':
Quoted 1 line
Quoted 1 line
drivers/cpufreq/s3c64xx-cpufreq.c:55:22: warning: variable 'old_freq' set but not used [-Wunused-but-set-variable]
55 | unsigned int old_freq, new_freq;
| ^~~~~~~~Quoted 1 line
Quoted 1 line
drivers/cpufreq/s3c64xx-cpufreq.c:54:30: warning: variable 'dvfs' set but not used [-Wunused-but-set-variable]
54 | struct s3c64xx_dvfs *dvfs;
| ^~~~--- drivers/cpufreq/s3c64xx-cpufreq.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/cpufreq/s3c64xx-cpufreq.c +7 -4
@@ -25,6 +25,7 @@ struct s3c64xx_dvfs {unsigned int vddarm_max; }; +#ifdef CONFIG_REGULATOR static struct s3c64xx_dvfs s3c64xx_dvfs_table[] = { [0 ] = {1000000 ,1150000 }, [1] = { 1050000, 1150000 },
@@ -32,6 +33,7 @@ static struct s3c64xx_dvfs s3c64xx_dvfs_ [3] = { 1200000, 1350000 }, [4] = { 1300000, 1350000 }, }; +#endif static struct cpufreq_frequency_table s3c64xx_freq_table[] = { {0 ,0 ,66000 },
@@ -53,15 +55,16 @@ static struct cpufreq_frequency_table s3 static int s3c64xx_cpufreq_set_target(struct cpufreq_policy *policy, unsigned int index) { - struct s3c64xx_dvfs *dvfs; - unsigned int old_freq, new_freq; + unsigned int new_freq = s3c64xx_freq_table[index].frequency; int ret; +#ifdef CONFIG_REGULATOR + struct s3c64xx_dvfs *dvfs; + unsigned int old_freq; + old_freq = clk_get_rate(policy->clk) / 1000; - new_freq = s3c64xx_freq_table[index].frequency; dvfs = &s3c64xx_dvfs_table[s3c64xx_freq_table[index].driver_data]; -#ifdef CONFIG_REGULATOR if (vddarm && new_freq > old_freq) { ret = regulator_set_voltage(vddarm, dvfs->vddarm_min,
Greg Kroah-Hartman
maintainerPATCH 118/328 leds: lp8860: Write full EEPROM, not only half of it
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Sverdlin <[email protected]>
commit 0d2e820a86793595e2a776855d04701109e46663 upstream.
I struggle to explain dividing an ARRAY_SIZE() by the size of an element once again. As the latter equals to 2, only the half of EEPROM was ever written. Drop the unexplainable division and write full ARRAY_SIZE().
--- drivers/leds/leds-lp8860.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-lp8860.c +1 -1
@@ -267,7 +267,7 @@ static int lp8860_init(struct lp8860_led goto out; } - reg_count =ARRAY_SIZE (lp8860_eeprom_disp_regs) /sizeof (lp8860_eeprom_disp_regs[0 ]); + reg_count =ARRAY_SIZE (lp8860_eeprom_disp_regs);for (i =0 ; i < reg_count; i++) { ret = regmap_write(led->eeprom_regmap, lp8860_eeprom_disp_regs[i].reg,
Greg Kroah-Hartman
maintainerPATCH 119/328 s390/futex: Fix FUTEX_OP_ANDN implementation
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
commit 26701574cee6777f867f89b4a5c667817e1ee0dd upstream.
The futex operation FUTEX_OP_ANDN is supposed to implement
*(int *)UADDR2 &= ~OPARG;
The s390 implementation just implements an AND instead of ANDN. Add the missing bitwise not operation to oparg to fix this.
This is broken since nearly 19 years, so it looks like user space is not making use of this operation.
--- arch/s390/include/asm/futex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/include/asm/futex.h +1 -1
@@ -46,7 +46,7 @@ static inline int arch_futex_atomic_op_ibreak ;case FUTEX_OP_ANDN :__futex_atomic_op ("lr %2,%1\nnr %2,%5\n" , - ret, oldval, newval, uaddr, oparg); + ret, oldval, newval, uaddr, ~oparg);break ;case FUTEX_OP_XOR : __futex_atomic_op("lr %2,%1\nxr %2,%5\n",
Greg Kroah-Hartman
maintainerPATCH 120/328 m68k: vga: Fix I/O defines
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit 53036937a101b5faeaf98e7438555fa854a1a844 upstream.
Including m68k's <asm/raw_io.h> in vga.h on nommu platforms results in conflicting defines with io_no.h for various I/O macros from the __raw_read and __raw_write families. An example error is
In file included from arch/m68k/include/asm/vga.h:12,
from include/video/vga.h:22, from include/linux/vgaarb.h:34, from drivers/video/aperture.c:12:
Quoted 1 line
Quoted 1 line
arch/m68k/include/asm/raw_io.h:39: warning: "__raw_readb" redefined
39 | #define __raw_readb in_8
|
In file included from arch/m68k/include/asm/io.h:6,
from include/linux/io.h:13,
from include/linux/irq.h:20,
from include/asm-generic/hardirq.h:17,
from ./arch/m68k/include/generated/asm/hardirq.h:1,
from include/linux/hardirq.h:11,
from include/linux/interrupt.h:11,
from include/linux/trace_recursion.h:5,
from include/linux/ftrace.h:10,
from include/linux/kprobes.h:28,
from include/linux/kgdb.h:19,
from include/linux/fb.h:6,
from drivers/video/aperture.c:5:
arch/m68k/include/asm/io_no.h:16: note: this is the location of the previous definition
16 | #define __raw_readb(addr) \
|Include <asm/io.h>, which avoids raw_io.h on nommu platforms. Also change the defined values of some of the read/write symbols in vga.h to __raw_read/__raw_write as the raw_in/raw_out symbols are not generally available.
--- arch/m68k/include/asm/vga.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/m68k/include/asm/vga.h +4 -4
@@ -9,7 +9,7 @@*/ #ifndef CONFIG_PCI -#include <asm/raw_io.h> +#include <asm/io.h> #include <asm/kmap.h> /*
@@ -29,9 +29,9 @@#define inw_p (port) 0#define outb_p (port, val) do { } while (0)#define outw (port, val) do { } while (0) -#define readb raw_inb -#define writeb raw_outb -#define writew raw_outw +#define readb __raw_readb +#define writeb __raw_writeb +#define writew __raw_writew#endif /* CONFIG_PCI */ #endif /* _ASM_M68K_VGA_H */
Greg Kroah-Hartman
maintainerPATCH 121/328 binfmt_flat: Fix integer overflow bug on 32 bit systems
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 55cf2f4b945f6a6416cc2524ba740b83cc9af25a upstream.
Most of these sizes and counts are capped at 256MB so the math doesn't result in an integer overflow. The "relocs" count needs to be checked as well. Otherwise on 32bit systems the calculation of "full_data" could be wrong.
full_data = data_len + relocs * sizeof(unsigned long);
--- fs/binfmt_flat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/binfmt_flat.c +1 -1
@@ -529,7 +529,7 @@ static int load_flat_file(struct linux_b* 28 bits (256 MB) is way more than reasonable in this case. * If some top bits are set we have probable binary corruption. */ -if ((text_len | data_len | bss_len | stack_len | full_data) >>28 ) { +if ((text_len | data_len | bss_len | stack_len | relocs | full_data) >>28 ) {pr_err ("bad header\n" ); ret = -ENOEXEC ; goto err;
Greg Kroah-Hartman
maintainerPATCH 122/328 arm64: dts: rockchip: increase gmac rx_delay on rk3399-puma
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakob Unterwurzacher <[email protected]>
commit 9d241b06802c6c2176ae7aa4f9f17f8a577ed337 upstream.
During mass manufacturing, we noticed the mmc_rx_crc_error counter, as reported by "ethtool -S eth0 | grep mmc_rx_crc_error", to increase above zero during nuttcp speedtests. Most of the time, this did not affect the achieved speed, but it prompted this investigation.
Cycling through the rx_delay range on six boards (see table below) of various ages shows that there is a large good region from 0x12 to 0x35 where we see zero crc errors on all tested boards.
The old rx_delay value (0x10) seems to have always been on the edge for the KSZ9031RNX that is usually placed on Puma.
Choose "rx_delay = 0x23" to put us smack in the middle of the good region. This works fine as well with the KSZ9131RNX PHY that was used for a small number of boards during the COVID chip shortages.
Board S/N PHY rx_delay good region --------- --- -------------------- Puma TT0069903 KSZ9031RNX 0x11 0x35 Puma TT0157733 KSZ9031RNX 0x11 0x35 Puma TT0681551 KSZ9031RNX 0x12 0x37 Puma TT0681156 KSZ9031RNX 0x10 0x38 Puma 17496030079 KSZ9031RNX 0x10 0x37 (Puma v1.2 from 2017) Puma TT0681720 KSZ9131RNX 0x02 0x39 (alternative PHY used in very few boards) Intersection of good regions = 0x12 0x35 Middle of good region = 0x23
--- arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi +1 -1
@@ -176,7 +176,7 @@ snps,reset-active-low; snps,reset-delays-us = <0 10000 50000>; tx_delay = <0x10>; - rx_delay = <0x10>; + rx_delay = <0x23>; status = "okay"; };
Greg Kroah-Hartman
maintainerPATCH 123/328 KVM: Explicitly verify target vCPU is online in kvm_get_vcpu()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 1e7381f3617d14b3c11da80ff5f8a93ab14cfc46 upstream.
Explicitly verify the target vCPU is fully online _prior_ to clamping the index in kvm_get_vcpu(). If the index is "bad", the nospec clamping will generate '0', i.e. KVM will return vCPU0 instead of NULL.
In practice, the bug is unlikely to cause problems, as it will only come into play if userspace or the guest is buggy or misbehaving, e.g. KVM may send interrupts to vCPU0 instead of dropping them on the floor.
However, returning vCPU0 when it shouldn't exist per online_vcpus is problematic now that KVM uses an xarray for the vCPUs array, as KVM needs to insert into the xarray before publishing the vCPU to userspace (see commit c5b077549136 ("KVM: Convert the kvm->vcpus array to a xarray")), i.e. before vCPU creation is guaranteed to succeed.
As a result, incorrectly providing access to vCPU0 will trigger a use-after-free if vCPU0 is dereferenced and kvm_vm_ioctl_create_vcpu() bails out of vCPU creation due to an error and frees vCPU0. Commit afb2acb2e3a3 ("KVM: Fix vcpu_array[0] races") papered over that issue, but in doing so introduced an unsolvable teardown conundrum. Preventing accesses to vCPU0 before it's fully online will allow reverting commit afb2acb2e3a3, without re-introducing the vcpu_array[0] UAF race.
--- include/linux/kvm_host.h | 9 +++++++++ 1 file changed, 9 insertions(+)
include/linux/kvm_host.h +9 -0
@@ -567,6 +567,15 @@ static inline struct kvm_io_bus *kvm_getstatic inline struct kvm_vcpu *kvm_get_vcpu (struct kvm *kvm,int i) {int num_vcpus =atomic_read (&kvm->online_vcpus); + +/* +* Explicitly verify the target vCPU is online, as the anti-speculation +* logic only limits the CPU's ability to speculate, e.g. given a "bad" +* index, clamping the index to 0 would return vCPU0, not NULL. +*/ +if (i >= num_vcpus) +return NULL ; + i =array_index_nospec (i, num_vcpus);/* Pairs with smp_wmb() in kvm_vm_ioctl_create_vcpu. */
Greg Kroah-Hartman
maintainerPATCH 124/328 KVM: s390: vsie: fix some corner-cases when grabbing vsie pages
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
commit 5f230f41fdd9e799f43a699348dc572bca7159aa upstream.
We try to reuse the same vsie page when re-executing the vsie with a given SCB address. The result is that we use the same shadow SCB -- residing in the vsie page -- and can avoid flushing the TLB when re-running the vsie on a CPU.
So, when we allocate a fresh vsie page, or when we reuse a vsie page for a different SCB address -- reusing the shadow SCB in different context -- we set ihcpu=0xffff to trigger the flush.
However, after we looked up the SCB address in the radix tree, but before we grabbed the vsie page by raising the refcount to 2, someone could reuse the vsie page for a different SCB address, adjusting page->index and the radix tree. In that case, we would be reusing the vsie page with a wrong page->index.
Another corner case is that we might set the SCB address for a vsie page, but fail the insertion into the radix tree. Whoever would reuse that page would remove the corresponding radix tree entry -- which might now be a valid entry pointing at another page, resulting in the wrong vsie page getting removed from the radix tree.
Let's handle such races better, by validating that the SCB address of a vsie page didn't change after we grabbed it (not reuse for a different SCB; the alternative would be performing another tree lookup), and by setting the SCB address to invalid until the insertion in the tree succeeded (SCB addresses are aligned to 512, so ULONG_MAX is invalid).
These scenarios are rare, the effects a bit unclear, and these issues were only found by code inspection. Let's CC stable to be safe.
Message-ID: <[email protected]>
--- arch/s390/kvm/vsie.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
arch/s390/kvm/vsie.c +19 -6
@@ -1228,8 +1228,14 @@ static struct vsie_page *get_vsie_page(s page =radix_tree_lookup (&kvm->arch.vsie.addr_to_page, addr >>9 );rcu_read_unlock ();if (page) { -if (page_ref_inc_return (page) ==2 ) -return page_to_virt (page); +if (page_ref_inc_return (page) ==2 ) { +if (page->index == addr) +return page_to_virt (page); +/* +* We raced with someone reusing + putting this vsie +* page before we grabbed it. +*/ + }page_ref_dec (page); }
@@ -1259,15 +1265,20 @@ static struct vsie_page *get_vsie_page(s kvm->arch.vsie.next++; kvm->arch.vsie.next %= nr_vcpus; } -radix_tree_delete (&kvm->arch.vsie.addr_to_page, page->index >>9 ); +if (page->index !=ULONG_MAX ) +radix_tree_delete (&kvm->arch.vsie.addr_to_page, + page->index >>9 ); } - page->index = addr; -/* double use of the same address */ +/* Mark it as invalid until it resides in the tree. */ + page->index =ULONG_MAX ; + +/* Double use of the same address or allocation failure. */ if (radix_tree_insert (&kvm->arch.vsie.addr_to_page, addr >>9 , page)) {page_ref_dec (page);mutex_unlock (&kvm->arch.vsie.mutex);return NULL ; } + page->index = addr;mutex_unlock (&kvm->arch.vsie.mutex); vsie_page =page_to_virt (page);
@@ -1360,7 +1371,9 @@ void kvm_s390_vsie_destroy(struct kvm *k vsie_page =page_to_virt (page);release_gmap_shadow (vsie_page);/* free the radix tree entry */ -radix_tree_delete (&kvm->arch.vsie.addr_to_page, page->index >>9 ); +if (page->index !=ULONG_MAX ) +radix_tree_delete (&kvm->arch.vsie.addr_to_page, + page->index >>9 );__free_page (page); } kvm->arch.vsie.page_count =0 ;
Greg Kroah-Hartman
maintainerPATCH 125/328 drm/komeda: Add check for komeda_get_layer_fourcc_list()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haoxiang Li <[email protected]>
commit 79fc672a092d93a7eac24fe20a571d4efd8fa5a4 upstream.
Add check for the return value of komeda_get_layer_fourcc_list() to catch the potential exception.
--- drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c +4 -0
@@ -159,6 +159,10 @@ static int komeda_wb_connector_add(struc formats =komeda_get_layer_fourcc_list (&mdev->fmt_tbl, kwb_conn->wb_layer->layer_type, &n_formats); +if (!formats) { +kfree (kwb_conn); +return -ENOMEM ; + } err = drm_writeback_connector_init(&kms->base, wb_conn, &komeda_wb_connector_funcs,
Greg Kroah-Hartman
maintainerPATCH 126/328 Bluetooth: L2CAP: handle NULL sock pointer in l2cap_sock_alloc
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
commit 5f397409f8ee5bc82901eeaf799e1cbc4f8edcf1 upstream.
A NULL sock pointer is passed into l2cap_sock_alloc() when it is called from l2cap_sock_new_connection_cb() and the error handling paths should also be aware of it.
Seemingly a more elegant solution would be to swap bt_sock_alloc() and l2cap_chan_create() calls since they are not interdependent to that moment but then l2cap_chan_create() adds the soon to be deallocated and still dummy-initialized channel to the global list accessible by many L2CAP paths. The channel would be removed from the list in short period of time but be a bit more straight-forward here and just check for NULL instead of changing the order of function calls.
Found by Linux Verification Center (linuxtesting.org) with SVACE static analysis tool.
--- net/bluetooth/l2cap_sock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/bluetooth/l2cap_sock.c +2 -1
@@ -1678,7 +1678,8 @@ static struct sock *l2cap_sock_alloc(str chan =l2cap_chan_create ();if (!chan) {sk_free (sk); - sock->sk =NULL ; +if (sock) + sock->sk =NULL ;return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 127/328 clk: qcom: clk-alpha-pll: fix alpha mode configuration
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabor Juhos <[email protected]>
commit 33f1722eb86e45320a3dd7b3d42f6593a1d595c2 upstream.
Commit c45ae598fc16 ("clk: qcom: support for alpha mode configuration") added support for configuring alpha mode, but it seems that the feature was never working in practice.
The value of the alpha_{en,mode}_mask members of the configuration gets added to the value parameter passed to the regmap_update_bits() function, however the same values are not getting applied to the bitmask. As the result, the respective bits in the USER_CTL register are never modifed which leads to improper configuration of several PLLs.
The following table shows the PLL configurations where the 'alpha_en_mask' member is set and which are passed as a parameter for the clk_alpha_pll_configure() function. In the table the 'expected rate' column shows the rate the PLL should run at with the given configuration, and the 'real rate' column shows the rate the PLL runs at actually. The real rates has been verified on hardwareOn IPQ* platforms, on other platforms, those are computed values only.
file pll expected rate real rate dispcc-qcm2290.c disp_cc_pll0 768.0 MHz 768.0 MHz dispcc-sm6115.c disp_cc_pll0 768.0 MHz 768.0 MHz gcc-ipq5018.c ubi32_pll 1000.0 MHz != 984.0 MHz gcc-ipq6018.c nss_crypto_pll 1200.0 MHz 1200.0 MHz gcc-ipq6018.c ubi32_pll 1497.6 MHz != 1488.0 MHz gcc-ipq8074.c nss_crypto_pll 1200.0 MHz != 1190.4 MHz gcc-qcm2290.c gpll11 532.0 MHz != 518.4 MHz gcc-qcm2290.c gpll8 533.2 MHz != 518.4 MHz gcc-qcs404.c gpll3 921.6 MHz 921.6 MHz gcc-sm6115.c gpll11 600.0 MHz != 595.2 MHz gcc-sm6115.c gpll8 800.0 MHz != 787.2 MHz gpucc-sdm660.c gpu_cc_pll0 800.0 MHz != 787.2 MHz gpucc-sdm660.c gpu_cc_pll1 740.0 MHz != 729.6 MHz gpucc-sm6115.c gpu_cc_pll0 1200.0 MHz != 1190.4 MHz gpucc-sm6115.c gpu_cc_pll1 640.0 MHz != 633.6 MHz gpucc-sm6125.c gpu_pll0 1020.0 MHz != 1017.6 MHz gpucc-sm6125.c gpu_pll1 930.0 MHz != 921.6 MHz mmcc-sdm660.c mmpll8 930.0 MHz != 921.6 MHz mmcc-sdm660.c mmpll5 825.0 MHz != 806.4 MHz
As it can be seen from the above, there are several PLLs which are configured incorrectly.
Change the code to apply both 'alpha_en_mask' and 'alpha_mode_mask' values to the bitmask in order to configure the alpha mode correctly.
Applying the 'alpha_en_mask' fixes the initial rate of the PLLs showed in the table above. Since the 'alpha_mode_mask' is not used by any driver currently, that part of the change causes no functional changes.
--- drivers/clk/qcom/clk-alpha-pll.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/qcom/clk-alpha-pll.c +2 -0
@@ -236,6 +236,8 @@ void clk_alpha_pll_configure(struct clk_ mask |= config->pre_div_mask; mask |= config->post_div_mask; mask |= config->vco_mask; + mask |= config->alpha_en_mask; + mask |= config->alpha_mode_mask;regmap_update_bits (regmap,PLL_USER_CTL (pll), mask, val);
Greg Kroah-Hartman
maintainerPATCH 128/328 clk: qcom: clk-rpmh: prevent integer overflow in recalc_rate
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anastasia Belova <[email protected]>
commit 89aa5925d201b90a48416784831916ca203658f9 upstream.
aggr_state and unit fields are u32. The result of their multiplication may not fit in this type.
Add explicit casting to prevent overflow.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/clk/qcom/clk-rpmh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/clk-rpmh.c +1 -1
@@ -331,7 +331,7 @@ static unsigned long clk_rpmh_bcm_recalc {struct clk_rpmh *c =to_clk_rpmh (hw); -return c->aggr_state * c->unit; +return (unsigned long )c->aggr_state * c->unit; }static const struct clk_ops clk_rpmh_bcm_ops = {
Greg Kroah-Hartman
maintainerPATCH 129/328 perf bench: Fix undefined behavior in cmpworker()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuan-Wei Chiu <[email protected]>
commit 62892e77b8a64b9dc0e1da75980aa145347b6820 upstream.
The comparison function cmpworker() violates the C standard's requirements for qsort() comparison functions, which mandate symmetry and transitivity:
Symmetry: If x < y, then y > x.
Transitivity: If x < y and y < z, then x < z.
In its current implementation, cmpworker() incorrectly returns 0 when w1->tid < w2->tid, which breaks both symmetry and transitivity. This violation causes undefined behavior, potentially leading to issues such as memory corruption in glibc [1].
Fix the issue by returning -1 when w1->tid < w2->tid, ensuring compliance with the C standard and preventing undefined behavior.
--- tools/perf/bench/epoll-wait.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tools/perf/bench/epoll-wait.c +6 -1
@@ -407,7 +407,12 @@ static int cmpworker(const void *p1, construct worker *w1 = (struct worker *) p1;struct worker *w2 = (struct worker *) p2; -return w1->tid > w2->tid; + +if (w1->tid > w2->tid) +return 1 ; +if (w1->tid < w2->tid) +return -1 ; +return 0 ; }int bench_epoll_wait (int argc,const char **argv)
Greg Kroah-Hartman
maintainerPATCH 130/328 of: Correct child specifier used as input of the 2nd nexus node
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit e4c00c9b1f70cd11792ff5b825899a6ee0234a62 upstream.
API of_parse_phandle_with_args_map() will use wrong input for nexus node Nexus_2 as shown below:
Node_1 Nexus_1 Nexus_2
&Nexus_1,arg_1 -> arg_1,&Nexus_2,arg_2' -> &Nexus_2,arg_2 -> arg_2,...
map-pass-thru=<...>
Nexus_1's output arg_2 should be used as input of Nexus_2, but the API wrongly uses arg_2' instead which != arg_2 due to Nexus_1's map-pass-thru.
Fix by always making @match_array point to @initial_match_array into which to store nexus output.
--- drivers/of/base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/base.c +1 -1
@@ -1733,7 +1733,6 @@ int of_parse_phandle_with_args_map(const* specifier into the out_args structure, keeping the * bits specified in <list>-map-pass-thru. */ - match_array = map - new_size;for (i =0 ; i < new_size; i++) {__be32 val = *(map - new_size + i);
@@ -1742,6 +1741,7 @@ int of_parse_phandle_with_args_map(const val |=cpu_to_be32 (out_args->args[i]) & pass[i]; } + initial_match_array[i] = val; out_args->args[i] =be32_to_cpu (val); } out_args->args_count = list_size = new_size;
Greg Kroah-Hartman
maintainerPATCH 131/328 of: Fix of_find_node_opts_by_path() handling of alias+path+options
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit b9e58c934c56aa35b0fb436d9afd86ef326bae0e upstream.
of_find_node_opts_by_path() fails to find OF device node when its @path parameter have pattern below:
"alias-name/node-name-1/.../node-name-N:options".
The reason is that alias name length calculated by the API is wrong, as explained by example below:
"testcase-alias/phandle-tests/consumer-a:testaliasoption".
^ ^ ^ 0 14 39
The right length of alias 'testcase-alias' is 14, but the result worked out by the API is 39 which is obvious wrong.
Fix by using index of either '/' or ':' as the length who comes earlier.
--- drivers/of/base.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/of/base.c +3 -3
@@ -988,10 +988,10 @@ struct device_node *of_find_node_opts_by/* The path could begin with an alias */ if (*path !='/' ) {int len; -const char *p = separator; +const char *p =strchrnul (path,'/' ); -if (!p) - p =strchrnul (path,'/' ); +if (separator && separator < p) + p = separator; len = p - path;/* of_aliases must not be NULL */
Greg Kroah-Hartman
maintainerPATCH 132/328 of: reserved-memory: Fix using wrong number of cells to get property alignment
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit 267b21d0bef8e67dbe6c591c9991444e58237ec9 upstream.
According to DT spec, size of property 'alignment' is based on parent node’s #size-cells property.
But __reserved_mem_alloc_size() wrongly uses @dt_root_addr_cells to get the property obviously.
Fix by using @dt_root_size_cells instead of @dt_root_addr_cells.
--- drivers/of/of_reserved_mem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/of/of_reserved_mem.c +2 -2
@@ -96,12 +96,12 @@ static int __init __reserved_mem_alloc_s prop =of_get_flat_dt_prop (node,"alignment" , &len);if (prop) { -if (len != dt_root_addr_cells *sizeof (__be32)) { +if (len != dt_root_size_cells *sizeof (__be32)) {pr_err ("invalid alignment property in '%s' node.\n" , uname);return -EINVAL ; } - align =dt_mem_next_cell (dt_root_addr_cells, &prop); + align =dt_mem_next_cell (dt_root_size_cells, &prop); }/* Need adjust the alignment to satisfy the CMA requirement */
Greg Kroah-Hartman
maintainerPATCH 133/328 HID: hid-sensor-hub: dont use stale platform-data on remove
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
commit 8a5b38c3fd709e8acd2bfdedf66c25e6af759576 upstream.
The hid-sensor-hub creates the individual device structs and transfers them to the created mfd platform-devices via the platform_data in the mfd_cell.
Before e651a1da442a ("HID: hid-sensor-hub: Allow parallel synchronous reads") the sensor-hub was managing access centrally, with one "completion" in the hub's data structure, which needed to be finished on removal at the latest.
The mentioned commit then moved this central management to each hid sensor device, resulting on a completion in each struct hid_sensor_hub_device. The remove procedure was adapted to go through all sensor devices and finish any pending "completion".
What this didn't take into account was, platform_device_add_data() that is used by mfd_add{_hotplug}_devices() does a kmemdup on the submitted platform-data. So the data the platform-device gets is a copy of the original data, meaning that the device worked on a different completion than what sensor_hub_remove() currently wants to access.
To fix that, use device_for_each_child() to go through each child-device similar to how mfd_remove_devices() unregisters the devices later and with that get the live platform_data to finalize the correct completion.
--- drivers/hid/hid-sensor-hub.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/hid/hid-sensor-hub.c +14 -7
@@ -730,23 +730,30 @@ err_stop_hw:return ret; } +static int sensor_hub_finalize_pending_fn (struct device *dev,void *data) +{ +struct hid_sensor_hub_device *hsdev = dev->platform_data; + +if (hsdev->pending.status) +complete (&hsdev->pending.ready); + +return 0 ; +} +static void sensor_hub_remove (struct hid_device *hdev) {struct sensor_hub_data *data =hid_get_drvdata (hdev);unsigned long flags; -int i;hid_dbg (hdev," hardware removed\n" );hid_hw_close (hdev);hid_hw_stop (hdev); +spin_lock_irqsave (&data->lock, flags); -for (i =0 ; i < data->hid_sensor_client_cnt; ++i) { -struct hid_sensor_hub_device *hsdev = - data->hid_sensor_hub_client_devs[i].platform_data; -if (hsdev->pending.status) -complete (&hsdev->pending.ready); - } +device_for_each_child (&hdev->dev,NULL , + sensor_hub_finalize_pending_fn);spin_unlock_irqrestore (&data->lock, flags); +mfd_remove_devices (&hdev->dev);mutex_destroy (&data->mutex); }
Greg Kroah-Hartman
maintainerPATCH 134/328 wifi: brcmfmac: fix NULL pointer dereference in brcmf_txfinalize()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcel Hamer <[email protected]>
commit 68abd0c4ebf24cd499841a488b97a6873d5efabb upstream.
On removal of the device or unloading of the kernel module a potential NULL pointer dereference occurs.
The following sequence deletes the interface:
brcmf_detach()
brcmf_remove_interface()
brcmf_del_if()Inside the brcmf_del_if() function the drvr->if2bss[ifidx] is updated to BRCMF_BSSIDX_INVALID (-1) if the bsscfgidx matches.
After brcmf_remove_interface() call the brcmf_proto_detach() function is called providing the following sequence:
brcmf_detach()
brcmf_proto_detach()
brcmf_proto_msgbuf_detach()
brcmf_flowring_detach()
brcmf_msgbuf_delete_flowring()
brcmf_msgbuf_remove_flowring()
brcmf_flowring_delete()
brcmf_get_ifp()
brcmf_txfinalize()Since brcmf_get_ip() can and actually will return NULL in this case the call to brcmf_txfinalize() will result in a NULL pointer dereference inside brcmf_txfinalize() when trying to update ifp->ndev->stats.tx_errors.
This will only happen if a flowring still has an skb.
Although the NULL pointer dereference has only been seen when trying to update the tx statistic, all other uses of the ifp pointer have been guarded as well with an early return if ifp is NULL.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +5 -0
@@ -538,6 +538,11 @@ void brcmf_txfinalize(struct brcmf_if *istruct ethhdr *eh;u16 type; +if (!ifp) { +brcmu_pkt_buf_free_skb (txp); +return ; + } + eh = (struct ethhdr *)(txp->data); type =ntohs (eh->h_proto);
Greg Kroah-Hartman
maintainerPATCH 135/328 usb: gadget: f_tcm: Translate error to sense
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit 98fa00fd3ae43b857b4976984a135483d89d9281 upstream.
When respond with check_condition error status, clear from_transport input so the target layer can translate the sense reason reported by f_tcm.
--- drivers/usb/gadget/function/f_tcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/f_tcm.c +2 -2
@@ -1063,7 +1063,7 @@ static void usbg_cmd_work(struct work_st out:transport_send_check_condition_and_sense (se_cmd, -TCM_UNSUPPORTED_SCSI_OPCODE ,1 ); +TCM_UNSUPPORTED_SCSI_OPCODE ,0 ); } static struct usbg_cmd *usbg_get_cmd(struct f_uas *fu,
@@ -1192,7 +1192,7 @@ static void bot_cmd_work(struct work_str out:transport_send_check_condition_and_sense (se_cmd, -TCM_UNSUPPORTED_SCSI_OPCODE ,1 ); +TCM_UNSUPPORTED_SCSI_OPCODE ,0 ); } static int bot_submit_command(struct f_uas *fu,
Greg Kroah-Hartman
maintainerPATCH 136/328 usb: gadget: f_tcm: Decrement command ref count on cleanup
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit 3b2a52e88ab0c9469eaadd4d4c8f57d072477820 upstream.
We submitted the command with TARGET_SCF_ACK_KREF, which requires acknowledgment of command completion. If the command fails, make sure to decrement the ref count.
--- drivers/usb/gadget/function/f_tcm.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/gadget/function/f_tcm.c +1 -0
@@ -971,6 +971,7 @@ static void usbg_data_write_cmpl(structreturn ; cleanup: +target_put_sess_cmd (se_cmd);transport_generic_free_cmd (&cmd->se_cmd,0 ); }
Greg Kroah-Hartman
maintainerPATCH 137/328 usb: gadget: f_tcm: ep_autoconfig with fullspeed endpoint
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit 25224c1f07d31c261d04dfbc705a7a0f314a825d upstream.
Match usb endpoint using fullspeed endpoint descriptor to make sure the wMaxPacketSize for fullspeed descriptors is automatically configured.
--- drivers/usb/gadget/function/f_tcm.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-)
drivers/usb/gadget/function/f_tcm.c +13 -17
@@ -2016,43 +2016,39 @@ static int tcm_bind(struct usb_configura bot_intf_desc.bInterfaceNumber = iface; uasp_intf_desc.bInterfaceNumber = iface; fu->iface = iface; - ep =usb_ep_autoconfig_ss (gadget, &uasp_ss_bi_desc, - &uasp_bi_ep_comp_desc); + ep =usb_ep_autoconfig (gadget, &uasp_fs_bi_desc);if (!ep) goto ep_fail; fu->ep_in = ep; - ep =usb_ep_autoconfig_ss (gadget, &uasp_ss_bo_desc, - &uasp_bo_ep_comp_desc); + ep =usb_ep_autoconfig (gadget, &uasp_fs_bo_desc);if (!ep) goto ep_fail; fu->ep_out = ep; - ep =usb_ep_autoconfig_ss (gadget, &uasp_ss_status_desc, - &uasp_status_in_ep_comp_desc); + ep =usb_ep_autoconfig (gadget, &uasp_fs_status_desc);if (!ep) goto ep_fail; fu->ep_status = ep; - ep =usb_ep_autoconfig_ss (gadget, &uasp_ss_cmd_desc, - &uasp_cmd_comp_desc); + ep =usb_ep_autoconfig (gadget, &uasp_fs_cmd_desc);if (!ep) goto ep_fail; fu->ep_cmd = ep;/* Assume endpoint addresses are the same for both speeds */ - uasp_bi_desc.bEndpointAddress = uasp_ss_bi_desc.bEndpointAddress; - uasp_bo_desc.bEndpointAddress = uasp_ss_bo_desc.bEndpointAddress; + uasp_bi_desc.bEndpointAddress = uasp_fs_bi_desc.bEndpointAddress; + uasp_bo_desc.bEndpointAddress = uasp_fs_bo_desc.bEndpointAddress; uasp_status_desc.bEndpointAddress = - uasp_ss_status_desc.bEndpointAddress; - uasp_cmd_desc.bEndpointAddress = uasp_ss_cmd_desc.bEndpointAddress; + uasp_fs_status_desc.bEndpointAddress; + uasp_cmd_desc.bEndpointAddress = uasp_fs_cmd_desc.bEndpointAddress; - uasp_fs_bi_desc.bEndpointAddress = uasp_ss_bi_desc.bEndpointAddress; - uasp_fs_bo_desc.bEndpointAddress = uasp_ss_bo_desc.bEndpointAddress; - uasp_fs_status_desc.bEndpointAddress = - uasp_ss_status_desc.bEndpointAddress; - uasp_fs_cmd_desc.bEndpointAddress = uasp_ss_cmd_desc.bEndpointAddress; + uasp_ss_bi_desc.bEndpointAddress = uasp_fs_bi_desc.bEndpointAddress; + uasp_ss_bo_desc.bEndpointAddress = uasp_fs_bo_desc.bEndpointAddress; + uasp_ss_status_desc.bEndpointAddress = + uasp_fs_status_desc.bEndpointAddress; + uasp_ss_cmd_desc.bEndpointAddress = uasp_fs_cmd_desc.bEndpointAddress; ret = usb_assign_descriptors(f, uasp_fs_function_desc, uasp_hs_function_desc, uasp_ss_function_desc,
Greg Kroah-Hartman
maintainerPATCH 138/328 usb: gadget: f_tcm: Dont prepare BOT write request twice
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit 94d9bf671ae314cacc2d7bf96bd233b4abc7cede upstream.
The duplicate kmalloc here is causing memory leak. The request preparation in bot_send_write_request is also done in usbg_prepare_w_request. Remove the duplicate work.
--- drivers/usb/gadget/function/f_tcm.c | 17 ----------------- 1 file changed, 17 deletions(-)
drivers/usb/gadget/function/f_tcm.c +0 -17
@@ -245,7 +245,6 @@ static int bot_send_write_request(struct {struct f_uas *fu = cmd->fu;struct se_cmd *se_cmd = &cmd->se_cmd; -struct usb_gadget *gadget =fuas_to_gadget (fu);int ret;init_completion (&cmd->write_complete);
@@ -256,22 +255,6 @@ static int bot_send_write_request(structreturn -EINVAL ; } -if (!gadget->sg_supported) { - cmd->data_buf =kmalloc (se_cmd->data_length,GFP_KERNEL ); -if (!cmd->data_buf) -return -ENOMEM ; - - fu->bot_req_out->buf = cmd->data_buf; - }else { - fu->bot_req_out->buf =NULL ; - fu->bot_req_out->num_sgs = se_cmd->t_data_nents; - fu->bot_req_out->sg = se_cmd->t_data_sg; - } - - fu->bot_req_out->complete = usbg_data_write_cmpl; - fu->bot_req_out->length = se_cmd->data_length; - fu->bot_req_out->context = cmd; - ret =usbg_prepare_w_request (cmd, fu->bot_req_out);if (ret) goto cleanup;
Greg Kroah-Hartman
maintainerPATCH 139/328 soc: qcom: socinfo: Avoid out of bounds read of serial number
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Gerhold <[email protected]>
commit 22cf4fae6660b6e1a583a41cbf84e3046ca9ccd0 upstream.
On MSM8916 devices, the serial number exposed in sysfs is constant and does not change across individual devices. It's always:
db410c:/sys/devices/soc0$ cat serial_number 2644893864
The firmware used on MSM8916 exposes SOCINFO_VERSION(0, 8), which does not have support for the serial_num field in the socinfo struct. There is an existing check to avoid exposing the serial number in that case, but it's not correct: When checking the item_size returned by SMEM, we need to make sure the *end* of the serial_num is within bounds, instead of comparing with the *start* offset. The serial_number currently exposed on MSM8916 devices is just an out of bounds read of whatever comes after the socinfo struct in SMEM.
Fix this by changing offsetof() to offsetofend(), so that the size of the field is also taken into account.
--- drivers/soc/qcom/socinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/socinfo.c +1 -1
@@ -436,7 +436,7 @@ static int qcom_socinfo_probe(struct plaif (!qs->attr.soc_id || !qs->attr.revision)return -ENOMEM ; -if (offsetof(struct socinfo , serial_num) <= item_size) { + if (offsetofend(struct socinfo, serial_num) <= item_size) { qs->attr.serial_number =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"%u" ,le32_to_cpu (info->serial_num));
Greg Kroah-Hartman
maintainerPATCH 140/328 serial: sh-sci: Drop __initdata macro for port_cfg
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
commit eaeee4225dba30bef4d424bdf134a07b7f423e8b upstream.
The port_cfg object is used by serial_console_write(), which serves as the write function for the earlycon device. Marking port_cfg as __initdata causes it to be freed after kernel initialization, resulting in earlycon becoming unavailable thereafter. Remove the __initdata macro from port_cfg to resolve this issue.
--- drivers/tty/serial/sh-sci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sh-sci.c +1 -1
@@ -3455,7 +3455,7 @@ early_platform_init_buffer("earlyprintk" early_serial_buf, ARRAY_SIZE(early_serial_buf));#endif #ifdef CONFIG_SERIAL_SH_SCI_EARLYCON -static struct plat_sci_port port_cfg__initdata ; +static struct plat_sci_port port_cfg;static int __init early_console_setup (struct earlycon_device *device,int type)
Greg Kroah-Hartman
maintainerPATCH 141/328 serial: sh-sci: Do not probe the serial port if its slot in sci_ports[] is in use
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
commit 9f7dea875cc7f9c1a56a5c688290634a59cd1420 upstream.
In the sh-sci driver, sci_ports[0] is used by earlycon. If the earlycon is still active when sci_probe() is called and the new serial port is supposed to map to sci_ports[0], return -EBUSY to prevent breaking the earlycon.
This situation should occurs in debug scenarios, and users should be aware of the potential conflict.
--- drivers/tty/serial/sh-sci.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/tty/serial/sh-sci.c +23 -0
@@ -166,6 +166,7 @@ struct sci_port {static struct sci_port sci_ports[SCI_NPORTS ];static unsigned long sci_ports_in_use;static struct uart_driver sci_uart_driver; +static bool sci_uart_earlycon;static inline struct sci_port *to_sci_port (struct uart_port *uart)
@@ -3345,6 +3346,7 @@ static int sci_probe_single(struct platfstatic int sci_probe (struct platform_device *dev) {struct plat_sci_port *p; +struct resource *res;struct sci_port *sp;unsigned int dev_id;int ret;
@@ -3372,6 +3374,26 @@ static int sci_probe(struct platform_dev } sp = &sci_ports[dev_id]; + +/* +* In case: +* - the probed port alias is zero (as the one used by earlycon), and +* - the earlycon is still active (e.g., "earlycon keep_bootcon" in +* bootargs) +* +* defer the probe of this serial. This is a debug scenario and the user +* must be aware of it. +* +* Except when the probed port is the same as the earlycon port. +*/ + + res =platform_get_resource (dev,IORESOURCE_MEM ,0 ); +if (!res) +return -ENODEV ; + +if (sci_uart_earlycon && sp == &sci_ports[0 ] && sp->port.mapbase != res->start) +return dev_err_probe (&dev->dev, -EBUSY ,"sci_port[0] is used by earlycon!\n" ); +platform_set_drvdata (dev, sp); ret =sci_probe_single (dev, dev_id, p, sp);
@@ -3470,6 +3492,7 @@ static int __init early_console_setup(st port_cfg.type = type; sci_ports[0 ].cfg = &port_cfg; sci_ports[0 ].params =sci_probe_regmap (&port_cfg); + sci_uart_earlycon = true; port_cfg.scscr =sci_serial_in (&sci_ports[0 ].port,SCSCR );sci_serial_out (&sci_ports[0 ].port,SCSCR ,SCSCR_RE |SCSCR_TE | port_cfg.scscr);
Greg Kroah-Hartman
maintainerPATCH 142/328 powerpc/pseries/eeh: Fix get PE state translation
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Narayana Murty N <[email protected]>
commit 11b93559000c686ad7e5ab0547e76f21cc143844 upstream.
The PE Reset State "0" returned by RTAS calls "ibm_read_slot_reset_[state|state2]" indicates that the reset is deactivated and the PE is in a state where MMIO and DMA are allowed. However, the current implementation of "pseries_eeh_get_state()" does not reflect this, causing drivers to incorrectly assume that MMIO and DMA operations cannot be resumed.
The userspace drivers as a part of EEH recovery using VFIO ioctls fail to detect when the recovery process is complete. The VFIO_EEH_PE_GET_STATE ioctl does not report the expected EEH_PE_STATE_NORMAL state, preventing userspace drivers from functioning properly on pseries systems.
The patch addresses this issue by updating 'pseries_eeh_get_state()' to include "EEH_STATE_MMIO_ENABLED" and "EEH_STATE_DMA_ENABLED" in the result mask for PE Reset State "0". This ensures correct state reporting to the callers, aligning the behavior with the PAPR specification and fixing the bug in EEH recovery for VFIO user workflows.
--- arch/powerpc/platforms/pseries/eeh_pseries.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/powerpc/platforms/pseries/eeh_pseries.c +4 -2
@@ -472,8 +472,10 @@ static int pseries_eeh_get_state(structswitch (rets[0 ]) {case 0 : - result =EEH_STATE_MMIO_ACTIVE | -EEH_STATE_DMA_ACTIVE ; + result =EEH_STATE_MMIO_ACTIVE | +EEH_STATE_DMA_ACTIVE | +EEH_STATE_MMIO_ENABLED | +EEH_STATE_DMA_ENABLED ;break ;case 1 : result = EEH_STATE_RESET_ACTIVE |
Greg Kroah-Hartman
maintainerPATCH 143/328 kbuild: Move -Wenum-enum-conversion to W=2
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit 8f6629c004b193d23612641c3607e785819e97ab upstream.
-Wenum-enum-conversion was strengthened in clang-19 to warn for C, which caused the kernel to move it to W=1 in commit 75b5ab134bb5 ("kbuild:
Move -Wenum-{compare-conditional,enum-conversion} into W=1") because there were numerous instances that would break builds with -Werror. Unfortunately, this is not a full solution, as more and more developers, subsystems, and distributors are building with W=1 as well, so they continue to see the numerous instances of this warning.
Since the move to W=1, there have not been many new instances that have appeared through various build reports and the ones that have appeared seem to be following similar existing patterns, suggesting that most instances of this warning will not be real issues. The only alternatives for silencing this warning are adding casts (which is generally seen as an ugly practice) or refactoring the enums to macro defines or a unified enum (which may be undesirable because of type safety in other parts of the code).
Move the warning to W=2, where warnings that occur frequently but may be relevant should reside.
--- scripts/Makefile.extrawarn | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
scripts/Makefile.extrawarn +4 -1
@@ -36,6 +36,10 @@ KBUILD_CFLAGS += $(call cc-option, -Wstr KBUILD_CFLAGS += -Wno-missing-field-initializers KBUILD_CFLAGS += -Wno-sign-compare +ifdef CONFIG_CC_IS_CLANG +KBUILD_CFLAGS += -Wno-enum-enum-conversion +endif + KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN1 else
@@ -52,7 +56,6 @@ KBUILD_CFLAGS += $(call cc-disable-warni KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access) KBUILD_CFLAGS += $(call cc-disable-warning, cast-function-type-strict) KBUILD_CFLAGS += -Wno-enum-compare-conditional -KBUILD_CFLAGS += -Wno-enum-enum-conversion endif endif
Greg Kroah-Hartman
maintainerPATCH 144/328 soc: qcom: smem_state: fix missing of_node_put in error path
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 70096b4990848229d0784c5e51dc3c7c072f1111 upstream.
If of_parse_phandle_with_args() succeeds, the OF node reference should be dropped, regardless of number of phandle arguments.
--- drivers/soc/qcom/smem_state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/soc/qcom/smem_state.c +2 -1
@@ -116,7 +116,8 @@ struct qcom_smem_state *qcom_smem_state_if (args.args_count !=1 ) {dev_err (dev,"invalid #qcom,smem-state-cells\n" ); -return ERR_PTR (-EINVAL ); + state =ERR_PTR (-EINVAL ); + goto put; } state =of_node_to_state (args.np);
Greg Kroah-Hartman
maintainerPATCH 145/328 media: ov5640: fix get_light_freq on auto
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sam Bobrowicz <[email protected]>
commit 001d3753538d26ddcbef011f5643cfff58a7f672 upstream.
Light frequency was not properly returned when in auto mode and the detected frequency was 60Hz.
--- drivers/media/i2c/ov5640.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/i2c/ov5640.c +1 -0
@@ -1368,6 +1368,7 @@ static int ov5640_get_light_freq(struct light_freq =50 ; }else {/* 60Hz */ + light_freq =60 ; } }
Greg Kroah-Hartman
maintainerPATCH 146/328 media: uvcvideo: Fix event flags in uvc_ctrl_send_events
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit c31cffd5ae2c3d7ef21d9008977a9d117ce7a64e upstream.
If there is an event that needs the V4L2_EVENT_CTRL_CH_FLAGS flag, all the following events will have that flag, regardless if they need it or not.
This is because we keep using the same variable all the time and we do not reset its original value.
--- drivers/media/usb/uvc/uvc_ctrl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/usb/uvc/uvc_ctrl.c +2 -2
@@ -1400,13 +1400,13 @@ static void uvc_ctrl_send_events(struct {struct uvc_control_mapping *mapping;struct uvc_control *ctrl; -u32 changes =V4L2_EVENT_CTRL_CH_VALUE ;unsigned int i;unsigned int j;for (i =0 ; i < xctrls_count; ++i) { - ctrl =uvc_find_control (handle->chain, xctrls[i].id, &mapping); +u32 changes =V4L2_EVENT_CTRL_CH_VALUE ; + ctrl =uvc_find_control (handle->chain, xctrls[i].id, &mapping);if (ctrl->info.flags &UVC_CTRL_FLAG_ASYNCHRONOUS )/* Notification will be sent from an Interrupt event. */ continue ;
Greg Kroah-Hartman
maintainerPATCH 147/328 media: uvcvideo: Remove redundant NULL assignment
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit 04d3398f66d2d31c4b8caea88f051a4257b7a161 upstream.
ctrl->handle will only be different than NULL for controls that have mappings. This is because that assignment is only done inside uvc_ctrl_set() for mapped controls.
--- drivers/media/usb/uvc/uvc_ctrl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/media/usb/uvc/uvc_ctrl.c +1 -3
@@ -1367,10 +1367,8 @@ bool uvc_ctrl_status_event_async(structstruct uvc_device *dev = chain->dev;struct uvc_ctrl_work *w = &dev->async_ctrl; -if (list_empty (&ctrl->info.mappings)) { - ctrl->handle =NULL ; +if (list_empty (&ctrl->info.mappings))return false; - } w->data = data; w->urb = urb;
Greg Kroah-Hartman
maintainerPATCH 148/328 crypto: qce - fix goto jump in error path
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <[email protected]>
commit 5278275c1758a38199b43530adfc50098f4b41c7 upstream.
If qce_check_version() fails, we should jump to err_dma as we already called qce_dma_request() a couple lines before.
--- drivers/crypto/qce/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/qce/core.c +1 -1
@@ -214,7 +214,7 @@ static int qce_crypto_probe(struct platf ret =qce_check_version (qce);if (ret) - goto err_clks; + goto err_dma;spin_lock_init (&qce->lock); tasklet_init(&qce->done_tasklet, qce_tasklet_req_done,
Greg Kroah-Hartman
maintainerPATCH 149/328 crypto: qce - unregister previously registered algos in error path
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <[email protected]>
commit e80cf84b608725303113d6fe98bb727bf7b7a40d upstream.
If we encounter an error when registering alorithms with the crypto framework, we just bail out and don't unregister the ones we successfully registered in prior iterations of the loop.
Add code that goes back over the algos and unregisters them before returning an error from qce_register_algs().
--- drivers/crypto/qce/core.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/crypto/qce/core.c +7 -4
@@ -40,16 +40,19 @@ static void qce_unregister_algs(struct qstatic int qce_register_algs (struct qce_device *qce) {const struct qce_algo_ops *ops; -int i, ret = -ENODEV ; +int i, j, ret = -ENODEV ;for (i =0 ; i <ARRAY_SIZE (qce_ops); i++) { ops = qce_ops[i]; ret = ops->register_algs (qce); -if (ret) -break ; +if (ret) { +for (j = i -1 ; j >=0 ; j--) + ops->unregister_algs (qce); +return ret; + } } -return ret; +return 0 ; }static int qce_handle_request (struct crypto_async_request *async_req)
Greg Kroah-Hartman
maintainerPATCH 150/328 nvmem: core: improve range check for nvmem_cell_write()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jennifer Berringer <[email protected]>
commit 31507fc2ad36e0071751a710449db19c85d82a7f upstream.
When __nvmem_cell_entry_write() is called for an nvmem cell that does not need bit shifting, it requires that the len parameter exactly matches the nvmem cell size. However, when the nvmem cell has a nonzero bit_offset, it was skipping this check.
Accepting values of len larger than the cell size results in nvmem_cell_prepare_write_buffer() trying to write past the end of a heap buffer that it allocates. Add a check to avoid that problem and instead return -EINVAL when len doesn't match the number of bits expected by the nvmem cell when bit_offset is nonzero.
This check uses cell->nbits in order to allow providing the smaller size to cells that are shifted into another byte by bit_offset. For example, a cell with nbits=8 and nonzero bit_offset would have bytes=2 but should accept a 1-byte write here, although no current callers depend on this.
--- drivers/nvmem/core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/nvmem/core.c +2 -0
@@ -1083,6 +1083,8 @@ int nvmem_cell_write(struct nvmem_cell *return -EINVAL ;if (cell->bit_offset || cell->nbits) { +if (len !=BITS_TO_BYTES (cell->nbits) && len != cell->bytes) +return -EINVAL ; buf =nvmem_cell_prepare_write_buffer (cell, buf, len);if (IS_ERR (buf))return PTR_ERR (buf);
Greg Kroah-Hartman
maintainerPATCH 151/328 vfio/platform: check the bounds of read/write syscalls
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Williamson <[email protected]>
commit ce9ff21ea89d191e477a02ad7eabf4f996b80a69 upstream.
count and offset are passed from user space and not checked, only offset is capped to 40 bits, which can be used to read/write out of bounds of the device.
--- drivers/vfio/platform/vfio_platform_common.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/vfio/platform/vfio_platform_common.c +10 -0
@@ -410,6 +410,11 @@ static ssize_t vfio_platform_read_mmio(s count =min_t (size_t, count, reg->size - off); +if (off >= reg->size) +return -EINVAL ; + + count =min_t (size_t, count, reg->size - off); +if (!reg->ioaddr) { reg->ioaddr =ioremap_nocache (reg->addr, reg->size);
@@ -489,6 +494,11 @@ static ssize_t vfio_platform_write_mmio(if (off >= reg->size)return -EINVAL ; + + count =min_t (size_t, count, reg->size - off); + +if (off >= reg->size) +return -EINVAL ; count =min_t (size_t, count, reg->size - off);