6.1.80-rc1 review
Subsystems (11)
Greg Kroah-Hartman
maintainerPATCH 1/195 net/sched: Retire CBQ qdisc
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
commit 051d442098421c28c7951625652f61b1e15c4bd5 upstream.
While this amazing qdisc has served us well over the years it has not been getting any tender love and care and has bitrotted over time. It has become mostly a shooting target for syzkaller lately. For this reason, we are retiring it. Goodbye CBQ - we loved you.
--- net/sched/Kconfig | 17 net/sched/Makefile | 1 net/sched/sch_cbq.c | 1727 ------------ tools/testing/selftests/tc-testing/tc-tests/qdiscs/cbq.json | 184 - 4 files changed, 1929 deletions(-) delete mode 100644 net/sched/sch_cbq.c delete mode 100644 tools/testing/selftests/tc-testing/tc-tests/qdiscs/cbq.json
net/sched/Kconfig +0 -17
@@ -45,23 +45,6 @@ if NET_SCHED comment "Queueing/Scheduling" -config NET_SCH_CBQ - tristate "Class Based Queueing (CBQ)" - help - Say Y here if you want to use the Class-Based Queueing (CBQ) packet - scheduling algorithm. This algorithm classifies the waiting packets - into a tree-like hierarchy of classes; the leaves of this tree are - in turn scheduled by separate algorithms. - - See the top of <file:net/sched/sch_cbq.c> for more details. - - CBQ is a commonly used scheduler, so if you're unsure, you should - say Y here. Then say Y to all the queueing algorithms below that you - want to use as leaf disciplines. - - To compile this code as a module, choose M here: the - module will be called sch_cbq. - config NET_SCH_HTB tristate "Hierarchical Token Bucket (HTB)" help
net/sched/Makefile +0 -1
@@ -33,7 +33,6 @@ obj-$(CONFIG_NET_ACT_TUNNEL_KEY)+= act_t obj-$(CONFIG_NET_ACT_CT) += act_ct.o obj-$(CONFIG_NET_ACT_GATE) += act_gate.o obj-$(CONFIG_NET_SCH_FIFO) += sch_fifo.o -obj-$(CONFIG_NET_SCH_CBQ) += sch_cbq.o obj-$(CONFIG_NET_SCH_HTB) += sch_htb.o obj-$(CONFIG_NET_SCH_HFSC) += sch_hfsc.o obj-$(CONFIG_NET_SCH_RED) += sch_red.o
net/sched/sch_cbq.c deleted +0 -1727
1,727 lines not on this page · raw message
tools/testing/selftests/tc-testing/tc-tests/qdiscs/cbq.json deleted +0 -184
184 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 2/195 net/sched: Retire ATM qdisc
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
commit fb38306ceb9e770adfb5ffa6e3c64047b55f7a07 upstream.
The ATM qdisc has served us well over the years but has not been getting much TLC due to lack of known users. Most recently it has become a shooting target for syzkaller. For this reason, we are retiring it.
--- net/sched/Kconfig | 14 net/sched/Makefile | 1 net/sched/sch_atm.c | 706 ------------ tools/testing/selftests/tc-testing/tc-tests/qdiscs/atm.json | 94 - 4 files changed, 815 deletions(-) delete mode 100644 net/sched/sch_atm.c delete mode 100644 tools/testing/selftests/tc-testing/tc-tests/qdiscs/atm.json
net/sched/Kconfig +0 -14
@@ -68,20 +68,6 @@ config NET_SCH_HFSC To compile this code as a module, choose M here: the module will be called sch_hfsc. -config NET_SCH_ATM - tristate "ATM Virtual Circuits (ATM)" - depends on ATM - help - Say Y here if you want to use the ATM pseudo-scheduler. This - provides a framework for invoking classifiers, which in turn - select classes of this queuing discipline. Each class maps - the flow(s) it is handling to a given virtual circuit. - - See the top of <file:net/sched/sch_atm.c> for more details. - - To compile this code as a module, choose M here: the - module will be called sch_atm. - config NET_SCH_PRIO tristate "Multi Band Priority Queueing (PRIO)" help
net/sched/Makefile +0 -1
@@ -45,7 +45,6 @@ obj-$(CONFIG_NET_SCH_TBF) += sch_tbf.o obj-$(CONFIG_NET_SCH_TEQL) += sch_teql.o obj-$(CONFIG_NET_SCH_PRIO) += sch_prio.o obj-$(CONFIG_NET_SCH_MULTIQ) += sch_multiq.o -obj-$(CONFIG_NET_SCH_ATM) += sch_atm.o obj-$(CONFIG_NET_SCH_NETEM) += sch_netem.o obj-$(CONFIG_NET_SCH_DRR) += sch_drr.o obj-$(CONFIG_NET_SCH_PLUG) += sch_plug.o
net/sched/sch_atm.c deleted +0 -706
706 lines not on this page · raw message
tools/testing/selftests/tc-testing/tc-tests/qdiscs/atm.json deleted +0 -94
94 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 3/195 net/sched: Retire dsmark qdisc
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
commit bbe77c14ee6185a61ba6d5e435c1cbb489d2a9ed upstream.
The dsmark qdisc has served us well over the years for diffserv but has not been getting much attention due to other more popular approaches to do diffserv services. Most recently it has become a shooting target for syzkaller. For this reason, we are retiring it.
--- net/sched/Kconfig | 11 net/sched/Makefile | 1 net/sched/sch_dsmark.c | 518 ---------- tools/testing/selftests/tc-testing/tc-tests/qdiscs/dsmark.json | 140 -- 4 files changed, 670 deletions(-) delete mode 100644 net/sched/sch_dsmark.c delete mode 100644 tools/testing/selftests/tc-testing/tc-tests/qdiscs/dsmark.json
net/sched/Kconfig +0 -11
@@ -186,17 +186,6 @@ config NET_SCH_GRED To compile this code as a module, choose M here: the module will be called sch_gred. -config NET_SCH_DSMARK - tristate "Differentiated Services marker (DSMARK)" - help - Say Y if you want to schedule packets according to the - Differentiated Services architecture proposed in RFC 2475. - Technical information on this method, with pointers to associated - RFCs, is available at <http://www.gta.ufrj.br/diffserv/>. - - To compile this code as a module, choose M here: the - module will be called sch_dsmark. - config NET_SCH_NETEM tristate "Network emulator (NETEM)" help
net/sched/Makefile +0 -1
@@ -38,7 +38,6 @@ obj-$(CONFIG_NET_SCH_HFSC) += sch_hfsc.o obj-$(CONFIG_NET_SCH_RED) += sch_red.o obj-$(CONFIG_NET_SCH_GRED) += sch_gred.o obj-$(CONFIG_NET_SCH_INGRESS) += sch_ingress.o -obj-$(CONFIG_NET_SCH_DSMARK) += sch_dsmark.o obj-$(CONFIG_NET_SCH_SFB) += sch_sfb.o obj-$(CONFIG_NET_SCH_SFQ) += sch_sfq.o obj-$(CONFIG_NET_SCH_TBF) += sch_tbf.o
net/sched/sch_dsmark.c deleted +0 -518
518 lines not on this page · raw message
tools/testing/selftests/tc-testing/tc-tests/qdiscs/dsmark.json deleted +0 -140
140 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 4/195 sched/rt: Disallow writing invalid values to sched_rt_period_us
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cyril Hrubis <[email protected]>
commit 079be8fc630943d9fc70a97807feb73d169ee3fc upstream.
The validation of the value written to sched_rt_period_us was broken because:
- the sysclt_sched_rt_period is declared as unsigned int
- parsed by proc_do_intvec()
- the range is asserted after the value parsed by proc_do_intvec()
Because of this negative values written to the file were written into a unsigned integer that were later on interpreted as large positive integers which did passed the check:
if (sysclt_sched_rt_period <= 0)
return EINVAL;
This commit fixes the parsing by setting explicit range for both perid_us and runtime_us into the sched_rt_sysctls table and processes the values with proc_dointvec_minmax() instead.
Alternatively if we wanted to use full range of unsigned int for the period value we would have to split the proc_handler and use proc_douintvec() for it however even the Documentation/scheduller/sched-rt-group.rst describes the range as 1 to INT_MAX.
As far as I can tell the only problem this causes is that the sysctl file allows writing negative values which when read back may confuse userspace.
There is also a LTP test being submitted for these sysctl files at:
http://patchwork.ozlabs.org/project/ltp/patch/[email protected]/
--- kernel/sched/rt.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
kernel/sched/rt.c +5 -4
@@ -37,6 +37,8 @@ static struct ctl_table sched_rt_sysctls .maxlen = sizeof(unsigned int), .mode = 0644, .proc_handler = sched_rt_handler, + .extra1 = SYSCTL_ONE, + .extra2 = SYSCTL_INT_MAX, }, { .procname = "sched_rt_runtime_us",
@@ -44,6 +46,8 @@ static struct ctl_table sched_rt_sysctls .maxlen = sizeof(int), .mode = 0644, .proc_handler = sched_rt_handler, + .extra1 = SYSCTL_NEG_ONE, + .extra2 = SYSCTL_INT_MAX, }, { .procname = "sched_rr_timeslice_ms",
@@ -2970,9 +2974,6 @@ static int sched_rt_global_constraints(v#ifdef CONFIG_SYSCTL static int sched_rt_global_validate (void ) { -if (sysctl_sched_rt_period <=0 ) -return -EINVAL ; - if ((sysctl_sched_rt_runtime != RUNTIME_INF) && ((sysctl_sched_rt_runtime > sysctl_sched_rt_period) || ((u64)sysctl_sched_rt_runtime *
@@ -3003,7 +3004,7 @@ static int sched_rt_handler(struct ctl_t old_period = sysctl_sched_rt_period; old_runtime = sysctl_sched_rt_runtime; - ret =proc_dointvec (table, write, buffer, lenp, ppos); + ret =proc_dointvec_minmax (table, write, buffer, lenp, ppos);if (!ret && write) { ret =sched_rt_global_validate ();
Greg Kroah-Hartman
maintainercover 6.1.80-rc1 review
This is the start of the stable review cycle for the 6.1.80 release. There are 195 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, 29 Feb 2024 13:15:36 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.80-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.1.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 6.1.80-rc1
Edward Lo <[email protected]>
fs/ntfs3: Enhance the attribute size check
Kuniyuki Iwashima <[email protected]>
arp: Prevent overflow in arp_req_get().
Lennert Buytenhek <[email protected]>
ahci: Extend ASM1061 43-bit DMA address quirk to other ASM106x parts
Szuying Chen <[email protected]>
ata: ahci: add identifiers for ASM2116 series adapters
Geliang Tang <[email protected]>
mptcp: add needs_id for netlink appending addr
Geliang Tang <[email protected]>
mptcp: userspace pm send RM_ADDR for ID 0
Yosry Ahmed <[email protected]>
mm: zswap: fix missing folio cleanup in writeback race path
Bart Van Assche <[email protected]>
fs/aio: Restrict kiocb_set_cancel_fn() to I/O submitted via libaio
SeongJae Park <[email protected]>
mm/damon/reclaim: fix quota stauts loss due to online tunings
Gao Xiang <[email protected]>
erofs: fix inconsistent per-file compression format
Gao Xiang <[email protected]>
erofs: simplify compression configuration parser
Corey Minyard <[email protected]>
i2c: imx: when being a target, mark the last read as processed
Armin Wolf <[email protected]>
drm/amd/display: Fix memory leak in dm_sw_fini()
Erik Kurzinger <[email protected]>
drm/syncobj: call drm_syncobj_fence_add_wait when WAIT_AVAILABLE flag is set
Siddharth Vadapalli <[email protected]>
net: phy: realtek: Fix rtl8211f_config_init() for RTL8211F(D)(I)-VD-CG PHY
Justin Iurman <[email protected]>
Fix write to cloned skb in ipv6_hop_ioam()
Rémi Denis-Courmont <[email protected]>
phonet/pep: fix racy skb_queue_empty() use
Rémi Denis-Courmont <[email protected]>
phonet: take correct lock to peek at the RX queue
Horatiu Vultur <[email protected]>
net: sparx5: Add spinlock for frame transmission from CPU
Jeremy Kerr <[email protected]>
net: mctp: put sock on tag allocation failure
Florian Westphal <[email protected]>
netfilter: nf_tables: use kzalloc for hook allocation
Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: register hooks last when adding new chain/flowtable
Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: rename function to destroy hook list
Pablo Neira Ayuso <[email protected]>
netfilter: nft_flow_offload: release dst in case direct xmit path is used
Pablo Neira Ayuso <[email protected]>
netfilter: nft_flow_offload: reset dst in route object after setting up flow
Pablo Neira Ayuso <[email protected]>
netfilter: flowtable: simplify route logic
Florian Westphal <[email protected]>
netfilter: nf_tables: set dormant flag on hook register failure
Sabrina Dubroca <[email protected]>
tls: don't skip over different type records from the rx_list
Sabrina Dubroca <[email protected]>
tls: stop recv() if initial process_rx_list gave us non-DATA
Sabrina Dubroca <[email protected]>
tls: break out of main loop when PEEK gets a non-data record
Shigeru Yoshida <[email protected]>
bpf, sockmap: Fix NULL pointer dereference in sk_psock_verdict_data_ready()
Jason Gunthorpe <[email protected]>
s390: use the correct count for __iowrite64_copy()
Subbaraya Sundeep <[email protected]>
octeontx2-af: Consider the action set by PF
Mario Limonciello <[email protected]>
platform/x86: thinkpad_acpi: Only update profile if successfully converted
Mark Brown <[email protected]>
arm64/sme: Restore SME registers on exit from suspend
Kees Cook <[email protected]>
net: dev: Convert sa_data to flexible array in struct sockaddr
Vasiliy Kovalev <[email protected]>
ipv6: sr: fix possible use-after-free and null-ptr-deref
Daniil Dulov <[email protected]>
afs: Increase buffer size in afs_update_volume_status()
Martin KaFai Lau <[email protected]>
bpf: Fix racing between bpf_timer_cancel_and_free and bpf_timer_cancel
Radhey Shyam Pandey <[email protected]>
ata: ahci_ceva: fix error handling for Xilinx GT PHY support
Eric Dumazet <[email protected]>
ipv6: properly combine dev_base_seq and ipv6.dev_addr_genid
Eric Dumazet <[email protected]>
ipv4: properly combine dev_base_seq and ipv4.dev_addr_genid
Pavel Sakharov <[email protected]>
net: stmmac: Fix incorrect dereference in interrupt handlers
Alison Schofield <[email protected]>
x86/numa: Fix the sort compare func used in numa_fill_memblks()
Alison Schofield <[email protected]>
x86/numa: Fix the address overlap check in numa_fill_memblks()
Arnd Bergmann <[email protected]>
nouveau: fix function cast warnings
Randy Dunlap <[email protected]>
net: ethernet: adi: requires PHYLIB support
Kuniyuki Iwashima <[email protected]>
dccp/tcp: Unhash sk from ehash for tb2 alloc failure after check_estalblished().
Tobias Waldekranz <[email protected]>
net: bridge: switchdev: Ensure deferred event delivery on unoffload
Tobias Waldekranz <[email protected]>
net: bridge: switchdev: Skip MDB replays of deferred events on offload
Randy Dunlap <[email protected]>
scsi: jazz_esp: Only build if SCSI core is builtin
Don Brace <[email protected]>
scsi: smartpqi: Fix disable_managed_interrupts
Gianmarco Lusvardi <[email protected]>
bpf, scripts: Correct GPL license name
Arnd Bergmann <[email protected]>
RDMA/srpt: fix function pointer cast warnings
Heiko Stuebner <[email protected]>
arm64: dts: rockchip: set num-cs property for spi on px30
Kamal Heib <[email protected]>
RDMA/qedr: Fix qedr_create_user_qp error flow
Joao Martins <[email protected]>
iommufd/iova_bitmap: Consider page offset for the pages to be pinned
Joao Martins <[email protected]>
iommufd/iova_bitmap: Switch iova_bitmap::bitmap to an u8 array
Joao Martins <[email protected]>
iommufd/iova_bitmap: Bounds check mapped::pages access
Bart Van Assche <[email protected]>
RDMA/srpt: Support specifying the srpt_service_guid parameter
Mustafa Ismail <[email protected]>
RDMA/irdma: Add AE for too many RNRS
Mustafa Ismail <[email protected]>
RDMA/irdma: Set the CQ read threshold for GEN 1
Shiraz Saleem <[email protected]>
RDMA/irdma: Validate max_send_wr and max_recv_wr
Mike Marciniszyn <[email protected]>
RDMA/irdma: Fix KASAN issue with tasklet
Kalesh AP <[email protected]>
RDMA/bnxt_re: Return error for SRQ resize
Zhipeng Lu <[email protected]>
IB/hfi1: Fix a memleak in init_credit_return
Sohaib Nadeem <[email protected]>
Revert "drm/amd/display: increased min_dcfclk_mhz and min_fclk_mhz"
Paolo Abeni <[email protected]>
mptcp: fix lockless access in subflow ULP diag
Geliang Tang <[email protected]>
mptcp: add needs_id for userspace appending addr
Geliang Tang <[email protected]>
mptcp: make userspace_pm_append_new_local_addr static
Xu Yang <[email protected]>
usb: roles: don't get/set_role() when usb_role_switch is unregistered
Xu Yang <[email protected]>
usb: roles: fix NULL pointer issue when put module's reference
Krishna Kurapati <[email protected]>
usb: gadget: ncm: Avoid dropping datagrams of properly parsed NTBs
Frank Li <[email protected]>
usb: cdns3: fix memory double free when handle zero packet
Frank Li <[email protected]>
usb: cdns3: fixed memory use after free at cdns3_gadget_ep_disable()
Pawel Laszczak <[email protected]>
usb: cdnsp: fixed issue with incorrect detecting CDNSP family controllers
Pawel Laszczak <[email protected]>
usb: cdnsp: blocked some cdns3 specific code
Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Don't disconnect if not started
Lino Sanfilippo <[email protected]>
serial: amba-pl011: Fix DMA transmission in RS485 mode
Sandeep Dhavale <[email protected]>
erofs: fix refcount on the metabuf used for inode lookup
Arnd Bergmann <[email protected]>
dm-integrity, dm-verity: reduce stack usage for recheck
Peter Zijlstra <[email protected]>
x86/alternative: Make custom return thunk unconditional
Borislav Petkov (AMD) <[email protected]>
Revert "x86/alternative: Make custom return thunk unconditional"
Peter Zijlstra <[email protected]>
x86/returnthunk: Allow different return thunks
Nikita Shubin <[email protected]>
ARM: ep93xx: Add terminator to gpiod_lookup_table
Tom Parkin <[email protected]>
l2tp: pass correct message length to ip6_append_data
Vidya Sagar <[email protected]>
PCI/MSI: Prevent MSI hardware interrupt number truncation
Nam Cao <[email protected]>
irqchip/sifive-plic: Enable interrupt if needed before EOI
Oliver Upton <[email protected]>
irqchip/gic-v3-its: Do not assume vPE tables are preallocated
zhenwei pi <[email protected]>
crypto: virtio/akcipher - Fix stack overflow on memcpy
Vasiliy Kovalev <[email protected]>
gtp: fix use-after-free and null-ptr-deref in gtp_genl_dump_pdp()
Oliver Upton <[email protected]>
KVM: arm64: vgic-its: Test for valid IRQ in its_sync_lpi_pending_table()
Oliver Upton <[email protected]>
KVM: arm64: vgic-its: Test for valid IRQ in MOVALL handler
Yu Kuai <[email protected]>
md: Fix missing release of 'active_io' for flush
Baokun Li <[email protected]>
cachefiles: fix memory leak in cachefiles_add_cache()
Hans de Goede <[email protected]>
platform/x86: touchscreen_dmi: Allow partial (prefix) matches for ACPI names
Hans de Goede <[email protected]>
platform/x86: intel-vbtn: Stop calling "VBDL" from notify_handler
Johannes Weiner <[email protected]>
mm: memcontrol: clarify swapaccount=0 deprecation warning
SeongJae Park <[email protected]>
mm/damon/lru_sort: fix quota status loss due to online tunings
Kairui Song <[email protected]>
mm/swap: fix race when skipping swapcache
Martin K. Petersen <[email protected]>
scsi: core: Consult supported VPD page list prior to fetching page
Naohiro Aota <[email protected]>
scsi: target: pscsi: Fix bio_put() for error case
Robert Richter <[email protected]>
cxl/pci: Fix disabling memory if DVSEC CXL Range does not match a CFMWS window
Mikulas Patocka <[email protected]>
dm-verity: recheck the hash after a failure
Mikulas Patocka <[email protected]>
dm-crypt: don't modify the data when using authenticated encryption
Mikulas Patocka <[email protected]>
dm-integrity: recheck the integrity tag after a failure
Helge Deller <[email protected]>
Revert "parisc: Only list existing CPUs in cpu_possible_mask"
Mikulas Patocka <[email protected]>
dm-crypt: recheck the integrity tag after a failure
Damien Le Moal <[email protected]>
ata: libata-core: Do not try to set sleeping devices to standby
Peter Oberparleiter <[email protected]>
s390/cio: fix invalid -EBUSY on ccw_device_start
Thomas Hellström <[email protected]>
drm/ttm: Fix an invalid freeing on already freed page in error path
Huacai Chen <[email protected]>
LoongArch: Disable IRQ before init_fn() for nonboot CPUs
Daniel Vacek <[email protected]>
IB/hfi1: Fix sdma.h tx->num_descs off-by-one error
Geert Uytterhoeven <[email protected]>
pmdomain: renesas: r8a77980-sysc: CR7 must be always on
Eugen Hristev <[email protected]>
pmdomain: mediatek: fix race conditions with genpd
Steve French <[email protected]>
smb3: clarify mount warning
Yi Sun <[email protected]>
virtio-blk: Ensure no requests in virtqueues before deleting vqs.
Paulo Alcantara <[email protected]>
smb: client: set correct d_type for reparse points under DFS mounts
Prike Liang <[email protected]>
drm/amdgpu: reset gpu for s3 suspend abort case
Prike Liang <[email protected]>
drm/amdgpu: skip to program GFXDEC registers for suspend abort
Takashi Sakamoto <[email protected]>
firewire: core: send bus reset promptly on gap count error
Masahiro Yamada <[email protected]>
LoongArch: Select HAVE_ARCH_SECCOMP to use the common SECCOMP menu
Masahiro Yamada <[email protected]>
LoongArch: Select ARCH_ENABLE_THP_MIGRATION instead of redefining it
SEO HOYOUNG <[email protected]>
scsi: ufs: core: Remove the ufshcd_release() in ufshcd_err_handling_prepare()
Hannes Reinecke <[email protected]>
scsi: lpfc: Use unsigned type for num_sge
Zhang Rui <[email protected]>
hwmon: (coretemp) Enlarge per package core count limit
Andrew Bresticker <[email protected]>
efi: Don't add memblocks for soft-reserved memory
Andrew Bresticker <[email protected]>
efi: runtime: Fix potential overflow of soft-reserved region size
Johannes Berg <[email protected]>
wifi: mac80211: adding missing drv_mgd_complete_tx() call
Johannes Berg <[email protected]>
wifi: mac80211: set station RX-NSS on reconfig
Edward Adam Davis <[email protected]>
fs/ntfs3: Fix oob in ntfs_listxattr
Konstantin Komarov <[email protected]>
fs/ntfs3: Update inode->i_size after success write into compressed file
Konstantin Komarov <[email protected]>
fs/ntfs3: Correct function is_rst_area_valid
Konstantin Komarov <[email protected]>
fs/ntfs3: Prevent generic message "attempt to access beyond end of device"
Ism Hong <[email protected]>
fs/ntfs3: use non-movable memory for ntfs3 MFT buffer cache
Konstantin Komarov <[email protected]>
fs/ntfs3: Disable ATTR_LIST_ENTRY size check
Konstantin Komarov <[email protected]>
fs/ntfs3: Add NULL ptr dereference checking at the end of attr_allocate_frame()
Konstantin Komarov <[email protected]>
fs/ntfs3: Fix detected field-spanning write (size 8) of single field "le->name"
Konstantin Komarov <[email protected]>
fs/ntfs3: Print warning while fixing hard links count
Konstantin Komarov <[email protected]>
fs/ntfs3: Correct hard links updating when dealing with DOS names
Konstantin Komarov <[email protected]>
fs/ntfs3: Improve ntfs_dir_count
Konstantin Komarov <[email protected]>
fs/ntfs3: Modified fix directory element type detection
Szilard Fabian <[email protected]>
Input: i8042 - add Fujitsu Lifebook U728 to i8042 quirk table
Zhang Yi <[email protected]>
ext4: correct the hole length returned by ext4_map_blocks()
Paulo Alcantara <[email protected]>
smb: client: increase number of PDUs allowed in a compound request
Daniel Wagner <[email protected]>
nvmet-fc: take ref count on tgtport before delete assoc
Daniel Wagner <[email protected]>
nvmet-fc: avoid deadlock on delete association path
Daniel Wagner <[email protected]>
nvmet-fc: abort command when there is no binding
Daniel Wagner <[email protected]>
nvmet-fc: hold reference on hostport match
Daniel Wagner <[email protected]>
nvmet-fc: defer cleanup using RCU properly
Daniel Wagner <[email protected]>
nvmet-fc: release reference on target port
Daniel Wagner <[email protected]>
nvmet-fcloop: swap the list_add_tail arguments
Daniel Wagner <[email protected]>
nvme-fc: do not wait in vain when unloading module
Alexander Tsoy <[email protected]>
ALSA: usb-audio: Ignore clock selector errors for single connection
Richard Fitzgerald <[email protected]>
ASoC: wm_adsp: Don't overwrite fwf_name with the default
Sohaib Nadeem <[email protected]>
drm/amd/display: increased min_dcfclk_mhz and min_fclk_mhz
Xin Long <[email protected]>
netfilter: conntrack: check SCTP_CID_SHUTDOWN_ACK for vtag setting in sctp_new
Will Deacon <[email protected]>
misc: open-dice: Fix spurious lockdep warning
Brenton Simpson <[email protected]>
Input: xpad - add Lenovo Legion Go controllers
Wolfram Sang <[email protected]>
spi: sh-msiof: avoid integer overflow in constants
Chen-Yu Tsai <[email protected]>
ASoC: sunxi: sun4i-spdif: Add support for Allwinner H616
Alexander Tsoy <[email protected]>
ALSA: usb-audio: Check presence of valid altsetting control
Christian A. Ehrhardt <[email protected]>
usb: ucsi_acpi: Quirk to ack a connector change ack cmd
Guixin Liu <[email protected]>
nvmet-tcp: fix nvme tcp ida memory leak
Martin Blumenstingl <[email protected]>
regulator: pwm-regulator: Add validity checks in continuous .get_voltage
Kunwu Chan <[email protected]>
dmaengine: ti: edma: Add some null pointer checks to the edma_probe
Hans de Goede <[email protected]>
Input: goodix - accept ACPI resources with gpio_count == 3 && gpio_int_idx == 0
Baokun Li <[email protected]>
ext4: avoid allocating blocks from corrupted group in ext4_mb_find_by_goal()
Baokun Li <[email protected]>
ext4: avoid allocating blocks from corrupted group in ext4_mb_try_best_found()
Baokun Li <[email protected]>
ext4: avoid dividing by 0 in mb_update_avg_fragment_size() when block bitmap corrupt
Phoenix Chen <[email protected]>
platform/x86: touchscreen_dmi: Add info for the TECLAST X16 Plus tablet
Huang Pei <[email protected]>
MIPS: reserve exception vector space ONLY ONCE
Lennert Buytenhek <[email protected]>
ahci: add 43-bit DMA address quirk for ASMedia ASM1061 controllers
Maksim Kiselev <[email protected]>
aoe: avoid potential deadlock at set_capacity
Conrad Kostecki <[email protected]>
ahci: asm1166: correct count of reported ports
Shyam Prasad N <[email protected]>
cifs: translate network errors on send to -ECONNABORTED
Kees Cook <[email protected]>
smb: Work around Clang __bdos() type confusion
Christian A. Ehrhardt <[email protected]>
block: Fix WARNING in _copy_from_iter
Devyn Liu <[email protected]>
spi: hisi-sfc-v3xx: Return IRQ_NONE if no interrupts were detected
Fullway Wang <[email protected]>
fbdev: sis: Error out if pixclock equals zero
Fullway Wang <[email protected]>
fbdev: savage: Error out if pixclock equals zero
Felix Fietkau <[email protected]>
wifi: mac80211: fix race condition on enabling fast-xmit
Michal Kazior <[email protected]>
wifi: cfg80211: fix missing interfaces when dumping
Vinod Koul <[email protected]>
dmaengine: fsl-qdma: increase size of 'irq_name'
Vinod Koul <[email protected]>
dmaengine: shdma: increase size of 'dev_id'
Shyam Prasad N <[email protected]>
cifs: open_cached_dir should not rely on primary channel
Dmitry Bogdanov <[email protected]>
scsi: target: core: Add TMF to tmr_list handling
Hector Martin <[email protected]>
dmaengine: apple-admac: Keep upper bits of REG_BUS_WIDTH
Jan Kiszka <[email protected]>
riscv/efistub: Ensure GP-relative addressing is not used
Dan Carpenter <[email protected]>
PCI: dwc: Fix a 64bit bug in dw_pcie_ep_raise_msix_irq()
Cyril Hrubis <[email protected]>
sched/rt: sysctl_sched_rr_timeslice show default timeslice after reset
Cyril Hrubis <[email protected]>
sched/rt: Disallow writing invalid values to sched_rt_period_us
Jamal Hadi Salim <[email protected]>
net/sched: Retire dsmark qdisc
Jamal Hadi Salim <[email protected]>
net/sched: Retire ATM qdisc
Jamal Hadi Salim <[email protected]>
net/sched: Retire CBQ qdisc
-------------
Diffstat:
Makefile | 4 +- arch/arm/mach-ep93xx/core.c | 1 + arch/arm64/boot/dts/rockchip/px30.dtsi | 2 + arch/arm64/include/asm/fpsimd.h | 2 + arch/arm64/kernel/fpsimd.c | 14 + arch/arm64/kernel/suspend.c | 3 + arch/arm64/kvm/vgic/vgic-its.c | 5 + arch/loongarch/Kconfig | 23 +- arch/loongarch/kernel/smp.c | 1 + arch/mips/kernel/traps.c | 8 +- arch/parisc/kernel/processor.c | 8 - arch/s390/pci/pci.c | 2 +- arch/x86/include/asm/nospec-branch.h | 2 + arch/x86/kernel/alternative.c | 13 +- arch/x86/kernel/ftrace.c | 2 +- arch/x86/kernel/static_call.c | 2 +- arch/x86/mm/numa.c | 21 +- arch/x86/net/bpf_jit_comp.c | 2 +- block/blk-map.c | 13 +- drivers/ata/ahci.c | 49 +- drivers/ata/ahci.h | 1 + drivers/ata/ahci_ceva.c | 125 +- drivers/ata/libata-core.c | 4 + drivers/block/aoe/aoeblk.c | 5 +- drivers/block/virtio_blk.c | 7 +- .../crypto/virtio/virtio_crypto_akcipher_algs.c | 5 +- drivers/cxl/core/pci.c | 6 +- drivers/dma/apple-admac.c | 5 +- drivers/dma/fsl-qdma.c | 2 +- drivers/dma/sh/shdma.h | 2 +- drivers/dma/ti/edma.c | 10 + drivers/firewire/core-card.c | 18 +- drivers/firmware/efi/arm-runtime.c | 2 +- drivers/firmware/efi/efi-init.c | 19 +- drivers/firmware/efi/libstub/Makefile | 2 +- drivers/firmware/efi/riscv-runtime.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 + drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 8 + drivers/gpu/drm/amd/amdgpu/soc15.c | 22 + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 + drivers/gpu/drm/drm_syncobj.c | 6 +- drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c | 8 +- drivers/gpu/drm/ttm/ttm_pool.c | 2 +- drivers/hwmon/coretemp.c | 2 +- drivers/i2c/busses/i2c-imx.c | 5 + drivers/infiniband/hw/bnxt_re/ib_verbs.c | 5 +- drivers/infiniband/hw/hfi1/pio.c | 6 +- drivers/infiniband/hw/hfi1/sdma.c | 2 +- drivers/infiniband/hw/irdma/defs.h | 1 + drivers/infiniband/hw/irdma/hw.c | 8 + drivers/infiniband/hw/irdma/verbs.c | 9 +- drivers/infiniband/hw/qedr/verbs.c | 11 +- drivers/infiniband/ulp/srpt/ib_srpt.c | 17 +- drivers/input/joystick/xpad.c | 2 + drivers/input/serio/i8042-acpipnpio.h | 8 + drivers/input/touchscreen/goodix.c | 3 +- drivers/irqchip/irq-gic-v3-its.c | 2 +- drivers/irqchip/irq-sifive-plic.c | 8 +- drivers/md/dm-crypt.c | 95 +- drivers/md/dm-integrity.c | 91 +- drivers/md/dm-verity-target.c | 86 +- drivers/md/dm-verity.h | 6 + drivers/md/md.c | 6 +- drivers/misc/open-dice.c | 2 +- drivers/net/ethernet/adi/Kconfig | 1 + .../net/ethernet/marvell/octeontx2/af/rvu_npc.c | 4 + .../net/ethernet/microchip/sparx5/sparx5_main.c | 1 + .../net/ethernet/microchip/sparx5/sparx5_main.h | 1 + .../net/ethernet/microchip/sparx5/sparx5_packet.c | 2 + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 20 - drivers/net/gtp.c | 10 +- drivers/net/phy/realtek.c | 4 +- drivers/nvme/host/fc.c | 47 +- drivers/nvme/target/fc.c | 131 +- drivers/nvme/target/fcloop.c | 6 +- drivers/nvme/target/tcp.c | 1 + drivers/pci/controller/dwc/pcie-designware-ep.c | 3 +- drivers/pci/msi/irqdomain.c | 2 +- drivers/platform/x86/intel/vbtn.c | 3 - drivers/platform/x86/thinkpad_acpi.c | 5 +- drivers/platform/x86/touchscreen_dmi.c | 39 +- drivers/regulator/pwm-regulator.c | 3 + drivers/s390/cio/device_ops.c | 6 +- drivers/scsi/Kconfig | 2 +- drivers/scsi/lpfc/lpfc_scsi.c | 12 +- drivers/scsi/scsi.c | 22 +- drivers/scsi/smartpqi/smartpqi_init.c | 5 +- drivers/soc/mediatek/mtk-pm-domains.c | 15 +- drivers/soc/renesas/r8a77980-sysc.c | 3 +- drivers/spi/spi-hisi-sfc-v3xx.c | 5 + drivers/spi/spi-sh-msiof.c | 16 +- drivers/target/target_core_device.c | 5 - drivers/target/target_core_pscsi.c | 9 +- drivers/target/target_core_transport.c | 4 + drivers/tty/serial/amba-pl011.c | 60 +- drivers/ufs/core/ufshcd.c | 1 - drivers/usb/cdns3/cdns3-gadget.c | 8 +- drivers/usb/cdns3/core.c | 1 - drivers/usb/cdns3/drd.c | 13 +- drivers/usb/cdns3/drd.h | 6 +- drivers/usb/cdns3/host.c | 16 +- drivers/usb/dwc3/gadget.c | 5 + drivers/usb/gadget/function/f_ncm.c | 10 +- drivers/usb/roles/class.c | 29 +- drivers/usb/typec/ucsi/ucsi_acpi.c | 71 +- drivers/vfio/iova_bitmap.c | 25 +- drivers/video/fbdev/savage/savagefb_driver.c | 3 + drivers/video/fbdev/sis/sis_main.c | 2 + fs/afs/volume.c | 4 +- fs/aio.c | 9 +- fs/cachefiles/cache.c | 2 + fs/cachefiles/daemon.c | 1 + fs/erofs/compress.h | 4 + fs/erofs/decompressor.c | 60 +- fs/erofs/decompressor_lzma.c | 4 +- fs/erofs/internal.h | 28 +- fs/erofs/namei.c | 28 +- fs/erofs/super.c | 72 +- fs/erofs/zmap.c | 23 +- fs/ext4/extents.c | 111 +- fs/ext4/mballoc.c | 15 +- fs/ntfs3/attrib.c | 20 +- fs/ntfs3/attrlist.c | 8 +- fs/ntfs3/dir.c | 40 +- fs/ntfs3/file.c | 2 + fs/ntfs3/fslog.c | 14 +- fs/ntfs3/fsntfs.c | 24 + fs/ntfs3/inode.c | 2 +- fs/ntfs3/ntfs.h | 4 +- fs/ntfs3/ntfs_fs.h | 14 +- fs/ntfs3/record.c | 25 +- fs/ntfs3/xattr.c | 3 + fs/smb/client/cached_dir.c | 2 +- fs/smb/client/cifsencrypt.c | 2 +- fs/smb/client/cifsglob.h | 2 +- fs/smb/client/fs_context.c | 2 +- fs/smb/client/readdir.c | 15 +- fs/smb/client/smb2pdu.c | 6 + fs/smb/client/transport.c | 15 +- include/linux/fs.h | 2 + include/linux/memblock.h | 2 + include/linux/socket.h | 5 +- include/linux/swap.h | 5 + include/net/netfilter/nf_flow_table.h | 4 +- include/net/switchdev.h | 3 + include/net/tcp.h | 2 +- include/scsi/scsi_device.h | 4 - kernel/bpf/helpers.c | 5 +- kernel/sched/rt.c | 12 +- mm/damon/lru_sort.c | 43 +- mm/damon/reclaim.c | 18 +- mm/memblock.c | 5 +- mm/memcontrol.c | 10 +- mm/memory.c | 20 + mm/swap.h | 5 + mm/swapfile.c | 13 + mm/zswap.c | 2 + net/bridge/br_switchdev.c | 86 +- net/core/dev.c | 2 +- net/core/dev_ioctl.c | 2 +- net/core/skmsg.c | 7 +- net/ipv4/arp.c | 3 +- net/ipv4/devinet.c | 21 +- net/ipv4/inet_hashtables.c | 25 +- net/ipv6/addrconf.c | 21 +- net/ipv6/exthdrs.c | 10 + net/ipv6/seg6.c | 20 +- net/l2tp/l2tp_ip6.c | 2 +- net/mac80211/cfg.c | 2 + net/mac80211/mlme.c | 1 + net/mac80211/sta_info.c | 2 + net/mac80211/tx.c | 2 +- net/mctp/route.c | 2 +- net/mptcp/diag.c | 6 +- net/mptcp/pm_netlink.c | 24 +- net/mptcp/pm_userspace.c | 54 +- net/mptcp/protocol.h | 2 - net/netfilter/nf_conntrack_proto_sctp.c | 2 +- net/netfilter/nf_flow_table_core.c | 41 +- net/netfilter/nf_tables_api.c | 87 +- net/netfilter/nft_flow_offload.c | 14 +- net/packet/af_packet.c | 10 +- net/phonet/datagram.c | 4 +- net/phonet/pep.c | 41 +- net/sched/Kconfig | 42 - net/sched/Makefile | 3 - net/sched/sch_atm.c | 706 -------- net/sched/sch_cbq.c | 1727 -------------------- net/sched/sch_dsmark.c | 518 ------ net/switchdev/switchdev.c | 73 + net/tls/tls_main.c | 2 +- net/tls/tls_sw.c | 24 +- net/wireless/nl80211.c | 1 + scripts/bpf_doc.py | 2 +- sound/soc/codecs/wm_adsp.c | 29 +- sound/soc/sunxi/sun4i-spdif.c | 5 + sound/usb/clock.c | 10 +- sound/usb/format.c | 20 + .../selftests/tc-testing/tc-tests/qdiscs/atm.json | 94 -- .../selftests/tc-testing/tc-tests/qdiscs/cbq.json | 184 --- .../tc-testing/tc-tests/qdiscs/dsmark.json | 140 -- 202 files changed, 1956 insertions(+), 4293 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 6/195 PCI: dwc: Fix a 64bit bug in dw_pcie_ep_raise_msix_irq()
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit b5d1b4b46f856da1473c7ba9a5cdfcb55c9b2478 upstream.
The "msg_addr" variable is u64. However, the "aligned_offset" is an unsigned int. This means that when the code does:
msg_addr &= ~aligned_offset;
it will unintentionally zero out the high 32 bits. Use ALIGN_DOWN() to do the alignment instead.
--- drivers/pci/controller/dwc/pcie-designware-ep.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/controller/dwc/pcie-designware-ep.c +2 -1
@@ -6,6 +6,7 @@* Author: Kishon Vijay Abraham I <[email protected]> */ +#include <linux/align.h> #include <linux/of.h> #include <linux/platform_device.h>
@@ -600,7 +601,7 @@ int dw_pcie_ep_raise_msix_irq(struct dw_ } aligned_offset = msg_addr & (epc->mem->window.page_size -1 ); - msg_addr &= ~aligned_offset; + msg_addr =ALIGN_DOWN (msg_addr, epc->mem->window.page_size); ret =dw_pcie_ep_map_addr (epc, func_no,0 , ep->msi_mem_phys, msg_addr, epc->mem->window.page_size);if (ret)
Greg Kroah-Hartman
maintainerPATCH 15/195 fbdev: savage: Error out if pixclock equals zero
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fullway Wang <[email protected]>
[ Upstream commit 04e5eac8f3ab2ff52fa191c187a46d4fdbc1e288 ]
The userspace program could pass any values to the driver through ioctl() interface. If the driver doesn't check the value of pixclock, it may cause divide-by-zero error.
Although pixclock is checked in savagefb_decode_var(), but it is not checked properly in savagefb_probe(). Fix this by checking whether pixclock is zero in the function savagefb_check_var() before info->var.pixclock is used as the divisor.
This is similar to CVE-2022-3061 in i740fb which was fixed by commit 15cf0b8.
--- drivers/video/fbdev/savage/savagefb_driver.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/video/fbdev/savage/savagefb_driver.c +3 -0
@@ -869,6 +869,9 @@ static int savagefb_check_var(struct fb_var_screeninfo *var,DBG ("savagefb_check_var" ); +if (!var->pixclock) +return -EINVAL ; + var->transp.offset =0 ; var->transp.length =0 ;switch (var->bits_per_pixel) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 16/195 fbdev: sis: Error out if pixclock equals zero
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fullway Wang <[email protected]>
[ Upstream commit e421946be7d9bf545147bea8419ef8239cb7ca52 ]
The userspace program could pass any values to the driver through ioctl() interface. If the driver doesn't check the value of pixclock, it may cause divide-by-zero error.
In sisfb_check_var(), var->pixclock is used as a divisor to caculate drate before it is checked against zero. Fix this by checking it at the beginning.
This is similar to CVE-2022-3061 in i740fb which was fixed by commit 15cf0b8.
--- drivers/video/fbdev/sis/sis_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/video/fbdev/sis/sis_main.c +2 -0
@@ -1475,6 +1475,8 @@ sisfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) vtotal = var->upper_margin + var->lower_margin + var->vsync_len; +if (!var->pixclock) +return -EINVAL ; pixclock = var->pixclock;if ((var->vmode &FB_VMODE_MASK ) ==FB_VMODE_NONINTERLACED ) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 17/195 spi: hisi-sfc-v3xx: Return IRQ_NONE if no interrupts were detected
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Devyn Liu <[email protected]>
[ Upstream commit de8b6e1c231a95abf95ad097b993d34b31458ec9 ]
Return IRQ_NONE from the interrupt handler when no interrupt was detected. Because an empty interrupt will cause a null pointer error:
Unable to handle kernel NULL pointer dereference at virtual
address 0000000000000008
Call trace:
complete+0x54/0x100
hisi_sfc_v3xx_isr+0x2c/0x40 [spi_hisi_sfc_v3xx]
__handle_irq_event_percpu+0x64/0x1e0
handle_irq_event+0x7c/0x1cc--- drivers/spi/spi-hisi-sfc-v3xx.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/spi/spi-hisi-sfc-v3xx.c +5 -0
@@ -377,6 +377,11 @@ static const struct spi_controller_mem_ops hisi_sfc_v3xx_mem_ops = {static irqreturn_t hisi_sfc_v3xx_isr (int irq,void *data) {struct hisi_sfc_v3xx_host *host = data; +u32 reg; + + reg =readl (host->regbase +HISI_SFC_V3XX_INT_STAT ); +if (!reg) +return IRQ_NONE ;hisi_sfc_v3xx_disable_int (host);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 18/195 block: Fix WARNING in _copy_from_iter
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian A. Ehrhardt <[email protected]>
[ Upstream commit 13f3956eb5681a4045a8dfdef48df5dc4d9f58a6 ]
Syzkaller reports a warning in _copy_from_iter because an iov_iter is supposedly used in the wrong direction. The reason is that syzcaller managed to generate a request with a transfer direction of SG_DXFER_TO_FROM_DEV. This instructs the kernel to copy user buffers into the kernel, read into the copied buffers and then copy the data back to user space.
Thus the iovec is used in both directions.
Detect this situation in the block layer and construct a new iterator with the correct direction for the copy-in.
--- block/blk-map.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
block/blk-map.c +10 -3
@@ -203,12 +203,19 @@ static int bio_copy_user_iov(struct request *rq, struct rq_map_data *map_data,/* * success */ -if ((iov_iter_rw (iter) ==WRITE && - (!map_data || !map_data->null_mapped)) || - (map_data && map_data->from_user)) { +if (iov_iter_rw (iter) ==WRITE && + (!map_data || !map_data->null_mapped)) { ret =bio_copy_from_iter (bio, iter);if (ret) goto cleanup; + }else if (map_data && map_data->from_user) { +struct iov_iter iter2 = *iter; + +/* This is the copy-in part of SG_DXFER_TO_FROM_DEV. */ + iter2.data_source =ITER_SOURCE ; + ret =bio_copy_from_iter (bio, &iter2); +if (ret) + goto cleanup; }else {if (bmd->is_our_pages)zero_fill_bio (bio);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 19/195 smb: Work around Clang __bdos() type confusion
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit 8deb05c84b63b4fdb8549e08942867a68924a5b8 ]
Recent versions of Clang gets confused about the possible size of the "user" allocation, and CONFIG_FORTIFY_SOURCE ends up emitting a warning[1]:
repro.c:126:4: warning: call to '__write_overflow_field' declared with 'warning' attribute: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning]
126 | __write_overflow_field(p_size_field, size);
| ^for this memset():
int len;
__le16 *user;
...
len = ses->user_name ? strlen(ses->user_name) : 0;
user = kmalloc(2 + (len * 2), GFP_KERNEL);
...
if (len) {
...
} else {
memset(user, '\0', 2);
}While Clang works on this bug[2], switch to using a direct assignment, which avoids memset() entirely which both simplifies the code and silences the false positive warning. (Making "len" size_t also silences the warning, but the direct assignment seems better.)
--- fs/smb/client/cifsencrypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/client/cifsencrypt.c +1 -1
@@ -444,7 +444,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash, len =cifs_strtoUTF16 (user, ses->user_name, len, nls_cp);UniStrupr (user); }else { -memset (user,'\0' ,2 ); + *(u16 *)user =0 ; } rc = crypto_shash_update(ses->server->secmech.hmacmd5,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 20/195 cifs: translate network errors on send to -ECONNABORTED
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shyam Prasad N <[email protected]>
[ Upstream commit a68106a6928e0a6680f12bcc7338c0dddcfe4d11 ]
When the network stack returns various errors, we today bubble up the error to the user (in case of soft mounts).
This change translates all network errors except -EINTR and -EAGAIN to -ECONNABORTED. A similar approach is taken when we receive network errors when reading from the socket.
The change also forces the cifsd thread to reconnect during it's next activity.
--- fs/smb/client/transport.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
fs/smb/client/transport.c +9 -2
@@ -427,10 +427,17 @@ __smb_send_rqst(struct TCP_Server_Info *server, int num_rqst, server->conn_id, server->hostname); } smbd_done: -if (rc <0 && rc != -EINTR ) +/* +* there's hardly any use for the layers above to know the +* actual error code here. All they should do at this point is +* to retry the connection and hope it goes away. +*/ +if (rc <0 && rc != -EINTR && rc != -EAGAIN ) {cifs_server_dbg (VFS ,"Error %d sending data on socket to server\n" , rc); -else if (rc >0 ) + rc = -ECONNABORTED ; +cifs_signal_cifsd_for_reconnect (server, false); + }else if (rc >0 ) rc =0 ; out:cifs_in_send_dec (server);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 21/195 ahci: asm1166: correct count of reported ports
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Conrad Kostecki <[email protected]>
[ Upstream commit 0077a504e1a4468669fd2e011108db49133db56e ]
The ASM1166 SATA host controller always reports wrongly, that it has 32 ports. But in reality, it only has six ports.
This seems to be a hardware issue, as all tested ASM1166 SATA host controllers reports such high count of ports.
Example output: ahci 0000:09:00.0: AHCI 0001.0301 32 slots 32 ports 6 Gbps 0xffffff3f impl SATA mode.
By adjusting the port_map, the count is limited to six ports.
New output: ahci 0000:09:00.0: AHCI 0001.0301 32 slots 32 ports 6 Gbps 0x3f impl SATA mode.
--- drivers/ata/ahci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/ata/ahci.c +5 -0
@@ -658,6 +658,11 @@ MODULE_PARM_DESC(mobile_lpm_policy, "Default LPM policy for mobile chipsets");static void ahci_pci_save_initial_config (struct pci_dev *pdev,struct ahci_host_priv *hpriv) { +if (pdev->vendor ==PCI_VENDOR_ID_ASMEDIA && pdev->device ==0x1166 ) { +dev_info (&pdev->dev,"ASM1166 has only six ports\n" ); + hpriv->saved_port_map =0x3f ; + } +if (pdev->vendor ==PCI_VENDOR_ID_JMICRON && pdev->device ==0x2361 ) {dev_info (&pdev->dev,"JMB361 has only one port\n" ); hpriv->saved_port_map =1 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 22/195 aoe: avoid potential deadlock at set_capacity
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maksim Kiselev <[email protected]>
[ Upstream commit e169bd4fb2b36c4b2bee63c35c740c85daeb2e86 ]
Move set_capacity() outside of the section procected by (&d->lock). To avoid possible interrupt unsafe locking scenario:
CPU0 CPU1
---- ----
[1] lock(&bdev->bd_size_lock);
local_irq_disable();
[2] lock(&d->lock);
[3] lock(&bdev->bd_size_lock); <Interrupt>
[4] lock(&d->lock);
*** DEADLOCK ***
Where [1](&bdev->bd_size_lock) hold by zram_add()->set_capacity(). [2]lock(&d->lock) hold by aoeblk_gdalloc(). And aoeblk_gdalloc() is trying to acquire [3](&bdev->bd_size_lock) at set_capacity() call. In this situation an attempt to acquire [4]lock(&d->lock) from aoecmd_cfg_rsp() will lead to deadlock.
So the simplest solution is breaking lock dependency [2](&d->lock) -> [3](&bdev->bd_size_lock) by moving set_capacity() outside.
--- drivers/block/aoe/aoeblk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/block/aoe/aoeblk.c +4 -1
@@ -333,6 +333,7 @@ aoeblk_gdalloc(void *vp)struct gendisk *gd;mempool_t *mp;struct blk_mq_tag_set *set; +sector_t ssize;ulong flags;int late =0 ;int err;
@@ -395,7 +396,7 @@ aoeblk_gdalloc(void *vp) gd->minors =AOE_PARTITIONS ; gd->fops = &aoe_bdops; gd->private_data = d; -set_capacity (gd, d->ssize); + ssize = d->ssize;snprintf (gd->disk_name,sizeof gd->disk_name,"etherd/e%ld.%d" , d->aoemajor, d->aoeminor);
@@ -404,6 +405,8 @@ aoeblk_gdalloc(void *vp)spin_unlock_irqrestore (&d->lock, flags); +set_capacity (gd, ssize); + err =device_add_disk (NULL , gd, aoe_attr_groups);if (err) goto out_disk_cleanup;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 23/195 ahci: add 43-bit DMA address quirk for ASMedia ASM1061 controllers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lennert Buytenhek <[email protected]>
[ Upstream commit 20730e9b277873deeb6637339edcba64468f3da3 ]
With one of the on-board ASM1061 AHCI controllers (1b21:0612) on an ASUSTeK Pro WS WRX80E-SAGE SE WIFI mainboard, a controller hang was observed that was immediately preceded by the following kernel messages:
ahci 0000:28:00.0: Using 64-bit DMA addresses
ahci 0000:28:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0035 address=0x7fffff00000 flags=0x0000] ahci 0000:28:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0035 address=0x7fffff00300 flags=0x0000] ahci 0000:28:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0035 address=0x7fffff00380 flags=0x0000] ahci 0000:28:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0035 address=0x7fffff00400 flags=0x0000] ahci 0000:28:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0035 address=0x7fffff00680 flags=0x0000] ahci 0000:28:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0035 address=0x7fffff00700 flags=0x0000]
The first message is produced by code in drivers/iommu/dma-iommu.c which is accompanied by the following comment that seems to apply:
/*
* Try to use all the 32-bit PCI addresses first. The original SAC vs.
* DAC reasoning loses relevance with PCIe, but enough hardware and
* firmware bugs are still lurking out there that it's safest not to
* venture into the 64-bit space until necessary.
*
* If your device goes wrong after seeing the notice then likely either
* its driver is not setting DMA masks accurately, the hardware has
* some inherent bug in handling >32-bit addresses, or not all the
* expected address bits are wired up between the device and the IOMMU. */
Asking the ASM1061 on a discrete PCIe card to DMA from I/O virtual address 0xffffffff00000000 produces the following I/O page faults:
vfio-pci 0000:07:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0021 address=0x7ff00000000 flags=0x0010] vfio-pci 0000:07:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0021 address=0x7ff00000500 flags=0x0010]
Note that the upper 21 bits of the logged DMA address are zero. (When asking a different PCIe device in the same PCIe slot to DMA to the same I/O virtual address, we do see all the upper 32 bits of the DMA address as 1, so this is not an issue with the chipset or IOMMU configuration on the test system.)
Also, hacking libahci to always set the upper 21 bits of all DMA addresses to 1 produces no discernible effect on the behavior of the ASM1061, and mkfs/mount/scrub/etc work as without this hack.
This all strongly suggests that the ASM1061 has a 43 bit DMA address limit, and this commit therefore adds a quirk to deal with this limit.
This issue probably applies to (some of) the other supported ASMedia parts as well, but we limit it to the PCI IDs known to refer to ASM1061 parts, as that's the only part we know for sure to be affected by this issue at this point.
--- drivers/ata/ahci.c | 29 +++++++++++++++++++++++------ drivers/ata/ahci.h | 1 + 2 files changed, 24 insertions(+), 6 deletions(-)
drivers/ata/ahci.c +23 -6
@@ -49,6 +49,7 @@ enum {enum board_ids {/* board IDs by feature in alphabetical order */ board_ahci, + board_ahci_43bit_dma, board_ahci_ign_iferr, board_ahci_low_power, board_ahci_no_debounce_delay,
@@ -129,6 +130,13 @@ static const struct ata_port_info ahci_port_info[] = { .udma_mask = ATA_UDMA6, .port_ops = &ahci_ops, }, + [board_ahci_43bit_dma] = { + AHCI_HFLAGS (AHCI_HFLAG_43BIT_ONLY), + .flags = AHCI_FLAG_COMMON, + .pio_mask = ATA_PIO4, + .udma_mask = ATA_UDMA6, + .port_ops = &ahci_ops, + }, [board_ahci_ign_iferr] = { AHCI_HFLAGS (AHCI_HFLAG_IGN_IRQ_IF_ERR), .flags = AHCI_FLAG_COMMON,
@@ -597,11 +605,11 @@ static const struct pci_device_id ahci_pci_tbl[] = { { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */ { PCI_VDEVICE(PROMISE, 0x3781), board_ahci }, /* FastTrak TX8660 ahci-mode */ -/* Asmedia */ +/* ASMedia */ { PCI_VDEVICE(ASMEDIA, 0x0601), board_ahci }, /* ASM1060 */ { PCI_VDEVICE(ASMEDIA, 0x0602), board_ahci }, /* ASM1060 */ - { PCI_VDEVICE(ASMEDIA, 0x0611), board_ahci }, /* ASM1061 */ - { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci }, /* ASM1062 */ + { PCI_VDEVICE(ASMEDIA, 0x0611), board_ahci_43bit_dma }, /* ASM1061 */ + { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci_43bit_dma }, /* ASM1061/1062 */ { PCI_VDEVICE(ASMEDIA, 0x0621), board_ahci }, /* ASM1061R */ { PCI_VDEVICE(ASMEDIA, 0x0622), board_ahci }, /* ASM1062R */ { PCI_VDEVICE(ASMEDIA, 0x0624), board_ahci }, /* ASM1062+JMB575 */
@@ -949,11 +957,20 @@ static int ahci_pci_device_resume(struct device *dev)#endif /* CONFIG_PM */ -static int ahci_configure_dma_masks (struct pci_dev *pdev,int using_dac) +static int ahci_configure_dma_masks (struct pci_dev *pdev, +struct ahci_host_priv *hpriv) { -const int dma_bits = using_dac ?64 :32 ; +int dma_bits;int rc; +if (hpriv->cap &HOST_CAP_64 ) { + dma_bits =64 ; +if (hpriv->flags &AHCI_HFLAG_43BIT_ONLY ) + dma_bits =43 ; + }else { + dma_bits =32 ; + } +/* * If the device fixup already set the dma_mask to some non-standard * value, don't extend it here. This happens on STA2X11, for example.
@@ -1926,7 +1943,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)ahci_gtf_filter_workaround (host);/* initialize adapter */ - rc =ahci_configure_dma_masks (pdev, hpriv->cap &HOST_CAP_64 ); + rc =ahci_configure_dma_masks (pdev, hpriv);if (rc)return rc;
drivers/ata/ahci.h +1 -0
@@ -247,6 +247,7 @@ enum {AHCI_HFLAG_SUSPEND_PHYS =BIT (26 ),/* handle PHYs during suspend/resume */ AHCI_HFLAG_NO_SXS =BIT (28 ),/* SXS not supported */ + AHCI_HFLAG_43BIT_ONLY = BIT(29), /* 43bit DMA addr limit *//* ap->flags bits */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 24/195 MIPS: reserve exception vector space ONLY ONCE
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huang Pei <[email protected]>
[ Upstream commit abcabb9e30a1f9a69c76776f8abffc31c377b542 ]
"cpu_probe" is called both by BP and APs, but reserving exception vector (like 0x0-0x1000) called by "cpu_probe" need once and calling on APs is too late since memblock is unavailable at that time.
So, reserve exception vector ONLY by BP.
--- arch/mips/kernel/traps.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/mips/kernel/traps.c +7 -1
@@ -2007,7 +2007,13 @@ unsigned long vi_handlers[64];void reserve_exception_space (phys_addr_t addr,unsigned long size) { -memblock_reserve (addr, size); +/* +* reserve exception space on CPUs other than CPU0 +* is too late, since memblock is unavailable when APs +* up +*/ +if (smp_processor_id () ==0 ) +memblock_reserve (addr, size); }void __init *set_except_vector (int n,void *addr)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 7/195 riscv/efistub: Ensure GP-relative addressing is not used
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kiszka <[email protected]>
commit afb2a4fb84555ef9e61061f6ea63ed7087b295d5 upstream.
The cflags for the RISC-V efistub were missing -mno-relax, thus were under the risk that the compiler could use GP-relative addressing. That happened for _edata with binutils-2.41 and kernel 6.1, causing the relocation to fail due to an invalid kernel_size in handle_kernel_image. It was not yet observed with newer versions, but that may just be luck.
--- drivers/firmware/efi/libstub/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/libstub/Makefile +1 -1
@@ -25,7 +25,7 @@ cflags-$(CONFIG_ARM) := $(subst $(CC_FL -fno-builtin -fpic \ $(call cc-option,-mno-single-pic-base) cflags-$(CONFIG_RISCV) := $(subst $(CC_FLAGS_FTRACE),,$(KBUILD_CFLAGS)) \ - -fpic + -fpic -mno-relax cflags-$(CONFIG_LOONGARCH) := $(subst $(CC_FLAGS_FTRACE),,$(KBUILD_CFLAGS)) \ -fpie
Greg Kroah-Hartman
maintainerPATCH 25/195 platform/x86: touchscreen_dmi: Add info for the TECLAST X16 Plus tablet
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phoenix Chen <[email protected]>
[ Upstream commit 1abdf288b0ef5606f76b6e191fa6df05330e3d7e ]
Add touch screen info for TECLAST X16 Plus tablet.
--- drivers/platform/x86/touchscreen_dmi.c | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
drivers/platform/x86/touchscreen_dmi.c +35 -0
@@ -913,6 +913,32 @@ static const struct ts_dmi_data teclast_tbook11_data = { .properties = teclast_tbook11_props, }; +static const struct property_entry teclast_x16_plus_props[] = { +PROPERTY_ENTRY_U32 ("touchscreen-min-x" ,8 ), +PROPERTY_ENTRY_U32 ("touchscreen-min-y" ,14 ), +PROPERTY_ENTRY_U32 ("touchscreen-size-x" ,1916 ), +PROPERTY_ENTRY_U32 ("touchscreen-size-y" ,1264 ), +PROPERTY_ENTRY_BOOL ("touchscreen-inverted-y" ), +PROPERTY_ENTRY_STRING ("firmware-name" ,"gsl3692-teclast-x16-plus.fw" ), +PROPERTY_ENTRY_U32 ("silead,max-fingers" ,10 ), +PROPERTY_ENTRY_BOOL ("silead,home-button" ), + { } +}; + +static const struct ts_dmi_data teclast_x16_plus_data = { + .embedded_fw = { + .name ="silead/gsl3692-teclast-x16-plus.fw" , + .prefix = {0xf0 ,0x00 ,0x00 ,0x00 ,0x02 ,0x00 ,0x00 ,0x00 }, + .length =43560 , + .sha256 = {0x9d ,0xb0 ,0x3d ,0xf1 ,0x00 ,0x3c ,0xb5 ,0x25 , +0x62 ,0x8a ,0xa0 ,0x93 ,0x4b ,0xe0 ,0x4e ,0x75 , +0xd1 ,0x27 ,0xb1 ,0x65 ,0x3c ,0xba ,0xa5 ,0x0f , +0xcd ,0xb4 ,0xbe ,0x00 ,0xbb ,0xf6 ,0x43 ,0x29 }, + }, + .acpi_name ="MSSL1680:00" , + .properties = teclast_x16_plus_props, +}; +static const struct property_entry teclast_x3_plus_props[] = {PROPERTY_ENTRY_U32 ("touchscreen-size-x" ,1980 ),PROPERTY_ENTRY_U32 ("touchscreen-size-y" ,1500 ),
@@ -1567,6 +1593,15 @@ const struct dmi_system_id touchscreen_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_SKU, "E5A6_A1"), }, }, + { +/* Teclast X16 Plus */ + .driver_data = (void *)&teclast_x16_plus_data, + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"TECLAST" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"Default string" ), + DMI_MATCH(DMI_PRODUCT_SKU, "D3A5_A1"), + }, + }, {/* Teclast X3 Plus */ .driver_data = (void *)&teclast_x3_plus_data,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 26/195 ext4: avoid dividing by 0 in mb_update_avg_fragment_size() when block bitmap corrupt
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
[ Upstream commit 993bf0f4c393b3667830918f9247438a8f6fdb5b ]
Determine if bb_fragments is 0 instead of determining bb_free to eliminate the risk of dividing by zero when the block bitmap is corrupted.
--- fs/ext4/mballoc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/mballoc.c +1 -1
@@ -831,7 +831,7 @@ mb_update_avg_fragment_size(struct super_block *sb, struct ext4_group_info *grp)struct ext4_sb_info *sbi =EXT4_SB (sb);int new_order; -if (!test_opt2 (sb,MB_OPTIMIZE_SCAN ) || grp->bb_free ==0 ) +if (!test_opt2 (sb,MB_OPTIMIZE_SCAN ) || grp->bb_fragments ==0 )return ; new_order = mb_avg_fragment_size_order(sb,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 27/195 ext4: avoid allocating blocks from corrupted group in ext4_mb_try_best_found()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
[ Upstream commit 4530b3660d396a646aad91a787b6ab37cf604b53 ]
Determine if the group block bitmap is corrupted before using ac_b_ex in ext4_mb_try_best_found() to avoid allocating blocks from a group with a corrupted block bitmap in the following concurrency and making the situation worse.
ext4_mb_regular_allocator
ext4_lock_group(sb, group)
ext4_mb_good_group
// check if the group bbitmap is corrupted
ext4_mb_complex_scan_group
// Scan group gets ac_b_ex but doesn't use it
ext4_unlock_group(sb, group)
ext4_mark_group_bitmap_corrupted(group)
// The block bitmap was corrupted during
// the group unlock gap.
ext4_mb_try_best_found
ext4_lock_group(ac->ac_sb, group)
ext4_mb_use_best_found
mb_mark_used
// Allocating blocks in block bitmap corrupted group--- fs/ext4/mballoc.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/ext4/mballoc.c +4 -0
@@ -2176,6 +2176,9 @@ int ext4_mb_try_best_found(struct ext4_allocation_context *ac,return err;ext4_lock_group (ac->ac_sb, group); +if (unlikely (EXT4_MB_GRP_BBITMAP_CORRUPT (e4b->bd_info))) + goto out; + max =mb_find_extent (e4b, ex.fe_start, ex.fe_len, &ex);if (max >0 ) {
@@ -2183,6 +2186,7 @@ int ext4_mb_try_best_found(struct ext4_allocation_context *ac,ext4_mb_use_best_found (ac, e4b); } +out:ext4_unlock_group (ac->ac_sb, group);ext4_mb_unload_buddy (e4b);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 28/195 ext4: avoid allocating blocks from corrupted group in ext4_mb_find_by_goal()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
[ Upstream commit 832698373a25950942c04a512daa652c18a9b513 ]
Places the logic for checking if the group's block bitmap is corrupt under the protection of the group lock to avoid allocating blocks from the group with a corrupted block bitmap.
--- fs/ext4/mballoc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
fs/ext4/mballoc.c +4 -5
@@ -2215,12 +2215,10 @@ int ext4_mb_find_by_goal(struct ext4_allocation_context *ac,if (err)return err; -if (unlikely (EXT4_MB_GRP_BBITMAP_CORRUPT (e4b->bd_info))) { -ext4_mb_unload_buddy (e4b); -return 0 ; - } -ext4_lock_group (ac->ac_sb, group); +if (unlikely (EXT4_MB_GRP_BBITMAP_CORRUPT (e4b->bd_info))) + goto out; + max =mb_find_extent (e4b, ac->ac_g_ex.fe_start, ac->ac_g_ex.fe_len, &ex); ex.fe_logical =0xDEADFA11 ;/* debug value */
@@ -2253,6 +2251,7 @@ int ext4_mb_find_by_goal(struct ext4_allocation_context *ac, ac->ac_b_ex = ex;ext4_mb_use_best_found (ac, e4b); } +out:ext4_unlock_group (ac->ac_sb, group);ext4_mb_unload_buddy (e4b);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 29/195 Input: goodix - accept ACPI resources with gpio_count == 3 && gpio_int_idx == 0
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 180a8f12c21f41740fee09ca7f7aa98ff5bb99f8 ]
Some devices list 3 Gpio resources in the ACPI resource list for the touchscreen:
1. GpioInt resource pointing to the GPIO used for the interrupt
2. GpioIo resource pointing to the reset GPIO
3. GpioIo resource pointing to the GPIO used for the interrupt
Note how the third extra GpioIo resource really is a duplicate of the GpioInt provided info.
Ignore this extra GPIO, treating this setup the same as gpio_count == 2 && gpio_int_idx == 0 fixes the touchscreen not working on the Thunderbook Colossus W803 rugged tablet and likely also on the CyberBook_T116K.
--- drivers/input/touchscreen/goodix.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/input/touchscreen/goodix.c +2 -1
@@ -884,7 +884,8 @@ static int goodix_add_acpi_gpio_mappings(struct goodix_ts_data *ts) } } -if (ts->gpio_count ==2 && ts->gpio_int_idx ==0 ) { +/* Some devices with gpio_int_idx 0 list a third unused GPIO */ +if ((ts->gpio_count ==2 || ts->gpio_count ==3 ) && ts->gpio_int_idx ==0 ) { ts->irq_pin_access_method =IRQ_PIN_ACCESS_ACPI_GPIO ; gpio_mapping = acpi_goodix_int_first_gpios; }else if (ts->gpio_count ==2 && ts->gpio_int_idx ==1 ) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 30/195 dmaengine: ti: edma: Add some null pointer checks to the edma_probe
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kunwu Chan <[email protected]>
[ Upstream commit 6e2276203ac9ff10fc76917ec9813c660f627369 ]
devm_kasprintf() returns a pointer to dynamically allocated memory which can be NULL upon failure. Ensure the allocation was successful by checking the pointer validity.
--- drivers/dma/ti/edma.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/dma/ti/edma.c +10 -0
@@ -2413,6 +2413,11 @@ static int edma_probe(struct platform_device *pdev)if (irq >0 ) { irq_name =devm_kasprintf (dev,GFP_KERNEL ,"%s_ccint" ,dev_name (dev)); +if (!irq_name) { + ret = -ENOMEM ; + goto err_disable_pm; + } + ret =devm_request_irq (dev, irq, dma_irq_handler,0 , irq_name, ecc);if (ret) {
@@ -2429,6 +2434,11 @@ static int edma_probe(struct platform_device *pdev)if (irq >0 ) { irq_name =devm_kasprintf (dev,GFP_KERNEL ,"%s_ccerrint" ,dev_name (dev)); +if (!irq_name) { + ret = -ENOMEM ; + goto err_disable_pm; + } + ret =devm_request_irq (dev, irq, dma_ccerr_handler,0 , irq_name, ecc);if (ret) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 31/195 regulator: pwm-regulator: Add validity checks in continuous .get_voltage
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Blumenstingl <[email protected]>
[ Upstream commit c92688cac239794e4a1d976afa5203a4d3a2ac0e ]
Continuous regulators can be configured to operate only in a certain duty cycle range (for example from 0..91%). Add a check to error out if the duty cycle translates to an unsupported (or out of range) voltage.
--- drivers/regulator/pwm-regulator.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/regulator/pwm-regulator.c +3 -0
@@ -158,6 +158,9 @@ static int pwm_regulator_get_voltage(struct regulator_dev *rdev)pwm_get_state (drvdata->pwm, &pstate); voltage =pwm_get_relative_duty_cycle (&pstate, duty_unit); +if (voltage <min (max_uV_duty, min_uV_duty) || + voltage >max (max_uV_duty, min_uV_duty)) +return -ENOTRECOVERABLE ;/* * The dutycycle for min_uV might be greater than the one for max_uV.
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 32/195 nvmet-tcp: fix nvme tcp ida memory leak
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guixin Liu <[email protected]>
[ Upstream commit 47c5dd66c1840524572dcdd956f4af2bdb6fbdff ]
The nvmet_tcp_queue_ida should be destroy when the nvmet-tcp module exit.
--- drivers/nvme/target/tcp.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvme/target/tcp.c +1 -0
@@ -1884,6 +1884,7 @@ static void __exit nvmet_tcp_exit(void)flush_workqueue (nvmet_wq);destroy_workqueue (nvmet_tcp_wq); +ida_destroy (&nvmet_tcp_queue_ida); }module_init (nvmet_tcp_init);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 33/195 usb: ucsi_acpi: Quirk to ack a connector change ack cmd
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian A. Ehrhardt <[email protected]>
[ Upstream commit f3be347ea42dbb0358cd8b2d8dc543a23b70a976 ]
The PPM on some Dell laptops seems to expect that the ACK_CC_CI command to clear the connector change notification is in turn followed by another ACK_CC_CI to acknowledge the ACK_CC_CI command itself. This is in violation of the UCSI spec that states:
"The only notification that is not acknowledged by the OPM is
the command completion notification for the ACK_CC_CI or the PPM_RESET command."
Add a quirk to send this ack anyway.
Apply the quirk to all Dell systems.
On the first command that acks a connector change send a dummy command to determine if it runs into a timeout. Only activate the quirk if it does. This ensure that we do not break Dell systems that do not need the quirk.
--- drivers/usb/typec/ucsi/ucsi_acpi.c | 71 ++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 3 deletions(-)
drivers/usb/typec/ucsi/ucsi_acpi.c +68 -3
@@ -25,6 +25,8 @@ struct ucsi_acpi {unsigned long flags;guid_t guid;u64 cmd; +bool dell_quirk_probed; +bool dell_quirk_active; };static int ucsi_acpi_dsm (struct ucsi_acpi *ua,int func)
@@ -126,12 +128,73 @@ static const struct ucsi_operations ucsi_zenbook_ops = { .async_write = ucsi_acpi_async_write }; -static const struct dmi_system_id zenbook_dmi_id[] = { +/* +* Some Dell laptops expect that an ACK command with the +* UCSI_ACK_CONNECTOR_CHANGE bit set is followed by a (separate) +* ACK command that only has the UCSI_ACK_COMMAND_COMPLETE bit set. +* If this is not done events are not delivered to OSPM and +* subsequent commands will timeout. +*/ +static int +ucsi_dell_sync_write (struct ucsi *ucsi,unsigned int offset, +const void *val,size_t val_len) +{ +struct ucsi_acpi *ua =ucsi_get_drvdata (ucsi); +u64 cmd = *(u64 *)val, ack =0 ; +int ret; + +if (UCSI_COMMAND (cmd) ==UCSI_ACK_CC_CI && + cmd &UCSI_ACK_CONNECTOR_CHANGE ) + ack =UCSI_ACK_CC_CI |UCSI_ACK_COMMAND_COMPLETE ; + + ret =ucsi_acpi_sync_write (ucsi, offset, val, val_len); +if (ret !=0 ) +return ret; +if (ack ==0 ) +return ret; + +if (!ua->dell_quirk_probed) { + ua->dell_quirk_probed = true; + + cmd =UCSI_GET_CAPABILITY ; + ret =ucsi_acpi_sync_write (ucsi,UCSI_CONTROL , &cmd, +sizeof (cmd)); +if (ret ==0 ) +return ucsi_acpi_sync_write (ucsi,UCSI_CONTROL , + &ack,sizeof (ack)); +if (ret != -ETIMEDOUT ) +return ret; + + ua->dell_quirk_active = true; +dev_err (ua->dev,"Firmware bug: Additional ACK required after ACKing a connector change.\n" ); +dev_err (ua->dev,"Firmware bug: Enabling workaround\n" ); + } + +if (!ua->dell_quirk_active) +return ret; + +return ucsi_acpi_sync_write (ucsi,UCSI_CONTROL , &ack,sizeof (ack)); +} + +static const struct ucsi_operations ucsi_dell_ops = { + .read = ucsi_acpi_read, + .sync_write = ucsi_dell_sync_write, + .async_write = ucsi_acpi_async_write +}; + +static const struct dmi_system_id ucsi_acpi_quirks[] = { { .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"ASUSTeK COMPUTER INC." ),DMI_MATCH (DMI_PRODUCT_NAME ,"ZenBook UX325UA_UM325UA" ), }, + .driver_data = (void *)&ucsi_zenbook_ops, + }, + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), + }, + .driver_data = (void *)&ucsi_dell_ops, }, { } };
@@ -160,6 +223,7 @@ static int ucsi_acpi_probe(struct platform_device *pdev) {struct acpi_device *adev =ACPI_COMPANION (&pdev->dev);const struct ucsi_operations *ops = &ucsi_acpi_ops; +const struct dmi_system_id *id;struct ucsi_acpi *ua;struct resource *res;acpi_status status;
@@ -189,8 +253,9 @@ static int ucsi_acpi_probe(struct platform_device *pdev)init_completion (&ua->complete); ua->dev = &pdev->dev; -if (dmi_check_system (zenbook_dmi_id)) - ops = &ucsi_zenbook_ops; + id =dmi_first_match (ucsi_acpi_quirks); +if (id) + ops = id->driver_data; ua->ucsi =ucsi_create (&pdev->dev, ops);if (IS_ERR (ua->ucsi))
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 34/195 ALSA: usb-audio: Check presence of valid altsetting control
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Tsoy <[email protected]>
[ Upstream commit 346f59d1e8ed0eed41c80e1acb657e484c308e6a ]
Many devices with a single alternate setting do not have a Valid Alternate Setting Control and validation performed by validate_sample_rate_table_v2v3() doesn't work on them and is not really needed. So check the presense of control before sending altsetting validation requests.
MOTU Microbook IIc is suffering the most without this check. It takes up to 40 seconds to bootup due to how slow it switches sampling rates:
[ 2659.164824] usb 3-2: New USB device found, idVendor=07fd, idProduct=0004, bcdDevice= 0.60 [ 2659.164827] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 2659.164829] usb 3-2: Product: MicroBook IIc [ 2659.164830] usb 3-2: Manufacturer: MOTU [ 2659.166204] usb 3-2: Found last interface = 3 [ 2679.322298] usb 3-2: No valid sample rate available for 1:1, assuming a firmware bug [ 2679.322306] usb 3-2: 1:1: add audio endpoint 0x3 [ 2679.322321] usb 3-2: Creating new data endpoint #3 [ 2679.322552] usb 3-2: 1:1 Set sample rate 96000, clock 1 [ 2684.362250] usb 3-2: 2:1: cannot get freq (v2/v3): err -110 [ 2694.444700] usb 3-2: No valid sample rate available for 2:1, assuming a firmware bug [ 2694.444707] usb 3-2: 2:1: add audio endpoint 0x84 [ 2694.444721] usb 3-2: Creating new data endpoint #84 [ 2699.482103] usb 3-2: 2:1 Set sample rate 96000, clock 1
--- sound/usb/format.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
sound/usb/format.c +20 -0
@@ -470,9 +470,11 @@ static int validate_sample_rate_table_v2v3(struct snd_usb_audio *chip, int clock) {struct usb_device *dev = chip->dev; +struct usb_host_interface *alts;unsigned int *table;unsigned int nr_rates;int i, err; +u32 bmControls;/* performing the rate verification may lead to unexpected USB bus * behavior afterwards by some unknown reason. Do this only for the
@@ -481,6 +483,24 @@ static int validate_sample_rate_table_v2v3(struct snd_usb_audio *chip,if (!(chip->quirk_flags &QUIRK_FLAG_VALIDATE_RATES ))return 0 ;/* don't perform the validation as default */ + alts =snd_usb_get_host_interface (chip, fp->iface, fp->altsetting); +if (!alts) +return 0 ; + +if (fp->protocol ==UAC_VERSION_3 ) { +struct uac3_as_header_descriptor *as =snd_usb_find_csint_desc ( + alts->extra, alts->extralen,NULL ,UAC_AS_GENERAL ); + bmControls =le32_to_cpu (as->bmControls); + }else { +struct uac2_as_header_descriptor *as =snd_usb_find_csint_desc ( + alts->extra, alts->extralen,NULL ,UAC_AS_GENERAL ); + bmControls = as->bmControls; + } + +if (!uac_v2v3_control_is_readable (bmControls, +UAC2_AS_VAL_ALT_SETTINGS )) +return 0 ; + table =kcalloc (fp->nr_rates,sizeof (*table),GFP_KERNEL );if (!table)return -ENOMEM ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 8/195 dmaengine: apple-admac: Keep upper bits of REG_BUS_WIDTH
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hector Martin <[email protected]>
[ Upstream commit 306f5df81fcc89b462fbeb9dbe26d9a8ad7c7582 ]
For RX channels, REG_BUS_WIDTH seems to default to a value of 0xf00, and macOS preserves the upper bits when setting the configuration in the lower ones. If we reset the upper bits to 0, this causes framing errors on suspend/resume (the data stream "tears" and channels get swapped around). Keeping the upper bits untouched, like the macOS driver does, fixes this issue.
--- drivers/dma/apple-admac.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/dma/apple-admac.c +4 -1
@@ -56,6 +56,8 @@#define REG_BUS_WIDTH (ch) (0x8040 + (ch) * 0x200) +#define BUS_WIDTH_WORD_SIZE GENMASK(3, 0) +#define BUS_WIDTH_FRAME_SIZE GENMASK(7, 4)#define BUS_WIDTH_8BIT 0x00#define BUS_WIDTH_16BIT 0x01#define BUS_WIDTH_32BIT 0x02
@@ -739,7 +741,8 @@ static int admac_device_config(struct dma_chan *chan,struct admac_data *ad = adchan->host;bool is_tx =admac_chan_direction (adchan->no) ==DMA_MEM_TO_DEV ;int wordsize =0 ; -u32 bus_width =0 ; +u32 bus_width =readl_relaxed (ad->base +REG_BUS_WIDTH (adchan->no)) & + ~(BUS_WIDTH_WORD_SIZE |BUS_WIDTH_FRAME_SIZE );switch (is_tx ? config->dst_addr_width : config->src_addr_width) {case DMA_SLAVE_BUSWIDTH_1_BYTE :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 35/195 ASoC: sunxi: sun4i-spdif: Add support for Allwinner H616
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
[ Upstream commit 0adf963b8463faa44653e22e56ce55f747e68868 ]
The SPDIF hardware block found in the H616 SoC has the same layout as the one found in the H6 SoC, except that it is missing the receiver side.
Since the driver currently only supports the transmit function, support for the H616 is identical to what is currently done for the H6.
--- sound/soc/sunxi/sun4i-spdif.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/soc/sunxi/sun4i-spdif.c +5 -0
@@ -578,6 +578,11 @@ static const struct of_device_id sun4i_spdif_of_match[] = { .compatible = "allwinner,sun50i-h6-spdif", .data = &sun50i_h6_spdif_quirks, }, + { + .compatible = "allwinner,sun50i-h616-spdif", + /* Essentially the same as the H6, but without RX */ + .data = &sun50i_h6_spdif_quirks, + }, {/* sentinel */ } };MODULE_DEVICE_TABLE (of, sun4i_spdif_of_match);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 9/195 scsi: target: core: Add TMF to tmr_list handling
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Bogdanov <[email protected]>
[ Upstream commit 83ab68168a3d990d5ff39ab030ad5754cbbccb25 ]
An abort that is responded to by iSCSI itself is added to tmr_list but does not go to target core. A LUN_RESET that goes through tmr_list takes a refcounter on the abort and waits for completion. However, the abort will be never complete because it was not started in target core.
Unable to locate ITT: 0x05000000 on CID: 0
Unable to locate RefTaskTag: 0x05000000 on CID: 0.
wait_for_tasks: Stopping tmf LUN_RESET with tag 0x0 ref_task_tag 0x0 i_state 34 t_state ISTATE_PROCESSING refcnt 2 transport_state active,stop,fabric_stop wait for tasks: tmf LUN_RESET with tag 0x0 ref_task_tag 0x0 i_state 34 t_state ISTATE_PROCESSING refcnt 2 transport_state active,stop,fabric_stop
...
INFO: task kworker/0:2:49 blocked for more than 491 seconds. task:kworker/0:2 state:D stack: 0 pid: 49 ppid: 2 flags:0x00000800 Workqueue: events target_tmr_work [target_core_mod] Call Trace: __switch_to+0x2c4/0x470 _schedule+0x314/0x1730 schedule+0x64/0x130 schedule_timeout+0x168/0x430 wait_for_completion+0x140/0x270 target_put_cmd_and_wait+0x64/0xb0 [target_core_mod] core_tmr_lun_reset+0x30/0xa0 [target_core_mod] target_tmr_work+0xc8/0x1b0 [target_core_mod] process_one_work+0x2d4/0x5d0 worker_thread+0x78/0x6c0
To fix this, only add abort to tmr_list if it will be handled by target core.
--- drivers/target/target_core_device.c | 5 ----- drivers/target/target_core_transport.c | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-)
drivers/target/target_core_device.c +0 -5
@@ -147,7 +147,6 @@ int transport_lookup_tmr_lun(struct se_cmd *se_cmd)struct se_session *se_sess = se_cmd->se_sess;struct se_node_acl *nacl = se_sess->se_node_acl;struct se_tmr_req *se_tmr = se_cmd->se_tmr_req; -unsigned long flags;rcu_read_lock (); deve =target_nacl_find_deve (nacl, se_cmd->orig_fe_lun);
@@ -178,10 +177,6 @@ int transport_lookup_tmr_lun(struct se_cmd *se_cmd) se_cmd->se_dev =rcu_dereference_raw (se_lun->lun_se_dev); se_tmr->tmr_dev =rcu_dereference_raw (se_lun->lun_se_dev); -spin_lock_irqsave (&se_tmr->tmr_dev->se_tmr_lock, flags); -list_add_tail (&se_tmr->tmr_list, &se_tmr->tmr_dev->dev_tmr_list); -spin_unlock_irqrestore (&se_tmr->tmr_dev->se_tmr_lock, flags); -return 0 ; }EXPORT_SYMBOL (transport_lookup_tmr_lun);
drivers/target/target_core_transport.c +4 -0
@@ -3627,6 +3627,10 @@ int transport_generic_handle_tmr(unsigned long flags;bool aborted = false; +spin_lock_irqsave (&cmd->se_dev->se_tmr_lock, flags); +list_add_tail (&cmd->se_tmr_req->tmr_list, &cmd->se_dev->dev_tmr_list); +spin_unlock_irqrestore (&cmd->se_dev->se_tmr_lock, flags); +spin_lock_irqsave (&cmd->t_state_lock, flags);if (cmd->transport_state &CMD_T_ABORTED ) { aborted = true;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 10/195 cifs: open_cached_dir should not rely on primary channel
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shyam Prasad N <[email protected]>
[ Upstream commit 936eba9cfb5cfbf6a2c762cd163605f2b784e03e ]
open_cached_dir today selects ses->server a.k.a primary channel to send requests. When multichannel is used, the primary channel maybe down. So it does not make sense to rely only on that channel.
This fix makes this function pick a channel with the standard helper function cifs_pick_channel.
--- fs/smb/client/cached_dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/client/cached_dir.c +1 -1
@@ -149,7 +149,7 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,return -EOPNOTSUPP ; ses = tcon->ses; - server = ses->server; + server =cifs_pick_channel (ses); cfids = tcon->cfids;if (!server->ops->new_lease_key)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 11/195 dmaengine: shdma: increase size of dev_id
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vinod Koul <[email protected]>
[ Upstream commit 404290240827c3bb5c4e195174a8854eef2f89ac ]
We seem to have hit warnings of 'output may be truncated' which is fixed by increasing the size of 'dev_id'
drivers/dma/sh/shdmac.c: In function ‘sh_dmae_probe’:drivers/dma/sh/shdmac.c:541:34: error: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 9 [-Werror=format-truncation=]
541 | "sh-dmae%d.%d", pdev->id, id);
| ^~
In function ‘sh_dmae_chan_probe’,
inlined from ‘sh_dmae_probe’ at drivers/dma/sh/shdmac.c:845:9:drivers/dma/sh/shdmac.c:541:26: note: directive argument in the range [0, 2147483647]
541 | "sh-dmae%d.%d", pdev->id, id);
| ^~~~~~~~~~~~~~
drivers/dma/sh/shdmac.c:541:26: note: directive argument in the range [0, 19]
drivers/dma/sh/shdmac.c:540:17: note: ‘snprintf’ output between 11 and 21 bytes into a destination of size 16
540 | snprintf(sh_chan->dev_id, sizeof(sh_chan->dev_id),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
541 | "sh-dmae%d.%d", pdev->id, id);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--- drivers/dma/sh/shdma.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/sh/shdma.h +1 -1
@@ -25,7 +25,7 @@ struct sh_dmae_chan {const struct sh_dmae_slave_config *config;/* Slave DMA configuration */ int xmit_shift;/* log_2(bytes_per_xfer) */ void __iomem *base; -char dev_id[16 ];/* unique name per DMAC of channel */ +char dev_id[32 ];/* unique name per DMAC of channel */ int pm_error;dma_addr_t slave_addr; };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 12/195 dmaengine: fsl-qdma: increase size of irq_name
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vinod Koul <[email protected]>
[ Upstream commit 6386f6c995b3ab91c72cfb76e4465553c555a8da ]
We seem to have hit warnings of 'output may be truncated' which is fixed by increasing the size of 'irq_name'
drivers/dma/fsl-qdma.c: In function ‘fsl_qdma_irq_init’:drivers/dma/fsl-qdma.c:824:46: error: ‘%d’ directive writing between 1 and 11 bytes into a region of size 10 [-Werror=format-overflow=]
824 | sprintf(irq_name, "qdma-queue%d", i);
| ^~drivers/dma/fsl-qdma.c:824:35: note: directive argument in the range [-2147483641, 2147483646]
824 | sprintf(irq_name, "qdma-queue%d", i);
| ^~~~~~~~~~~~~~
drivers/dma/fsl-qdma.c:824:17: note: ‘sprintf’ output between 12 and 22 bytes into a destination of size 20
824 | sprintf(irq_name, "qdma-queue%d", i);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--- drivers/dma/fsl-qdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/fsl-qdma.c +1 -1
@@ -805,7 +805,7 @@ fsl_qdma_irq_init(struct platform_device *pdev,int i;int cpu;int ret; -char irq_name[20 ]; +char irq_name[32 ]; fsl_qdma->error_irq =platform_get_irq_byname (pdev,"qdma-error" );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 13/195 wifi: cfg80211: fix missing interfaces when dumping
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Kazior <[email protected]>
[ Upstream commit a6e4f85d3820d00694ed10f581f4c650445dbcda ]
The nl80211_dump_interface() supports resumption in case nl80211_send_iface() doesn't have the resources to complete its work.
The logic would store the progress as iteration offsets for rdev and wdev loops.
However the logic did not properly handle resumption for non-last rdev. Assuming a system with 2 rdevs, with 2 wdevs each, this could happen:
dump(cb=[0, 0]):
if_start=cb[1] (=0)
send rdev0.wdev0 -> ok
send rdev0.wdev1 -> yield
cb[1] = 1
dump(cb=[0, 1]):
if_start=cb[1] (=1)
send rdev0.wdev1 -> ok
// since if_start=1 the rdev0.wdev0 got skipped // through if_idx < if_start
send rdev1.wdev1 -> ok
The if_start needs to be reset back to 0 upon wdev loop end.
The problem is actually hard to hit on a desktop, and even on most routers. The prerequisites for this manifesting was:
- more than 1 wiphy
- a few handful of interfaces
- dump without rdev or wdev filter
I was seeing this with 4 wiphys 9 interfaces each. It'd miss 6 interfaces from the last wiphy reported to userspace.
--- net/wireless/nl80211.c | 1 + 1 file changed, 1 insertion(+)
net/wireless/nl80211.c +1 -0
@@ -3960,6 +3960,7 @@ static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback * if_idx++; } + if_start =0 ; wp_idx++; } out:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 14/195 wifi: mac80211: fix race condition on enabling fast-xmit
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit bcbc84af1183c8cf3d1ca9b78540c2185cd85e7f ]
fast-xmit must only be enabled after the sta has been uploaded to the driver, otherwise it could end up passing the not-yet-uploaded sta via drv_tx calls to the driver, leading to potential crashes because of uninitialized drv_priv data.
Add a missing sta->uploaded check and re-check fast xmit after inserting a sta.
--- net/mac80211/sta_info.c | 2 ++ net/mac80211/tx.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-)
net/mac80211/sta_info.c +2 -0
@@ -891,6 +891,8 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU)if (ieee80211_vif_is_mesh (&sdata->vif))mesh_accept_plinks_update (sdata); +ieee80211_check_fast_xmit (sta); +return 0 ; out_remove:if (sta->sta.valid_links)
net/mac80211/tx.c +1 -1
@@ -3044,7 +3044,7 @@ void ieee80211_check_fast_xmit(struct sta_info *sta) sdata->vif.type == NL80211_IFTYPE_STATION) goto out; -if (!test_sta_flag (sta,WLAN_STA_AUTHORIZED )) +if (!test_sta_flag (sta,WLAN_STA_AUTHORIZED ) || !sta->uploaded) goto out; if (test_sta_flag(sta, WLAN_STA_PS_STA) ||
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 5/195 sched/rt: sysctl_sched_rr_timeslice show default timeslice after reset
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cyril Hrubis <[email protected]>
commit c1fc6484e1fb7cc2481d169bfef129a1b0676abe upstream.
The sched_rr_timeslice can be reset to default by writing value that is <= 0. However after reading from this file we always got the last value written, which is not useful at all.
$ echo -1 > /proc/sys/kernel/sched_rr_timeslice_ms $ cat /proc/sys/kernel/sched_rr_timeslice_ms -1
Fix this by setting the variable that holds the sysctl file value to the jiffies_to_msecs(RR_TIMESLICE) in case that <= 0 value was written.
--- kernel/sched/rt.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/sched/rt.c +3 -0
@@ -3048,6 +3048,9 @@ static int sched_rr_handler(struct ctl_t sched_rr_timeslice = sysctl_sched_rr_timeslice <=0 ?RR_TIMESLICE :msecs_to_jiffies (sysctl_sched_rr_timeslice); + +if (sysctl_sched_rr_timeslice <=0 ) + sysctl_sched_rr_timeslice =jiffies_to_msecs (RR_TIMESLICE ); }mutex_unlock (&mutex);
Greg Kroah-Hartman
maintainerPATCH 37/195 Input: xpad - add Lenovo Legion Go controllers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brenton Simpson <[email protected]>
[ Upstream commit 80441f76ee67002437db61f3b317ed80cce085d2 ]
The Lenovo Legion Go is a handheld gaming system, similar to a Steam Deck. It has a gamepad (including rear paddles), 3 gyroscopes, a trackpad, volume buttons, a power button, and 2 LED ring lights.
The Legion Go firmware presents these controls as a USB hub with various devices attached. In its default state, the gamepad is presented as an Xbox controller connected to this hub. (By holding a combination of buttons, it can be changed to use the older DirectInput API.)
This patch teaches the existing Xbox controller module xpad to bind to the controller in the Legion Go, which enables support for the:
- directional pad,
- analog sticks (including clicks),
- X, Y, A, B,
- start and select (or menu and capture),
- shoulder buttons, and
- rumble.
The trackpad, touchscreen, volume controls, and power button are already supported via existing kernel modules. Two of the face buttons, the gyroscopes, rear paddles, and LEDs are not.
After this patch lands, the Legion Go will be mostly functional in Linux, out-of-the-box. The various components of the USB hub can be synthesized into a single logical controller (including the additional buttons) in userspace with [Handheld Daemon](https://github.com/hhd-dev/hhd), which makes the Go fully functional.
--- drivers/input/joystick/xpad.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/input/joystick/xpad.c +2 -0
@@ -294,6 +294,7 @@ static const struct xpad_device { { 0x1689, 0xfd00, "Razer Onza Tournament Edition", 0, XTYPE_XBOX360 }, { 0x1689, 0xfd01, "Razer Onza Classic Edition", 0, XTYPE_XBOX360 }, { 0x1689, 0xfe00, "Razer Sabertooth", 0, XTYPE_XBOX360 }, + { 0x17ef, 0x6182, "Lenovo Legion Controller for Windows", 0, XTYPE_XBOX360 }, { 0x1949, 0x041a, "Amazon Game Controller", 0, XTYPE_XBOX360 }, { 0x1bad, 0x0002, "Harmonix Rock Band Guitar", 0, XTYPE_XBOX360 }, { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
@@ -489,6 +490,7 @@ static const struct usb_device_id xpad_table[] = {XPAD_XBOX360_VENDOR (0x15e4 ),/* Numark X-Box 360 controllers */ XPAD_XBOX360_VENDOR (0x162e ),/* Joytech X-Box 360 controllers */ XPAD_XBOX360_VENDOR (0x1689 ),/* Razer Onza */ +XPAD_XBOX360_VENDOR (0x17ef ),/* Lenovo */ XPAD_XBOX360_VENDOR (0x1949 ),/* Amazon controllers */ XPAD_XBOX360_VENDOR (0x1bad ),/* Harminix Rock Band Guitar and Drums */ XPAD_XBOX360_VENDOR(0x20d6), /* PowerA Controllers */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 46/195 nvmet-fc: defer cleanup using RCU properly
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Wagner <[email protected]>
[ Upstream commit 4049dc96b8de7aeb3addcea039446e464726a525 ]
When the target executes a disconnect and the host triggers a reconnect immediately, the reconnect command still finds an existing association.
The reconnect crashes later on because nvmet_fc_delete_target_assoc blindly removes resources while the reconnect code wants to use it.
To address this, nvmet_fc_find_target_assoc should not be able to lookup an association which is being removed. The association list is already under RCU lifetime management, so let's properly use it and remove the association from the list and wait for a grace period before cleaning up all. This means we also can drop the RCU management on the queues, because this is now handled via the association itself.
A second step split the execution context so that the initial disconnect command can complete without running the reconnect code in the same context. As usual, this is done by deferring the ->done to a workqueue.
--- drivers/nvme/target/fc.c | 83 ++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 46 deletions(-)
drivers/nvme/target/fc.c +37 -46
@@ -165,7 +165,7 @@ struct nvmet_fc_tgt_assoc {struct nvmet_fc_hostport *hostport;struct nvmet_fc_ls_iod *rcv_disconn;struct list_head a_list; -struct nvmet_fc_tgt_queue __rcu *queues[NVMET_NR_QUEUES +1 ]; +struct nvmet_fc_tgt_queue *queues[NVMET_NR_QUEUES +1 ];struct kref ref;struct work_struct del_work;struct rcu_head rcu;
@@ -802,14 +802,11 @@ nvmet_fc_alloc_target_queue(struct nvmet_fc_tgt_assoc *assoc,if (!queue)return NULL ; -if (!nvmet_fc_tgt_a_get (assoc)) - goto out_free_queue; - queue->work_q =alloc_workqueue ("ntfc%d.%d.%d" ,0 ,0 , assoc->tgtport->fc_target_port.port_num, assoc->a_id, qid);if (!queue->work_q) - goto out_a_put; + goto out_free_queue; queue->qid = qid; queue->sqsize = sqsize;
@@ -831,15 +828,13 @@ nvmet_fc_alloc_target_queue(struct nvmet_fc_tgt_assoc *assoc, goto out_fail_iodlist;WARN_ON (assoc->queues[qid]); -rcu_assign_pointer (assoc->queues[qid], queue); + assoc->queues[qid] = queue;return queue; out_fail_iodlist:nvmet_fc_destroy_fcp_iodlist (assoc->tgtport, queue);destroy_workqueue (queue->work_q); -out_a_put: -nvmet_fc_tgt_a_put (assoc); out_free_queue:kfree (queue);return NULL ;
@@ -852,12 +847,8 @@ nvmet_fc_tgt_queue_free(struct kref *ref)struct nvmet_fc_tgt_queue *queue = container_of(ref, struct nvmet_fc_tgt_queue, ref); -rcu_assign_pointer (queue->assoc->queues[queue->qid],NULL ); -nvmet_fc_destroy_fcp_iodlist (queue->assoc->tgtport, queue); -nvmet_fc_tgt_a_put (queue->assoc); -destroy_workqueue (queue->work_q);kfree_rcu (queue, rcu);
@@ -969,7 +960,7 @@ nvmet_fc_find_target_queue(struct nvmet_fc_tgtport *tgtport,rcu_read_lock ();list_for_each_entry_rcu (assoc, &tgtport->assoc_list, a_list) {if (association_id == assoc->association_id) { - queue =rcu_dereference (assoc->queues[qid]); + queue = assoc->queues[qid];if (queue && (!atomic_read (&queue->connected) || !nvmet_fc_tgt_q_get (queue)))
@@ -1172,13 +1163,18 @@ nvmet_fc_target_assoc_free(struct kref *ref)struct nvmet_fc_tgtport *tgtport = assoc->tgtport;struct nvmet_fc_ls_iod *oldls;unsigned long flags; +int i; + +for (i =NVMET_NR_QUEUES ; i >=0 ; i--) { +if (assoc->queues[i]) +nvmet_fc_delete_target_queue (assoc->queues[i]); + }/* Send Disconnect now that all i/o has completed */ nvmet_fc_xmt_disconnect_assoc (assoc);nvmet_fc_free_hostport (assoc->hostport);spin_lock_irqsave (&tgtport->lock, flags); -list_del_rcu (&assoc->a_list); oldls = assoc->rcv_disconn;spin_unlock_irqrestore (&tgtport->lock, flags);/* if pending Rcv Disconnect Association LS, send rsp now */
@@ -1208,7 +1204,7 @@ static void nvmet_fc_delete_target_assoc(struct nvmet_fc_tgt_assoc *assoc) {struct nvmet_fc_tgtport *tgtport = assoc->tgtport; -struct nvmet_fc_tgt_queue *queue; +unsigned long flags;int i, terminating; terminating =atomic_xchg (&assoc->terminating,1 );
@@ -1217,29 +1213,21 @@ nvmet_fc_delete_target_assoc(struct nvmet_fc_tgt_assoc *assoc)if (terminating)return ; +spin_lock_irqsave (&tgtport->lock, flags); +list_del_rcu (&assoc->a_list); +spin_unlock_irqrestore (&tgtport->lock, flags); -for (i =NVMET_NR_QUEUES ; i >=0 ; i--) { -rcu_read_lock (); - queue =rcu_dereference (assoc->queues[i]); -if (!queue) { -rcu_read_unlock (); -continue ; - } +synchronize_rcu (); -if (!nvmet_fc_tgt_q_get (queue)) { -rcu_read_unlock (); -continue ; - } -rcu_read_unlock (); -nvmet_fc_delete_target_queue (queue); -nvmet_fc_tgt_q_put (queue); +/* ensure all in-flight I/Os have been processed */ +for (i =NVMET_NR_QUEUES ; i >=0 ; i--) { +if (assoc->queues[i]) +flush_workqueue (assoc->queues[i]->work_q); }dev_info (tgtport->dev,"{%d:%d} Association deleted\n" , tgtport->fc_target_port.port_num, assoc->a_id); - -nvmet_fc_tgt_a_put (assoc); } static struct nvmet_fc_tgt_assoc *
@@ -1492,9 +1480,8 @@ __nvmet_fc_free_assocs(struct nvmet_fc_tgtport *tgtport)list_for_each_entry_rcu (assoc, &tgtport->assoc_list, a_list) {if (!nvmet_fc_tgt_a_get (assoc))continue ; -if (!queue_work (nvmet_wq, &assoc->del_work)) -/* already deleting - release local reference */ -nvmet_fc_tgt_a_put (assoc); +queue_work (nvmet_wq, &assoc->del_work); +nvmet_fc_tgt_a_put (assoc); }rcu_read_unlock (); }
@@ -1547,9 +1534,8 @@ nvmet_fc_invalidate_host(struct nvmet_fc_target_port *target_port,continue ; assoc->hostport->invalid =1 ; noassoc = false; -if (!queue_work (nvmet_wq, &assoc->del_work)) -/* already deleting - release local reference */ -nvmet_fc_tgt_a_put (assoc); +queue_work (nvmet_wq, &assoc->del_work); +nvmet_fc_tgt_a_put (assoc); }spin_unlock_irqrestore (&tgtport->lock, flags);
@@ -1581,7 +1567,7 @@ nvmet_fc_delete_ctrl(struct nvmet_ctrl *ctrl)rcu_read_lock ();list_for_each_entry_rcu (assoc, &tgtport->assoc_list, a_list) { - queue =rcu_dereference (assoc->queues[0 ]); + queue = assoc->queues[0 ];if (queue && queue->nvme_sq.ctrl == ctrl) {if (nvmet_fc_tgt_a_get (assoc)) found_ctrl = true;
@@ -1593,9 +1579,8 @@ nvmet_fc_delete_ctrl(struct nvmet_ctrl *ctrl)nvmet_fc_tgtport_put (tgtport);if (found_ctrl) { -if (!queue_work (nvmet_wq, &assoc->del_work)) -/* already deleting - release local reference */ -nvmet_fc_tgt_a_put (assoc); +queue_work (nvmet_wq, &assoc->del_work); +nvmet_fc_tgt_a_put (assoc);return ; }
@@ -1625,6 +1610,8 @@ nvmet_fc_unregister_targetport(struct nvmet_fc_target_port *target_port)/* terminate any outstanding associations */ __nvmet_fc_free_assocs (tgtport); +flush_workqueue (nvmet_wq); +/* * should terminate LS's as well. However, LS's will be generated * at the tail end of association termination, so they likely don't
@@ -1870,9 +1857,6 @@ nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport, sizeof(struct fcnvme_ls_disconnect_assoc_acc)), FCNVME_LS_DISCONNECT_ASSOC); -/* release get taken in nvmet_fc_find_target_assoc */ -nvmet_fc_tgt_a_put (assoc); -/* * The rules for LS response says the response cannot * go back until ABTS's have been sent for all outstanding
@@ -1887,8 +1871,6 @@ nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport, assoc->rcv_disconn = iod;spin_unlock_irqrestore (&tgtport->lock, flags); -nvmet_fc_delete_target_assoc (assoc); -if (oldls) {dev_info (tgtport->dev, "{%d:%d} Multiple Disconnect Association LS's "
@@ -1904,6 +1886,9 @@ nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport,nvmet_fc_xmt_ls_rsp (tgtport, oldls); } +queue_work (nvmet_wq, &assoc->del_work); +nvmet_fc_tgt_a_put (assoc); +return false; }
@@ -2902,6 +2887,9 @@ nvmet_fc_remove_port(struct nvmet_port *port)nvmet_fc_portentry_unbind (pe); +/* terminate any outstanding associations */ +__nvmet_fc_free_assocs (pe->tgtport); +kfree (pe); }
@@ -2933,6 +2921,9 @@ static int __init nvmet_fc_init_module(void) static void __exit nvmet_fc_exit_module(void) { +/* ensure any shutdown operation, e.g. delete ctrls have finished */ +flush_workqueue (nvmet_wq); +/* sanity check - all lports should be removed */ if (!list_empty (&nvmet_fc_target_list))pr_warn ("%s: targetport list not empty\n" , __func__);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 47/195 nvmet-fc: hold reference on hostport match
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Wagner <[email protected]>
[ Upstream commit ca121a0f7515591dba0eb5532bfa7ace4dc153ce ]
The hostport data structure is shared between the association, this why we keep track of the users via a refcount. So we should not decrement the refcount on a match and free the hostport several times.
Reported by KASAN.
--- drivers/nvme/target/fc.c | 2 -- 1 file changed, 2 deletions(-)
drivers/nvme/target/fc.c +0 -2
@@ -1069,8 +1069,6 @@ nvmet_fc_alloc_hostport(struct nvmet_fc_tgtport *tgtport, void *hosthandle)/* new allocation not needed */ kfree (newhost); newhost = match; -/* no new allocation - release reference */ -nvmet_fc_tgtport_put (tgtport); }else { newhost->tgtport = tgtport; newhost->hosthandle = hosthandle;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 48/195 nvmet-fc: abort command when there is no binding
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Wagner <[email protected]>
[ Upstream commit 3146345c2e9c2f661527054e402b0cfad80105a4 ]
When the target port has not active port binding, there is no point in trying to process the command as it has to fail anyway. Instead adding checks to all commands abort the command early.
--- drivers/nvme/target/fc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/nvme/target/fc.c +6 -2
@@ -1101,6 +1101,9 @@ nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle)int idx;bool needrandom = true; +if (!tgtport->pe) +return NULL ; + assoc =kzalloc (sizeof (*assoc),GFP_KERNEL );if (!assoc)return NULL ;
@@ -2523,8 +2526,9 @@ nvmet_fc_handle_fcp_rqst(struct nvmet_fc_tgtport *tgtport, fod->req.cmd = &fod->cmdiubuf.sqe; fod->req.cqe = &fod->rspiubuf.cqe; -if (tgtport->pe) - fod->req.port = tgtport->pe->port; +if (!tgtport->pe) + goto transport_error; + fod->req.port = tgtport->pe->port;/* clear any response payload */ memset (&fod->rspiubuf,0 ,sizeof (fod->rspiubuf));
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 49/195 nvmet-fc: avoid deadlock on delete association path
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Wagner <[email protected]>
[ Upstream commit 710c69dbaccdac312e32931abcb8499c1525d397 ]
When deleting an association the shutdown path is deadlocking because we try to flush the nvmet_wq nested. Avoid this by deadlock by deferring the put work into its own work item.
--- drivers/nvme/target/fc.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/nvme/target/fc.c +13 -3
@@ -111,6 +111,8 @@ struct nvmet_fc_tgtport {struct nvmet_fc_port_entry *pe;struct kref ref;u32 max_sg_cnt; + +struct work_struct put_work; };struct nvmet_fc_port_entry {
@@ -248,6 +250,13 @@ static int nvmet_fc_tgt_a_get(struct nvmet_fc_tgt_assoc *assoc);static void nvmet_fc_tgt_q_put (struct nvmet_fc_tgt_queue *queue);static int nvmet_fc_tgt_q_get (struct nvmet_fc_tgt_queue *queue);static void nvmet_fc_tgtport_put (struct nvmet_fc_tgtport *tgtport); +static void nvmet_fc_put_tgtport_work (struct work_struct *work) +{ +struct nvmet_fc_tgtport *tgtport = + container_of(work, struct nvmet_fc_tgtport, put_work); + +nvmet_fc_tgtport_put (tgtport); +}static int nvmet_fc_tgtport_get (struct nvmet_fc_tgtport *tgtport);static void nvmet_fc_handle_fcp_rqst (struct nvmet_fc_tgtport *tgtport,struct nvmet_fc_fcp_iod *fod);
@@ -359,7 +368,7 @@ __nvmet_fc_finish_ls_req(struct nvmet_fc_ls_req_op *lsop)if (!lsop->req_queued) {spin_unlock_irqrestore (&tgtport->lock, flags); - goto out_puttgtport; + goto out_putwork; }list_del (&lsop->lsreq_list);
@@ -372,8 +381,8 @@ __nvmet_fc_finish_ls_req(struct nvmet_fc_ls_req_op *lsop) (lsreq->rqstlen + lsreq->rsplen), DMA_BIDIRECTIONAL); -out_puttgtport: -nvmet_fc_tgtport_put (tgtport); +out_putwork: +queue_work (nvmet_wq, &tgtport->put_work); } static int
@@ -1404,6 +1413,7 @@ nvmet_fc_register_targetport(struct nvmet_fc_port_info *pinfo,kref_init (&newrec->ref);ida_init (&newrec->assoc_cnt); newrec->max_sg_cnt = template->max_sgl_segments; +INIT_WORK (&newrec->put_work, nvmet_fc_put_tgtport_work); ret =nvmet_fc_alloc_ls_iodlist (newrec);if (ret) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 50/195 nvmet-fc: take ref count on tgtport before delete assoc
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Wagner <[email protected]>
[ Upstream commit fe506a74589326183297d5abdda02d0c76ae5a8b ]
We have to ensure that the tgtport is not going away before be have remove all the associations.
--- drivers/nvme/target/fc.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-)
drivers/nvme/target/fc.c +23 -8
@@ -1092,13 +1092,28 @@ nvmet_fc_alloc_hostport(struct nvmet_fc_tgtport *tgtport, void *hosthandle) }static void -nvmet_fc_delete_assoc (struct work_struct *work) +nvmet_fc_delete_assoc (struct nvmet_fc_tgt_assoc *assoc) +{ +nvmet_fc_delete_target_assoc (assoc); +nvmet_fc_tgt_a_put (assoc); +} + +static void +nvmet_fc_delete_assoc_work (struct work_struct *work) {struct nvmet_fc_tgt_assoc *assoc = container_of(work, struct nvmet_fc_tgt_assoc, del_work); +struct nvmet_fc_tgtport *tgtport = assoc->tgtport; -nvmet_fc_delete_target_assoc (assoc); -nvmet_fc_tgt_a_put (assoc); +nvmet_fc_delete_assoc (assoc); +nvmet_fc_tgtport_put (tgtport); +} + +static void +nvmet_fc_schedule_delete_assoc (struct nvmet_fc_tgt_assoc *assoc) +{ +nvmet_fc_tgtport_get (assoc->tgtport); +queue_work (nvmet_wq, &assoc->del_work); } static struct nvmet_fc_tgt_assoc *
@@ -1132,7 +1147,7 @@ nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle) assoc->a_id = idx;INIT_LIST_HEAD (&assoc->a_list);kref_init (&assoc->ref); -INIT_WORK (&assoc->del_work, nvmet_fc_delete_assoc); +INIT_WORK (&assoc->del_work, nvmet_fc_delete_assoc_work);atomic_set (&assoc->terminating,0 );while (needrandom) {
@@ -1491,7 +1506,7 @@ __nvmet_fc_free_assocs(struct nvmet_fc_tgtport *tgtport)list_for_each_entry_rcu (assoc, &tgtport->assoc_list, a_list) {if (!nvmet_fc_tgt_a_get (assoc))continue ; -queue_work (nvmet_wq, &assoc->del_work); +nvmet_fc_schedule_delete_assoc (assoc);nvmet_fc_tgt_a_put (assoc); }rcu_read_unlock ();
@@ -1545,7 +1560,7 @@ nvmet_fc_invalidate_host(struct nvmet_fc_target_port *target_port,continue ; assoc->hostport->invalid =1 ; noassoc = false; -queue_work (nvmet_wq, &assoc->del_work); +nvmet_fc_schedule_delete_assoc (assoc);nvmet_fc_tgt_a_put (assoc); }spin_unlock_irqrestore (&tgtport->lock, flags);
@@ -1590,7 +1605,7 @@ nvmet_fc_delete_ctrl(struct nvmet_ctrl *ctrl)nvmet_fc_tgtport_put (tgtport);if (found_ctrl) { -queue_work (nvmet_wq, &assoc->del_work); +nvmet_fc_schedule_delete_assoc (assoc);nvmet_fc_tgt_a_put (assoc);return ; }
@@ -1897,7 +1912,7 @@ nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport,nvmet_fc_xmt_ls_rsp (tgtport, oldls); } -queue_work (nvmet_wq, &assoc->del_work); +nvmet_fc_schedule_delete_assoc (assoc);nvmet_fc_tgt_a_put (assoc);return false;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 51/195 smb: client: increase number of PDUs allowed in a compound request
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <[email protected]>
[ Upstream commit 11d4d1dba3315f73d2d1d386f5bf4811a8241d45 ]
With the introduction of SMB2_OP_QUERY_WSL_EA, the client may now send 5 commands in a single compound request in order to query xattrs from potential WSL reparse points, which should be fine as we currently allow up to 5 PDUs in a single compound request. However, if encryption is enabled (e.g. 'seal' mount option) or enforced by the server, current MAX_COMPOUND(5) won't be enough as we require an extra PDU for the transform header.
Fix this by increasing MAX_COMPOUND to 7 and, while we're at it, add an WARN_ON_ONCE() and return -EIO instead of -ENOMEM in case we attempt to send a compound request that couldn't include the extra transform header.
--- fs/smb/client/cifsglob.h | 2 +- fs/smb/client/transport.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
fs/smb/client/cifsglob.h +1 -1
@@ -86,7 +86,7 @@#define SMB_INTERFACE_POLL_INTERVAL 600/* maximum number of PDUs in one compound */ -#define MAX_COMPOUND 5 +#define MAX_COMPOUND 7/* * Default number of credits to keep available for SMB3.
fs/smb/client/transport.c +2 -2
@@ -456,8 +456,8 @@ smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,if (!(flags &CIFS_TRANSFORM_REQ ))return __smb_send_rqst (server, num_rqst, rqst); -if (num_rqst >MAX_COMPOUND -1 ) -return -ENOMEM ; +if (WARN_ON_ONCE (num_rqst >MAX_COMPOUND -1 )) +return -EIO ;if (!server->ops->init_transform_rq) {cifs_server_dbg (VFS ,"Encryption requested but transform callback is missing\n" );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 52/195 ext4: correct the hole length returned by ext4_map_blocks()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Yi <[email protected]>
[ Upstream commit 6430dea07e85958fa87d0276c0c4388dd51e630b ]
In ext4_map_blocks(), if we can't find a range of mapping in the extents cache, we are calling ext4_ext_map_blocks() to search the real path and ext4_ext_determine_hole() to determine the hole range. But if the querying range was partially or completely overlaped by a delalloc extent, we can't find it in the real extent path, so the returned hole length could be incorrect.
Fortunately, ext4_ext_put_gap_in_cache() have already handle delalloc extent, but it searches start from the expanded hole_start, doesn't start from the querying range, so the delalloc extent found could not be the one that overlaped the querying range, plus, it also didn't adjust the hole length. Let's just remove ext4_ext_put_gap_in_cache(), handle delalloc and insert adjusted hole extent in ext4_ext_determine_hole().
--- fs/ext4/extents.c | 111 +++++++++++++++++++++++++++++----------------- 1 file changed, 70 insertions(+), 41 deletions(-)
fs/ext4/extents.c +70 -41
@@ -2229,7 +2229,7 @@ static int ext4_fill_es_cache_info(struct inode *inode,/* -* ext4_ext_determine_hole - determine hole around given block +* ext4_ext_find_hole - find hole around given block according to the given path * @inode: inode we lookup in * @path: path in extent tree to @lblk * @lblk: pointer to logical block around which we want to determine hole
@@ -2241,9 +2241,9 @@ static int ext4_fill_es_cache_info(struct inode *inode,* The function returns the length of a hole starting at @lblk. We update @lblk * to the beginning of the hole if we managed to find it. */ -static ext4_lblk_t ext4_ext_determine_hole (struct inode *inode, -struct ext4_ext_path *path, -ext4_lblk_t *lblk) +static ext4_lblk_t ext4_ext_find_hole (struct inode *inode, +struct ext4_ext_path *path, +ext4_lblk_t *lblk) {int depth =ext_depth (inode);struct ext4_extent *ex;
@@ -2270,30 +2270,6 @@ static ext4_lblk_t ext4_ext_determine_hole(struct inode *inode,return len; } -/* -* ext4_ext_put_gap_in_cache: -* calculate boundaries of the gap that the requested block fits into -* and cache this gap -*/ -static void -ext4_ext_put_gap_in_cache (struct inode *inode,ext4_lblk_t hole_start, -ext4_lblk_t hole_len) -{ -struct extent_status es; - -ext4_es_find_extent_range (inode, &ext4_es_is_delayed, hole_start, - hole_start + hole_len -1 , &es); -if (es.es_len) { -/* There's delayed extent containing lblock? */ -if (es.es_lblk <= hole_start) -return ; - hole_len =min (es.es_lblk - hole_start, hole_len); - } -ext_debug (inode," -> %u:%u\n" , hole_start, hole_len); -ext4_es_insert_extent (inode, hole_start, hole_len, ~0 , -EXTENT_STATUS_HOLE ); -} -/* * ext4_ext_rm_idx: * removes index from the index block.
@@ -4064,6 +4040,69 @@ static int get_implied_cluster_alloc(struct super_block *sb,return 0 ; } +/* +* Determine hole length around the given logical block, first try to +* locate and expand the hole from the given @path, and then adjust it +* if it's partially or completely converted to delayed extents, insert +* it into the extent cache tree if it's indeed a hole, finally return +* the length of the determined extent. +*/ +static ext4_lblk_t ext4_ext_determine_insert_hole (struct inode *inode, +struct ext4_ext_path *path, +ext4_lblk_t lblk) +{ +ext4_lblk_t hole_start, len; +struct extent_status es; + + hole_start = lblk; + len =ext4_ext_find_hole (inode, path, &hole_start); +again: +ext4_es_find_extent_range (inode, &ext4_es_is_delayed, hole_start, + hole_start + len -1 , &es); +if (!es.es_len) + goto insert_hole; + +/* +* There's a delalloc extent in the hole, handle it if the delalloc +* extent is in front of, behind and straddle the queried range. +*/ +if (lblk >= es.es_lblk + es.es_len) { +/* +* The delalloc extent is in front of the queried range, +* find again from the queried start block. +*/ + len -= lblk - hole_start; + hole_start = lblk; + goto again; + }else if (in_range (lblk, es.es_lblk, es.es_len)) { +/* +* The delalloc extent containing lblk, it must have been +* added after ext4_map_blocks() checked the extent status +* tree, adjust the length to the delalloc extent's after +* lblk. +*/ + len = es.es_lblk + es.es_len - lblk; +return len; + }else { +/* +* The delalloc extent is partially or completely behind +* the queried range, update hole length until the +* beginning of the delalloc extent. +*/ + len =min (es.es_lblk - hole_start, len); + } + +insert_hole: +/* Put just found gap into cache to speed up subsequent requests */ +ext_debug (inode," -> %u:%u\n" , hole_start, len); +ext4_es_insert_extent (inode, hole_start, len, ~0 ,EXTENT_STATUS_HOLE ); + +/* Update hole_len to reflect hole size after lblk */ +if (hole_start != lblk) + len -= lblk - hole_start; + +return len; +}/* * Block allocation/map/preallocation routine for extents based files
@@ -4181,22 +4220,12 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,* we couldn't try to create block if create flag is zero */ if ((flags &EXT4_GET_BLOCKS_CREATE ) ==0 ) { -ext4_lblk_t hole_start, hole_len; +ext4_lblk_t len; - hole_start = map->m_lblk; - hole_len =ext4_ext_determine_hole (inode, path, &hole_start); -/* -* put just found gap into cache to speed up -* subsequent requests -*/ -ext4_ext_put_gap_in_cache (inode, hole_start, hole_len); + len =ext4_ext_determine_insert_hole (inode, path, map->m_lblk); -/* Update hole_len to reflect hole size after map->m_lblk */ -if (hole_start != map->m_lblk) - hole_len -= map->m_lblk - hole_start; map->m_pblk =0 ; - map->m_len = min_t(unsigned int, map->m_len, hole_len); - + map->m_len = min_t(unsigned int, map->m_len, len); goto out; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 53/195 Input: i8042 - add Fujitsu Lifebook U728 to i8042 quirk table
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Szilard Fabian <[email protected]>
[ Upstream commit 4255447ad34c5c3785fcdcf76cfa0271d6e5ed39 ]
Another Fujitsu-related patch.
In the initial boot stage the integrated keyboard of Fujitsu Lifebook U728 refuses to work and it's not possible to type for example a dm-crypt passphrase without the help of an external keyboard.
i8042.nomux kernel parameter resolves this issue but using that a PS/2 mouse is detected. This input device is unused even when the i2c-hid-acpi kernel module is blacklisted making the integrated ELAN touchpad (04F3:3092) not working at all.
So this notebook uses a hid-over-i2c touchpad which is managed by the i2c_designware input driver. Since you can't find a PS/2 mouse port on this computer and you can't connect a PS/2 mouse to it even with an official port replicator I think it's safe to not use the PS/2 mouse port at all.
--- drivers/input/serio/i8042-acpipnpio.h | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/input/serio/i8042-acpipnpio.h +8 -0
@@ -634,6 +634,14 @@ static const struct dmi_system_id i8042_dmi_quirk_table[] __initconst = { }, .driver_data = (void *)(SERIO_QUIRK_NOAUX) }, + { +/* Fujitsu Lifebook U728 */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"FUJITSU" ), + DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U728"), + }, + .driver_data = (void *)(SERIO_QUIRK_NOAUX ) + }, {/* Gigabyte M912 */ .matches = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 54/195 fs/ntfs3: Modified fix directory element type detection
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 22457c047ed971f2f2e33be593ddfabd9639a409 ]
Unfortunately reparse attribute is used for many purposes (several dozens). It is not possible here to know is this name symlink or not.
To get exactly the type of name we should to open inode (read mft). getattr for opened file (fstat) correctly returns symlink.
--- fs/ntfs3/dir.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-)
fs/ntfs3/dir.c +25 -5
@@ -309,11 +309,31 @@ static inline int ntfs_filldir(struct ntfs_sb_info *sbi, struct ntfs_inode *ni,return 0 ; } -/* NTFS: symlinks are "dir + reparse" or "file + reparse" */ -if (fname->dup.fa &FILE_ATTRIBUTE_REPARSE_POINT ) - dt_type =DT_LNK ; -else - dt_type = (fname->dup.fa &FILE_ATTRIBUTE_DIRECTORY ) ?DT_DIR :DT_REG ; +/* +* NTFS: symlinks are "dir + reparse" or "file + reparse" +* Unfortunately reparse attribute is used for many purposes (several dozens). +* It is not possible here to know is this name symlink or not. +* To get exactly the type of name we should to open inode (read mft). +* getattr for opened file (fstat) correctly returns symlink. +*/ + dt_type = (fname->dup.fa &FILE_ATTRIBUTE_DIRECTORY ) ?DT_DIR :DT_REG ; + +/* +* It is not reliable to detect the type of name using duplicated information +* stored in parent directory. +* The only correct way to get the type of name - read MFT record and find ATTR_STD. +* The code below is not good idea. +* It does additional locks/reads just to get the type of name. +* Should we use additional mount option to enable branch below? +*/ +if ((fname->dup.fa &FILE_ATTRIBUTE_REPARSE_POINT ) && + ino != ni->mi.rno) { +struct inode *inode =ntfs_iget5 (sbi->sb, &e->ref,NULL ); +if (!IS_ERR_OR_NULL (inode)) { + dt_type =fs_umode_to_dtype (inode->i_mode); +iput (inode); + } + }return !dir_emit (ctx, (s8 *)name, name_len, ino, dt_type); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 55/195 fs/ntfs3: Improve ntfs_dir_count
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 6a799c928b78b14999b7705c4cca0f88e297fe96 ]
--- fs/ntfs3/dir.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
fs/ntfs3/dir.c +3 -7
@@ -515,11 +515,9 @@ static int ntfs_dir_count(struct inode *dir, bool *is_empty, size_t *dirs,struct INDEX_HDR *hdr;const struct ATTR_FILE_NAME *fname;u32 e_size, off, end; -u64 vbo =0 ;size_t drs =0 , fles =0 , bit =0 ; -loff_t i_size = ni->vfs_inode.i_size;struct indx_node *node =NULL ; -u8 index_bits = ni->dir.index_bits; +size_t max_indx = ni->vfs_inode.i_size >> ni->dir.index_bits;if (is_empty) *is_empty = true;
@@ -563,7 +561,7 @@ static int ntfs_dir_count(struct inode *dir, bool *is_empty, size_t *dirs, fles +=1 ; } -if (vbo >= i_size) +if (bit >= max_indx) goto out; err =indx_used_bit (&ni->dir, ni, &bit);
@@ -573,8 +571,7 @@ static int ntfs_dir_count(struct inode *dir, bool *is_empty, size_t *dirs,if (bit ==MINUS_ONE_T ) goto out; - vbo = (u64 )bit << index_bits; -if (vbo >= i_size) +if (bit >= max_indx) goto out; err = indx_read(&ni->dir, ni, bit << ni->dir.idx2vbn_bits,
@@ -584,7 +581,6 @@ static int ntfs_dir_count(struct inode *dir, bool *is_empty, size_t *dirs, hdr = &node->index->ihdr; bit +=1 ; - vbo = (u64 )bit << ni->dir.idx2vbn_bits; } out:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 38/195 misc: open-dice: Fix spurious lockdep warning
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
[ Upstream commit ac9762a74c7ca7cbfcb4c65f5871373653a046ac ]
When probing the open-dice driver with PROVE_LOCKING=y, lockdep complains that the mutex in 'drvdata->lock' has a non-static key:
| INFO: trying to register non-static key. | The code is fine but needs lockdep annotation, or maybe | you didn't initialize this object before use? | turning off the locking correctness validator.
Fix the problem by initialising the mutex memory with mutex_init() instead of __MUTEX_INITIALIZER().
--- drivers/misc/open-dice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/open-dice.c +1 -1
@@ -142,7 +142,6 @@ static int __init open_dice_probe(struct platform_device *pdev)return -ENOMEM ; *drvdata = (struct open_dice_drvdata ){ - .lock =__MUTEX_INITIALIZER (drvdata->lock), .rmem = rmem, .misc = (struct miscdevice ){ .parent = dev,
@@ -152,6 +151,7 @@ static int __init open_dice_probe(struct platform_device *pdev) .mode = 0600, }, }; +mutex_init (&drvdata->lock);/* Index overflow check not needed, misc_register() will fail. */ snprintf (drvdata->name,sizeof (drvdata->name),DRIVER_NAME "%u" , dev_idx++);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 56/195 fs/ntfs3: Correct hard links updating when dealing with DOS names
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 1918c10e137eae266b8eb0ab1cc14421dcb0e3e2 ]
--- fs/ntfs3/record.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
fs/ntfs3/record.c +14 -2
@@ -491,8 +491,20 @@ bool mi_remove_attr(struct ntfs_inode *ni, struct mft_inode *mi,return false;if (ni &&is_attr_indexed (attr)) { -le16_add_cpu (&ni->mi.mrec->hard_links,-1 ); - ni->mi.dirty = true; +u16 links =le16_to_cpu (ni->mi.mrec->hard_links); +struct ATTR_FILE_NAME *fname = + attr->type !=ATTR_NAME ? +NULL : +resident_data_ex (attr, +SIZEOF_ATTRIBUTE_FILENAME ); +if (fname && fname->type ==FILE_NAME_DOS ) { +/* Do not decrease links count deleting DOS name. */ + }else if (!links) { +/* minor error. Not critical. */ + }else { + ni->mi.mrec->hard_links =cpu_to_le16 (links -1 ); + ni->mi.dirty = true; + } } used -= asize;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 57/195 fs/ntfs3: Print warning while fixing hard links count
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 85ba2a75faee759809a7e43b4c103ac59bac1026 ]
--- fs/ntfs3/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/inode.c +1 -1
@@ -402,7 +402,6 @@ static struct inode *ntfs_read_mft(struct inode *inode, goto out;if (!is_match && name) { -/* Reuse rec as buffer for ascii name. */ err = -ENOENT ; goto out; }
@@ -417,6 +416,7 @@ static struct inode *ntfs_read_mft(struct inode *inode,if (names !=le16_to_cpu (rec->hard_links)) {/* Correct minor error on the fly. Do not mark inode as dirty. */ +ntfs_inode_warn (inode,"Correct links count -> %u." , names); rec->hard_links =cpu_to_le16 (names); ni->mi.dirty = true; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 58/195 fs/ntfs3: Fix detected field-spanning write (size 8) of single field "le->name"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit d155617006ebc172a80d3eb013c4b867f9a8ada4 ]
--- fs/ntfs3/ntfs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/ntfs.h +1 -1
@@ -517,7 +517,7 @@ struct ATTR_LIST_ENTRY {__le64 vcn;// 0x08: Starting VCN of this attribute. struct MFT_REF ref;// 0x10: MFT record number with attribute. __le16 id;// 0x18: struct ATTRIB ID. -__le16 name[3 ];// 0x1A: Just to align. To get real name can use bNameOffset. +__le16 name[];// 0x1A: Just to align. To get real name can use name_off. };// sizeof(0x20)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 59/195 fs/ntfs3: Add NULL ptr dereference checking at the end of attr_allocate_frame()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit aaab47f204aaf47838241d57bf8662c8840de60a ]
It is preferable to exit through the out: label because internal debugging functions are located there.
--- fs/ntfs3/attrib.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
fs/ntfs3/attrib.c +12 -8
@@ -1658,8 +1658,10 @@ int attr_allocate_frame(struct ntfs_inode *ni, CLST frame, size_t compr_size, le_b =NULL ; attr_b =ni_find_attr (ni,NULL , &le_b,ATTR_DATA ,NULL ,0 ,NULL , &mi_b); -if (!attr_b) -return -ENOENT ; +if (!attr_b) { + err = -ENOENT ; + goto out; + } attr = attr_b; le = le_b;
@@ -1740,13 +1742,15 @@ int attr_allocate_frame(struct ntfs_inode *ni, CLST frame, size_t compr_size, ok:run_truncate_around (run, vcn); out: -if (new_valid > data_size) - new_valid = data_size; +if (attr_b) { +if (new_valid > data_size) + new_valid = data_size; - valid_size =le64_to_cpu (attr_b->nres.valid_size); -if (new_valid != valid_size) { - attr_b->nres.valid_size =cpu_to_le64 (valid_size); - mi_b->dirty = true; + valid_size =le64_to_cpu (attr_b->nres.valid_size); +if (new_valid != valid_size) { + attr_b->nres.valid_size =cpu_to_le64 (valid_size); + mi_b->dirty = true; + } }return err;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 60/195 fs/ntfs3: Disable ATTR_LIST_ENTRY size check
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 4cdfb6e7bc9c80142d33bf1d4653a73fa678ba56 ]
The use of sizeof(struct ATTR_LIST_ENTRY) has been replaced with le_size(0) due to alignment peculiarities on different platforms.
--- fs/ntfs3/attrlist.c | 8 ++++---- fs/ntfs3/ntfs.h | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-)
fs/ntfs3/attrlist.c +4 -4
@@ -127,12 +127,13 @@ struct ATTR_LIST_ENTRY *al_enumerate(struct ntfs_inode *ni, {size_t off;u16 sz; +const unsigned le_min_size =le_size (0 );if (!le) { le = ni->attr_list.le; }else { sz =le16_to_cpu (le->size); -if (sz <sizeof (struct ATTR_LIST_ENTRY )) { +if (sz < le_min_size) {/* Impossible 'cause we should not return such le. */ return NULL ; }
@@ -141,7 +142,7 @@ struct ATTR_LIST_ENTRY *al_enumerate(struct ntfs_inode *ni,/* Check boundary. */ off =PtrOffset (ni->attr_list.le, le); -if (off +sizeof (struct ATTR_LIST_ENTRY ) > ni->attr_list.size) { +if (off + le_min_size > ni->attr_list.size) {/* The regular end of list. */ return NULL ; }
@@ -149,8 +150,7 @@ struct ATTR_LIST_ENTRY *al_enumerate(struct ntfs_inode *ni, sz =le16_to_cpu (le->size);/* Check le for errors. */ -if (sz <sizeof (struct ATTR_LIST_ENTRY ) || - off + sz > ni->attr_list.size || +if (sz < le_min_size || off + sz > ni->attr_list.size || sz < le->name_off + le->name_len *sizeof (short )) {return NULL ; }
fs/ntfs3/ntfs.h +0 -2
@@ -521,8 +521,6 @@ struct ATTR_LIST_ENTRY { };// sizeof(0x20) -static_assert (sizeof (struct ATTR_LIST_ENTRY ) ==0x20 ); -static inline u32 le_size (u8 name_len) { return ALIGN(offsetof(struct ATTR_LIST_ENTRY, name) +
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 61/195 fs/ntfs3: use non-movable memory for ntfs3 MFT buffer cache
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ism Hong <[email protected]>
[ Upstream commit d6d33f03baa43d763fe094ca926eeae7d3421d07 ]
Since the buffer cache for ntfs3 metadata is not released until the file system is unmounted, allocating from the movable zone may result in cma allocation failures. This is due to the page still being used by ntfs3, leading to migration failures.
To address this, this commit use sb_bread_umovable() instead of sb_bread(). This change prevents allocation from the movable zone, ensuring compatibility with scenarios where the buffer head is not released until unmount. This patch is inspired by commit a8ac900b8163("ext4: use non-movable memory for the ext4 superblock").
The issue is found when playing video files stored in NTFS on the Android TV platform. During this process, the media parser reads the video file, causing ntfs3 to allocate buffer cache from the CMA area. Subsequently, the hardware decoder attempts to allocate memory from the same CMA area. However, the page is still in use by ntfs3, resulting in a migrate failure in alloc_contig_range().
The pinned page and allocating stacktrace reported by page owner shows below:
page:ffffffff00b68880 refcount:3 mapcount:0 mapping:ffffff80046aa828
index:0xc0040 pfn:0x20fa4
aops:def_blk_aops ino:0
flags: 0x2020(active|private)
page dumped because: migration failure
page last allocated via order 0, migratetype Movable,
gfp_mask 0x108c48
(GFP_NOFS|__GFP_NOFAIL|__GFP_HARDWALL|__GFP_MOVABLE),
page_owner tracks the page as allocated
prep_new_page
get_page_from_freelist
__alloc_pages_nodemask
pagecache_get_page
__getblk_gfp
__bread_gfp
ntfs_read_run_nb
ntfs_read_bh
mi_read
ntfs_iget5
dir_search_u
ntfs_lookup
__lookup_slow
lookup_slow
walk_component
path_lookupat--- fs/ntfs3/ntfs_fs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/ntfs_fs.h +1 -1
@@ -1015,7 +1015,7 @@ static inline u64 bytes_to_block(const struct super_block *sb, u64 size)static inline struct buffer_head *ntfs_bread (struct super_block *sb,sector_t block) { -struct buffer_head *bh =sb_bread (sb, block); +struct buffer_head *bh =sb_bread_unmovable (sb, block);if (bh)return bh;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 62/195 fs/ntfs3: Prevent generic message "attempt to access beyond end of device"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 5ca87d01eba7bdfe9536a157ca33c1455bb8d16c ]
It used in test environment.
--- fs/ntfs3/fsntfs.c | 24 ++++++++++++++++++++++++ fs/ntfs3/ntfs_fs.h | 14 +------------- 2 files changed, 25 insertions(+), 13 deletions(-)
fs/ntfs3/fsntfs.c +24 -0
@@ -976,6 +976,30 @@ static inline __le32 security_hash(const void *sd, size_t bytes)return cpu_to_le32 (hash); } +/* +* simple wrapper for sb_bread_unmovable. +*/ +struct buffer_head *ntfs_bread (struct super_block *sb,sector_t block) +{ +struct ntfs_sb_info *sbi = sb->s_fs_info; +struct buffer_head *bh; + +if (unlikely (block >= sbi->volume.blocks)) { +/* prevent generic message "attempt to access beyond end of device" */ +ntfs_err (sb,"try to read out of volume at offset 0x%llx" , + (u64 )block << sb->s_blocksize_bits); +return NULL ; + } + + bh =sb_bread_unmovable (sb, block); +if (bh) +return bh; + +ntfs_err (sb,"failed to read volume at offset 0x%llx" , + (u64 )block << sb->s_blocksize_bits); +return NULL ; +} +int ntfs_sb_read (struct super_block *sb,u64 lbo,size_t bytes,void *buffer) {struct block_device *bdev = sb->s_bdev;
fs/ntfs3/ntfs_fs.h +1 -13
@@ -580,6 +580,7 @@ bool check_index_header(const struct INDEX_HDR *hdr, size_t bytes);int log_replay (struct ntfs_inode *ni,bool *initialized);/* Globals from fsntfs.c */ +struct buffer_head *ntfs_bread (struct super_block *sb,sector_t block);bool ntfs_fix_pre_write (struct NTFS_RECORD_HEADER *rhdr,size_t bytes);int ntfs_fix_post_read (struct NTFS_RECORD_HEADER *rhdr,size_t bytes,bool simple);
@@ -1012,19 +1013,6 @@ static inline u64 bytes_to_block(const struct super_block *sb, u64 size)return (size + sb->s_blocksize -1 ) >> sb->s_blocksize_bits; } -static inline struct buffer_head *ntfs_bread (struct super_block *sb, -sector_t block) -{ -struct buffer_head *bh =sb_bread_unmovable (sb, block); - -if (bh) -return bh; - -ntfs_err (sb,"failed to read volume at offset 0x%llx" , - (u64 )block << sb->s_blocksize_bits); -return NULL ; -} -static inline struct ntfs_inode *ntfs_i (struct inode *inode) { return container_of(inode, struct ntfs_inode, vfs_inode);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 63/195 fs/ntfs3: Correct function is_rst_area_valid
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 1b7dd28e14c4728ae1a815605ca33ffb4ce1b309 ]
--- fs/ntfs3/fslog.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
fs/ntfs3/fslog.c +8 -6
@@ -465,7 +465,7 @@ static inline bool is_rst_area_valid(const struct RESTART_HDR *rhdr) {const struct RESTART_AREA *ra;u16 cl, fl, ul; -u32 off, l_size, file_dat_bits, file_size_round; +u32 off, l_size, seq_bits;u16 ro =le16_to_cpu (rhdr->ra_off);u32 sys_page =le32_to_cpu (rhdr->sys_page_size);
@@ -511,13 +511,15 @@ static inline bool is_rst_area_valid(const struct RESTART_HDR *rhdr)/* Make sure the sequence number bits match the log file size. */ l_size =le64_to_cpu (ra->l_size); - file_dat_bits =sizeof (u64) *8 -le32_to_cpu (ra->seq_num_bits); - file_size_round =1u << (file_dat_bits +3 ); -if (file_size_round != l_size && - (file_size_round < l_size || (file_size_round /2 ) > l_size)) { -return false; + seq_bits =sizeof (u64) *8 +3 ; +while (l_size) { + l_size >>=1 ; + seq_bits -=1 ; } +if (seq_bits != ra->seq_num_bits) +return false; +/* The log page data offset and record header length must be quad-aligned. */ if (!IS_ALIGNED (le16_to_cpu (ra->data_off),8 ) || !IS_ALIGNED (le16_to_cpu (ra->rec_hdr_len),8 ))
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 64/195 fs/ntfs3: Update inode->i_size after success write into compressed file
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit d68968440b1a75dee05cfac7f368f1aa139e1911 ]
--- fs/ntfs3/file.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ntfs3/file.c +2 -0
@@ -1110,6 +1110,8 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from) iocb->ki_pos += written;if (iocb->ki_pos > ni->i_valid) ni->i_valid = iocb->ki_pos; +if (iocb->ki_pos > i_size) +i_size_write (inode, iocb->ki_pos);return written; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 65/195 fs/ntfs3: Fix oob in ntfs_listxattr
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <[email protected]>
[ Upstream commit 731ab1f9828800df871c5a7ab9ffe965317d3f15 ]
The length of name cannot exceed the space occupied by ea.
--- fs/ntfs3/xattr.c | 3 +++ 1 file changed, 3 insertions(+)
fs/ntfs3/xattr.c +3 -0
@@ -217,6 +217,9 @@ static ssize_t ntfs_list_ea(struct ntfs_inode *ni, char *buffer,if (!ea->name_len)break ; +if (ea->name_len > ea_size) +break ; +if (buffer) {/* Check if we can use field ea->name */ if (off + ea_size > size)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 39/195 netfilter: conntrack: check SCTP_CID_SHUTDOWN_ACK for vtag setting in sctp_new
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit 6e348067ee4bc5905e35faa3a8fafa91c9124bc7 ]
The annotation says in sctp_new(): "If it is a shutdown ack OOTB packet, we expect a return shutdown complete, otherwise an ABORT Sec 8.4 (5) and (8)". However, it does not check SCTP_CID_SHUTDOWN_ACK before setting vtag[REPLY] in the conntrack entry(ct).
Because of that, if the ct in Router disappears for some reason in [1] with the packet sequence like below:
Client > Server: sctp (1) [INIT] [init tag: 3201533963] Server > Client: sctp (1) [INIT ACK] [init tag: 972498433] Client > Server: sctp (1) [COOKIE ECHO]
Server > Client: sctp (1) [COOKIE ACK]
Client > Server: sctp (1) [DATA] (B)(E) [TSN: 3075057809] Server > Client: sctp (1) [SACK] [cum ack 3075057809] Server > Client: sctp (1) [HB REQ]
(the ct in Router disappears somehow) <-------- [1] Client > Server: sctp (1) [HB ACK]
Client > Server: sctp (1) [DATA] (B)(E) [TSN: 3075057810] Client > Server: sctp (1) [DATA] (B)(E) [TSN: 3075057810] Client > Server: sctp (1) [HB REQ]
Client > Server: sctp (1) [DATA] (B)(E) [TSN: 3075057810] Client > Server: sctp (1) [HB REQ]
Client > Server: sctp (1) [ABORT]
when processing HB ACK packet in Router it calls sctp_new() to initialize the new ct with vtag[REPLY] set to HB_ACK packet's vtag.
Later when sending DATA from Client, all the SACKs from Server will get dropped in Router, as the SACK packet's vtag does not match vtag[REPLY] in the ct. The worst thing is the vtag in this ct will never get fixed by the upcoming packets from Server.
This patch fixes it by checking SCTP_CID_SHUTDOWN_ACK before setting vtag[REPLY] in the ct in sctp_new() as the annotation says. With this fix, it will leave vtag[REPLY] in ct to 0 in the case above, and the next HB REQ/ACK from Server is able to fix the vtag as its value is 0 in nf_conntrack_sctp_packet().
--- net/netfilter/nf_conntrack_proto_sctp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_conntrack_proto_sctp.c +1 -1
@@ -299,7 +299,7 @@ sctp_new(struct nf_conn *ct, const struct sk_buff *skb,pr_debug ("Setting vtag %x for secondary conntrack\n" , sh->vtag); ct->proto.sctp.vtag[IP_CT_DIR_ORIGINAL ] = sh->vtag; - }else { + }else if (sch->type ==SCTP_CID_SHUTDOWN_ACK ) {/* If it is a shutdown ack OOTB packet, we expect a return shutdown complete, otherwise an ABORT Sec 8.4 (5) and (8) */ pr_debug("Setting vtag %x for new conn OOTB\n",
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 66/195 wifi: mac80211: set station RX-NSS on reconfig
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit dd6c064cfc3fc18d871107c6f5db8837e88572e4 ]
When a station is added/reconfigured by userspace, e.g. a TDLS peer or a SoftAP client STA, rx_nss is currently not always set, so that it might be left zero. Set it up properly.
--- net/mac80211/cfg.c | 2 ++ 1 file changed, 2 insertions(+)
net/mac80211/cfg.c +2 -0
@@ -1775,6 +1775,8 @@ static int sta_link_apply_parameters(struct ieee80211_local *local, sband->band); } +ieee80211_sta_set_rx_nss (link_sta); +return ret; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 40/195 drm/amd/display: increased min_dcfclk_mhz and min_fclk_mhz
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sohaib Nadeem <[email protected]>
[ Upstream commit 2ff33c759a4247c84ec0b7815f1f223e155ba82a ]
[why]
Originally, PMFW said min FCLK is 300Mhz, but min DCFCLK can be increased to 400Mhz because min FCLK is now 600Mhz so FCLK >= 1.5 * DCFCLK hardware requirement will still be satisfied. Increasing min DCFCLK addresses underflow issues (underflow occurs when phantom pipe is turned on for some Sub-Viewport configs).
[how]
Increasing DCFCLK by raising the min_dcfclk_mhz
--- drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c +1 -1
@@ -2123,7 +2123,7 @@ static int build_synthetic_soc_states(struct clk_bw_params *bw_params,unsigned int max_dcfclk_mhz =0 , max_dispclk_mhz =0 , max_dppclk_mhz =0 , max_phyclk_mhz =0 , max_dtbclk_mhz =0 , max_fclk_mhz =0 , max_uclk_mhz =0 ; -unsigned int min_dcfclk_mhz =199 , min_fclk_mhz =299 ; +unsigned int min_dcfclk_mhz =399 , min_fclk_mhz =599 ;static const unsigned int num_dcfclk_stas =5 ;unsigned int dcfclk_sta_targets[DC__VOLTAGE_STATES ] = {199 ,615 ,906 ,1324 ,1564 };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 41/195 ASoC: wm_adsp: Dont overwrite fwf_name with the default
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Fitzgerald <[email protected]>
[ Upstream commit daf3f0f99cde93a066240462b7a87cdfeedc04c0 ]
There's no need to overwrite fwf_name with a kstrdup() of the cs_dsp part name. It is trivial to select either fwf_name or cs_dsp.part as the string to use when building the filename in wm_adsp_request_firmware_file().
This leaves fwf_name entirely owned by the codec driver.
It also avoids problems with freeing the pointer. With the original code fwf_name was either a pointer owned by the codec driver, or a kstrdup() created by wm_adsp. This meant wm_adsp must free it if it set it, but not if the codec driver set it. The code was handling this by using devm_kstrdup().
But there is no absolute requirement that wm_adsp_common_init() must be called from probe(), so this was a pseudo-memory leak - each new call to wm_adsp_common_init() would allocate another block of memory but these would only be freed if the owning codec driver was removed.
--- sound/soc/codecs/wm_adsp.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-)
sound/soc/codecs/wm_adsp.c +12 -17
@@ -740,19 +740,25 @@ static int wm_adsp_request_firmware_file(struct wm_adsp *dsp, const char *filetype) {struct cs_dsp *cs_dsp = &dsp->cs_dsp; +const char *fwf;char *s, c;int ret =0 ; +if (dsp->fwf_name) + fwf = dsp->fwf_name; +else + fwf = dsp->cs_dsp.name; +if (system_name && asoc_component_prefix) *filename =kasprintf (GFP_KERNEL ,"%s%s-%s-%s-%s-%s.%s" , dir, dsp->part, - dsp->fwf_name, wm_adsp_fw[dsp->fw].file, system_name, + fwf, wm_adsp_fw[dsp->fw].file, system_name, asoc_component_prefix, filetype);else if (system_name) *filename =kasprintf (GFP_KERNEL ,"%s%s-%s-%s-%s.%s" , dir, dsp->part, - dsp->fwf_name, wm_adsp_fw[dsp->fw].file, system_name, + fwf, wm_adsp_fw[dsp->fw].file, system_name, filetype);else - *filename =kasprintf (GFP_KERNEL ,"%s%s-%s-%s.%s" , dir, dsp->part, dsp->fwf_name, + *filename =kasprintf (GFP_KERNEL ,"%s%s-%s-%s.%s" , dir, dsp->part, fwf, wm_adsp_fw[dsp->fw].file, filetype);if (*filename ==NULL )
@@ -842,29 +848,18 @@ static int wm_adsp_request_firmware_files(struct wm_adsp *dsp, }adsp_err (dsp,"Failed to request firmware <%s>%s-%s-%s<-%s<%s>>.wmfw\n" , - cirrus_dir, dsp->part, dsp->fwf_name, wm_adsp_fw[dsp->fw].file, - system_name, asoc_component_prefix); + cirrus_dir, dsp->part, + dsp->fwf_name ? dsp->fwf_name : dsp->cs_dsp.name, + wm_adsp_fw[dsp->fw].file, system_name, asoc_component_prefix);return -ENOENT ; }static int wm_adsp_common_init (struct wm_adsp *dsp) { -char *p; -INIT_LIST_HEAD (&dsp->compr_list);INIT_LIST_HEAD (&dsp->buffer_list); -if (!dsp->fwf_name) { - p =devm_kstrdup (dsp->cs_dsp.dev, dsp->cs_dsp.name,GFP_KERNEL ); -if (!p) -return -ENOMEM ; - - dsp->fwf_name = p; -for (; *p !=0 ; ++p) - *p =tolower (*p); - } -return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 42/195 ALSA: usb-audio: Ignore clock selector errors for single connection
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Tsoy <[email protected]>
[ Upstream commit eaa1b01fe709d6a236a9cec74813e0400601fd23 ]
For devices with multiple clock sources connected to a selector, we need to check what a clock selector control request has returned. This is needed to ensure that a requested clock source is indeed selected and for autoclock feature to work.
For devices with single clock source connected, if we get an error there is nothing else we can do about it. We can't skip clock selector setup as it is required by some devices. So lets just ignore error in this case.
This should fix various buggy Mackie devices:
[ 649.109785] usb 1-1.3: parse_audio_format_rates_v2v3(): unable to find clock source (clock -32) [ 649.111946] usb 1-1.3: parse_audio_format_rates_v2v3(): unable to find clock source (clock -32) [ 649.113822] usb 1-1.3: parse_audio_format_rates_v2v3(): unable to find clock source (clock -32)
There is also interesting info from the Windows documentation [1] (this is probably why manufacturers dont't even test this feature):
"The USB Audio 2.0 driver doesn't support clock selection. The driver uses the Clock Source Entity, which is selected by default and never issues a Clock Selector Control SET CUR request."
--- sound/usb/clock.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
sound/usb/clock.c +9 -1
@@ -328,8 +328,16 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip,if (chip->quirk_flags &QUIRK_FLAG_SKIP_CLOCK_SELECTOR )return ret; err =uac_clock_selector_set_val (chip, entity_id, cur); -if (err <0 ) +if (err <0 ) { +if (pins ==1 ) { +usb_audio_dbg (chip, +"%s(): selector returned an error, " +"assuming a firmware bug, id %d, ret %d\n" , + __func__, clock_id, err); +return ret; + }return err; + } }if (!validate || ret >0 || !chip->autoclock)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 43/195 nvme-fc: do not wait in vain when unloading module
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Wagner <[email protected]>
[ Upstream commit 70fbfc47a392b98e5f8dba70c6efc6839205c982 ]
The module exit path has race between deleting all controllers and freeing 'left over IDs'. To prevent double free a synchronization between nvme_delete_ctrl and ida_destroy has been added by the initial commit.
There is some logic around trying to prevent from hanging forever in wait_for_completion, though it does not handling all cases. E.g. blktests is able to reproduce the situation where the module unload hangs forever.
If we completely rely on the cleanup code executed from the nvme_delete_ctrl path, all IDs will be freed eventually. This makes calling ida_destroy unnecessary. We only have to ensure that all nvme_delete_ctrl code has been executed before we leave nvme_fc_exit_module. This is done by flushing the nvme_delete_wq workqueue.
While at it, remove the unused nvme_fc_wq workqueue too.
--- drivers/nvme/host/fc.c | 47 ++++++------------------------------------ 1 file changed, 6 insertions(+), 41 deletions(-)
drivers/nvme/host/fc.c +6 -41
@@ -221,11 +221,6 @@ static LIST_HEAD(nvme_fc_lport_list);static DEFINE_IDA (nvme_fc_local_port_cnt);static DEFINE_IDA (nvme_fc_ctrl_cnt); -static struct workqueue_struct *nvme_fc_wq; - -static bool nvme_fc_waiting_to_unload; -static DECLARE_COMPLETION (nvme_fc_unload_proceed); -/* * These items are short-term. They will eventually be moved into * a generic FC class. See comments in module init.
@@ -255,8 +250,6 @@ nvme_fc_free_lport(struct kref *ref)/* remove from transport list */ spin_lock_irqsave (&nvme_fc_lock, flags);list_del (&lport->port_list); -if (nvme_fc_waiting_to_unload &&list_empty (&nvme_fc_lport_list)) -complete (&nvme_fc_unload_proceed);spin_unlock_irqrestore (&nvme_fc_lock, flags);ida_free (&nvme_fc_local_port_cnt, lport->localport.port_num);
@@ -3869,10 +3862,6 @@ static int __init nvme_fc_init_module(void) {int ret; - nvme_fc_wq =alloc_workqueue ("nvme_fc_wq" ,WQ_MEM_RECLAIM ,0 ); -if (!nvme_fc_wq) -return -ENOMEM ; -/* * NOTE: * It is expected that in the future the kernel will combine
@@ -3890,7 +3879,7 @@ static int __init nvme_fc_init_module(void) ret =class_register (&fc_class);if (ret) {pr_err ("couldn't register class fc\n" ); - goto out_destroy_wq; +return ret; }/*
@@ -3914,8 +3903,6 @@ static int __init nvme_fc_init_module(void)device_destroy (&fc_class,MKDEV (0 ,0 )); out_destroy_class:class_unregister (&fc_class); -out_destroy_wq: -destroy_workqueue (nvme_fc_wq);return ret; }
@@ -3935,45 +3922,23 @@ nvme_fc_delete_controllers(struct nvme_fc_rport *rport)spin_unlock (&rport->lock); } -static void -nvme_fc_cleanup_for_unload (void ) +static void __exit nvme_fc_exit_module(void) {struct nvme_fc_lport *lport;struct nvme_fc_rport *rport; - -list_for_each_entry (lport, &nvme_fc_lport_list, port_list) { -list_for_each_entry (rport, &lport->endp_list, endp_list) { -nvme_fc_delete_controllers (rport); - } - } -} - -static void __exit nvme_fc_exit_module(void) -{unsigned long flags; -bool need_cleanup = false;spin_lock_irqsave (&nvme_fc_lock, flags); - nvme_fc_waiting_to_unload = true; -if (!list_empty (&nvme_fc_lport_list)) { - need_cleanup = true; -nvme_fc_cleanup_for_unload (); - } +list_for_each_entry (lport, &nvme_fc_lport_list, port_list) +list_for_each_entry (rport, &lport->endp_list, endp_list) +nvme_fc_delete_controllers (rport);spin_unlock_irqrestore (&nvme_fc_lock, flags); -if (need_cleanup) { -pr_info ("%s: waiting for ctlr deletes\n" , __func__); -wait_for_completion (&nvme_fc_unload_proceed); -pr_info ("%s: ctrl deletes complete\n" , __func__); - } +flush_workqueue (nvme_delete_wq);nvmf_unregister_transport (&nvme_fc_transport); -ida_destroy (&nvme_fc_local_port_cnt); -ida_destroy (&nvme_fc_ctrl_cnt); -device_destroy (&fc_class,MKDEV (0 ,0 ));class_unregister (&fc_class); -destroy_workqueue (nvme_fc_wq); }module_init (nvme_fc_init_module);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 44/195 nvmet-fcloop: swap the list_add_tail arguments
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Wagner <[email protected]>
[ Upstream commit dcfad4ab4d6733f2861cd241d8532a0004fc835a ]
The first argument of list_add_tail function is the new element which should be added to the list which is the second argument. Swap the arguments to allow processing more than one element at a time.
--- drivers/nvme/target/fcloop.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/nvme/target/fcloop.c +3 -3
@@ -358,7 +358,7 @@ fcloop_h2t_ls_req(struct nvme_fc_local_port *localport,if (!rport->targetport) { tls_req->status = -ECONNREFUSED ;spin_lock (&rport->lock); -list_add_tail (&rport->ls_list, &tls_req->ls_list); +list_add_tail (&tls_req->ls_list, &rport->ls_list);spin_unlock (&rport->lock);queue_work (nvmet_wq, &rport->ls_work);return ret;
@@ -391,7 +391,7 @@ fcloop_h2t_xmt_ls_rsp(struct nvmet_fc_target_port *targetport,if (remoteport) { rport = remoteport->private;spin_lock (&rport->lock); -list_add_tail (&rport->ls_list, &tls_req->ls_list); +list_add_tail (&tls_req->ls_list, &rport->ls_list);spin_unlock (&rport->lock);queue_work (nvmet_wq, &rport->ls_work); }
@@ -446,7 +446,7 @@ fcloop_t2h_ls_req(struct nvmet_fc_target_port *targetport, void *hosthandle,if (!tport->remoteport) { tls_req->status = -ECONNREFUSED ;spin_lock (&tport->lock); -list_add_tail (&tport->ls_list, &tls_req->ls_list); +list_add_tail (&tls_req->ls_list, &tport->ls_list);spin_unlock (&tport->lock);queue_work (nvmet_wq, &tport->ls_work);return ret;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 45/195 nvmet-fc: release reference on target port
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Wagner <[email protected]>
[ Upstream commit c691e6d7e13dab81ac8c7489c83b5dea972522a5 ]
In case we return early out of __nvmet_fc_finish_ls_req() we still have to release the reference on the target port.
--- drivers/nvme/target/fc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/target/fc.c +2 -1
@@ -359,7 +359,7 @@ __nvmet_fc_finish_ls_req(struct nvmet_fc_ls_req_op *lsop)if (!lsop->req_queued) {spin_unlock_irqrestore (&tgtport->lock, flags); -return ; + goto out_puttgtport; }list_del (&lsop->lsreq_list);
@@ -372,6 +372,7 @@ __nvmet_fc_finish_ls_req(struct nvmet_fc_ls_req_op *lsop) (lsreq->rqstlen + lsreq->rsplen), DMA_BIDIRECTIONAL); +out_puttgtport:nvmet_fc_tgtport_put (tgtport); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 36/195 spi: sh-msiof: avoid integer overflow in constants
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
[ Upstream commit 6500ad28fd5d67d5ca0fee9da73c463090842440 ]
cppcheck rightfully warned:
drivers/spi/spi-sh-msiof.c:792:28: warning: Signed integer overflow for expression '7<<29'. [integerOverflow] sh_msiof_write(p, SIFCTR, SIFCTR_TFWM_1 | SIFCTR_RFWM_1);
--- drivers/spi/spi-sh-msiof.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/spi/spi-sh-msiof.c +8 -8
@@ -137,14 +137,14 @@ struct sh_msiof_spi_priv {/* SIFCTR */ #define SIFCTR_TFWM_MASK GENMASK(31, 29)/* Transmit FIFO Watermark */ -#define SIFCTR_TFWM_64 (0 << 29)/* Transfer Request when 64 empty stages */ -#define SIFCTR_TFWM_32 (1 << 29)/* Transfer Request when 32 empty stages */ -#define SIFCTR_TFWM_24 (2 << 29)/* Transfer Request when 24 empty stages */ -#define SIFCTR_TFWM_16 (3 << 29)/* Transfer Request when 16 empty stages */ -#define SIFCTR_TFWM_12 (4 << 29)/* Transfer Request when 12 empty stages */ -#define SIFCTR_TFWM_8 (5 << 29)/* Transfer Request when 8 empty stages */ -#define SIFCTR_TFWM_4 (6 << 29)/* Transfer Request when 4 empty stages */ -#define SIFCTR_TFWM_1 (7 << 29)/* Transfer Request when 1 empty stage */ +#define SIFCTR_TFWM_64 (0UL << 29)/* Transfer Request when 64 empty stages */ +#define SIFCTR_TFWM_32 (1UL << 29)/* Transfer Request when 32 empty stages */ +#define SIFCTR_TFWM_24 (2UL << 29)/* Transfer Request when 24 empty stages */ +#define SIFCTR_TFWM_16 (3UL << 29)/* Transfer Request when 16 empty stages */ +#define SIFCTR_TFWM_12 (4UL << 29)/* Transfer Request when 12 empty stages */ +#define SIFCTR_TFWM_8 (5UL << 29)/* Transfer Request when 8 empty stages */ +#define SIFCTR_TFWM_4 (6UL << 29)/* Transfer Request when 4 empty stages */ +#define SIFCTR_TFWM_1 (7UL << 29)/* Transfer Request when 1 empty stage */ #define SIFCTR_TFUA_MASK GENMASK(26, 20)/* Transmit FIFO Usable Area */ #define SIFCTR_TFUA_SHIFT 20#define SIFCTR_TFUA (i) ((i) << SIFCTR_TFUA_SHIFT)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 68/195 efi: runtime: Fix potential overflow of soft-reserved region size
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Bresticker <[email protected]>
[ Upstream commit de1034b38a346ef6be25fe8792f5d1e0684d5ff4 ]
md_size will have been narrowed if we have >= 4GB worth of pages in a soft-reserved region.
--- drivers/firmware/efi/arm-runtime.c | 2 +- drivers/firmware/efi/riscv-runtime.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/firmware/efi/arm-runtime.c +1 -1
@@ -107,7 +107,7 @@ static int __init arm_enable_runtime_services(void)efi_memory_desc_t *md;for_each_efi_memory_desc (md) { -int md_size = md->num_pages <<EFI_PAGE_SHIFT ; +u64 md_size = md->num_pages <<EFI_PAGE_SHIFT ;struct resource *res;if (!(md->attribute &EFI_MEMORY_SP ))
drivers/firmware/efi/riscv-runtime.c +1 -1
@@ -85,7 +85,7 @@ static int __init riscv_enable_runtime_services(void)efi_memory_desc_t *md;for_each_efi_memory_desc (md) { -int md_size = md->num_pages <<EFI_PAGE_SHIFT ; +u64 md_size = md->num_pages <<EFI_PAGE_SHIFT ;struct resource *res;if (!(md->attribute &EFI_MEMORY_SP ))
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 77/195 drm/amdgpu: reset gpu for s3 suspend abort case
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prike Liang <[email protected]>
[ Upstream commit 6ef82ac664bb9568ca3956e0d9c9c478e25077ff ]
In the s3 suspend abort case some type of gfx9 power rail not turn off from FCH side and this will put the GPU in an unknown power status, so let's reset the gpu to a known good power state before reinitialize gpu device.
--- drivers/gpu/drm/amd/amdgpu/soc15.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/gpu/drm/amd/amdgpu/soc15.c +22 -0
@@ -1285,10 +1285,32 @@ static int soc15_common_suspend(void *handle)return soc15_common_hw_fini (adev); } +static bool soc15_need_reset_on_resume (struct amdgpu_device *adev) +{ +u32 sol_reg; + + sol_reg =RREG32_SOC15 (MP0 ,0 , mmMP0_SMN_C2PMSG_81); + +/* Will reset for the following suspend abort cases. +* 1) Only reset limit on APU side, dGPU hasn't checked yet. +* 2) S3 suspend abort and TOS already launched. +*/ +if (adev->flags &AMD_IS_APU && adev->in_s3 && + !adev->suspend_complete && + sol_reg) +return true; + +return false; +} +static int soc15_common_resume (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +if (soc15_need_reset_on_resume (adev)) { +dev_info (adev->dev,"S3 suspend abort case, let's reset ASIC.\n" ); +soc15_asic_reset (adev); + }return soc15_common_hw_init (adev); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 78/195 smb: client: set correct d_type for reparse points under DFS mounts
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <[email protected]>
[ Upstream commit 55c7788c37242702868bfac7861cdf0c358d6c3d ]
Send query dir requests with an info level of SMB_FIND_FILE_FULL_DIRECTORY_INFO rather than SMB_FIND_FILE_DIRECTORY_INFO when the client is generating its own inode numbers (e.g. noserverino) so that reparse tags still can be parsed directly from the responses, but server won't send UniqueId (server inode number)
--- fs/smb/client/readdir.c | 15 ++++++++------- fs/smb/client/smb2pdu.c | 6 ++++++ 2 files changed, 14 insertions(+), 7 deletions(-)
fs/smb/client/readdir.c +8 -7
@@ -304,14 +304,16 @@ cifs_dir_info_to_fattr(struct cifs_fattr *fattr, FILE_DIRECTORY_INFO *info, }static void cifs_fulldir_info_to_fattr (struct cifs_fattr *fattr, -SEARCH_ID_FULL_DIR_INFO *info, +const void *info,struct cifs_sb_info *cifs_sb) { +const FILE_FULL_DIRECTORY_INFO *di = info; +__dir_info_to_fattr (fattr, info); -/* See MS-FSCC 2.4.19 FileIdFullDirectoryInformation */ +/* See MS-FSCC 2.4.14, 2.4.19 */ if (fattr->cf_cifsattrs &ATTR_REPARSE ) - fattr->cf_cifstag =le32_to_cpu (info->EaSize); + fattr->cf_cifstag =le32_to_cpu (di->EaSize);cifs_fill_common_info (fattr, cifs_sb); }
@@ -425,7 +427,7 @@ _initiate_cifs_search(const unsigned int xid, struct file *file, }else if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_SERVER_INUM ) { cifsFile->srch_inf.info_level =SMB_FIND_FILE_ID_FULL_DIR_INFO ; }else /* not srvinos - BB fixme add check for backlevel? */ { - cifsFile->srch_inf.info_level =SMB_FIND_FILE_DIRECTORY_INFO ; + cifsFile->srch_inf.info_level =SMB_FIND_FILE_FULL_DIRECTORY_INFO ; } search_flags =CIFS_SEARCH_CLOSE_AT_END |CIFS_SEARCH_RETURN_RESUME ;
@@ -1019,10 +1021,9 @@ static int cifs_filldir(char *find_entry, struct file *file, (FIND_FILE_STANDARD_INFO *)find_entry, cifs_sb);break ; +case SMB_FIND_FILE_FULL_DIRECTORY_INFO :case SMB_FIND_FILE_ID_FULL_DIR_INFO : -cifs_fulldir_info_to_fattr (&fattr, - (SEARCH_ID_FULL_DIR_INFO *)find_entry, - cifs_sb); +cifs_fulldir_info_to_fattr (&fattr, find_entry, cifs_sb);break ;default : cifs_dir_info_to_fattr(&fattr,
fs/smb/client/smb2pdu.c +6 -0
@@ -5010,6 +5010,9 @@ int SMB2_query_directory_init(const unsigned int xid,case SMB_FIND_FILE_POSIX_INFO : req->FileInformationClass =SMB_FIND_FILE_POSIX_INFO ;break ; +case SMB_FIND_FILE_FULL_DIRECTORY_INFO : + req->FileInformationClass =FILE_FULL_DIRECTORY_INFORMATION ; +break ;default :cifs_tcon_dbg (VFS ,"info level %u isn't supported\n" , info_level);
@@ -5079,6 +5082,9 @@ smb2_parse_query_directory(struct cifs_tcon *tcon,/* note that posix payload are variable size */ info_buf_size =sizeof (struct smb2_posix_info );break ; +case SMB_FIND_FILE_FULL_DIRECTORY_INFO : + info_buf_size =sizeof (FILE_FULL_DIRECTORY_INFO ); +break ;default :cifs_tcon_dbg (VFS ,"info level %u isn't supported\n" , srch_inf->info_level);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 79/195 virtio-blk: Ensure no requests in virtqueues before deleting vqs.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yi Sun <[email protected]>
[ Upstream commit 4ce6e2db00de8103a0687fb0f65fd17124a51aaa ]
Ensure no remaining requests in virtqueues before resetting vdev and deleting virtqueues. Otherwise these requests will never be completed. It may cause the system to become unresponsive.
Function blk_mq_quiesce_queue() can ensure that requests have become in_flight status, but it cannot guarantee that requests have been processed by the device. Virtqueues should never be deleted before all requests become complete status.
Function blk_mq_freeze_queue() ensure that all requests in virtqueues become complete status. And no requests can enter in virtqueues.
--- drivers/block/virtio_blk.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/block/virtio_blk.c +4 -3
@@ -1206,14 +1206,15 @@ static int virtblk_freeze(struct virtio_device *vdev) {struct virtio_blk *vblk = vdev->priv; +/* Ensure no requests in virtqueues before deleting vqs. */ +blk_mq_freeze_queue (vblk->disk->queue); +/* Ensure we don't receive any more interrupts */ virtio_reset_device (vdev);/* Make sure no work handler is accessing the device. */ flush_work (&vblk->config_work); -blk_mq_quiesce_queue (vblk->disk->queue); - vdev->config->del_vqs (vdev);kfree (vblk->vqs);
@@ -1231,7 +1232,7 @@ static int virtblk_restore(struct virtio_device *vdev)virtio_device_ready (vdev); -blk_mq_unquiesce_queue (vblk->disk->queue); +blk_mq_unfreeze_queue (vblk->disk->queue); return 0; }#endif
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 80/195 smb3: clarify mount warning
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
[ Upstream commit a5cc98eba2592d6e3c5a4351319595ddde2a5901 ]
When a user tries to use the "sec=krb5p" mount parameter to encrypt data on connection to a server (when authenticating with Kerberos), we indicate that it is not supported, but do not note the equivalent recommended mount parameter ("sec=krb5,seal") which turns on encryption for that mount (and uses Kerberos for auth). Update the warning message.
--- fs/smb/client/fs_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/client/fs_context.c +1 -1
@@ -209,7 +209,7 @@ cifs_parse_security_flavors(struct fs_context *fc, char *value, struct smb3_fs_cswitch (match_token (value, cifs_secflavor_tokens, args)) {case Opt_sec_krb5p: -cifs_errorf (fc,"sec=krb5p is not supported!\n" ); +cifs_errorf (fc,"sec=krb5p is not supported. Use sec=krb5,seal instead\n" );return 1 ;case Opt_sec_krb5i: ctx->sign = true;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 81/195 pmdomain: mediatek: fix race conditions with genpd
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eugen Hristev <[email protected]>
[ Upstream commit c41336f4d69057cbf88fed47951379b384540df5 ]
If the power domains are registered first with genpd and *after that* the driver attempts to power them on in the probe sequence, then it is possible that a race condition occurs if genpd tries to power them on in the same time.
The same is valid for powering them off before unregistering them from genpd.
Attempt to fix race conditions by first removing the domains from genpd and *after that* powering down domains.
Also first power up the domains and *after that* register them to genpd.
--- drivers/soc/mediatek/mtk-pm-domains.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/soc/mediatek/mtk-pm-domains.c +7 -8
@@ -499,6 +499,11 @@ static int scpsys_add_subdomain(struct scpsys *scpsys, struct device_node *paren goto err_put_node; } +/* recursive call to add all subdomains */ + ret =scpsys_add_subdomain (scpsys, child); +if (ret) + goto err_put_node; + ret =pm_genpd_add_subdomain (parent_pd, child_pd);if (ret) { dev_err(scpsys->dev, "failed to add %s subdomain to parent %s\n",
@@ -508,11 +513,6 @@ static int scpsys_add_subdomain(struct scpsys *scpsys, struct device_node *parendev_dbg (scpsys->dev,"%s add subdomain: %s\n" , parent_pd->name, child_pd->name); } - -/* recursive call to add all subdomains */ - ret =scpsys_add_subdomain (scpsys, child); -if (ret) - goto err_put_node; }return 0 ;
@@ -526,9 +526,6 @@ static void scpsys_remove_one_domain(struct scpsys_domain *pd) {int ret; -if (scpsys_domain_is_on (pd)) -scpsys_power_off (&pd->genpd); -/* * We're in the error cleanup already, so we only complain, * but won't emit another error on top of the original one.
@@ -538,6 +535,8 @@ static void scpsys_remove_one_domain(struct scpsys_domain *pd)dev_err (pd->scpsys->dev,"failed to remove domain '%s' : %d - state may be inconsistent\n" , pd->genpd.name, ret); +if (scpsys_domain_is_on (pd)) +scpsys_power_off (&pd->genpd);clk_bulk_put (pd->num_clks, pd->clks);clk_bulk_put (pd->num_subsys_clks, pd->subsys_clks);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 82/195 pmdomain: renesas: r8a77980-sysc: CR7 must be always on
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit f0e4a1356466ec1858ae8e5c70bea2ce5e55008b ]
The power domain containing the Cortex-R7 CPU core on the R-Car V3H SoC must always be in power-on state, unlike on other SoCs in the R-Car Gen3 family. See Table 9.4 "Power domains" in the R-Car Series, 3rd Generation Hardware User’s Manual Rev.1.00 and later.
Fix this by marking the domain as a CPU domain without control registers, so the driver will not touch it.
--- drivers/soc/renesas/r8a77980-sysc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/soc/renesas/r8a77980-sysc.c +2 -1
@@ -25,7 +25,8 @@ static const struct rcar_sysc_area r8a77980_areas[] __initconst = { PD_CPU_NOCR }, {"ca53-cpu3" ,0x200 ,3 ,R8A77980_PD_CA53_CPU3 ,R8A77980_PD_CA53_SCU , PD_CPU_NOCR }, - { "cr7", 0x240, 0, R8A77980_PD_CR7, R8A77980_PD_ALWAYS_ON }, + { "cr7", 0x240, 0, R8A77980_PD_CR7, R8A77980_PD_ALWAYS_ON, + PD_CPU_NOCR }, { "a3ir", 0x180, 0, R8A77980_PD_A3IR, R8A77980_PD_ALWAYS_ON }, { "a2ir0", 0x400, 0, R8A77980_PD_A2IR0, R8A77980_PD_A3IR }, { "a2ir1", 0x400, 1, R8A77980_PD_A2IR1, R8A77980_PD_A3IR },
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 83/195 IB/hfi1: Fix sdma.h tx->num_descs off-by-one error
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vacek <[email protected]>
commit e6f57c6881916df39db7d95981a8ad2b9c3458d6 upstream.
Unfortunately the commit fd8958efe877 introduced another error causing the descs array to overflow. This reults in further crashes easily reproducible by sendmsg system call.
[ 1080.836473] general protection fault, probably for non-canonical address 0x400300015528b00a: 0000 [#1] PREEMPT SMP PTI [ 1080.869326] RIP: 0010:hfi1_ipoib_build_ib_tx_headers.constprop.0+0xe1/0x2b0 [hfi1] -- [ 1080.974535] Call Trace: [ 1080.976990] <TASK> [ 1081.021929] hfi1_ipoib_send_dma_common+0x7a/0x2e0 [hfi1] [ 1081.027364] hfi1_ipoib_send_dma_list+0x62/0x270 [hfi1] [ 1081.032633] hfi1_ipoib_send+0x112/0x300 [hfi1] [ 1081.042001] ipoib_start_xmit+0x2a9/0x2d0 [ib_ipoib] [ 1081.046978] dev_hard_start_xmit+0xc4/0x210 -- [ 1081.148347] __sys_sendmsg+0x59/0xa0
crash> ipoib_txreq 0xffff9cfeba229f00
struct ipoib_txreq {
txreq = {
list = {
next = 0xffff9cfeba229f00,
prev = 0xffff9cfeba229f00
},
descp = 0xffff9cfeba229f40,
coalesce_buf = 0x0,
wait = 0xffff9cfea4e69a48,
complete = 0xffffffffc0fe0760 <hfi1_ipoib_sdma_complete>,
packet_len = 0x46d,
tlen = 0x0,
num_desc = 0x0,
desc_limit = 0x6,
next_descq_idx = 0x45c,
coalesce_idx = 0x0,
flags = 0x0,
descs = {{
qw = {0x8024000120dffb00, 0x4} # SDMA_DESC0_FIRST_DESC_FLAG (bit 63)
}, {
qw = { 0x3800014231b108, 0x4}
}, {
qw = { 0x310000e4ee0fcf0, 0x8}
}, {
qw = { 0x3000012e9f8000, 0x8}
}, {
qw = { 0x59000dfb9d0000, 0x8}
}, {
qw = { 0x78000e02e40000, 0x8}
}} },
sdma_hdr = 0x400300015528b000, <<< invalid pointer in the tx request structure
sdma_status = 0x0, SDMA_DESC0_LAST_DESC_FLAG (bit 62)
complete = 0x0,
priv = 0x0,
txq = 0xffff9cfea4e69880,
skb = 0xffff9d099809f400
}
If an SDMA send consists of exactly 6 descriptors and requires dword padding (in the 7th descriptor), the sdma_txreq descriptor array is not properly expanded and the packet will overflow into the container structure. This results in a panic when the send completion runs. The exact panic varies depending on what elements of the container structure get corrupted. The fix is to use the correct expression in _pad_sdma_tx_descs() to test the need to expand the descriptor array.
With this patch the crashes are no longer reproducible and the machine is stable.
--- drivers/infiniband/hw/hfi1/sdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/hfi1/sdma.c +1 -1
@@ -3158,7 +3158,7 @@ int _pad_sdma_tx_descs(struct hfi1_devda {int rval =0 ; -if ((unlikely (tx->num_desc +1 == tx->desc_limit))) { +if ((unlikely (tx->num_desc == tx->desc_limit))) { rval =_extend_sdma_tx_descs (dd, tx);if (rval) {__sdma_txclean (dd, tx);
Greg Kroah-Hartman
maintainerPATCH 84/195 LoongArch: Disable IRQ before init_fn() for nonboot CPUs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit 1001db6c42e4012b55e5ee19405490f23e033b5a upstream.
Disable IRQ before init_fn() for nonboot CPUs when hotplug, in order to silence such warnings (and also avoid potential errors due to unexpected interrupts):
WARNING: CPU: 1 PID: 0 at kernel/rcu/tree.c:4503 rcu_cpu_starting+0x214/0x280 CPU: 1 PID: 0 Comm: swapper/1 Not tainted 6.6.17+ #1198
pc 90000000048e3334 ra 90000000047bd56c tp 900000010039c000 sp 900000010039fdd0 a0 0000000000000001 a1 0000000000000006 a2 900000000802c040 a3 0000000000000000 a4 0000000000000001 a5 0000000000000004 a6 0000000000000000 a7 90000000048e3f4c t0 0000000000000001 t1 9000000005c70968 t2 0000000004000000 t3 000000000005e56e t4 00000000000002e4 t5 0000000000001000 t6 ffffffff80000000 t7 0000000000040000 t8 9000000007931638 u0 0000000000000006 s9 0000000000000004 s0 0000000000000001 s1 9000000006356ac0 s2 9000000007244000 s3 0000000000000001 s4 0000000000000001 s5 900000000636f000 s6 7fffffffffffffff s7 9000000002123940 s8 9000000001ca55f8
ra: 90000000047bd56c tlb_init+0x24c/0x528
ERA: 90000000048e3334 rcu_cpu_starting+0x214/0x280
CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE)
PRMD: 00000000 (PPLV0 -PIE -PWE)
EUEN: 00000000 (-FPE -SXE -ASXE -BTE)
ECFG: 00071000 (LIE=12 VS=7)
ESTAT: 000c0000 [BRK] (IS= ECode=12 EsubCode=0)
PRID: 0014c010 (Loongson-64bit, Loongson-3A5000)
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 6.6.17+ #1198
Stack : 0000000000000000 9000000006375000 9000000005b61878 900000010039c000
900000010039fa30 0000000000000000 900000010039fa38 900000000619a140
9000000006456888 9000000006456880 900000010039f950 0000000000000001
0000000000000001 cb0cb028ec7e52e1 0000000002b90000 9000000100348700
0000000000000000 0000000000000001 ffffffff916d12f1 0000000000000003
0000000000040000 9000000007930370 0000000002b90000 0000000000000004
9000000006366000 900000000619a140 0000000000000000 0000000000000004
0000000000000000 0000000000000009 ffffffffffc681f2 9000000002123940
9000000001ca55f8 9000000006366000 90000000047a4828 00007ffff057ded8
00000000000000b0 0000000000000000 0000000000000000 0000000000071000
...
Call Trace:
[<90000000047a4828>] show_stack+0x48/0x1a0
[<9000000005b61874>] dump_stack_lvl+0x84/0xcc
[<90000000047f60ac>] __warn+0x8c/0x1e0
[<9000000005b0ab34>] report_bug+0x1b4/0x280
[<9000000005b63110>] do_bp+0x2d0/0x480
[<90000000047a2e20>] handle_bp+0x120/0x1c0
[<90000000048e3334>] rcu_cpu_starting+0x214/0x280
[<90000000047bd568>] tlb_init+0x248/0x528
[<90000000047a4c44>] per_cpu_trap_init+0x124/0x160
[<90000000047a19f4>] cpu_probe+0x494/0xa00
[<90000000047b551c>] start_secondary+0x3c/0xc0
[<9000000005b66134>] smpboot_entry+0x50/0x58--- arch/loongarch/kernel/smp.c | 1 + 1 file changed, 1 insertion(+)
arch/loongarch/kernel/smp.c +1 -0
@@ -297,6 +297,7 @@ void play_dead(void) addr =iocsr_read64 (LOONGARCH_IOCSR_MBUF0 ); }while (addr ==0 ); +local_irq_disable (); init_fn = (void *)TO_CACHE (addr);iocsr_write32 (0xffffffff ,LOONGARCH_IOCSR_IPI_CLEAR );
Greg Kroah-Hartman
maintainerPATCH 85/195 drm/ttm: Fix an invalid freeing on already freed page in error path
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Hellström <[email protected]>
commit 40510a941d27d405a82dc3320823d875f94625df upstream.
If caching mode change fails due to, for example, OOM we free the allocated pages in a two-step process. First the pages for which the caching change has already succeeded. Secondly the pages for which a caching change did not succeed.
However the second step was incorrectly freeing the pages already freed in the first step.
Fix.
--- drivers/gpu/drm/ttm/ttm_pool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/ttm/ttm_pool.c +1 -1
@@ -383,7 +383,7 @@ static void ttm_pool_free_range(struct tenum ttm_caching caching, pgoff_t start_page, pgoff_t end_page) { - struct page **pages = tt->pages; + struct page **pages = &tt->pages[start_page];unsigned int order;pgoff_t i, nr;
Greg Kroah-Hartman
maintainerPATCH 86/195 s390/cio: fix invalid -EBUSY on ccw_device_start
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Oberparleiter <[email protected]>
commit 5ef1dc40ffa6a6cb968b0fdc43c3a61727a9e950 upstream.
The s390 common I/O layer (CIO) returns an unexpected -EBUSY return code when drivers try to start I/O while a path-verification (PV) process is pending. This can lead to failed device initialization attempts with symptoms like broken network connectivity after boot.
Fix this by replacing the -EBUSY return code with a deferred condition code 1 reply to make path-verification handling consistent from a driver's point of view.
The problem can be reproduced semi-regularly using the following process, while repeating steps 2-3 as necessary (example assumes an OSA device with bus-IDs 0.0.a000-0.0.a002 on CHPID 0.02):
1. echo 0.0.a000,0.0.a001,0.0.a002 >/sys/bus/ccwgroup/drivers/qeth/group
2. echo 0 > /sys/bus/ccwgroup/devices/0.0.a000/online
3. echo 1 > /sys/bus/ccwgroup/devices/0.0.a000/online ; \
echo on > /sys/devices/css0/chp0.02/status
Background information:
The common I/O layer starts path-verification I/Os when it receives indications about changes in a device path's availability. This occurs for example when hardware events indicate a change in channel-path status, or when a manual operation such as a CHPID vary or configure operation is performed.
If a driver attempts to start I/O while a PV is running, CIO reports a successful I/O start (ccw_device_start() return code 0). Then, after completion of PV, CIO synthesizes an interrupt response that indicates an asynchronous status condition that prevented the start of the I/O (deferred condition code 1).
If a PV indication arrives while a device is busy with driver-owned I/O, PV is delayed until after I/O completion was reported to the driver's interrupt handler. To ensure that PV can be started eventually, CIO reports a device busy condition (ccw_device_start() return code -EBUSY) if a driver tries to start another I/O while PV is pending.
In some cases this -EBUSY return code causes device drivers to consider a device not operational, resulting in failed device initialization.
Note: The code that introduced the problem was added in 2003. Symptoms started appearing with the following CIO commit that causes a PV indication when a device is removed from the cio_ignore list after the associated parent subchannel device was probed, but before online processing of the CCW device has started:
2297791c92d0 ("s390/cio: dont unregister subchannel from child-drivers")
During boot, the cio_ignore list is modified by the cio_ignore dracut module [1] as well as Linux vendor-specific systemd service scripts[2]. When combined, this commit and boot scripts cause a frequent occurrence of the problem during boot.
[1] https://github.com/dracutdevs/dracut/tree/master/modules.d/81cio_ignore
[2] https://github.com/SUSE/s390-tools/blob/master/cio_ignore.service
--- drivers/s390/cio/device_ops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/s390/cio/device_ops.c +3 -3
@@ -202,7 +202,8 @@ int ccw_device_start_timeout_key(structreturn -EINVAL ;if (cdev->private->state ==DEV_STATE_NOT_OPER )return -ENODEV ; -if (cdev->private->state ==DEV_STATE_VERIFY ) { +if (cdev->private->state ==DEV_STATE_VERIFY || + cdev->private->flags.doverify) {/* Remember to fake irb when finished. */ if (!cdev->private->flags.fake_irb) { cdev->private->flags.fake_irb =FAKE_CMD_IRB ;
@@ -214,8 +215,7 @@ int ccw_device_start_timeout_key(struct }if (cdev->private->state !=DEV_STATE_ONLINE || ((sch->schib.scsw.cmd.stctl &SCSW_STCTL_PRIM_STATUS ) && - !(sch->schib.scsw.cmd.stctl &SCSW_STCTL_SEC_STATUS )) || - cdev->private->flags.doverify) + !(sch->schib.scsw.cmd.stctl &SCSW_STCTL_SEC_STATUS )))return -EBUSY ; ret =cio_set_options (sch, flags);if (ret)
Greg Kroah-Hartman
maintainerPATCH 69/195 efi: Dont add memblocks for soft-reserved memory
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Bresticker <[email protected]>
[ Upstream commit 0bcff59ef7a652fcdc6d535554b63278c2406c8f ]
Adding memblocks for soft-reserved regions prevents them from later being hotplugged in by dax_kmem.
--- drivers/firmware/efi/efi-init.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/firmware/efi/efi-init.c +10 -9
@@ -116,15 +116,6 @@ static __init int is_usable_memory(efi_memory_desc_t *md)case EFI_BOOT_SERVICES_DATA :case EFI_CONVENTIONAL_MEMORY :case EFI_PERSISTENT_MEMORY : -/* -* Special purpose memory is 'soft reserved', which means it -* is set aside initially, but can be hotplugged back in or -* be assigned to the dax driver after boot. -*/ -if (efi_soft_reserve_enabled () && - (md->attribute &EFI_MEMORY_SP )) -return false; -/* * According to the spec, these regions are no longer reserved * after calling ExitBootServices(). However, we can only use
@@ -169,6 +160,16 @@ static __init void reserve_regions(void) size = npages <<PAGE_SHIFT ;if (is_memory (md)) { +/* +* Special purpose memory is 'soft reserved', which +* means it is set aside initially. Don't add a memblock +* for it now so that it can be hotplugged back in or +* be assigned to the dax driver after boot. +*/ +if (efi_soft_reserve_enabled () && + (md->attribute &EFI_MEMORY_SP )) +continue ; +early_init_dt_add_memory_arch (paddr, size);if (!is_usable_memory (md))
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 87/195 ata: libata-core: Do not try to set sleeping devices to standby
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Damien Le Moal <[email protected]>
commit 4b085736e44dbbe69b5eea1a8a294f404678a1f4 upstream.
In ata ata_dev_power_set_standby(), check that the target device is not sleeping. If it is, there is no need to do anything.
--- drivers/ata/libata-core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/ata/libata-core.c +4 -0
@@ -2005,6 +2005,10 @@ void ata_dev_power_set_active(struct atastruct ata_taskfile tf;unsigned int err_mask; +/* If the device is already sleeping, do nothing. */ +if (dev->flags &ATA_DFLAG_SLEEPING ) +return ; +/* * Issue READ VERIFY SECTORS command for 1 sector at lba=0 only * if supported by the device.
Greg Kroah-Hartman
maintainerPATCH 88/195 dm-crypt: recheck the integrity tag after a failure
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 42e15d12070b4ff9af2b980f1b65774c2dab0507 upstream.
If a userspace process reads (with O_DIRECT) multiple blocks into the same buffer, dm-crypt reports an authentication error [1]. The error is reported in a log and it may cause RAID leg being kicked out of the array.
This commit fixes dm-crypt, so that if integrity verification fails, the data is read again into a kernel buffer (where userspace can't modify it) and the integrity tag is rechecked. If the recheck succeeds, the content of the kernel buffer is copied into the user buffer; if the recheck fails, an integrity error is reported.
[1] https://people.redhat.com/~mpatocka/testcases/blk-auth-modify/read2.c
--- drivers/md/dm-crypt.c | 89 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 73 insertions(+), 16 deletions(-)
drivers/md/dm-crypt.c +73 -16
@@ -61,6 +61,8 @@ struct convert_context {struct skcipher_request *req;struct aead_request *req_aead; } r; +bool aead_recheck; +bool aead_failed; };
@@ -81,6 +83,8 @@ struct dm_crypt_io {blk_status_t error;sector_t sector; +struct bvec_iter saved_bi_iter; +struct rb_node rb_node; }CRYPTO_MINALIGN_ATTR ;
@@ -1365,10 +1369,13 @@ static int crypt_convert_block_aead(struif (r == -EBADMSG ) {sector_t s =le64_to_cpu (*sector); -DMERR_LIMIT ("%pg: INTEGRITY AEAD ERROR, sector %llu" , - ctx->bio_in->bi_bdev, s); -dm_audit_log_bio (DM_MSG_PREFIX ,"integrity-aead" , - ctx->bio_in, s,0 ); + ctx->aead_failed = true; +if (ctx->aead_recheck) { +DMERR_LIMIT ("%pg: INTEGRITY AEAD ERROR, sector %llu" , + ctx->bio_in->bi_bdev, s); +dm_audit_log_bio (DM_MSG_PREFIX ,"integrity-aead" , + ctx->bio_in, s,0 ); + } }if (!r && cc->iv_gen_ops && cc->iv_gen_ops->post)
@@ -1724,6 +1731,8 @@ static void crypt_io_init(struct dm_cryp io->base_bio = bio; io->sector = sector; io->error =0 ; + io->ctx.aead_recheck = false; + io->ctx.aead_failed = false; io->ctx.r.req =NULL ; io->integrity_metadata =NULL ; io->integrity_metadata_from_pool = false;
@@ -1735,6 +1744,8 @@ static void crypt_inc_pending(struct dm_atomic_inc (&io->io_pending); } +static void kcryptd_queue_read (struct dm_crypt_io *io); +/* * One of the bios was finished. Check for completion of * the whole request and correctly clean up the buffer.
@@ -1748,6 +1759,15 @@ static void crypt_dec_pending(struct dm_if (!atomic_dec_and_test (&io->io_pending))return ; +if (likely (!io->ctx.aead_recheck) &&unlikely (io->ctx.aead_failed) && + cc->on_disk_tag_size &&bio_data_dir (base_bio) ==READ ) { + io->ctx.aead_recheck = true; + io->ctx.aead_failed = false; + io->error =0 ; +kcryptd_queue_read (io); +return ; + } +if (io->ctx.r.req)crypt_free_req (cc, io->ctx.r.req, base_bio);
@@ -1783,15 +1803,19 @@ static void crypt_endio(struct bio *clonstruct dm_crypt_io *io = clone->bi_private;struct crypt_config *cc = io->cc;unsigned int rw =bio_data_dir (clone); -blk_status_t error; +blk_status_t error = clone->bi_status; + +if (io->ctx.aead_recheck && !error) { +kcryptd_queue_crypt (io); +return ; + }/* * free the processed pages */ -if (rw ==WRITE ) +if (rw ==WRITE || io->ctx.aead_recheck)crypt_free_buffer_pages (cc, clone); - error = clone->bi_status;bio_put (clone);if (rw ==READ && !error) {
@@ -1812,6 +1836,22 @@ static int kcryptd_io_read(struct dm_crystruct crypt_config *cc = io->cc;struct bio *clone; +if (io->ctx.aead_recheck) { +if (!(gfp & __GFP_DIRECT_RECLAIM)) +return 1 ; +crypt_inc_pending (io); + clone =crypt_alloc_buffer (io, io->base_bio->bi_iter.bi_size); +if (unlikely (!clone)) { +crypt_dec_pending (io); +return 1 ; + } + clone->bi_iter.bi_sector = cc->start + io->sector; +crypt_convert_init (cc, &io->ctx, clone, clone, io->sector); + io->saved_bi_iter = clone->bi_iter; +dm_submit_bio_remap (io->base_bio, clone); +return 0 ; + } +/* * We need the original biovec array in order to decrypt the whole bio * data *afterwards* -- thanks to immutable biovecs we don't need to
@@ -2074,6 +2114,14 @@ dec:static void kcryptd_crypt_read_done (struct dm_crypt_io *io) { +if (io->ctx.aead_recheck) { +if (!io->error) { + io->ctx.bio_in->bi_iter = io->saved_bi_iter; +bio_copy_data (io->base_bio, io->ctx.bio_in); + } +crypt_free_buffer_pages (io->cc, io->ctx.bio_in); +bio_put (io->ctx.bio_in); + }crypt_dec_pending (io); }
@@ -2103,11 +2151,17 @@ static void kcryptd_crypt_read_convert(scrypt_inc_pending (io); -crypt_convert_init (cc, &io->ctx, io->base_bio, io->base_bio, - io->sector); +if (io->ctx.aead_recheck) { + io->ctx.cc_sector = io->sector + cc->iv_offset; + r =crypt_convert (cc, &io->ctx, +test_bit (DM_CRYPT_NO_READ_WORKQUEUE , &cc->flags), true); + }else { +crypt_convert_init (cc, &io->ctx, io->base_bio, io->base_bio, + io->sector); - r =crypt_convert (cc, &io->ctx, -test_bit (DM_CRYPT_NO_READ_WORKQUEUE , &cc->flags), true); + r =crypt_convert (cc, &io->ctx, +test_bit (DM_CRYPT_NO_READ_WORKQUEUE , &cc->flags), true); + }/* * Crypto API backlogged the request, because its queue was full * and we're in softirq context, so continue from a workqueue
@@ -2150,10 +2204,13 @@ static void kcryptd_async_done(struct crif (error == -EBADMSG ) {sector_t s =le64_to_cpu (*org_sector_of_dmreq (cc, dmreq)); -DMERR_LIMIT ("%pg: INTEGRITY AEAD ERROR, sector %llu" , - ctx->bio_in->bi_bdev, s); -dm_audit_log_bio (DM_MSG_PREFIX ,"integrity-aead" , - ctx->bio_in, s,0 ); + ctx->aead_failed = true; +if (ctx->aead_recheck) { +DMERR_LIMIT ("%pg: INTEGRITY AEAD ERROR, sector %llu" , + ctx->bio_in->bi_bdev, s); +dm_audit_log_bio (DM_MSG_PREFIX ,"integrity-aead" , + ctx->bio_in, s,0 ); + } io->error =BLK_STS_PROTECTION ; }else if (error <0 ) io->error =BLK_STS_IOERR ;
@@ -3079,7 +3136,7 @@ static int crypt_ctr_optional(struct dm_ sval =strchr (opt_string +strlen ("integrity:" ),':' ) +1 ;if (!strcasecmp (sval,"aead" )) {set_bit (CRYPT_MODE_INTEGRITY_AEAD , &cc->cipher_flags); - }else if (strcasecmp (sval,"none" )) { + }else if (strcasecmp (sval,"none" )) { ti->error ="Unknown integrity profile" ;return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 89/195 Revert "parisc: Only list existing CPUs in cpu_possible_mask"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit 82b143aeb169b8b55798d7d2063032e1a6ceeeb0 upstream.
This reverts commit 0921244f6f4f0d05698b953fe632a99b38907226.
It broke CPU hotplugging because it modifies the __cpu_possible_mask after bootup, so that it will be different than nr_cpu_ids, which then effictively breaks the workqueue setup code and triggers crashes when shutting down CPUs at runtime.
Guenter was the first who noticed the wrong values in __cpu_possible_mask, since the cpumask Kunit tests were failig.
Reverting this commit fixes both issues, but sadly brings back this uncritical runtime warning:register_cpu_capacity_sysctl: too early to get CPU4 device!
--- arch/parisc/kernel/processor.c | 8 -------- 1 file changed, 8 deletions(-)
arch/parisc/kernel/processor.c +0 -8
@@ -171,7 +171,6 @@ static int __init processor_probe(struct p->cpu_num = cpu_info.cpu_num; p->cpu_loc = cpu_info.cpu_loc; -set_cpu_possible (cpuid, true);store_cpu_topology (cpuid);#ifdef CONFIG_SMP
@@ -466,13 +465,6 @@ static struct parisc_driver cpu_driver _*/ void __init processor_init (void ) { -unsigned int cpu; -reset_cpu_topology (); - -/* reset possible mask. We will mark those which are possible. */ -for_each_possible_cpu (cpu) -set_cpu_possible (cpu, false); -register_parisc_driver (&cpu_driver); }
Greg Kroah-Hartman
maintainerPATCH 90/195 dm-integrity: recheck the integrity tag after a failure
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit c88f5e553fe38b2ffc4c33d08654e5281b297677 upstream.
If a userspace process reads (with O_DIRECT) multiple blocks into the same buffer, dm-integrity reports an error [1]. The error is reported in a log and it may cause RAID leg being kicked out of the array.
This commit fixes dm-integrity, so that if integrity verification fails, the data is read again into a kernel buffer (where userspace can't modify it) and the integrity tag is rechecked. If the recheck succeeds, the content of the kernel buffer is copied into the user buffer; if the recheck fails, an integrity error is reported.
[1] https://people.redhat.com/~mpatocka/testcases/blk-auth-modify/read2.c
--- drivers/md/dm-integrity.c | 93 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 84 insertions(+), 9 deletions(-)
drivers/md/dm-integrity.c +84 -9
@@ -279,6 +279,8 @@ struct dm_integrity_c {atomic64_t number_of_mismatches; +mempool_t recheck_pool; +struct notifier_block reboot_notifier; };
@@ -1699,6 +1701,79 @@ failed:get_random_bytes (result, ic->tag_size); } +static void integrity_recheck (struct dm_integrity_io *dio) +{ +struct bio *bio =dm_bio_from_per_bio_data (dio,sizeof (struct dm_integrity_io )); +struct dm_integrity_c *ic = dio->ic; +struct bvec_iter iter; +struct bio_vec bv; +sector_t sector, logical_sector, area, offset; +char checksum_onstack[max_t (size_t,HASH_MAX_DIGESTSIZE ,MAX_TAG_SIZE )]; +struct page *page; +void *buffer; + +get_area_and_offset (ic, dio->range.logical_sector, &area, &offset); + dio->metadata_block =get_metadata_sector_and_offset (ic, area, offset, + &dio->metadata_offset); + sector =get_data_sector (ic, area, offset); + logical_sector = dio->range.logical_sector; + + page =mempool_alloc (&ic->recheck_pool,GFP_NOIO ); + buffer =page_to_virt (page); + +__bio_for_each_segment (bv, bio, iter, dio->bio_details.bi_iter) { +unsigned pos =0 ; + +do { +char *mem; +int r; +struct dm_io_request io_req; +struct dm_io_region io_loc; + io_req.bi_opf =REQ_OP_READ ; + io_req.mem.type =DM_IO_KMEM ; + io_req.mem.ptr.addr = buffer; + io_req.notify.fn =NULL ; + io_req.client = ic->io; + io_loc.bdev = ic->dev->bdev; + io_loc.sector = sector; + io_loc.count = ic->sectors_per_block; + + r =dm_io (&io_req,1 , &io_loc,NULL ); +if (unlikely (r)) { + dio->bi_status =errno_to_blk_status (r); + goto free_ret; + } + +integrity_sector_checksum (ic, logical_sector, buffer, + checksum_onstack); + r =dm_integrity_rw_tag (ic, checksum_onstack, &dio->metadata_block, + &dio->metadata_offset, ic->tag_size,TAG_CMP ); +if (r) { +if (r >0 ) { +DMERR_LIMIT ("%pg: Checksum failed at sector 0x%llx" , + bio->bi_bdev, logical_sector); +atomic64_inc (&ic->number_of_mismatches); +dm_audit_log_bio (DM_MSG_PREFIX ,"integrity-checksum" , + bio, logical_sector,0 ); + r = -EILSEQ ; + } + dio->bi_status =errno_to_blk_status (r); + goto free_ret; + } + + mem =bvec_kmap_local (&bv); +memcpy (mem + pos, buffer, ic->sectors_per_block <<SECTOR_SHIFT ); +kunmap_local (mem); + + pos += ic->sectors_per_block <<SECTOR_SHIFT ; + sector += ic->sectors_per_block; + logical_sector += ic->sectors_per_block; + }while (pos < bv.bv_len); + } +free_ret: +mempool_free (page, &ic->recheck_pool); +} +static void integrity_metadata (struct work_struct *w) { struct dm_integrity_io *dio = container_of(w, struct dm_integrity_io, work);
@@ -1784,15 +1859,8 @@ again: checksums_ptr - checksums, dio->op == REQ_OP_READ ? TAG_CMP : TAG_WRITE);if (unlikely (r)) {if (r >0 ) { -sector_t s; - - s = sector - ((r + ic->tag_size -1 ) / ic->tag_size); -DMERR_LIMIT ("%pg: Checksum failed at sector 0x%llx" , - bio->bi_bdev, s); - r = -EILSEQ ; -atomic64_inc (&ic->number_of_mismatches); -dm_audit_log_bio (DM_MSG_PREFIX ,"integrity-checksum" , - bio, s,0 ); +integrity_recheck (dio); + goto skip_io; }if (likely (checksums != checksums_onstack))kfree (checksums);
@@ -4208,6 +4276,12 @@ static int dm_integrity_ctr(struct dm_ta goto bad; } + r =mempool_init_page_pool (&ic->recheck_pool,1 ,0 ); +if (r) { + ti->error ="Cannot allocate mempool" ; + goto bad; + } + ic->metadata_wq =alloc_workqueue ("dm-integrity-metadata" ,WQ_MEM_RECLAIM ,METADATA_WORKQUEUE_MAX_ACTIVE );if (!ic->metadata_wq) {
@@ -4572,6 +4646,7 @@ static void dm_integrity_dtr(struct dm_tkvfree (ic->bbs);if (ic->bufio)dm_bufio_client_destroy (ic->bufio); +mempool_exit (&ic->recheck_pool);mempool_exit (&ic->journal_io_mempool);if (ic->io)dm_io_client_destroy (ic->io);
Greg Kroah-Hartman
maintainerPATCH 91/195 dm-crypt: dont modify the data when using authenticated encryption
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 50c70240097ce41fe6bce6478b80478281e4d0f7 upstream.
It was said that authenticated encryption could produce invalid tag when the data that is being encrypted is modified [1]. So, fix this problem by copying the data into the clone bio first and then encrypt them inside the clone bio.
This may reduce performance, but it is needed to prevent the user from corrupting the device by writing data with O_DIRECT and modifying them at the same time.
[1] https://lore.kernel.org/all/[email protected]/T/
--- drivers/md/dm-crypt.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/md/dm-crypt.c +6 -0
@@ -2078,6 +2078,12 @@ static void kcryptd_crypt_write_convert( io->ctx.bio_out = clone; io->ctx.iter_out = clone->bi_iter; +if (crypt_integrity_aead (cc)) { +bio_copy_data (clone, io->base_bio); + io->ctx.bio_in = clone; + io->ctx.iter_in = clone->bi_iter; + } + sector +=bio_sectors (clone);crypt_inc_pending (io);
Greg Kroah-Hartman
maintainerPATCH 92/195 dm-verity: recheck the hash after a failure
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 9177f3c0dea6143d05cac1bbd28668fd0e216d11 upstream.
If a userspace process reads (with O_DIRECT) multiple blocks into the same buffer, dm-verity reports an error [1].
This commit fixes dm-verity, so that if hash verification fails, the data is read again into a kernel buffer (where userspace can't modify it) and the hash is rechecked. If the recheck succeeds, the content of the kernel buffer is copied into the user buffer; if the recheck fails, an error is reported.
[1] https://people.redhat.com/~mpatocka/testcases/blk-auth-modify/read2.c
--- drivers/md/dm-verity-target.c | 86 +++++++++++++++++++++++++++++++++++++++--- drivers/md/dm-verity.h | 6 ++ 2 files changed, 86 insertions(+), 6 deletions(-)
drivers/md/dm-verity-target.c +80 -6
@@ -474,6 +474,63 @@ int verity_for_bv_block(struct dm_verityreturn 0 ; } +static int verity_recheck_copy (struct dm_verity *v,struct dm_verity_io *io, +u8 *data,size_t len) +{ +memcpy (data, io->recheck_buffer, len); + io->recheck_buffer += len; + +return 0 ; +} + +static int verity_recheck (struct dm_verity *v,struct dm_verity_io *io, +struct bvec_iter start,sector_t cur_block) +{ +struct page *page; +void *buffer; +int r; +struct dm_io_request io_req; +struct dm_io_region io_loc; + + page =mempool_alloc (&v->recheck_pool,GFP_NOIO ); + buffer =page_to_virt (page); + + io_req.bi_opf =REQ_OP_READ ; + io_req.mem.type =DM_IO_KMEM ; + io_req.mem.ptr.addr = buffer; + io_req.notify.fn =NULL ; + io_req.client = v->io; + io_loc.bdev = v->data_dev->bdev; + io_loc.sector = cur_block << (v->data_dev_block_bits -SECTOR_SHIFT ); + io_loc.count =1 << (v->data_dev_block_bits -SECTOR_SHIFT ); + r =dm_io (&io_req,1 , &io_loc,NULL ); +if (unlikely (r)) + goto free_ret; + + r =verity_hash (v,verity_io_hash_req (v, io), buffer, +1 << v->data_dev_block_bits, +verity_io_real_digest (v, io), true); +if (unlikely (r)) + goto free_ret; + +if (memcmp (verity_io_real_digest (v, io), +verity_io_want_digest (v, io), v->digest_size)) { + r = -EIO ; + goto free_ret; + } + + io->recheck_buffer = buffer; + r =verity_for_bv_block (v, io, &start, verity_recheck_copy); +if (unlikely (r)) + goto free_ret; + + r =0 ; +free_ret: +mempool_free (page, &v->recheck_pool); + +return r; +} +static int verity_bv_zero (struct dm_verity *v,struct dm_verity_io *io,u8 *data,size_t len) {
@@ -500,9 +557,7 @@ static int verity_verify_io(struct dm_ve {bool is_zero;struct dm_verity *v = io->v; -#if defined(CONFIG_DM_VERITY_FEC )struct bvec_iter start; -#endif struct bvec_iter iter_copy;struct bvec_iter *iter;struct crypto_wait wait;
@@ -553,10 +608,7 @@ static int verity_verify_io(struct dm_veif (unlikely (r <0 ))return r; -#if defined(CONFIG_DM_VERITY_FEC ) -if (verity_fec_is_enabled (v)) - start = *iter; -#endif + start = *iter; r =verity_for_io_block (v, io, iter, &wait);if (unlikely (r <0 ))return r;
@@ -578,6 +630,10 @@ static int verity_verify_io(struct dm_ve* tasklet since it may sleep, so fallback to work-queue. */ return -EAGAIN ; + }else if (verity_recheck (v, io, start, cur_block) ==0 ) { +if (v->validated_blocks) +set_bit (cur_block, v->validated_blocks); +continue ;#if defined(CONFIG_DM_VERITY_FEC ) } else if (verity_fec_decode(v, io, DM_VERITY_BLOCK_TYPE_DATA, cur_block,NULL , &start) ==0 ) {
@@ -928,6 +984,10 @@ static void verity_dtr(struct dm_targetif (v->verify_wq)destroy_workqueue (v->verify_wq); +mempool_exit (&v->recheck_pool); +if (v->io) +dm_io_client_destroy (v->io); +if (v->bufio)dm_bufio_client_destroy (v->bufio);
@@ -1364,6 +1424,20 @@ static int verity_ctr(struct dm_target * } v->hash_blocks = hash_position; + r =mempool_init_page_pool (&v->recheck_pool,1 ,0 ); +if (unlikely (r)) { + ti->error ="Cannot allocate mempool" ; + goto bad; + } + + v->io =dm_io_client_create (); +if (IS_ERR (v->io)) { + r =PTR_ERR (v->io); + v->io =NULL ; + ti->error ="Cannot allocate dm io" ; + goto bad; + } + v->bufio = dm_bufio_client_create(v->hash_dev->bdev, 1 << v->hash_dev_block_bits, 1, sizeof(struct buffer_aux), dm_bufio_alloc_callback, NULL,
drivers/md/dm-verity.h +6 -0
@@ -11,6 +11,7 @@#ifndef DM_VERITY_H #define DM_VERITY_H +#include <linux/dm-io.h> #include <linux/dm-bufio.h> #include <linux/device-mapper.h> #include <linux/interrupt.h>
@@ -68,6 +69,9 @@ struct dm_verity {unsigned long *validated_blocks;/* bitset blocks validated */ char *signature_key_desc;/* signature keyring reference */ + +struct dm_io_client *io; +mempool_t recheck_pool; };struct dm_verity_io {
@@ -84,6 +88,8 @@ struct dm_verity_io {struct work_struct work; +char *recheck_buffer; +/* * Three variably-size fields follow this struct: *
Greg Kroah-Hartman
maintainerPATCH 93/195 cxl/pci: Fix disabling memory if DVSEC CXL Range does not match a CFMWS window
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robert Richter <[email protected]>
commit 0cab687205986491302cd2e440ef1d253031c221 upstream.
The Linux CXL subsystem is built on the assumption that HPA == SPA. That is, the host physical address (HPA) the HDM decoder registers are programmed with are system physical addresses (SPA).
During HDM decoder setup, the DVSEC CXL range registers (cxl-3.1, 8.1.3.8) are checked if the memory is enabled and the CXL range is in a HPA window that is described in a CFMWS structure of the CXL host bridge (cxl-3.1, 9.18.1.3).
Now, if the HPA is not an SPA, the CXL range does not match a CFMWS window and the CXL memory range will be disabled then. The HDM decoder stops working which causes system memory being disabled and further a system hang during HDM decoder initialization, typically when a CXL enabled kernel boots.
Prevent a system hang and do not disable the HDM decoder if the decoder's CXL range is not found in a CFMWS window.
Note the change only fixes a hardware hang, but does not implement HPA/SPA translation. Support for this can be added in a follow on patch series.
--- drivers/cxl/core/pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/cxl/core/pci.c +3 -3
@@ -376,9 +376,9 @@ static bool __cxl_hdm_decode_init(struct allowed++; } -if (!allowed) { -cxl_set_mem_enable (cxlds,0 ); - info->mem_enabled =0 ; +if (!allowed && info->mem_enabled) { +dev_err (dev,"Range register decodes outside platform defined CXL ranges.\n" ); +return -ENXIO ; }/*
Greg Kroah-Hartman
maintainerPATCH 94/195 scsi: target: pscsi: Fix bio_put() for error case
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naohiro Aota <[email protected]>
commit de959094eb2197636f7c803af0943cb9d3b35804 upstream.
As of commit 066ff571011d ("block: turn bio_kmalloc into a simple kmalloc wrapper"), a bio allocated by bio_kmalloc() must be freed by bio_uninit() and kfree(). That is not done properly for the error case, hitting WARN and NULL pointer dereference in bio_free().
--- drivers/target/target_core_pscsi.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/target/target_core_pscsi.c +6 -3
@@ -910,12 +910,15 @@ new_bio:return 0 ; fail: -if (bio) -bio_put (bio); +if (bio) { +bio_uninit (bio); +kfree (bio); + }while (req->bio) { bio = req->bio; req->bio = bio->bi_next; -bio_put (bio); +bio_uninit (bio); +kfree (bio); } req->biotail =NULL ;return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ;
Greg Kroah-Hartman
maintainerPATCH 95/195 scsi: core: Consult supported VPD page list prior to fetching page
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin K. Petersen <[email protected]>
commit b5fc07a5fb56216a49e6c1d0b172d5464d99a89b upstream.
Commit c92a6b5d6335 ("scsi: core: Query VPD size before getting full page") removed the logic which checks whether a VPD page is present on the supported pages list before asking for the page itself. That was done because SPC helpfully states "The Supported VPD Pages VPD page list may or may not include all the VPD pages that are able to be returned by the device server". Testing had revealed a few devices that supported some of the 0xBn pages but didn't actually list them in page 0.
Julian Sikorski bisected a problem with his drive resetting during discovery to the commit above. As it turns out, this particular drive firmware will crash if we attempt to fetch page 0xB9.
Various approaches were attempted to work around this. In the end, reinstating the logic that consults VPD page 0 before fetching any other page was the path of least resistance. A firmware update for the devices which originally compelled us to remove the check has since been released.
--- drivers/scsi/scsi.c | 22 ++++++++++++++++++++-- include/scsi/scsi_device.h | 4 ---- 2 files changed, 20 insertions(+), 6 deletions(-)
drivers/scsi/scsi.c +20 -2
@@ -328,21 +328,39 @@ static int scsi_vpd_inquiry(struct scsi_return result +4 ; } +enum scsi_vpd_parameters { +SCSI_VPD_HEADER_SIZE =4 , +SCSI_VPD_LIST_SIZE =36 , +}; +static int scsi_get_vpd_size (struct scsi_device *sdev,u8 page) { -unsigned char vpd_header[SCSI_VPD_HEADER_SIZE ]__aligned(4) ; +unsigned char vpd[SCSI_VPD_LIST_SIZE ]__aligned(4) ;int result;if (sdev->no_vpd_size)return SCSI_DEFAULT_VPD_LEN ;/* +* Fetch the supported pages VPD and validate that the requested page +* number is present. +*/ +if (page !=0 ) { + result =scsi_vpd_inquiry (sdev, vpd,0 ,sizeof (vpd)); +if (result <SCSI_VPD_HEADER_SIZE ) +return 0 ; + + result -=SCSI_VPD_HEADER_SIZE ; +if (!memchr (&vpd[SCSI_VPD_HEADER_SIZE ], page, result)) +return 0 ; + } +/* * Fetch the VPD page header to find out how big the page * is. This is done to prevent problems on legacy devices * which can not handle allocation lengths as large as * potentially requested by the caller. */ - result =scsi_vpd_inquiry (sdev, vpd_header, page,sizeof (vpd_header)); + result =scsi_vpd_inquiry (sdev, vpd, page,SCSI_VPD_HEADER_SIZE );if (result <0 )return 0 ;
include/scsi/scsi_device.h +0 -4
@@ -100,10 +100,6 @@ struct scsi_vpd {unsigned char data[]; }; -enum scsi_vpd_parameters { -SCSI_VPD_HEADER_SIZE =4 , -}; -struct scsi_device {struct Scsi_Host *host;struct request_queue *request_queue;
Greg Kroah-Hartman
maintainerPATCH 96/195 mm/swap: fix race when skipping swapcache
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kairui Song <[email protected]>
commit 13ddaf26be324a7f951891ecd9ccd04466d27458 upstream.
When skipping swapcache for SWP_SYNCHRONOUS_IO, if two or more threads swapin the same entry at the same time, they get different pages (A, B). Before one thread (T0) finishes the swapin and installs page (A) to the PTE, another thread (T1) could finish swapin of page (B), swap_free the entry, then swap out the possibly modified page reusing the same entry. It breaks the pte_same check in (T0) because PTE value is unchanged, causing ABA problem. Thread (T0) will install a stalled page (A) into the PTE and cause data corruption.
One possible callstack is like this:
CPU0 CPU1 ---- ---- do_swap_page() do_swap_page() with same entry <direct swapin path> <direct swapin path> <alloc page A> <alloc page B> swap_read_folio() <- read to page A swap_read_folio() <- read to page B <slow on later locks or interrupt> <finished swapin first> ... set_pte_at()
swap_free() <- entry is free <write to page B, now page A stalled> <swap out page B to same swap entry>pte_same() <- Check pass, PTE seems
unchanged, but page A
is stalled!swap_free() <- page B content lost!set_pte_at() <- staled page A installed!
And besides, for ZRAM, swap_free() allows the swap device to discard the entry content, so even if page (B) is not modified, if swap_read_folio() on CPU0 happens later than swap_free() on CPU1, it may also cause data loss.
To fix this, reuse swapcache_prepare which will pin the swap entry using the cache flag, and allow only one thread to swap it in, also prevent any parallel code from putting the entry in the cache. Release the pin after PT unlocked.
Racers just loop and wait since it's a rare and very short event. A schedule_timeout_uninterruptible(1) call is added to avoid repeated page faults wasting too much CPU, causing livelock or adding too much noise to perf statistics. A similar livelock issue was described in commit 029c4628b2eb ("mm: swap: get rid of livelock in swapin readahead")
Reproducer:
This race issue can be triggered easily using a well constructed reproducer and patched brd (with a delay in read path) [1]:
With latest 6.8 mainline, race caused data loss can be observed easily:
$ gcc -g -lpthread test-thread-swap-race.c && ./a.out Polulating 32MB of memory region... Keep swapping out... Starting round 0... Spawning 65536 workers... 32746 workers spawned, wait for done... Round 0: Error on 0x5aa00, expected 32746, got 32743, 3 data loss! Round 0: Error on 0x395200, expected 32746, got 32743, 3 data loss! Round 0: Error on 0x3fd000, expected 32746, got 32737, 9 data loss! Round 0 Failed, 15 data loss!
This reproducer spawns multiple threads sharing the same memory region using a small swap device. Every two threads updates mapped pages one by one in opposite direction trying to create a race, with one dedicated thread keep swapping out the data out using madvise.
The reproducer created a reproduce rate of about once every 5 minutes, so the race should be totally possible in production.
After this patch, I ran the reproducer for over a few hundred rounds and no data loss observed.
Performance overhead is minimal, microbenchmark swapin 10G from 32G zram:
Before: 10934698 us After: 11157121 us Cached: 13155355 us (Dropping SWP_SYNCHRONOUS_IO flag)
--- include/linux/swap.h | 5 +++++ mm/memory.c | 20 ++++++++++++++++++++ mm/swap.h | 5 +++++ mm/swapfile.c | 13 +++++++++++++ 4 files changed, 43 insertions(+)
include/linux/swap.h +5 -0
@@ -571,6 +571,11 @@ static inline int swap_duplicate(swp_entreturn 0 ; } +static inline int swapcache_prepare (swp_entry_t swp) +{ +return 0 ; +} +static inline void swap_free (swp_entry_t swp) { }
mm/memory.c +20 -0
@@ -3761,6 +3761,7 @@ vm_fault_t do_swap_page(struct vm_faultstruct page *page;struct swap_info_struct *si =NULL ;rmap_t rmap_flags =RMAP_NONE ; +bool need_clear_cache = false;bool exclusive = false;swp_entry_t entry;pte_t pte;
@@ -3822,6 +3823,20 @@ vm_fault_t do_swap_page(struct vm_faultif (!folio) {if (data_race (si->flags &SWP_SYNCHRONOUS_IO ) &&__swap_count (entry) ==1 ) { +/* +* Prevent parallel swapin from proceeding with +* the cache flag. Otherwise, another thread may +* finish swapin first, free the entry, and swapout +* reusing the same entry. It's undetectable as +* pte_same() returns true due to entry reuse. +*/ +if (swapcache_prepare (entry)) { +/* Relax a bit to prevent rapid repeated page faults */ +schedule_timeout_uninterruptible (1 ); + goto out; + } + need_clear_cache = true; +/* skip swapcache */ folio =vma_alloc_folio (GFP_HIGHUSER_MOVABLE ,0 , vma, vmf->address, false);
@@ -4073,6 +4088,9 @@ vm_fault_t do_swap_page(struct vm_fault unlock:pte_unmap_unlock (vmf->pte, vmf->ptl); out: +/* Clear the swap cache pin for direct swapin after PTL unlock */ +if (need_clear_cache) +swapcache_clear (si, entry);if (si)put_swap_device (si);return ret;
@@ -4086,6 +4104,8 @@ out_release:folio_unlock (swapcache);folio_put (swapcache); } +if (need_clear_cache) +swapcache_clear (si, entry);if (si)put_swap_device (si);return ret;
mm/swap.h +5 -0
@@ -39,6 +39,7 @@ void __delete_from_swap_cache(struct folvoid delete_from_swap_cache (struct folio *folio);void clear_shadow_from_swap_cache (int type,unsigned long begin,unsigned long end); +void swapcache_clear (struct swap_info_struct *si,swp_entry_t entry);struct folio *swap_cache_get_folio (swp_entry_t entry,struct vm_area_struct *vma,unsigned long addr);struct page *find_get_incore_page (struct address_space *mapping,pgoff_t index);
@@ -98,6 +99,10 @@ static inline int swap_writepage(structreturn 0 ; } +static inline void swapcache_clear (struct swap_info_struct *si,swp_entry_t entry) +{ +} +static inline struct folio *swap_cache_get_folio (swp_entry_t entry,struct vm_area_struct *vma,unsigned long addr) {
mm/swapfile.c +13 -0
@@ -3373,6 +3373,19 @@ int swapcache_prepare(swp_entry_t entry)return __swap_duplicate (entry,SWAP_HAS_CACHE ); } +void swapcache_clear (struct swap_info_struct *si,swp_entry_t entry) +{ +struct swap_cluster_info *ci; +unsigned long offset =swp_offset (entry); +unsigned char usage; + + ci =lock_cluster_or_swap_info (si, offset); + usage =__swap_entry_free_locked (si, offset,SWAP_HAS_CACHE ); +unlock_cluster_or_swap_info (si, ci); +if (!usage) +free_swap_slot (entry); +} +struct swap_info_struct *swp_swap_info (swp_entry_t entry) {return swap_type_to_swap_info (swp_type (entry));
Greg Kroah-Hartman
maintainerPATCH 70/195 hwmon: (coretemp) Enlarge per package core count limit
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Rui <[email protected]>
[ Upstream commit 34cf8c657cf0365791cdc658ddbca9cc907726ce ]
Currently, coretemp driver supports only 128 cores per package. This loses some core temperature information on systems that have more than 128 cores per package.
[ 58.685033] coretemp coretemp.0: Adding Core 128 failed [ 58.692009] coretemp coretemp.0: Adding Core 129 failed ...
Enlarge the limitation to 512 because there are platforms with more than 256 cores per package.
--- drivers/hwmon/coretemp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/coretemp.c +1 -1
@@ -40,7 +40,7 @@ MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius");#define PKG_SYSFS_ATTR_NO 1/* Sysfs attribute for package temp */ #define BASE_SYSFS_ATTR_NO 2/* Sysfs Base attr no for coretemp */ -#define NUM_REAL_CORES 128/* Number of Real cores per cpu */ +#define NUM_REAL_CORES 512/* Number of Real cores per cpu */ #define CORETEMP_NAME_LENGTH 28/* String Length of attrs */ #define MAX_CORE_ATTRS 4/* Maximum no of basic attrs */ #define TOTAL_ATTRS (MAX_CORE_ATTRS + 1)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 97/195 mm/damon/lru_sort: fix quota status loss due to online tunings
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 13d0599ab3b2ff17f798353f24bcbef1659d3cfc upstream.
For online parameters change, DAMON_LRU_SORT creates new schemes based on latest values of the parameters and replaces the old schemes with the new one. When creating it, the internal status of the quotas of the old schemes is not preserved. As a result, charging of the quota starts from zero after the online tuning. The data that collected to estimate the throughput of the scheme's action is also reset, and therefore the estimation should start from the scratch again. Because the throughput estimation is being used to convert the time quota to the effective size quota, this could result in temporal time quota inaccuracy. It would be recovered over time, though. In short, the quota accuracy could be temporarily degraded after online parameters update.
Fix the problem by checking the case and copying the internal fields for the status.
--- mm/damon/lru_sort.c | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-)
mm/damon/lru_sort.c +36 -7
@@ -185,9 +185,21 @@ static struct damos *damon_lru_sort_new_return damon_lru_sort_new_scheme (&pattern,DAMOS_LRU_DEPRIO ); } +static void damon_lru_sort_copy_quota_status (struct damos_quota *dst, +struct damos_quota *src) +{ + dst->total_charged_sz = src->total_charged_sz; + dst->total_charged_ns = src->total_charged_ns; + dst->charged_sz = src->charged_sz; + dst->charged_from = src->charged_from; + dst->charge_target_from = src->charge_target_from; + dst->charge_addr_from = src->charge_addr_from; +} +static int damon_lru_sort_apply_parameters (void ) { -struct damos *scheme; +struct damos *scheme, *hot_scheme, *cold_scheme; +struct damos *old_hot_scheme =NULL , *old_cold_scheme =NULL ;unsigned int hot_thres, cold_thres;int err =0 ;
@@ -195,18 +207,35 @@ static int damon_lru_sort_apply_parameteif (err)return err; +damon_for_each_scheme (scheme, ctx) { +if (!old_hot_scheme) { + old_hot_scheme = scheme; +continue ; + } + old_cold_scheme = scheme; + } + hot_thres =damon_max_nr_accesses (&damon_lru_sort_mon_attrs) * hot_thres_access_freq /1000 ; - scheme =damon_lru_sort_new_hot_scheme (hot_thres); -if (!scheme) + hot_scheme =damon_lru_sort_new_hot_scheme (hot_thres); +if (!hot_scheme)return -ENOMEM ; -damon_set_schemes (ctx, &scheme,1 ); +if (old_hot_scheme) +damon_lru_sort_copy_quota_status (&hot_scheme->quota, + &old_hot_scheme->quota); cold_thres = cold_min_age / damon_lru_sort_mon_attrs.aggr_interval; - scheme =damon_lru_sort_new_cold_scheme (cold_thres); -if (!scheme) + cold_scheme =damon_lru_sort_new_cold_scheme (cold_thres); +if (!cold_scheme) { +damon_destroy_scheme (hot_scheme);return -ENOMEM ; -damon_add_scheme (ctx, scheme); + } +if (old_cold_scheme) +damon_lru_sort_copy_quota_status (&cold_scheme->quota, + &old_cold_scheme->quota); + +damon_set_schemes (ctx, &hot_scheme,1 ); +damon_add_scheme (ctx, cold_scheme); return damon_set_region_biggest_system_ram_default(target, &monitor_region_start,
Greg Kroah-Hartman
maintainerPATCH 71/195 scsi: lpfc: Use unsigned type for num_sge
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Reinecke <[email protected]>
[ Upstream commit d6c1b19153f92e95e5e1801d540e98771053afae ]
LUNs going into "failed ready running" state observed on >1T and on even numbers of size (2T, 4T, 6T, 8T and 10T). The issue occurs when DIF is enabled at the host.
The kernel logs:
Cannot setup S/G List for HBAIO segs 1/1 SGL 512 SCSI 256: 3 0
The host lpfc driver is failing to setup scatter/gather list (protection data) for the I/Os.
The return type lpfc_bg_setup_sgl()/lpfc_bg_setup_sgl_prot() causes the compiler to remove the most significant bit. Use an unsigned type instead.
--- drivers/scsi/lpfc/lpfc_scsi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/scsi/lpfc/lpfc_scsi.c +6 -6
@@ -1919,7 +1919,7 @@ lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,* * Returns the number of SGEs added to the SGL. **/ -static int +static uint32_t lpfc_bg_setup_sgl (struct lpfc_hba *phba,struct scsi_cmnd *sc,struct sli4_sge *sgl,int datasegcnt,struct lpfc_io_buf *lpfc_cmd)
@@ -1927,8 +1927,8 @@ lpfc_bg_setup_sgl(struct lpfc_hba *phba, struct scsi_cmnd *sc,struct scatterlist *sgde =NULL ;/* s/g data entry */ struct sli4_sge_diseed *diseed =NULL ;dma_addr_t physaddr; -int i =0 , num_sge =0 , status; -uint32_t reftag; +int i =0 , status; +uint32_t reftag, num_sge =0 ;uint8_t txop, rxop;#ifdef CONFIG_SCSI_LPFC_DEBUG_FS uint32_t rc;
@@ -2100,7 +2100,7 @@ lpfc_bg_setup_sgl(struct lpfc_hba *phba, struct scsi_cmnd *sc,* * Returns the number of SGEs added to the SGL. **/ -static int +static uint32_t lpfc_bg_setup_sgl_prot (struct lpfc_hba *phba,struct scsi_cmnd *sc,struct sli4_sge *sgl,int datacnt,int protcnt,struct lpfc_io_buf *lpfc_cmd)
@@ -2124,8 +2124,8 @@ lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,uint32_t rc;#endif uint32_t checking =1 ; -uint32_t dma_offset =0 ; -int num_sge =0 , j =2 ; +uint32_t dma_offset =0 , num_sge =0 ; +int j =2 ;struct sli4_hybrid_sgl *sgl_xtra =NULL ; sgpe =scsi_prot_sglist (sc);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 72/195 scsi: ufs: core: Remove the ufshcd_release() in ufshcd_err_handling_prepare()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: SEO HOYOUNG <[email protected]>
[ Upstream commit 17e94b2585417e04dabc2f13bc03b4665ae687f3 ]
If ufshcd_err_handler() is called in a suspend/resume situation, ufs_release() can be called twice and active_reqs end up going negative. This is because ufshcd_err_handling_prepare() and ufshcd_err_handling_unprepare() both call ufshcd_release().
Remove superfluous call to ufshcd_release().
--- drivers/ufs/core/ufshcd.c | 1 - 1 file changed, 1 deletion(-)
drivers/ufs/core/ufshcd.c +0 -1
@@ -6159,7 +6159,6 @@ static void ufshcd_err_handling_prepare(struct ufs_hba *hba)ufshcd_hold (hba, false);if (!ufshcd_is_clkgating_allowed (hba))ufshcd_setup_clocks (hba, true); -ufshcd_release (hba); pm_op = hba->is_sys_suspended ?UFS_SYSTEM_PM :UFS_RUNTIME_PM ;ufshcd_vops_resume (hba, pm_op); }else {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 73/195 LoongArch: Select ARCH_ENABLE_THP_MIGRATION instead of redefining it
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit b3ff2d9c3a9c64cd0a011cdd407ffc38a6ea8788 ]
ARCH_ENABLE_THP_MIGRATION is supposed to be selected by arch Kconfig.
--- arch/loongarch/Kconfig | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/loongarch/Kconfig +1 -4
@@ -9,6 +9,7 @@ config LOONGARCH select ARCH_BINFMT_ELF_STATE select ARCH_ENABLE_MEMORY_HOTPLUG select ARCH_ENABLE_MEMORY_HOTREMOVE + select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE select ARCH_HAS_PTE_SPECIAL
@@ -495,10 +496,6 @@ config ARCH_SPARSEMEM_ENABLE or have huge holes in the physical address space for other reasons. See <file:Documentation/mm/numa.rst> for more. -config ARCH_ENABLE_THP_MIGRATION - def_bool y - depends on TRANSPARENT_HUGEPAGE - config ARCH_MEMORY_PROBE def_bool y depends on MEMORY_HOTPLUG
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 74/195 LoongArch: Select HAVE_ARCH_SECCOMP to use the common SECCOMP menu
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit 6b79ecd084c99b31c8b4d0beda08893716d5558e ]
LoongArch missed the refactoring made by commit 282a181b1a0d ("seccomp:
Move config option SECCOMP to arch/Kconfig") because LoongArch was not mainlined at that time.
The 'depends on PROC_FS' statement is stale as described in that commit. Select HAVE_ARCH_SECCOMP, and remove the duplicated config entry.
--- arch/loongarch/Kconfig | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-)
arch/loongarch/Kconfig +1 -17
@@ -81,6 +81,7 @@ config LOONGARCH select GPIOLIB select HAVE_ARCH_AUDITSYSCALL select HAVE_ARCH_MMAP_RND_BITS if MMU + select HAVE_ARCH_SECCOMP select HAVE_ARCH_SECCOMP_FILTER select HAVE_ARCH_TRACEHOOK select HAVE_ARCH_TRANSPARENT_HUGEPAGE
@@ -462,23 +463,6 @@ config PHYSICAL_START specified in the "crashkernel=YM@XM" command line boot parameter passed to the panic-ed kernel). -config SECCOMP - bool "Enable seccomp to safely compute untrusted bytecode" - depends on PROC_FS - default y - help - This kernel feature is useful for number crunching applications - that may need to compute untrusted bytecode during their - execution. By using pipes or other transports made available to - the process as file descriptors supporting the read/write - syscalls, it's possible to isolate those applications in - their own address space using seccomp. Once seccomp is - enabled via /proc/<pid>/seccomp, it cannot be disabled - and the task is only allowed to execute a few safe syscalls - defined by each seccomp mode. - - If unsure, say Y. Only embedded should say N here. - endmenu config ARCH_SELECT_MEMORY_MODEL
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 75/195 firewire: core: send bus reset promptly on gap count error
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Sakamoto <[email protected]>
[ Upstream commit 7ed4380009e96d9e9c605e12822e987b35b05648 ]
If we are bus manager and the bus has inconsistent gap counts, send a bus reset immediately instead of trying to read the root node's config ROM first. Otherwise, we could spend a lot of time trying to read the config ROM but never succeeding.
This eliminates a 50+ second delay before the FireWire bus is usable after a newly connected device is powered on in certain circumstances.
The delay occurs if a gap count inconsistency occurs, we are not the root node, and we become bus manager. One scenario that causes this is with a TI XIO2213B OHCI, the first time a Sony DSR-25 is powered on after being connected to the FireWire cable. In this configuration, the Linux box will not receive the initial PHY configuration packet sent by the DSR-25 as IRM, resulting in the DSR-25 having a gap count of 44 while the Linux box has a gap count of 63.
FireWire devices have a gap count parameter, which is set to 63 on power-up and can be changed with a PHY configuration packet. This determines the duration of the subaction and arbitration gaps. For reliable communication, all nodes on a FireWire bus must have the same gap count.
A node may have zero or more of the following roles: root node, bus manager (BM), isochronous resource manager (IRM), and cycle master. Unless a root node was forced with a PHY configuration packet, any node might become root node after a bus reset. Only the root node can become cycle master. If the root node is not cycle master capable, the BM or IRM should force a change of root node.
After a bus reset, each node sends a self-ID packet, which contains its current gap count. A single bus reset does not change the gap count, but two bus resets in a row will set the gap count to 63. Because a consistent gap count is required for reliable communication, IEEE 1394a-2000 requires that the bus manager generate a bus reset if it detects that the gap count is inconsistent.
When the gap count is inconsistent, build_tree() will notice this after the self identification process. It will set card->gap_count to the invalid value 0. If we become bus master, this will force bm_work() to send a bus reset when it performs gap count optimization.
After a bus reset, there is no bus manager. We will almost always try to become bus manager. Once we become bus manager, we will first determine whether the root node is cycle master capable. Then, we will determine if the gap count should be changed. If either the root node or the gap count should be changed, we will generate a bus reset.
To determine if the root node is cycle master capable, we read its configuration ROM. bm_work() will wait until we have finished trying to read the configuration ROM.
However, an inconsistent gap count can make this take a long time. read_config_rom() will read the first few quadlets from the config ROM. Due to the gap count inconsistency, eventually one of the reads will time out. When read_config_rom() fails, fw_device_init() calls it again until MAX_RETRIES is reached. This takes 50+ seconds.
Once we give up trying to read the configuration ROM, bm_work() will wake up, assume that the root node is not cycle master capable, and do a bus reset. Hopefully, this will resolve the gap count inconsistency.
This change makes bm_work() check for an inconsistent gap count before waiting for the root node's configuration ROM. If the gap count is inconsistent, bm_work() will immediately do a bus reset. This eliminates the 50+ second delay and rapidly brings the bus to a working state.
I considered that if the gap count is inconsistent, a PHY configuration packet might not be successful, so it could be desirable to skip the PHY configuration packet before the bus reset in this case. However, IEEE 1394a-2000 and IEEE 1394-2008 say that the bus manager may transmit a PHY configuration packet before a bus reset when correcting a gap count error. Since the standard endorses this, I decided it's safe to retain the PHY configuration packet transmission.
Normally, after a topology change, we will reset the bus a maximum of 5 times to change the root node and perform gap count optimization. However, if there is a gap count inconsistency, we must always generate a bus reset. Otherwise the gap count inconsistency will persist and communication will be unreliable. For that reason, if there is a gap count inconstency, we generate a bus reset even if we already reached the 5 reset limit.
Reference: https://sourceforge.net/p/linux1394/mailman/message/58727806/
--- drivers/firewire/core-card.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/firewire/core-card.c +17 -1
@@ -429,7 +429,23 @@ static void bm_work(struct work_struct *work)*/ card->bm_generation = generation; -if (root_device ==NULL ) { +if (card->gap_count ==0 ) { +/* +* If self IDs have inconsistent gap counts, do a +* bus reset ASAP. The config rom read might never +* complete, so don't wait for it. However, still +* send a PHY configuration packet prior to the +* bus reset. The PHY configuration packet might +* fail, but 1394-2008 8.4.5.2 explicitly permits +* it in this case, so it should be safe to try. +*/ + new_root_id = local_id; +/* +* We must always send a bus reset if the gap count +* is inconsistent, so bypass the 5-reset limit. +*/ + card->bm_retries =0 ; + }else if (root_device ==NULL ) {/* * Either link_on is false, or we failed to read the * config rom. In either case, pick another root.
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 76/195 drm/amdgpu: skip to program GFXDEC registers for suspend abort
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prike Liang <[email protected]>
[ Upstream commit 93bafa32a6918154aa0caf9f66679a32c2431357 ]
In the suspend abort cases, the gfx power rail doesn't turn off so some GFXDEC registers/CSB can't reset to default value and at this moment reinitialize GFXDEC/CSB will result in an unexpected error. So let skip those program sequence for the suspend abort case.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 ++ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 8 ++++++++ 3 files changed, 12 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
@@ -999,6 +999,8 @@ struct amdgpu_device {bool in_s3;bool in_s4;bool in_s0ix; +/* indicate amdgpu suspension status */ +bool suspend_complete;enum pp_mp1_state mp1_state;struct amdgpu_doorbell_index doorbell_index;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -0
@@ -2414,6 +2414,7 @@ static int amdgpu_pmops_suspend(struct device *dev)struct drm_device *drm_dev =dev_get_drvdata (dev);struct amdgpu_device *adev =drm_to_adev (drm_dev); + adev->suspend_complete = false;if (amdgpu_acpi_is_s0ix_active (adev)) adev->in_s0ix = true;else if (amdgpu_acpi_is_s3_active (adev))
@@ -2428,6 +2429,7 @@ static int amdgpu_pmops_suspend_noirq(struct device *dev)struct drm_device *drm_dev =dev_get_drvdata (dev);struct amdgpu_device *adev =drm_to_adev (drm_dev); + adev->suspend_complete = true;if (amdgpu_acpi_should_gpu_reset (adev))return amdgpu_asic_reset (adev);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +8 -0
@@ -3064,6 +3064,14 @@ static int gfx_v9_0_cp_gfx_start(struct amdgpu_device *adev)gfx_v9_0_cp_gfx_enable (adev, true); +/* Now only limit the quirk on the APU gfx9 series and already +* confirmed that the APU gfx10/gfx11 needn't such update. +*/ +if (adev->flags &AMD_IS_APU && + adev->in_s3 && !adev->suspend_complete) { +DRM_INFO (" Will skip the CSB packet resubmit\n" ); +return 0 ; + } r =amdgpu_ring_alloc (ring,gfx_v9_0_get_csb_size (adev) +4 +3 );if (r) {DRM_ERROR ("amdgpu: cp failed to lock ring (%d).\n" , r);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 67/195 wifi: mac80211: adding missing drv_mgd_complete_tx() call
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit c042600c17d8c490279f0ae2baee29475fe8047d ]
There's a call to drv_mgd_prepare_tx() and so there should be one to drv_mgd_complete_tx(), but on this path it's not. Add it.
--- net/mac80211/mlme.c | 1 + 1 file changed, 1 insertion(+)
net/mac80211/mlme.c +1 -0
@@ -7294,6 +7294,7 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,ieee80211_report_disconnect (sdata, frame_buf,sizeof (frame_buf), true, req->reason_code, false); +drv_mgd_complete_tx (sdata->local, sdata, &info);return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 99/195 platform/x86: intel-vbtn: Stop calling "VBDL" from notify_handler
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 84c16d01ff219bc0a5dca5219db6b8b86a6854fb upstream.
Commit 14c200b7ca46 ("platform/x86: intel-vbtn: Fix missing tablet-mode-switch events") causes 2 issues on the ThinkPad X1 Tablet Gen2:
1. The ThinkPad will wake up immediately from suspend
2. When put in tablet mode SW_TABLET_MODE reverts to 0 after about 1 second
Both these issues are caused by the "VBDL" ACPI method call added at the end of the notify_handler.
And it never became entirely clear if this call is even necessary to fix the issue of missing tablet-mode-switch events on the Dell Inspiron 7352.
Drop the "VBDL" ACPI method call again to fix the 2 issues this is causing on the ThinkPad X1 Tablet Gen2.
--- drivers/platform/x86/intel/vbtn.c | 3 --- 1 file changed, 3 deletions(-)
drivers/platform/x86/intel/vbtn.c +0 -3
@@ -200,9 +200,6 @@ static void notify_handler(acpi_handle h autorelease = val && (!ke_rel || ke_rel->type ==KE_IGNORE );sparse_keymap_report_event (input_dev, event, val, autorelease); - -/* Some devices need this to report further events */ -acpi_evaluate_object (handle,"VBDL" ,NULL ,NULL ); }/*
Greg Kroah-Hartman
maintainerPATCH 108/195 irqchip/sifive-plic: Enable interrupt if needed before EOI
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nam Cao <[email protected]>
commit 9c92006b896c767218aabe8947b62026a571cfd0 upstream.
RISC-V PLIC cannot "end-of-interrupt" (EOI) disabled interrupts, as explained in the description of Interrupt Completion in the PLIC spec:
"The PLIC signals it has completed executing an interrupt handler by writing the interrupt ID it received from the claim to the claim/complete register. The PLIC does not check whether the completion ID is the same as the last claim ID for that target. If the completion ID does not match an interrupt source that *is currently enabled* for the target, the completion is silently ignored."
Commit 69ea463021be ("irqchip/sifive-plic: Fixup EOI failed when masked") ensured that EOI is successful by enabling interrupt first, before EOI.
Commit a1706a1c5062 ("irqchip/sifive-plic: Separate the enable and mask operations") removed the interrupt enabling code from the previous commit, because it assumes that interrupt should already be enabled at the point of EOI.
However, this is incorrect: there is a window after a hart claiming an interrupt and before irq_desc->lock getting acquired, interrupt can be disabled during this window. Thus, EOI can be invoked while the interrupt is disabled, effectively nullify this EOI. This results in the interrupt never gets asserted again, and the device who uses this interrupt appears frozen.
Make sure that interrupt is really enabled before EOI.
--- drivers/irqchip/irq-sifive-plic.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/irqchip/irq-sifive-plic.c +7 -1
@@ -144,7 +144,13 @@ static void plic_irq_eoi(struct irq_data {struct plic_handler *handler =this_cpu_ptr (&plic_handlers); -writel (d->hwirq, handler->hart_base +CONTEXT_CLAIM ); +if (unlikely (irqd_irq_disabled (d))) { +plic_toggle (handler, d->hwirq,1 ); +writel (d->hwirq, handler->hart_base +CONTEXT_CLAIM ); +plic_toggle (handler, d->hwirq,0 ); + }else { +writel (d->hwirq, handler->hart_base +CONTEXT_CLAIM ); + } }#ifdef CONFIG_SMP
Greg Kroah-Hartman
maintainerPATCH 109/195 PCI/MSI: Prevent MSI hardware interrupt number truncation
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vidya Sagar <[email protected]>
commit db744ddd59be798c2627efbfc71f707f5a935a40 upstream.
While calculating the hardware interrupt number for a MSI interrupt, the higher bits (i.e. from bit-5 onwards a.k.a domain_nr >= 32) of the PCI domain number gets truncated because of the shifted value casting to return type of pci_domain_nr() which is 'int'. This for example is resulting in same hardware interrupt number for devices 0019:00:00.0 and 0039:00:00.0.
To address this cast the PCI domain number to 'irq_hw_number_t' before left shifting it to calculate the hardware interrupt number.
Please note that this fixes the issue only on 64-bit systems and doesn't change the behavior for 32-bit systems i.e. the 32-bit systems continue to have the issue. Since the issue surfaces only if there are too many PCIe controllers in the system which usually is the case in modern server systems and they don't tend to run 32-bit kernels.
--- drivers/pci/msi/irqdomain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/msi/irqdomain.c +1 -1
@@ -60,7 +60,7 @@ static irq_hw_number_t pci_msi_domain_careturn (irq_hw_number_t )desc->msi_index |pci_dev_id (dev) <<11 | - (pci_domain_nr (dev->bus) &0xFFFFFFFF ) <<27 ; + ((irq_hw_number_t)(pci_domain_nr (dev->bus) &0xFFFFFFFF )) <<27 ; }static inline bool pci_msi_desc_is_multi_msi (struct msi_desc *desc)
Greg Kroah-Hartman
maintainerPATCH 110/195 l2tp: pass correct message length to ip6_append_data
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tom Parkin <[email protected]>
commit 359e54a93ab43d32ee1bff3c2f9f10cb9f6b6e79 upstream.
l2tp_ip6_sendmsg needs to avoid accounting for the transport header twice when splicing more data into an already partially-occupied skbuff.
To manage this, we check whether the skbuff contains data using skb_queue_empty when deciding how much data to append using ip6_append_data.
However, the code which performed the calculation was incorrect:
ulen = len + skb_queue_empty(&sk->sk_write_queue) ? transhdrlen : 0;
...due to C operator precedence, this ends up setting ulen to transhdrlen for messages with a non-zero length, which results in corrupted packets on the wire.
Add parentheses to correct the calculation in line with the original intent.
--- net/l2tp/l2tp_ip6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/l2tp/l2tp_ip6.c +1 -1
@@ -630,7 +630,7 @@ static int l2tp_ip6_sendmsg(struct sock back_from_confirm:lock_sock (sk); - ulen = len +skb_queue_empty (&sk->sk_write_queue) ? transhdrlen :0 ; + ulen = len + (skb_queue_empty (&sk->sk_write_queue) ? transhdrlen :0 ); err = ip6_append_data(sk, ip_generic_getfrag, msg, ulen, transhdrlen, &ipc6, &fl6, (struct rt6_info *)dst,
Greg Kroah-Hartman
maintainerPATCH 111/195 ARM: ep93xx: Add terminator to gpiod_lookup_table
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Shubin <[email protected]>
commit fdf87a0dc26d0550c60edc911cda42f9afec3557 upstream.
Without the terminator, if a con_id is passed to gpio_find() that does not exist in the lookup table the function will not stop looping correctly, and eventually cause an oops.
--- arch/arm/mach-ep93xx/core.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-ep93xx/core.c +1 -0
@@ -339,6 +339,7 @@ static struct gpiod_lookup_table ep93xx_ GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), GPIO_LOOKUP_IDX("G", 0, NULL, 1, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), + { } }, };
Greg Kroah-Hartman
maintainerPATCH 112/195 x86/returnthunk: Allow different return thunks
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
Upstream commit: 770ae1b709528a6a173b5c7b183818ee9b45e376
In preparation for call depth tracking on Intel SKL CPUs, make it possible to patch in a SKL specific return thunk.
--- arch/x86/include/asm/nospec-branch.h | 6 ++++++ arch/x86/kernel/alternative.c | 19 ++++++++++++++----- arch/x86/kernel/ftrace.c | 2 +- arch/x86/kernel/static_call.c | 2 +- arch/x86/net/bpf_jit_comp.c | 2 +- 5 files changed, 23 insertions(+), 8 deletions(-)
arch/x86/include/asm/nospec-branch.h +6 -0
@@ -222,6 +222,12 @@ extern void srso_alias_untrain_ret(void)extern void entry_untrain_ret (void );extern void entry_ibpb (void ); +#ifdef CONFIG_CALL_THUNKS +extern void (*x86_return_thunk)(void ); +#else +#define x86_return_thunk (&__x86_return_thunk) +#endif +#ifdef CONFIG_RETPOLINE #define GEN (reg) \
arch/x86/kernel/alternative.c +14 -5
@@ -536,6 +536,11 @@ void __init_or_module noinline apply_ret }#ifdef CONFIG_RETHUNK + +#ifdef CONFIG_CALL_THUNKS +void (*x86_return_thunk)(void )__ro_after_init = &__x86_return_thunk; +#endif +/* * Rewrite the compiler generated return thunk tail-calls. *
@@ -551,14 +556,18 @@ static int patch_return(void *addr, stru {int i =0 ; -if (cpu_feature_enabled (X86_FEATURE_RETHUNK )) -return -1 ; - - bytes[i++] =RET_INSN_OPCODE ; +if (cpu_feature_enabled (X86_FEATURE_RETHUNK )) { +if (x86_return_thunk == __x86_return_thunk) +return -1 ; + + i =JMP32_INSN_SIZE ; +__text_gen_insn (bytes,JMP32_INSN_OPCODE , addr, x86_return_thunk, i); + }else { + bytes[i++] =RET_INSN_OPCODE ; + }for (; i < insn->length;) bytes[i++] =INT3_INSN_OPCODE ; -return i; }
arch/x86/kernel/ftrace.c +1 -1
@@ -361,7 +361,7 @@ create_trampoline(struct ftrace_ops *ops ip = trampoline + size;if (cpu_feature_enabled (X86_FEATURE_RETHUNK )) -__text_gen_insn (ip,JMP32_INSN_OPCODE , ip, &__x86_return_thunk,JMP32_INSN_SIZE ); +__text_gen_insn (ip,JMP32_INSN_OPCODE , ip, x86_return_thunk,JMP32_INSN_SIZE );else memcpy (ip, retq,sizeof (retq));
arch/x86/kernel/static_call.c +1 -1
@@ -80,7 +80,7 @@ static void __ref __static_call_transforcase RET :if (cpu_feature_enabled (X86_FEATURE_RETHUNK )) - code =text_gen_insn (JMP32_INSN_OPCODE , insn, &__x86_return_thunk); + code =text_gen_insn (JMP32_INSN_OPCODE , insn, x86_return_thunk);else code = &retinsn;break ;
arch/x86/net/bpf_jit_comp.c +1 -1
@@ -432,7 +432,7 @@ static void emit_return(u8 **pprog, u8 *u8 *prog = *pprog;if (cpu_feature_enabled (X86_FEATURE_RETHUNK )) { -emit_jump (&prog, &__x86_return_thunk, ip); +emit_jump (&prog, x86_return_thunk, ip); }else {EMIT1 (0xC3 );/* ret */ if (IS_ENABLED (CONFIG_SLS ))
Greg Kroah-Hartman
maintainerPATCH 113/195 Revert "x86/alternative: Make custom return thunk unconditional"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Borislav Petkov (AMD)" <[email protected]>
This reverts commit 53ebbe1c8c02aa7b7f072dd2f96bca4faa1daa59.
Revert the backport of upstream commit:
095b8303f383 ("x86/alternative: Make custom return thunk unconditional")
in order to backport the full version now that
770ae1b70952 ("x86/returnthunk: Allow different return thunks")
has been backported.
Revert it here so that the build breakage is kept at minimum.
--- arch/x86/include/asm/nospec-branch.h | 4 ---- arch/x86/kernel/cpu/bugs.c | 2 -- 2 files changed, 6 deletions(-)
arch/x86/include/asm/nospec-branch.h +0 -4
@@ -205,11 +205,7 @@typedef u8 retpoline_thunk_t [RETPOLINE_THUNK_SIZE ];extern retpoline_thunk_t __x86_indirect_thunk_array[]; -#ifdef CONFIG_RETHUNK extern void __x86_return_thunk (void ); -#else -static inline void __x86_return_thunk (void ) {} -#endif extern void retbleed_return_thunk (void );extern void srso_return_thunk (void );
arch/x86/kernel/cpu/bugs.c +0 -2
@@ -62,8 +62,6 @@ EXPORT_SYMBOL_GPL(x86_pred_cmd);static DEFINE_MUTEX (spec_ctrl_mutex); -void (*x86_return_thunk)(void )__ro_after_init = &__x86_return_thunk; -/* Update SPEC_CTRL MSR and its cached copy unconditionally */ static void update_spec_ctrl (u64 val) {
Greg Kroah-Hartman
maintainerPATCH 114/195 x86/alternative: Make custom return thunk unconditional
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
Upstream commit: 095b8303f3835c68ac4a8b6d754ca1c3b6230711
There is infrastructure to rewrite return thunks to point to any random thunk one desires, unwrap that from CALL_THUNKS, which up to now was the sole user of that.
[ bp: Make the thunks visible on 32-bit and add ifdeffery for the
32-bit builds. ]
--- arch/x86/include/asm/nospec-branch.h | 8 ++++---- arch/x86/kernel/alternative.c | 4 ---- arch/x86/kernel/cpu/bugs.c | 2 ++ 3 files changed, 6 insertions(+), 8 deletions(-)
arch/x86/include/asm/nospec-branch.h +4 -4
@@ -205,7 +205,11 @@typedef u8 retpoline_thunk_t [RETPOLINE_THUNK_SIZE ];extern retpoline_thunk_t __x86_indirect_thunk_array[]; +#ifdef CONFIG_RETHUNK extern void __x86_return_thunk (void ); +#else +static inline void __x86_return_thunk (void ) {} +#endif extern void retbleed_return_thunk (void );extern void srso_return_thunk (void );
@@ -218,11 +222,7 @@ extern void srso_alias_untrain_ret(void)extern void entry_untrain_ret (void );extern void entry_ibpb (void ); -#ifdef CONFIG_CALL_THUNKS extern void (*x86_return_thunk)(void ); -#else -#define x86_return_thunk (&__x86_return_thunk) -#endif #ifdef CONFIG_RETPOLINE
arch/x86/kernel/alternative.c +0 -4
@@ -537,10 +537,6 @@ void __init_or_module noinline apply_ret#ifdef CONFIG_RETHUNK -#ifdef CONFIG_CALL_THUNKS -void (*x86_return_thunk)(void )__ro_after_init = &__x86_return_thunk; -#endif -/* * Rewrite the compiler generated return thunk tail-calls. *
arch/x86/kernel/cpu/bugs.c +2 -0
@@ -62,6 +62,8 @@ EXPORT_SYMBOL_GPL(x86_pred_cmd);static DEFINE_MUTEX (spec_ctrl_mutex); +void (*x86_return_thunk)(void )__ro_after_init = &__x86_return_thunk; +/* Update SPEC_CTRL MSR and its cached copy unconditionally */ static void update_spec_ctrl (u64 val) {
Greg Kroah-Hartman
maintainerPATCH 115/195 dm-integrity, dm-verity: reduce stack usage for recheck
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 66ad2fbcdbeab0edfd40c5d94f32f053b98c2320 upstream.
The newly added integrity_recheck() function has another larger stack allocation, just like its caller integrity_metadata(). When it gets inlined, the combination of the two exceeds the warning limit for 32-bit architectures and possibly risks an overflow when this is called from a deep call chain through a file system:
drivers/md/dm-integrity.c:1767:13: error: stack frame size (1048) exceeds limit (1024) in 'integrity_metadata' [-Werror,-Wframe-larger-than]
1767 | static void integrity_metadata(struct work_struct *w)
Since the caller at this point is done using its checksum buffer, just reuse the same buffer in the new function to avoid the double allocation.
[Mikulas: add "noinline" to integrity_recheck and verity_recheck. These functions are only called on error, so they shouldn't bloat the stack frame or code size of the caller.]
--- drivers/md/dm-integrity.c | 10 ++++------ drivers/md/dm-verity-target.c | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-)
drivers/md/dm-integrity.c +4 -6
@@ -1701,14 +1701,13 @@ failed:get_random_bytes (result, ic->tag_size); } -static void integrity_recheck (struct dm_integrity_io *dio) +static noinline void integrity_recheck(struct dm_integrity_io *dio, char *checksum) {struct bio *bio =dm_bio_from_per_bio_data (dio,sizeof (struct dm_integrity_io ));struct dm_integrity_c *ic = dio->ic;struct bvec_iter iter;struct bio_vec bv;sector_t sector, logical_sector, area, offset; -char checksum_onstack[max_t (size_t,HASH_MAX_DIGESTSIZE ,MAX_TAG_SIZE )];struct page *page;void *buffer;
@@ -1744,9 +1743,8 @@ static void integrity_recheck(struct dm_ goto free_ret; } -integrity_sector_checksum (ic, logical_sector, buffer, - checksum_onstack); - r =dm_integrity_rw_tag (ic, checksum_onstack, &dio->metadata_block, +integrity_sector_checksum (ic, logical_sector, buffer, checksum); + r =dm_integrity_rw_tag (ic, checksum, &dio->metadata_block, &dio->metadata_offset, ic->tag_size,TAG_CMP );if (r) {if (r >0 ) {
@@ -1859,7 +1857,7 @@ again: checksums_ptr - checksums, dio->op == REQ_OP_READ ? TAG_CMP : TAG_WRITE);if (unlikely (r)) {if (r >0 ) { -integrity_recheck (dio); +integrity_recheck (dio, checksums); goto skip_io; }if (likely (checksums != checksums_onstack))
drivers/md/dm-verity-target.c +2 -2
@@ -483,8 +483,8 @@ static int verity_recheck_copy(struct dmreturn 0 ; } -static int verity_recheck (struct dm_verity *v,struct dm_verity_io *io, -struct bvec_iter start,sector_t cur_block) +static noinline int verity_recheck(struct dm_verity *v, struct dm_verity_io *io, +struct bvec_iter start,sector_t cur_block) {struct page *page;void *buffer;
Greg Kroah-Hartman
maintainerPATCH 116/195 erofs: fix refcount on the metabuf used for inode lookup
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sandeep Dhavale <[email protected]>
commit 56ee7db31187dc36d501622cb5f1415e88e01c2a upstream.
In erofs_find_target_block() when erofs_dirnamecmp() returns 0, we do not assign the target metabuf. This causes the caller erofs_namei()'s erofs_put_metabuf() at the end to be not effective leaving the refcount on the page.
As the page from metabuf (buf->page) is never put, such page cannot be migrated or reclaimed. Fix it now by putting the metabuf from previous loop and assigning the current metabuf to target before returning so caller erofs_namei() can do the final put as it was intended.
--- fs/erofs/namei.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
fs/erofs/namei.c +14 -14
@@ -137,24 +137,24 @@ static void *find_target_block_classic(s/* string comparison without already matched prefix */ diff =erofs_dirnamecmp (name, &dname, &matched); -if (!diff) { - *_ndirents =0 ; - goto out; - }else if (diff >0 ) { - head = mid +1 ; - startprfx = matched; - -if (!IS_ERR (candidate)) -erofs_put_metabuf (target); - *target = buf; - candidate = de; - *_ndirents = ndirents; - }else { +if (diff <0 ) {erofs_put_metabuf (&buf); - back = mid -1 ; endprfx = matched; +continue ; + } + +if (!IS_ERR (candidate)) +erofs_put_metabuf (target); + *target = buf; +if (!diff) { + *_ndirents =0 ; +return de; } + head = mid +1 ; + startprfx = matched; + candidate = de; + *_ndirents = ndirents;continue ; } out:/* free if the candidate is valid */
Greg Kroah-Hartman
maintainerPATCH 117/195 serial: amba-pl011: Fix DMA transmission in RS485 mode
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lino Sanfilippo <[email protected]>
commit 3b69e32e151bc4a4e3c785cbdb1f918d5ee337ed upstream.
When DMA is used in RS485 mode make sure that the UARTs tx section is enabled before the DMA buffers are queued for transmission.
--- drivers/tty/serial/amba-pl011.c | 60 ++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 30 deletions(-)
drivers/tty/serial/amba-pl011.c +30 -30
@@ -1345,11 +1345,41 @@ static void pl011_start_tx_pio(struct ua } } +static void pl011_rs485_tx_start (struct uart_amba_port *uap) +{ +struct uart_port *port = &uap->port; +u32 cr; + +/* Enable transmitter */ + cr =pl011_read (uap,REG_CR ); + cr |=UART011_CR_TXE ; + +/* Disable receiver if half-duplex */ +if (!(port->rs485.flags &SER_RS485_RX_DURING_TX )) + cr &= ~UART011_CR_RXE ; + +if (port->rs485.flags &SER_RS485_RTS_ON_SEND ) + cr &= ~UART011_CR_RTS ; +else + cr |=UART011_CR_RTS ; + +pl011_write (cr, uap,REG_CR ); + +if (port->rs485.delay_rts_before_send) +mdelay (port->rs485.delay_rts_before_send); + + uap->rs485_tx_started = true; +} +static void pl011_start_tx (struct uart_port *port) {struct uart_amba_port *uap = container_of(port, struct uart_amba_port, port); +if ((uap->port.rs485.flags &SER_RS485_ENABLED ) && + !uap->rs485_tx_started) +pl011_rs485_tx_start (uap); +if (!pl011_dma_tx_start (uap))pl011_start_tx_pio (uap); }
@@ -1431,42 +1461,12 @@ static bool pl011_tx_char(struct uart_amreturn true; } -static void pl011_rs485_tx_start (struct uart_amba_port *uap) -{ -struct uart_port *port = &uap->port; -u32 cr; - -/* Enable transmitter */ - cr =pl011_read (uap,REG_CR ); - cr |=UART011_CR_TXE ; - -/* Disable receiver if half-duplex */ -if (!(port->rs485.flags &SER_RS485_RX_DURING_TX )) - cr &= ~UART011_CR_RXE ; - -if (port->rs485.flags &SER_RS485_RTS_ON_SEND ) - cr &= ~UART011_CR_RTS ; -else - cr |=UART011_CR_RTS ; - -pl011_write (cr, uap,REG_CR ); - -if (port->rs485.delay_rts_before_send) -mdelay (port->rs485.delay_rts_before_send); - - uap->rs485_tx_started = true; -} -/* Returns true if tx interrupts have to be (kept) enabled */ static bool pl011_tx_chars (struct uart_amba_port *uap,bool from_irq) {struct circ_buf *xmit = &uap->port.state->xmit;int count = uap->fifosize >>1 ; -if ((uap->port.rs485.flags &SER_RS485_ENABLED ) && - !uap->rs485_tx_started) -pl011_rs485_tx_start (uap); -if (uap->port.x_char) {if (!pl011_tx_char (uap, uap->port.x_char, from_irq))return true;
Greg Kroah-Hartman
maintainerPATCH 100/195 platform/x86: touchscreen_dmi: Allow partial (prefix) matches for ACPI names
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit dbcbfd662a725641d118fb3ae5ffb7be4e3d0fb0 upstream.
On some devices the ACPI name of the touchscreen is e.g. either MSSL1680:00 or MSSL1680:01 depending on the BIOS version.
This happens for example on the "Chuwi Hi8 Air" tablet where the initial commit's ts_data uses "MSSL1680:00" but the tablets from the github issue and linux-hardware.org probe linked below both use "MSSL1680:01".
Replace the strcmp() match on ts_data->acpi_name with a strstarts() check to allow using a partial match on just the ACPI HID of "MSSL1680" and change the ts_data->acpi_name for the "Chuwi Hi8 Air" accordingly to fix the touchscreen not working on models where it is "MSSL1680:01".
Note this drops the length check for I2C_NAME_SIZE. This never was necessary since the ACPI names used are never more then 11 chars and I2C_NAME_SIZE is 20 so the replaced strncmp() would always stop long before reaching I2C_NAME_SIZE.
--- drivers/platform/x86/touchscreen_dmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/touchscreen_dmi.c +2 -2
@@ -50,7 +50,7 @@ static const struct property_entry chuwi };static const struct ts_dmi_data chuwi_hi8_air_data = { - .acpi_name ="MSSL1680:00" , + .acpi_name ="MSSL1680" , .properties = chuwi_hi8_air_props, };
@@ -1776,7 +1776,7 @@ static void ts_dmi_add_props(struct i2c_int error;if (has_acpi_companion (dev) && - !strncmp (ts_data->acpi_name, client->name,I2C_NAME_SIZE )) { +strstarts (client->name, ts_data->acpi_name)) { error =device_create_managed_software_node (dev, ts_data->properties,NULL );if (error)dev_err (dev,"failed to add properties: %d\n" , error);
Greg Kroah-Hartman
maintainerPATCH 118/195 usb: dwc3: gadget: Dont disconnect if not started
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit b191a18cb5c47109ca696370a74a5062a70adfd0 upstream.
Don't go through soft-disconnection sequence if the controller hasn't started. Otherwise, there will be timeout and warning reports from the soft-disconnection flow.
--- drivers/usb/dwc3/gadget.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/dwc3/gadget.c +5 -0
@@ -2548,6 +2548,11 @@ static int dwc3_gadget_soft_disconnect(sint ret;spin_lock_irqsave (&dwc->lock, flags); +if (!dwc->pullups_connected) { +spin_unlock_irqrestore (&dwc->lock, flags); +return 0 ; + } + dwc->connected = false;/*
Greg Kroah-Hartman
maintainerPATCH 119/195 usb: cdnsp: blocked some cdns3 specific code
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pawel Laszczak <[email protected]>
commit 18a6be674306c9acb05c08e5c3fd376ef50a917c upstream.
host.c file has some parts of code that were introduced for CDNS3 driver and should not be used with CDNSP driver.
This patch blocks using these parts of codes by CDNSP driver. These elements include:
- xhci_plat_cdns3_xhci object
- cdns3 specific XECP_PORT_CAP_REG register
- cdns3 specific XECP_AUX_CTRL_REG1 register
--- drivers/usb/cdns3/host.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/usb/cdns3/host.c +14 -2
@@ -18,6 +18,11 @@#include "../host/xhci.h" #include "../host/xhci-plat.h" +/* +* The XECP_PORT_CAP_REG and XECP_AUX_CTRL_REG1 exist only +* in Cadence USB3 dual-role controller, so it can't be used +* with Cadence CDNSP dual-role controller. +*/ #define XECP_PORT_CAP_REG 0x8000#define XECP_AUX_CTRL_REG1 0x8120
@@ -57,6 +62,8 @@ static const struct xhci_plat_priv xhci_ .resume_quirk = xhci_cdns3_resume_quirk, }; +static const struct xhci_plat_priv xhci_plat_cdnsp_xhci; +static int __cdns_host_init (struct cdns *cdns) {struct platform_device *xhci;
@@ -81,8 +88,13 @@ static int __cdns_host_init(struct cdns goto err1; } - cdns->xhci_plat_data =kmemdup (&xhci_plat_cdns3_xhci, -sizeof (struct xhci_plat_priv ),GFP_KERNEL ); +if (cdns->version <CDNSP_CONTROLLER_V2 ) + cdns->xhci_plat_data =kmemdup (&xhci_plat_cdns3_xhci, +sizeof (struct xhci_plat_priv ),GFP_KERNEL ); +else + cdns->xhci_plat_data =kmemdup (&xhci_plat_cdnsp_xhci, +sizeof (struct xhci_plat_priv ),GFP_KERNEL ); +if (!cdns->xhci_plat_data) { ret = -ENOMEM ; goto err1;
Greg Kroah-Hartman
maintainerPATCH 120/195 usb: cdnsp: fixed issue with incorrect detecting CDNSP family controllers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pawel Laszczak <[email protected]>
commit 47625b018c6bc788bc10dd654c82696eb0a5ef11 upstream.
Cadence have several controllers from 0x000403xx family but current driver suuport detecting only one with DID equal 0x0004034E. It causes that if someone uses different CDNSP controller then driver will use incorrect version and register space.
Patch fix this issue.
--- drivers/usb/cdns3/core.c | 1 - drivers/usb/cdns3/drd.c | 13 +++++++++---- drivers/usb/cdns3/drd.h | 6 +++++- 3 files changed, 14 insertions(+), 6 deletions(-)
drivers/usb/cdns3/core.c +0 -1
@@ -394,7 +394,6 @@ pm_put:return ret; } -/** * cdns_wakeup_irq - interrupt handler for wakeup events * @irq: irq number for cdns3/cdnsp core device
drivers/usb/cdns3/drd.c +9 -4
@@ -156,7 +156,8 @@ bool cdns_is_device(struct cdns *cdns)*/ static void cdns_otg_disable_irq (struct cdns *cdns) { -writel (0 , &cdns->otg_irq_regs->ien); +if (cdns->version) +writel (0 , &cdns->otg_irq_regs->ien); }/**
@@ -418,15 +419,20 @@ int cdns_drd_init(struct cdns *cdns) cdns->otg_regs = (void __iomem *)&cdns->otg_v1_regs->cmd; -if (readl (&cdns->otg_cdnsp_regs->did) ==OTG_CDNSP_DID ) { + state =readl (&cdns->otg_cdnsp_regs->did); + +if (OTG_CDNSP_CHECK_DID (state)) { cdns->otg_irq_regs = (struct cdns_otg_irq_regs __iomem *) &cdns->otg_cdnsp_regs->ien; cdns->version =CDNSP_CONTROLLER_V2 ; - }else { + }else if (OTG_CDNS3_CHECK_DID (state)) { cdns->otg_irq_regs = (struct cdns_otg_irq_regs __iomem *) &cdns->otg_v1_regs->ien;writel (1 , &cdns->otg_v1_regs->simulate); cdns->version =CDNS3_CONTROLLER_V1 ; + }else { +dev_err (cdns->dev,"not supporte DID=0x%08x\n" , state); +return -EINVAL ; } dev_dbg(cdns->dev, "DRD version v1 (ID: %08x, rev: %08x)\n",
@@ -479,7 +485,6 @@ int cdns_drd_exit(struct cdns *cdns)return 0 ; } -/* Indicate the cdns3 core was power lost before */ bool cdns_power_is_lost (struct cdns *cdns) {
drivers/usb/cdns3/drd.h +5 -1
@@ -79,7 +79,11 @@ struct cdnsp_otg_regs {__le32 susp_timing_ctrl; }; -#define OTG_CDNSP_DID 0x0004034E +/* CDNSP driver supports 0x000403xx Cadence USB controller family. */ +#define OTG_CDNSP_CHECK_DID (did) (((did) & GENMASK(31, 8)) == 0x00040300) + +/* CDNS3 driver supports 0x000402xx Cadence USB controller family. */ +#define OTG_CDNS3_CHECK_DID (did) (((did) & GENMASK(31, 8)) == 0x00040200)/* * Common registers interface for both CDNS3 and CDNSP version of DRD.
Greg Kroah-Hartman
maintainerPATCH 121/195 usb: cdns3: fixed memory use after free at cdns3_gadget_ep_disable()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Li <[email protected]>
commit cd45f99034b0c8c9cb346dd0d6407a95ca3d36f6 upstream.
... cdns3_gadget_ep_free_request(&priv_ep->endpoint, &priv_req->request); list_del_init(&priv_req->list); ...
'priv_req' actually free at cdns3_gadget_ep_free_request(). But list_del_init() use priv_req->list after it.
[ 1542.642868][ T534] BUG: KFENCE: use-after-free read in __list_del_entry_valid+0x10/0xd4 [ 1542.642868][ T534] [ 1542.653162][ T534] Use-after-free read at 0x000000009ed0ba99 (in kfence-#3): [ 1542.660311][ T534] __list_del_entry_valid+0x10/0xd4 [ 1542.665375][ T534] cdns3_gadget_ep_disable+0x1f8/0x388 [cdns3] [ 1542.671571][ T534] usb_ep_disable+0x44/0xe4 [ 1542.675948][ T534] ffs_func_eps_disable+0x64/0xc8 [ 1542.680839][ T534] ffs_func_set_alt+0x74/0x368 [ 1542.685478][ T534] ffs_func_disable+0x18/0x28
Move list_del_init() before cdns3_gadget_ep_free_request() to resolve this problem.
--- drivers/usb/cdns3/cdns3-gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/cdns3/cdns3-gadget.c +1 -1
@@ -2537,11 +2537,11 @@ static int cdns3_gadget_ep_disable(strucwhile (!list_empty (&priv_ep->wa2_descmiss_req_list)) { priv_req =cdns3_next_priv_request (&priv_ep->wa2_descmiss_req_list); +list_del_init (&priv_req->list);kfree (priv_req->request.buf);cdns3_gadget_ep_free_request (&priv_ep->endpoint, &priv_req->request); -list_del_init (&priv_req->list); --priv_ep->wa2_counter; }
Greg Kroah-Hartman
maintainerPATCH 122/195 usb: cdns3: fix memory double free when handle zero packet
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Li <[email protected]>
commit 5fd9e45f1ebcd57181358af28506e8a661a260b3 upstream.
829 if (request->complete) {
830 spin_unlock(&priv_dev->lock);
831 usb_gadget_giveback_request(&priv_ep->endpoint,
832 request);
833 spin_lock(&priv_dev->lock);
834 }
835
836 if (request->buf == priv_dev->zlp_buf)
837 cdns3_gadget_ep_free_request(&priv_ep->endpoint, request);
Driver append an additional zero packet request when queue a packet, which length mod max packet size is 0. When transfer complete, run to line 831, usb_gadget_giveback_request() will free this requestion. 836 condition is true, so cdns3_gadget_ep_free_request() free this request again.
Log:
[ 1920.140696][ T150] BUG: KFENCE: use-after-free read in cdns3_gadget_giveback+0x134/0x2c0 [cdns3] [ 1920.140696][ T150] [ 1920.151837][ T150] Use-after-free read at 0x000000003d1cd10b (in kfence-#36): [ 1920.159082][ T150] cdns3_gadget_giveback+0x134/0x2c0 [cdns3] [ 1920.164988][ T150] cdns3_transfer_completed+0x438/0x5f8 [cdns3]
Add check at line 829, skip call usb_gadget_giveback_request() if it is additional zero length packet request. Needn't call usb_gadget_giveback_request() because it is allocated in this driver.
--- drivers/usb/cdns3/cdns3-gadget.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/cdns3/cdns3-gadget.c +5 -1
@@ -826,7 +826,11 @@ void cdns3_gadget_giveback(struct cdns3_return ; } -if (request->complete) { +/* +* zlp request is appended by driver, needn't call usb_gadget_giveback_request() to notify +* gadget composite driver. +*/ +if (request->complete && request->buf != priv_dev->zlp_buf) {spin_unlock (&priv_dev->lock);usb_gadget_giveback_request (&priv_ep->endpoint, request);
Greg Kroah-Hartman
maintainerPATCH 123/195 usb: gadget: ncm: Avoid dropping datagrams of properly parsed NTBs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krishna Kurapati <[email protected]>
commit 76c51146820c5dac629f21deafab0a7039bc3ccd upstream.
It is observed sometimes when tethering is used over NCM with Windows 11 as host, at some instances, the gadget_giveback has one byte appended at the end of a proper NTB. When the NTB is parsed, unwrap call looks for any leftover bytes in SKB provided by u_ether and if there are any pending bytes, it treats them as a separate NTB and parses it. But in case the second NTB (as per unwrap call) is faulty/corrupt, all the datagrams that were parsed properly in the first NTB and saved in rx_list are dropped.
Adding a few custom traces showed the following:
[002] d..1 7828.532866: dwc3_gadget_giveback: ep1out:
req 000000003868811a length 1025/16384 zsI ==> 0
[002] d..1 7828.532867: ncm_unwrap_ntb: K: ncm_unwrap_ntb toprocess: 1025 [002] d..1 7828.532867: ncm_unwrap_ntb: K: ncm_unwrap_ntb nth: 1751999342 [002] d..1 7828.532868: ncm_unwrap_ntb: K: ncm_unwrap_ntb seq: 0xce67 [002] d..1 7828.532868: ncm_unwrap_ntb: K: ncm_unwrap_ntb blk_len: 0x400 [002] d..1 7828.532868: ncm_unwrap_ntb: K: ncm_unwrap_ntb ndp_len: 0x10 [002] d..1 7828.532869: ncm_unwrap_ntb: K: Parsed NTB with 1 frames
In this case, the giveback is of 1025 bytes and block length is 1024. The rest 1 byte (which is 0x00) won't be parsed resulting in drop of all datagrams in rx_list.
Same is case with packets of size 2048:
[002] d..1 7828.557948: dwc3_gadget_giveback: ep1out:
req 0000000011dfd96e length 2049/16384 zsI ==> 0
[002] d..1 7828.557949: ncm_unwrap_ntb: K: ncm_unwrap_ntb nth: 1751999342
[002] d..1 7828.557950: ncm_unwrap_ntb: K: ncm_unwrap_ntb blk_len: 0x800
Lecroy shows one byte coming in extra confirming that the byte is coming in from PC:
Transfer 2959 - Bytes Transferred(1025) Timestamp((18.524 843 590)
- Transaction 8391 - Data(1025 bytes) Timestamp(18.524 843 590) --- Packet 4063861
Data(1024 bytes)
Duration(2.117us) Idle(14.700ns) Timestamp(18.524 843 590)
--- Packet 4063863
Data(1 byte)
Duration(66.160ns) Time(282.000ns) Timestamp(18.524 845 722)According to Windows driver, no ZLP is needed if wBlockLength is non-zero, because the non-zero wBlockLength has already told the function side the size of transfer to be expected. However, there are in-market NCM devices that rely on ZLP as long as the wBlockLength is multiple of wMaxPacketSize. To deal with such devices, it pads an extra 0 at end so the transfer is no longer multiple of wMaxPacketSize.
--- drivers/usb/gadget/function/f_ncm.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/usb/gadget/function/f_ncm.c +9 -1
@@ -1340,7 +1340,15 @@ parse_ntb: "Parsed NTB with %d frames\n", dgram_counter); to_process -= block_len; -if (to_process !=0 ) { + +/* +* Windows NCM driver avoids USB ZLPs by adding a 1-byte +* zero pad as needed. +*/ +if (to_process ==1 && + (*(unsigned char *)(ntb_ptr + block_len) ==0x00 )) { + to_process--; + }else if (to_process >0 ) { ntb_ptr = (unsigned char *)(ntb_ptr + block_len); goto parse_ntb; }
Greg Kroah-Hartman
maintainerPATCH 124/195 usb: roles: fix NULL pointer issue when put modules reference
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Yang <[email protected]>
commit 1c9be13846c0b2abc2480602f8ef421360e1ad9e upstream.
In current design, usb role class driver will get usb_role_switch parent's module reference after the user get usb_role_switch device and put the reference after the user put the usb_role_switch device. However, the parent device of usb_role_switch may be removed before the user put the usb_role_switch. If so, then, NULL pointer issue will be met when the user put the parent module's reference.
This will save the module pointer in structure of usb_role_switch. Then, we don't need to find module by iterating long relations.
--- drivers/usb/roles/class.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/usb/roles/class.c +11 -6
@@ -19,6 +19,7 @@ static struct class *role_class;struct usb_role_switch {struct device dev;struct mutex lock;/* device lock*/ +struct module *module;/* the module this device depends on */ enum usb_role role;/* From descriptor */
@@ -133,7 +134,7 @@ struct usb_role_switch *usb_role_switch_ usb_role_switch_match);if (!IS_ERR_OR_NULL (sw)) -WARN_ON (!try_module_get (sw->dev.parent->driver->owner)); +WARN_ON (!try_module_get (sw->module));return sw; }
@@ -155,7 +156,7 @@ struct usb_role_switch *fwnode_usb_role_ sw =fwnode_connection_find_match (fwnode,"usb-role-switch" ,NULL , usb_role_switch_match);if (!IS_ERR_OR_NULL (sw)) -WARN_ON (!try_module_get (sw->dev.parent->driver->owner)); +WARN_ON (!try_module_get (sw->module));return sw; }
@@ -170,7 +171,7 @@ EXPORT_SYMBOL_GPL(fwnode_usb_role_switchvoid usb_role_switch_put (struct usb_role_switch *sw) {if (!IS_ERR_OR_NULL (sw)) { -module_put (sw->dev.parent->driver->owner); +module_put (sw->module);put_device (&sw->dev); } }
@@ -187,15 +188,18 @@ struct usb_role_switch * usb_role_switch_find_by_fwnode(const struct fwnode_handle *fwnode) {struct device *dev; +struct usb_role_switch *sw =NULL ;if (!fwnode)return NULL ; dev =class_find_device_by_fwnode (role_class, fwnode); -if (dev) -WARN_ON (!try_module_get (dev->parent->driver->owner)); +if (dev) { + sw =to_role_switch (dev); +WARN_ON (!try_module_get (sw->module)); + } -return dev ?to_role_switch (dev) :NULL ; +return sw; }EXPORT_SYMBOL_GPL (usb_role_switch_find_by_fwnode);
@@ -337,6 +341,7 @@ usb_role_switch_register(struct device * sw->set = desc->set; sw->get = desc->get; + sw->module = parent->driver->owner; sw->dev.parent = parent; sw->dev.fwnode = desc->fwnode; sw->dev.class = role_class;
Greg Kroah-Hartman
maintainerPATCH 125/195 usb: roles: dont get/set_role() when usb_role_switch is unregistered
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Yang <[email protected]>
commit b787a3e781759026a6212736ef8e52cf83d1821a upstream.
There is a possibility that usb_role_switch device is unregistered before the user put usb_role_switch. In this case, the user may still want to get/set_role() since the user can't sense the changes of usb_role_switch.
This will add a flag to show if usb_role_switch is already registered and avoid unwanted behaviors.
--- drivers/usb/roles/class.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/usb/roles/class.c +10 -2
@@ -21,6 +21,7 @@ struct usb_role_switch {struct mutex lock;/* device lock*/ struct module *module;/* the module this device depends on */ enum usb_role role; +bool registered;/* From descriptor */ struct device *usb2_port;
@@ -47,6 +48,9 @@ int usb_role_switch_set_role(struct usb_if (IS_ERR_OR_NULL (sw))return 0 ; +if (!sw->registered) +return -EOPNOTSUPP ; +mutex_lock (&sw->lock); ret = sw->set (sw, role);
@@ -72,7 +76,7 @@ enum usb_role usb_role_switch_get_role(s {enum usb_role role; -if (IS_ERR_OR_NULL (sw)) +if (IS_ERR_OR_NULL (sw) || !sw->registered)return USB_ROLE_NONE ;mutex_lock (&sw->lock);
@@ -356,6 +360,8 @@ usb_role_switch_register(struct device *return ERR_PTR (ret); } + sw->registered = true; +/* TODO: Symlinks for the host port and the device controller. */ return sw;
@@ -370,8 +376,10 @@ EXPORT_SYMBOL_GPL(usb_role_switch_regist*/ void usb_role_switch_unregister (struct usb_role_switch *sw) { -if (!IS_ERR_OR_NULL (sw)) +if (!IS_ERR_OR_NULL (sw)) { + sw->registered = false;device_unregister (&sw->dev); + } }EXPORT_SYMBOL_GPL (usb_role_switch_unregister);
Greg Kroah-Hartman
maintainerPATCH 126/195 mptcp: make userspace_pm_append_new_local_addr static
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geliang Tang <[email protected]>
commit aa5887dca2d236fc50000e27023d4d78dce3af30 upstream.
mptcp_userspace_pm_append_new_local_addr() has always exclusively been used in pm_userspace.c since its introduction in
commit 4638de5aefe5 ("mptcp: handle local addrs announced by userspace PMs").
So make it static.
--- net/mptcp/pm_userspace.c | 4 ++-- net/mptcp/protocol.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-)
net/mptcp/pm_userspace.c +2 -2
@@ -25,8 +25,8 @@ void mptcp_free_local_addr_list(struct m } } -int mptcp_userspace_pm_append_new_local_addr (struct mptcp_sock *msk, -struct mptcp_pm_addr_entry *entry) +static int mptcp_userspace_pm_append_new_local_addr (struct mptcp_sock *msk, +struct mptcp_pm_addr_entry *entry) {DECLARE_BITMAP (id_bitmap,MPTCP_PM_MAX_ADDR_ID +1 );struct mptcp_pm_addr_entry *match =NULL ;
net/mptcp/protocol.h +0 -2
@@ -834,8 +834,6 @@ void mptcp_pm_remove_addrs(struct mptcp_void mptcp_pm_remove_addrs_and_subflows (struct mptcp_sock *msk,struct list_head *rm_list); -int mptcp_userspace_pm_append_new_local_addr (struct mptcp_sock *msk, -struct mptcp_pm_addr_entry *entry);void mptcp_free_local_addr_list (struct mptcp_sock *msk);int mptcp_nl_cmd_announce (struct sk_buff *skb,struct genl_info *info);int mptcp_nl_cmd_remove (struct sk_buff *skb,struct genl_info *info);
Greg Kroah-Hartman
maintainerPATCH 127/195 mptcp: add needs_id for userspace appending addr
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geliang Tang <[email protected]>
commit 6c347be62ae963b301ead8e7fa7b9973e6e0d6e1 upstream.
When userspace PM requires to create an ID 0 subflow in "userspace pm create id 0 subflow" test like this:
userspace_pm_add_sf $ns2 10.0.3.2 0
An ID 1 subflow, in fact, is created.
Since in mptcp_pm_nl_append_new_local_addr(), 'id 0' will be treated as no ID is set by userspace, and will allocate a new ID immediately:
if (!e->addr.id)
e->addr.id = find_next_zero_bit(pernet->id_bitmap,
MPTCP_PM_MAX_ADDR_ID + 1,
1);To solve this issue, a new parameter needs_id is added for mptcp_userspace_pm_append_new_local_addr() to distinguish between whether userspace PM has set an ID 0 or whether userspace PM has not set any address.
needs_id is true in mptcp_userspace_pm_get_local_id(), but false in mptcp_pm_nl_announce_doit() and mptcp_pm_nl_subflow_create_doit().
--- net/mptcp/pm_userspace.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
net/mptcp/pm_userspace.c +7 -6
@@ -26,7 +26,8 @@ void mptcp_free_local_addr_list(struct m }static int mptcp_userspace_pm_append_new_local_addr (struct mptcp_sock *msk, -struct mptcp_pm_addr_entry *entry) +struct mptcp_pm_addr_entry *entry, +bool needs_id) {DECLARE_BITMAP (id_bitmap,MPTCP_PM_MAX_ADDR_ID +1 );struct mptcp_pm_addr_entry *match =NULL ;
@@ -41,7 +42,7 @@ static int mptcp_userspace_pm_append_newspin_lock_bh (&msk->pm.lock);list_for_each_entry (e, &msk->pm.userspace_pm_local_addr_list, list) { addr_match =mptcp_addresses_equal (&e->addr, &entry->addr, true); -if (addr_match && entry->addr.id ==0 ) +if (addr_match && entry->addr.id ==0 && needs_id) entry->addr.id = e->addr.id; id_match = (e->addr.id == entry->addr.id);if (addr_match && id_match) {
@@ -64,7 +65,7 @@ static int mptcp_userspace_pm_append_new } *e = *entry; -if (!e->addr.id) +if (!e->addr.id && needs_id) e->addr.id =find_next_zero_bit (id_bitmap,MPTCP_PM_MAX_ADDR_ID +1 ,1 );
@@ -155,7 +156,7 @@ int mptcp_userspace_pm_get_local_id(struif (new_entry.addr.port == msk_sport) new_entry.addr.port =0 ; -return mptcp_userspace_pm_append_new_local_addr (msk, &new_entry); +return mptcp_userspace_pm_append_new_local_addr (msk, &new_entry, true); }int mptcp_nl_cmd_announce (struct sk_buff *skb,struct genl_info *info)
@@ -197,7 +198,7 @@ int mptcp_nl_cmd_announce(struct sk_buff goto announce_err; } - err =mptcp_userspace_pm_append_new_local_addr (msk, &addr_val); + err =mptcp_userspace_pm_append_new_local_addr (msk, &addr_val, false);if (err <0 ) {GENL_SET_ERR_MSG (info,"did not match address and id" ); goto announce_err;
@@ -335,7 +336,7 @@ int mptcp_nl_cmd_sf_create(struct sk_buf } local.addr = addr_l; - err =mptcp_userspace_pm_append_new_local_addr (msk, &local); + err =mptcp_userspace_pm_append_new_local_addr (msk, &local, false);if (err <0 ) {GENL_SET_ERR_MSG (info,"did not match address and id" ); goto create_err;
Greg Kroah-Hartman
maintainerPATCH 101/195 cachefiles: fix memory leak in cachefiles_add_cache()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
commit e21a2f17566cbd64926fb8f16323972f7a064444 upstream.
The following memory leak was reported after unbinding /dev/cachefiles:
==================================================================
unreferenced object 0xffff9b674176e3c0 (size 192):
comm "cachefilesd2", pid 680, jiffies 4294881224 hex dump (first 32 bytes):
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace (crc ea38a44b):
[<ffffffff8eb8a1a5>] kmem_cache_alloc+0x2d5/0x370
[<ffffffff8e917f86>] prepare_creds+0x26/0x2e0
[<ffffffffc002eeef>] cachefiles_determine_cache_security+0x1f/0x120
[<ffffffffc00243ec>] cachefiles_add_cache+0x13c/0x3a0
[<ffffffffc0025216>] cachefiles_daemon_write+0x146/0x1c0
[<ffffffff8ebc4a3b>] vfs_write+0xcb/0x520
[<ffffffff8ebc5069>] ksys_write+0x69/0xf0
[<ffffffff8f6d4662>] do_syscall_64+0x72/0x140
[<ffffffff8f8000aa>] entry_SYSCALL_64_after_hwframe+0x6e/0x76
==================================================================Put the reference count of cache_cred in cachefiles_daemon_unbind() to fix the problem. And also put cache_cred in cachefiles_add_cache() error branch to avoid memory leaks.
--- fs/cachefiles/cache.c | 2 ++ fs/cachefiles/daemon.c | 1 + 2 files changed, 3 insertions(+)
fs/cachefiles/cache.c +2 -0
@@ -168,6 +168,8 @@ error_unsupported:dput (root); error_open_root:cachefiles_end_secure (cache, saved_cred); +put_cred (cache->cache_cred); + cache->cache_cred =NULL ; error_getsec:fscache_relinquish_cache (cache_cookie); cache->cache =NULL ;
fs/cachefiles/daemon.c +1 -0
@@ -805,6 +805,7 @@ static void cachefiles_daemon_unbind(strcachefiles_put_directory (cache->graveyard);cachefiles_put_directory (cache->store);mntput (cache->mnt); +put_cred (cache->cache_cred);kfree (cache->rootdirname);kfree (cache->secctx);
Greg Kroah-Hartman
maintainerPATCH 128/195 mptcp: fix lockless access in subflow ULP diag
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit b8adb69a7d29c2d33eb327bca66476fb6066516b upstream.
Since the introduction of the subflow ULP diag interface, the dump callback accessed all the subflow data with lockless.
We need either to annotate all the read and write operation accordingly, or acquire the subflow socket lock. Let's do latter, even if slower, to avoid a diffstat havoc.
--- include/net/tcp.h | 2 +- net/mptcp/diag.c | 6 +++++- net/tls/tls_main.c | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-)
include/net/tcp.h +1 -1
@@ -2290,7 +2290,7 @@ struct tcp_ulp_ops {/* cleanup ulp */ void (*release)(struct sock *sk);/* diagnostic */ -int (*get_info)(const struct sock *sk,struct sk_buff *skb); +int (*get_info)(struct sock *sk,struct sk_buff *skb);size_t (*get_info_size)(const struct sock *sk);/* clone ulp */ void (*clone)(const struct request_sock *req, struct sock *newsk,
net/mptcp/diag.c +5 -1
@@ -13,17 +13,19 @@#include <uapi/linux/mptcp.h> #include "protocol.h" -static int subflow_get_info (const struct sock *sk,struct sk_buff *skb) +static int subflow_get_info (struct sock *sk,struct sk_buff *skb) {struct mptcp_subflow_context *sf;struct nlattr *start;u32 flags =0 ; +bool slow;int err; start =nla_nest_start_noflag (skb,INET_ULP_INFO_MPTCP );if (!start)return -EMSGSIZE ; + slow =lock_sock_fast (sk);rcu_read_lock (); sf =rcu_dereference (inet_csk (sk)->icsk_ulp_data);if (!sf) {
@@ -69,11 +71,13 @@ static int subflow_get_info(const struct }rcu_read_unlock (); +unlock_sock_fast (sk, slow);nla_nest_end (skb, start);return 0 ; nla_failure:rcu_read_unlock (); +unlock_sock_fast (sk, slow);nla_nest_cancel (skb, start);return err; }
net/tls/tls_main.c +1 -1
@@ -1098,7 +1098,7 @@ static u16 tls_user_config(struct tls_coreturn 0 ; } -static int tls_get_info (const struct sock *sk,struct sk_buff *skb) +static int tls_get_info (struct sock *sk,struct sk_buff *skb) {u16 version, cipher_type;struct tls_context *ctx;
Greg Kroah-Hartman
maintainerPATCH 102/195 md: Fix missing release of active_io for flush
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
commit 855678ed8534518e2b428bcbcec695de9ba248e8 upstream.
submit_flushes
atomic_set(&mddev->flush_pending, 1);
rdev_for_each_rcu(rdev, mddev)
atomic_inc(&mddev->flush_pending);
bi->bi_end_io = md_end_flush
submit_bio(bi);
/* flush io is done first */
md_end_flush
if (atomic_dec_and_test(&mddev->flush_pending))
percpu_ref_put(&mddev->active_io)
-> active_io is not released if (atomic_dec_and_test(&mddev->flush_pending))
-> missing release of active_io
For consequence, mddev_suspend() will wait for 'active_io' to be zero forever.
Fix this problem by releasing 'active_io' in submit_flushes() if 'flush_pending' is decreased to zero.
--- drivers/md/md.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/md/md.c +5 -1
@@ -564,8 +564,12 @@ static void submit_flushes(struct work_srcu_read_lock (); }rcu_read_unlock (); -if (atomic_dec_and_test (&mddev->flush_pending)) +if (atomic_dec_and_test (&mddev->flush_pending)) { +/* The pair is percpu_ref_get() from md_flush_request() */ +percpu_ref_put (&mddev->active_io); +queue_work (md_wq, &mddev->flush_work); + } }static void md_submit_flush_data (struct work_struct *ws)
Greg Kroah-Hartman
maintainerPATCH 103/195 KVM: arm64: vgic-its: Test for valid IRQ in MOVALL handler
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Upton <[email protected]>
commit 85a71ee9a0700f6c18862ef3b0011ed9dad99aca upstream.
It is possible that an LPI mapped in a different ITS gets unmapped while handling the MOVALL command. If that is the case, there is no state that can be migrated to the destination. Silently ignore it and continue migrating other LPIs.
--- arch/arm64/kvm/vgic/vgic-its.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/kvm/vgic/vgic-its.c +2 -0
@@ -1427,6 +1427,8 @@ static int vgic_its_cmd_handle_movall(stfor (i =0 ; i < irq_count; i++) { irq =vgic_get_irq (kvm,NULL , intids[i]); +if (!irq) +continue ;update_affinity (irq, vcpu2);
Greg Kroah-Hartman
maintainerPATCH 104/195 KVM: arm64: vgic-its: Test for valid IRQ in its_sync_lpi_pending_table()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Upton <[email protected]>
commit 8d3a7dfb801d157ac423261d7cd62c33e95375f8 upstream.
vgic_get_irq() may not return a valid descriptor if there is no ITS that holds a valid translation for the specified INTID. If that is the case, it is safe to silently ignore it and continue processing the LPI pending table.
--- arch/arm64/kvm/vgic/vgic-its.c | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/kvm/vgic/vgic-its.c +3 -0
@@ -462,6 +462,9 @@ static int its_sync_lpi_pending_table(st } irq =vgic_get_irq (vcpu->kvm,NULL , intids[i]); +if (!irq) +continue ; +raw_spin_lock_irqsave (&irq->irq_lock, flags); irq->pending_latch = pendmask & (1U << bit_nr);vgic_queue_irq_unlock (vcpu->kvm, irq, flags);
Greg Kroah-Hartman
maintainerPATCH 105/195 gtp: fix use-after-free and null-ptr-deref in gtp_genl_dump_pdp()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasiliy Kovalev <[email protected]>
commit 136cfaca22567a03bbb3bf53a43d8cb5748b80ec upstream.
The gtp_net_ops pernet operations structure for the subsystem must be registered before registering the generic netlink family.
Syzkaller hit 'general protection fault in gtp_genl_dump_pdp' bug:
general protection fault, probably for non-canonical address
0xdffffc0000000002: 0000 [#1] PREEMPT SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017]
CPU: 1 PID: 5826 Comm: gtp Not tainted 6.8.0-rc3-std-def-alt1 #1
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.0-alt1 04/01/2014
RIP: 0010:gtp_genl_dump_pdp+0x1be/0x800 [gtp]
Code: c6 89 c6 e8 64 e9 86 df 58 45 85 f6 0f 85 4e 04 00 00 e8 c5 ee 86
df 48 8b 54 24 18 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <80>
3c 02 00 0f 85 de 05 00 00 48 8b 44 24 18 4c 8b 30 4c 39 f0 74
RSP: 0018:ffff888014107220 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000002 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: ffff88800fcda588 R14: 0000000000000001 R15: 0000000000000000
FS: 00007f1be4eb05c0(0000) GS:ffff88806ce80000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f1be4e766cf CR3: 000000000c33e000 CR4: 0000000000750ef0
PKRU: 55555554
Call Trace:
<TASK>
? show_regs+0x90/0xa0
? die_addr+0x50/0xd0
? exc_general_protection+0x148/0x220
? asm_exc_general_protection+0x22/0x30
? gtp_genl_dump_pdp+0x1be/0x800 [gtp]
? __alloc_skb+0x1dd/0x350
? __pfx___alloc_skb+0x10/0x10
genl_dumpit+0x11d/0x230
netlink_dump+0x5b9/0xce0
? lockdep_hardirqs_on_prepare+0x253/0x430
? __pfx_netlink_dump+0x10/0x10
? kasan_save_track+0x10/0x40
? __kasan_kmalloc+0x9b/0xa0
? genl_start+0x675/0x970
__netlink_dump_start+0x6fc/0x9f0
genl_family_rcv_msg_dumpit+0x1bb/0x2d0
? __pfx_genl_family_rcv_msg_dumpit+0x10/0x10
? genl_op_from_small+0x2a/0x440
? cap_capable+0x1d0/0x240
? __pfx_genl_start+0x10/0x10
? __pfx_genl_dumpit+0x10/0x10
? __pfx_genl_done+0x10/0x10
? security_capable+0x9d/0xe0--- drivers/net/gtp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/gtp.c +5 -5
@@ -1906,20 +1906,20 @@ static int __init gtp_init(void)if (err <0 ) goto error_out; - err =genl_register_family (>p_genl_family); + err =register_pernet_subsys (>p_net_ops);if (err <0 ) goto unreg_rtnl_link; - err =register_pernet_subsys (>p_net_ops); + err =genl_register_family (>p_genl_family);if (err <0 ) - goto unreg_genl_family; + goto unreg_pernet_subsys;pr_info ("GTP module loaded (pdp ctx size %zd bytes)\n" ,sizeof (struct pdp_ctx ));return 0 ; -unreg_genl_family: -genl_unregister_family (>p_genl_family); +unreg_pernet_subsys: +unregister_pernet_subsys (>p_net_ops); unreg_rtnl_link:rtnl_link_unregister (>p_link_ops); error_out:
Greg Kroah-Hartman
maintainerPATCH 106/195 crypto: virtio/akcipher - Fix stack overflow on memcpy
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: zhenwei pi <[email protected]>
commit c0ec2a712daf133d9996a8a1b7ee2d4996080363 upstream.
sizeof(struct virtio_crypto_akcipher_session_para) is less than sizeof(struct virtio_crypto_op_ctrl_req::u), copying more bytes from stack variable leads stack overflow. Clang reports this issue by commands:
make -j CC=clang-14 mrproper >/dev/null 2>&1
make -j O=/tmp/crypto-build CC=clang-14 allmodconfig >/dev/null 2>&1 make -j O=/tmp/crypto-build W=1 CC=clang-14 drivers/crypto/virtio/
virtio_crypto_akcipher_algs.o
--- drivers/crypto/virtio/virtio_crypto_akcipher_algs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/crypto/virtio/virtio_crypto_akcipher_algs.c +3 -2
@@ -104,7 +104,8 @@ static void virtio_crypto_dataq_akcipher }static int virtio_crypto_alg_akcipher_init_session (struct virtio_crypto_akcipher_ctx *ctx, -struct virtio_crypto_ctrl_header *header,void *para, +struct virtio_crypto_ctrl_header *header, +struct virtio_crypto_akcipher_session_para *para,const uint8_t *key,unsigned int keylen) {struct scatterlist outhdr_sg, key_sg, inhdr_sg, *sgs[3 ];
@@ -128,7 +129,7 @@ static int virtio_crypto_alg_akcipher_in ctrl = &vc_ctrl_req->ctrl;memcpy (&ctrl->header, header,sizeof (ctrl->header)); -memcpy (&ctrl->u, para,sizeof (ctrl->u)); +memcpy (&ctrl->u.akcipher_create_session.para, para,sizeof (*para)); input = &vc_ctrl_req->input; input->status =cpu_to_le32 (VIRTIO_CRYPTO_ERR );
Greg Kroah-Hartman
maintainerPATCH 107/195 irqchip/gic-v3-its: Do not assume vPE tables are preallocated
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Upton <[email protected]>
commit ec4308ecfc887128a468f03fb66b767559c57c23 upstream.
The GIC/ITS code is designed to ensure to pick up any preallocated LPI tables on the redistributors, as enabling LPIs is a one-way switch. There is no such restriction for vLPIs, and for GICv4.1 it is expected to allocate a new vPE table at boot.
This works as intended when initializing an ITS, however when setting up a redistributor in cpu_init_lpis() the early return for preallocated RD tables skips straight past the GICv4 setup. This all comes to a head when trying to kexec() into a new kernel, as the new kernel silently fails to set up GICv4, leading to a complete loss of SGIs and LPIs for KVM VMs.
Slap a band-aid on the problem by ensuring its_cpu_init_lpis() always initializes GICv4 on the way out, even if the other RD tables were preallocated.
--- drivers/irqchip/irq-gic-v3-its.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-gic-v3-its.c +1 -1
@@ -3161,6 +3161,7 @@ static void its_cpu_init_lpis(void) val |=GICR_CTLR_ENABLE_LPIS ;writel_relaxed (val, rbase +GICR_CTLR ); +out:if (gic_rdists->has_vlpis && !gic_rdists->has_rvpeid) {void __iomem *vlpi_base =gic_data_rdist_vlpi_base ();
@@ -3196,7 +3197,6 @@ static void its_cpu_init_lpis(void)/* Make sure the GIC has seen the above */ dsb (sy); -out:gic_data_rdist ()->flags |=RD_LOCAL_LPI_ENABLED ; pr_info("GICv3: CPU%d: using %s LPI pending table @%pa\n", smp_processor_id(),
Greg Kroah-Hartman
maintainerPATCH 98/195 mm: memcontrol: clarify swapaccount=0 deprecation warning
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Weiner <[email protected]>
commit 118642d7f606fc9b9c92ee611275420320290ffb upstream.
The swapaccount deprecation warning is throwing false positives. Since we deprecated the knob and defaulted to enabling, the only reports we've been getting are from folks that set swapaccount=1. While this is a nice affirmation that always-enabling was the right choice, we certainly don't want to warn when users request the supported mode.
Only warn when disabling is requested, and clarify the warning.
--- mm/memcontrol.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
mm/memcontrol.c +7 -3
@@ -7517,9 +7517,13 @@ bool mem_cgroup_swap_full(struct folio *static int __init setup_swap_account (char *s) { -pr_warn_once ("The swapaccount= commandline option is deprecated. " -"Please report your usecase to [email protected] if you " -"depend on this functionality.\n" ); +bool res; + +if (!kstrtobool (s, &res) && !res) +pr_warn_once ("The swapaccount=0 commandline option is deprecated " +"in favor of configuring swap control via cgroupfs. " +"Please report your usecase to [email protected] if you " +"depend on this functionality.\n" );return 1 ; }__setup ("swapaccount=" , setup_swap_account);
Greg Kroah-Hartman
maintainerPATCH 130/195 IB/hfi1: Fix a memleak in init_credit_return
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhipeng Lu <[email protected]>
[ Upstream commit 809aa64ebff51eb170ee31a95f83b2d21efa32e2 ]
When dma_alloc_coherent fails to allocate dd->cr_base[i].va, init_credit_return should deallocate dd->cr_base and dd->cr_base[i] that allocated before. Or those resources would be never freed and a memleak is triggered.
--- drivers/infiniband/hw/hfi1/pio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/infiniband/hw/hfi1/pio.c +5 -1
@@ -2089,7 +2089,7 @@ int init_credit_return(struct hfi1_devdata *dd)"Unable to allocate credit return DMA range for NUMA %d\n" , i); ret = -ENOMEM ; - goto done; + goto free_cr_base; } }set_dev_node (&dd->pcidev->dev, dd->node);
@@ -2097,6 +2097,10 @@ int init_credit_return(struct hfi1_devdata *dd) ret =0 ; done:return ret; + +free_cr_base: +free_credit_return (dd); + goto done; }void free_credit_return (struct hfi1_devdata *dd)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 139/195 iommufd/iova_bitmap: Consider page offset for the pages to be pinned
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joao Martins <[email protected]>
[ Upstream commit 4bbcbc6ea2fa379632a24c14cfb47aa603816ac6 ]
For small bitmaps that aren't PAGE_SIZE aligned *and* that are less than 512 pages in bitmap length, use an extra page to be able to cover the entire range e.g. [1M..3G] which would be iterated more efficiently in a single iteration, rather than two.
--- drivers/vfio/iova_bitmap.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/vfio/iova_bitmap.c +7 -6
@@ -174,18 +174,19 @@ static int iova_bitmap_get(struct iova_bitmap *bitmap) bitmap->mapped_base_index) * sizeof(*bitmap->bitmap), PAGE_SIZE); -/* -* We always cap at max number of 'struct page' a base page can fit. -* This is, for example, on x86 means 2M of bitmap data max. -*/ - npages =min (npages,PAGE_SIZE /sizeof (struct page *)); -/* * Bitmap address to be pinned is calculated via pointer arithmetic * with bitmap u64 word index. */ addr = bitmap->bitmap + bitmap->mapped_base_index; +/* +* We always cap at max number of 'struct page' a base page can fit. +* This is, for example, on x86 means 2M of bitmap data max. +*/ + npages =min (npages + !!offset_in_page (addr), +PAGE_SIZE /sizeof (struct page *)); + ret =pin_user_pages_fast ((unsigned long )addr, npages,FOLL_WRITE , mapped->pages);if (ret <=0 )
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 140/195 RDMA/qedr: Fix qedr_create_user_qp error flow
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kamal Heib <[email protected]>
[ Upstream commit 5ba4e6d5863c53e937f49932dee0ecb004c65928 ]
Avoid the following warning by making sure to free the allocated resources in case that qedr_init_user_queue() fail.
-----------[ cut here ]-----------
WARNING: CPU: 0 PID: 143192 at drivers/infiniband/core/rdma_core.c:874 uverbs_destroy_ufile_hw+0xcf/0xf0 [ib_uverbs] Modules linked in: tls target_core_user uio target_core_pscsi target_core_file target_core_iblock ib_srpt ib_srp scsi_transport_srp nfsd nfs_acl rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lockd grace fscache netfs 8021q garp mrp stp llc ext4 mbcache jbd2 opa_vnic ib_umad ib_ipoib sunrpc rdma_ucm ib_isert iscsi_target_mod target_core_mod ib_iser libiscsi scsi_transport_iscsi rdma_cm iw_cm ib_cm hfi1 intel_rapl_msr intel_rapl_common mgag200 qedr sb_edac drm_shmem_helper rdmavt x86_pkg_temp_thermal drm_kms_helper intel_powerclamp ib_uverbs coretemp i2c_algo_bit kvm_intel dell_wmi_descriptor ipmi_ssif sparse_keymap kvm ib_core rfkill syscopyarea sysfillrect video sysimgblt irqbypass ipmi_si ipmi_devintf fb_sys_fops rapl iTCO_wdt mxm_wmi iTCO_vendor_support intel_cstate pcspkr dcdbas intel_uncore ipmi_msghandler lpc_ich acpi_power_meter mei_me mei fuse drm xfs libcrc32c qede sd_mod ahci libahci t10_pi sg crct10dif_pclmul crc32_pclmul crc32c_intel qed libata tg3 ghash_clmulni_intel megaraid_sas crc8 wmi [last unloaded: ib_srpt] CPU: 0 PID: 143192 Comm: fi_rdm_tagged_p Kdump: loaded Not tainted 5.14.0-408.el9.x86_64 #1 Hardware name: Dell Inc. PowerEdge R430/03XKDV, BIOS 2.14.0 01/25/2022 RIP: 0010:uverbs_destroy_ufile_hw+0xcf/0xf0 [ib_uverbs] Code: 5d 41 5c 41 5d 41 5e e9 0f 26 1b dd 48 89 df e8 67 6a ff ff 49 8b 86 10 01 00 00 48 85 c0 74 9c 4c 89 e7 e8 83 c0 cb dd eb 92 <0f> 0b eb be 0f 0b be 04 00 00 00 48 89 df e8 8e f5 ff ff e9 6d ff RSP: 0018:ffffb7c6cadfbc60 EFLAGS: 00010286 RAX: ffff8f0889ee3f60 RBX: ffff8f088c1a5200 RCX: 00000000802a0016 RDX: 00000000802a0017 RSI: 0000000000000001 RDI: ffff8f0880042600 RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000000 R10: ffff8f11fffd5000 R11: 0000000000039000 R12: ffff8f0d5b36cd80 R13: ffff8f088c1a5250 R14: ffff8f1206d91000 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff8f11d7c00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000147069200e20 CR3: 00000001c7210002 CR4: 00000000001706f0 Call Trace: <TASK> ? show_trace_log_lvl+0x1c4/0x2df ? show_trace_log_lvl+0x1c4/0x2df ? ib_uverbs_close+0x1f/0xb0 [ib_uverbs] ? uverbs_destroy_ufile_hw+0xcf/0xf0 [ib_uverbs] ? __warn+0x81/0x110 ? uverbs_destroy_ufile_hw+0xcf/0xf0 [ib_uverbs] ? report_bug+0x10a/0x140 ? handle_bug+0x3c/0x70 ? exc_invalid_op+0x14/0x70 ? asm_exc_invalid_op+0x16/0x20 ? uverbs_destroy_ufile_hw+0xcf/0xf0 [ib_uverbs] ib_uverbs_close+0x1f/0xb0 [ib_uverbs] __fput+0x94/0x250 task_work_run+0x5c/0x90 do_exit+0x270/0x4a0 do_group_exit+0x2d/0x90 get_signal+0x87c/0x8c0 arch_do_signal_or_restart+0x25/0x100 ? ib_uverbs_ioctl+0xc2/0x110 [ib_uverbs] exit_to_user_mode_loop+0x9c/0x130 exit_to_user_mode_prepare+0xb6/0x100 syscall_exit_to_user_mode+0x12/0x40 do_syscall_64+0x69/0x90 ? syscall_exit_work+0x103/0x130 ? syscall_exit_to_user_mode+0x22/0x40 ? do_syscall_64+0x69/0x90 ? syscall_exit_work+0x103/0x130 ? syscall_exit_to_user_mode+0x22/0x40 ? do_syscall_64+0x69/0x90 ? do_syscall_64+0x69/0x90 ? common_interrupt+0x43/0xa0 entry_SYSCALL_64_after_hwframe+0x72/0xdc RIP: 0033:0x1470abe3ec6b Code: Unable to access opcode bytes at RIP 0x1470abe3ec41. RSP: 002b:00007fff13ce9108 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: fffffffffffffffc RBX: 00007fff13ce9218 RCX: 00001470abe3ec6b RDX: 00007fff13ce9200 RSI: 00000000c0181b01 RDI: 0000000000000004 RBP: 00007fff13ce91e0 R08: 0000558d9655da10 R09: 0000558d9655dd00 R10: 00007fff13ce95c0 R11: 0000000000000246 R12: 00007fff13ce9358 R13: 0000000000000013 R14: 0000558d9655db50 R15: 00007fff13ce9470 </TASK>
--[ end trace 888a9b92e04c5c97 ]--
--- drivers/infiniband/hw/qedr/verbs.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/infiniband/hw/qedr/verbs.c +10 -1
@@ -1879,8 +1879,17 @@ static int qedr_create_user_qp(struct qedr_dev *dev,/* RQ - read access only (0) */ rc =qedr_init_user_queue (udata, dev, &qp->urq, ureq.rq_addr, ureq.rq_len, true,0 , alloc_and_init); -if (rc) +if (rc) { +ib_umem_release (qp->usq.umem); + qp->usq.umem =NULL ; +if (rdma_protocol_roce (&dev->ibdev,1 )) { +qedr_free_pbl (dev, &qp->usq.pbl_info, + qp->usq.pbl_tbl); + }else { +kfree (qp->usq.pbl_tbl); + }return rc; + } }memset (&in_params,0 ,sizeof (in_params));
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 141/195 arm64: dts: rockchip: set num-cs property for spi on px30
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
[ Upstream commit 334bf0710c98d391f4067b72f535d6c4c84dfb6f ]
The px30 has two spi controllers with two chip-selects each. The num-cs property is specified as the total number of chip selects a controllers has and is used since 2020 to find uses of chipselects outside that range in the Rockchip spi driver.
Without the property set, the default is 1, so spi devices using the second chipselect will not be created.
--- arch/arm64/boot/dts/rockchip/px30.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/rockchip/px30.dtsi +2 -0
@@ -607,6 +607,7 @@ clock-names = "spiclk", "apb_pclk"; dmas = <&dmac 12>, <&dmac 13>; dma-names = "tx", "rx"; + num-cs = <2>; pinctrl-names = "default"; pinctrl-0 = <&spi0_clk &spi0_csn &spi0_miso &spi0_mosi>; #address-cells = <1>;
@@ -622,6 +623,7 @@ clock-names = "spiclk", "apb_pclk"; dmas = <&dmac 14>, <&dmac 15>; dma-names = "tx", "rx"; + num-cs = <2>; pinctrl-names = "default"; pinctrl-0 = <&spi1_clk &spi1_csn0 &spi1_csn1 &spi1_miso &spi1_mosi>; #address-cells = <1>;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 142/195 RDMA/srpt: fix function pointer cast warnings
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit eb5c7465c3240151cd42a55c7ace9da0026308a1 ]
clang-16 notices that srpt_qp_event() gets called through an incompatible pointer here:
drivers/infiniband/ulp/srpt/ib_srpt.c:1815:5: error: cast from 'void (*)(struct ib_event *, struct srpt_rdma_ch *)' to 'void (*)(struct ib_event *, void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
1815 | = (void(*)(struct ib_event *, void*))srpt_qp_event;
Change srpt_qp_event() to use the correct prototype and adjust the argument inside of it.
--- drivers/infiniband/ulp/srpt/ib_srpt.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/infiniband/ulp/srpt/ib_srpt.c +5 -4
@@ -214,10 +214,12 @@ static const char *get_ch_state_name(enum rdma_ch_state s)/** * srpt_qp_event - QP event callback function * @event: Description of the event that occurred. -* @ch: SRPT RDMA channel. +* @ptr: SRPT RDMA channel. */ -static void srpt_qp_event (struct ib_event *event,struct srpt_rdma_ch *ch) +static void srpt_qp_event (struct ib_event *event,void *ptr) { +struct srpt_rdma_ch *ch = ptr; +pr_debug ("QP event %d on ch=%p sess_name=%s-%d state=%s\n" , event->event, ch, ch->sess_name, ch->qp->qp_num,get_ch_state_name (ch->state));
@@ -1811,8 +1813,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) ch->cq_size = ch->rq_size + sq_size; qp_init->qp_context = (void *)ch; - qp_init->event_handler - = (void (*)(struct ib_event *,void *))srpt_qp_event; + qp_init->event_handler = srpt_qp_event; qp_init->send_cq = ch->cq; qp_init->recv_cq = ch->cq; qp_init->sq_sig_type =IB_SIGNAL_REQ_WR ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 143/195 bpf, scripts: Correct GPL license name
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gianmarco Lusvardi <[email protected]>
[ Upstream commit e37243b65d528a8a9f8b9a57a43885f8e8dfc15c ]
The bpf_doc script refers to the GPL as the "GNU Privacy License". I strongly suspect that the author wanted to refer to the GNU General Public License, under which the Linux kernel is released, as, to the best of my knowledge, there is no license named "GNU Privacy License". This patch corrects the license name in the script accordingly.
--- scripts/bpf_doc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/bpf_doc.py +1 -1
@@ -495,7 +495,7 @@ eBPF programs can have an associated license, passed along with the bytecode instructions to the kernel when the programs are loaded. The format for that string is identical to the one in use for kernel modules (Dual licenses, such as "Dual BSD/GPL", may be used). Some helper functions are only accessible to -programs that are compatible with the GNU Privacy License (GPL). +programs that are compatible with the GNU General Public License (GNU GPL). In order to use such helpers, the eBPF program must be loaded with the correct license string passed (via **attr**) to the **bpf**\ () system call, and this
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 144/195 scsi: smartpqi: Fix disable_managed_interrupts
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Don Brace <[email protected]>
[ Upstream commit 5761eb9761d2d5fe8248a9b719efc4d8baf1f24a ]
Correct blk-mq registration issue with module parameter disable_managed_interrupts enabled.
When we turn off the default PCI_IRQ_AFFINITY flag, the driver needs to register with blk-mq using blk_mq_map_queues(). The driver is currently calling blk_mq_pci_map_queues() which results in a stack trace and possibly undefined behavior.
Stack Trace:
[ 7.860089] scsi host2: smartpqi [ 7.871934] WARNING: CPU: 0 PID: 238 at block/blk-mq-pci.c:52 blk_mq_pci_map_queues+0xca/0xd0 [ 7.889231] Modules linked in: sd_mod t10_pi sg uas smartpqi(+) crc32c_intel scsi_transport_sas usb_storage dm_mirror dm_region_hash dm_log dm_mod ipmi_devintf ipmi_msghandler fuse [ 7.924755] CPU: 0 PID: 238 Comm: kworker/0:3 Not tainted 4.18.0-372.88.1.el8_6_smartpqi_test.x86_64 #1 [ 7.944336] Hardware name: HPE ProLiant DL380 Gen10/ProLiant DL380 Gen10, BIOS U30 03/08/2022 [ 7.963026] Workqueue: events work_for_cpu_fn [ 7.978275] RIP: 0010:blk_mq_pci_map_queues+0xca/0xd0 [ 7.978278] Code: 48 89 de 89 c7 e8 f6 0f 4f 00 3b 05 c4 b7 8e 01 72 e1 5b 31 c0 5d 41 5c 41 5d 41 5e 41 5f e9 7d df 73 00 31 c0 e9 76 df 73 00 <0f> 0b eb bc 90 90 0f 1f 44 00 00 41 57 49 89 ff 41 56 41 55 41 54 [ 7.978280] RSP: 0018:ffffa95fc3707d50 EFLAGS: 00010216 [ 7.978283] RAX: 00000000ffffffff RBX: 0000000000000000 RCX: 0000000000000010 [ 7.978284] RDX: 0000000000000004 RSI: 0000000000000000 RDI: ffff9190c32d4310 [ 7.978286] RBP: 0000000000000000 R08: ffffa95fc3707d38 R09: ffff91929b81ac00 [ 7.978287] R10: 0000000000000001 R11: ffffa95fc3707ac0 R12: 0000000000000000 [ 7.978288] R13: ffff9190c32d4000 R14: 00000000ffffffff R15: ffff9190c4c950a8 [ 7.978290] FS: 0000000000000000(0000) GS:ffff9193efc00000(0000) knlGS:0000000000000000 [ 7.978292] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 8.172814] CR2: 000055d11166c000 CR3: 00000002dae10002 CR4: 00000000007706f0 [ 8.172816] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 8.172817] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 8.172818] PKRU: 55555554 [ 8.172819] Call Trace: [ 8.172823] blk_mq_alloc_tag_set+0x12e/0x310 [ 8.264339] scsi_add_host_with_dma.cold.9+0x30/0x245 [ 8.279302] pqi_ctrl_init+0xacf/0xc8e [smartpqi] [ 8.294085] ? pqi_pci_probe+0x480/0x4c8 [smartpqi] [ 8.309015] pqi_pci_probe+0x480/0x4c8 [smartpqi] [ 8.323286] local_pci_probe+0x42/0x80 [ 8.337855] work_for_cpu_fn+0x16/0x20 [ 8.351193] process_one_work+0x1a7/0x360 [ 8.364462] ? create_worker+0x1a0/0x1a0 [ 8.379252] worker_thread+0x1ce/0x390 [ 8.392623] ? create_worker+0x1a0/0x1a0 [ 8.406295] kthread+0x10a/0x120 [ 8.418428] ? set_kthread_struct+0x50/0x50 [ 8.431532] ret_from_fork+0x1f/0x40 [ 8.444137] ---[ end trace 1bf0173d39354506 ]---
--- drivers/scsi/smartpqi/smartpqi_init.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/smartpqi/smartpqi_init.c +4 -1
@@ -6449,8 +6449,11 @@ static void pqi_map_queues(struct Scsi_Host *shost) {struct pqi_ctrl_info *ctrl_info =shost_to_hba (shost); -blk_mq_pci_map_queues (&shost->tag_set.map[HCTX_TYPE_DEFAULT ], +if (!ctrl_info->disable_managed_interrupts) +return blk_mq_pci_map_queues (&shost->tag_set.map[HCTX_TYPE_DEFAULT ], ctrl_info->pci_dev,0 ); +else +return blk_mq_map_queues (&shost->tag_set.map[HCTX_TYPE_DEFAULT ]); }static inline bool pqi_is_tape_changer_device (struct pqi_scsi_dev *device)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 145/195 scsi: jazz_esp: Only build if SCSI core is builtin
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit 9ddf190a7df77b77817f955fdb9c2ae9d1c9c9a3 ]
JAZZ_ESP is a bool kconfig symbol that selects SCSI_SPI_ATTRS. When CONFIG_SCSI=m, this results in SCSI_SPI_ATTRS=m while JAZZ_ESP=y, which causes many undefined symbol linker errors.
Fix this by only offering to build this driver when CONFIG_SCSI=y.
[mkp: JAZZ_ESP is unique in that it does not support being compiled as a module unlike the remaining SPI SCSI HBA drivers]
--- drivers/scsi/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/Kconfig +1 -1
@@ -1285,7 +1285,7 @@ source "drivers/scsi/arm/Kconfig" config JAZZ_ESP bool "MIPS JAZZ FAS216 SCSI support" - depends on MACH_JAZZ && SCSI + depends on MACH_JAZZ && SCSI=y select SCSI_SPI_ATTRS help This is the driver for the onboard SCSI host adapter of MIPS Magnum
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 146/195 net: bridge: switchdev: Skip MDB replays of deferred events on offload
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tobias Waldekranz <[email protected]>
[ Upstream commit dc489f86257cab5056e747344f17a164f63bff4b ]
Before this change, generation of the list of MDB events to replay would race against the creation of new group memberships, either from the IGMP/MLD snooping logic or from user configuration.
While new memberships are immediately visible to walkers of br->mdb_list, the notification of their existence to switchdev event subscribers is deferred until a later point in time. So if a replay list was generated during a time that overlapped with such a window, it would also contain a replay of the not-yet-delivered event.
The driver would thus receive two copies of what the bridge internally considered to be one single event. On destruction of the bridge, only a single membership deletion event was therefore sent. As a consequence of this, drivers which reference count memberships (at least DSA), would be left with orphan groups in their hardware database when the bridge was destroyed.
This is only an issue when replaying additions. While deletion events may still be pending on the deferred queue, they will already have been removed from br->mdb_list, so no duplicates can be generated in that scenario.
To a user this meant that old group memberships, from a bridge in which a port was previously attached, could be reanimated (in hardware) when the port joined a new bridge, without the new bridge's knowledge.
For example, on an mv88e6xxx system, create a snooping bridge and immediately add a port to it:
root@infix-06-0b-00:~$ ip link add dev br0 up type bridge mcast_snooping 1 && \
Quoted 1 line
ip link set dev x3 up master br0
And then destroy the bridge:
root@infix-06-0b-00:~$ ip link del dev br0
root@infix-06-0b-00:~$ mvls atu
ADDRESS FID STATE Q F 0 1 2 3 4 5 6 7 8 9 a
DEV:0 Marvell 88E6393X
33:33:00:00:00:6a 1 static - - 0 . . . . . . . . . .
33:33:ff:87:e4:3f 1 static - - 0 . . . . . . . . . .
ff:ff:ff:ff:ff:ff 1 static - - 0 1 2 3 4 5 6 7 8 9 a
root@infix-06-0b-00:~$The two IPv6 groups remain in the hardware database because the port (x3) is notified of the host's membership twice: once via the original event and once via a replay. Since only a single delete notification is sent, the count remains at 1 when the bridge is destroyed.
Then add the same port (or another port belonging to the same hardware domain) to a new bridge, this time with snooping disabled:
root@infix-06-0b-00:~$ ip link add dev br1 up type bridge mcast_snooping 0 && \
Quoted 1 line
ip link set dev x3 up master br1
All multicast, including the two IPv6 groups from br0, should now be flooded, according to the policy of br1. But instead the old memberships are still active in the hardware database, causing the switch to only forward traffic to those groups towards the CPU (port 0).
Eliminate the race in two steps:
1. Grab the write-side lock of the MDB while generating the replay list.
This prevents new memberships from showing up while we are generating the replay list. But it leaves the scenario in which a deferred event was already generated, but not delivered, before we grabbed the lock. Therefore:
2. Make sure that no deferred version of a replay event is already enqueued to the switchdev deferred queue, before adding it to the replay list, when replaying additions.
--- include/net/switchdev.h | 3 ++ net/bridge/br_switchdev.c | 74 ++++++++++++++++++++++++--------------- net/switchdev/switchdev.c | 73 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 122 insertions(+), 28 deletions(-)
include/net/switchdev.h +3 -0
@@ -303,6 +303,9 @@ void switchdev_deferred_process(void);int switchdev_port_attr_set (struct net_device *dev,const struct switchdev_attr *attr,struct netlink_ext_ack *extack); +bool switchdev_port_obj_act_is_deferred (struct net_device *dev, +enum switchdev_notifier_type nt, +const struct switchdev_obj *obj);int switchdev_port_obj_add (struct net_device *dev,const struct switchdev_obj *obj,struct netlink_ext_ack *extack);
net/bridge/br_switchdev.c +46 -28
118 lines not on this page · raw message
net/switchdev/switchdev.c +73 -0
85 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 147/195 net: bridge: switchdev: Ensure deferred event delivery on unoffload
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tobias Waldekranz <[email protected]>
[ Upstream commit f7a70d650b0b6b0134ccba763d672c8439d9f09b ]
When unoffloading a device, it is important to ensure that all relevant deferred events are delivered to it before it disassociates itself from the bridge.
Before this change, this was true for the normal case when a device maps 1:1 to a net_bridge_port, i.e.
br0
/
swp0
When swp0 leaves br0, the call to switchdev_deferred_process() in del_nbp() makes sure to process any outstanding events while the device is still associated with the bridge.
In the case when the association is indirect though, i.e. when the device is attached to the bridge via an intermediate device, like a LAG...
br0
/ lag0
/
swp0
...then detaching swp0 from lag0 does not cause any net_bridge_port to be deleted, so there was no guarantee that all events had been processed before the device disassociated itself from the bridge.
Fix this by always synchronously processing all deferred events before signaling completion of unoffloading back to the driver.
--- net/bridge/br_switchdev.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
net/bridge/br_switchdev.c +10 -0
@@ -798,6 +798,16 @@ static void nbp_switchdev_unsync_objs(struct net_bridge_port *p,br_switchdev_mdb_replay (br_dev, dev, ctx, false, blocking_nb,NULL );br_switchdev_vlan_replay (br_dev, ctx, false, blocking_nb,NULL ); + +/* Make sure that the device leaving this bridge has seen all +* relevant events before it is disassociated. In the normal +* case, when the device is directly attached to the bridge, +* this is covered by del_nbp(). If the association was indirect +* however, e.g. via a team or bond, and the device is leaving +* that intermediate device, then the bridge port remains in +* place. +*/ +switchdev_deferred_process (); }/* Let the bridge know that this port is offloaded, so that it can assign a
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 148/195 dccp/tcp: Unhash sk from ehash for tb2 alloc failure after check_estalblished().
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 66b60b0c8c4a163b022a9f0ad6769b0fd3dc662f ]
syzkaller reported a warning [0] in inet_csk_destroy_sock() with no repro.
WARN_ON(inet_sk(sk)->inet_num && !inet_csk(sk)->icsk_bind_hash);
However, the syzkaller's log hinted that connect() failed just before the warning due to FAULT_INJECTION. [1]
When connect() is called for an unbound socket, we search for an available ephemeral port. If a bhash bucket exists for the port, we call __inet_check_established() or __inet6_check_established() to check if the bucket is reusable.
If reusable, we add the socket into ehash and set inet_sk(sk)->inet_num.
Later, we look up the corresponding bhash2 bucket and try to allocate it if it does not exist.
Although it rarely occurs in real use, if the allocation fails, we must revert the changes by check_established(). Otherwise, an unconnected socket could illegally occupy an ehash entry.
Note that we do not put tw back into ehash because sk might have already responded to a packet for tw and it would be better to free tw earlier under such memory presure.
[0]:
WARNING: CPU: 0 PID: 350830 at net/ipv4/inet_connection_sock.c:1193 inet_csk_destroy_sock (net/ipv4/inet_connection_sock.c:1193) Modules linked in: Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 RIP: 0010:inet_csk_destroy_sock (net/ipv4/inet_connection_sock.c:1193) Code: 41 5c 41 5d 41 5e e9 2d 4a 3d fd e8 28 4a 3d fd 48 89 ef e8 f0 cd 7d ff 5b 5d 41 5c 41 5d 41 5e e9 13 4a 3d fd e8 0e 4a 3d fd <0f> 0b e9 61 fe ff ff e8 02 4a 3d fd 4c 89 e7 be 03 00 00 00 e8 05 RSP: 0018:ffffc9000b21fd38 EFLAGS: 00010293 RAX: 0000000000000000 RBX: 0000000000009e78 RCX: ffffffff840bae40 RDX: ffff88806e46c600 RSI: ffffffff840bb012 RDI: ffff88811755cca8 RBP: ffff88811755c880 R08: 0000000000000003 R09: 0000000000000000 R10: 0000000000009e78 R11: 0000000000000000 R12: ffff88811755c8e0 R13: ffff88811755c892 R14: ffff88811755c918 R15: 0000000000000000 FS: 00007f03e5243800(0000) GS:ffff88811ae00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000001b32f21000 CR3: 0000000112ffe001 CR4: 0000000000770ef0 PKRU: 55555554 Call Trace: <TASK> ? inet_csk_destroy_sock (net/ipv4/inet_connection_sock.c:1193) dccp_close (net/dccp/proto.c:1078) inet_release (net/ipv4/af_inet.c:434) __sock_release (net/socket.c:660) sock_close (net/socket.c:1423) __fput (fs/file_table.c:377) __fput_sync (fs/file_table.c:462) __x64_sys_close (fs/open.c:1557 fs/open.c:1539 fs/open.c:1539) do_syscall_64 (arch/x86/entry/common.c:52 arch/x86/entry/common.c:83) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:129) RIP: 0033:0x7f03e53852bb Code: 03 00 00 00 0f 05 48 3d 00 f0 ff ff 77 41 c3 48 83 ec 18 89 7c 24 0c e8 43 c9 f5 ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 c9 f5 ff 8b 44 RSP: 002b:00000000005dfba0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 00007f03e53852bb RDX: 0000000000000002 RSI: 0000000000000002 RDI: 0000000000000003 RBP: 0000000000000000 R08: 0000000000000000 R09: 000000000000167c R10: 0000000008a79680 R11: 0000000000000293 R12: 00007f03e4e43000 R13: 00007f03e4e43170 R14: 00007f03e4e43178 R15: 00007f03e4e43170 </TASK>
[1]:FAULT_INJECTION: forcing a failure.
name failslab, interval 1, probability 0, space 0, times 0
CPU: 0 PID: 350833 Comm: syz-executor.1 Not tainted 6.7.0-12272-g2121c43f88f5 #9 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 Call Trace: <TASK> dump_stack_lvl (lib/dump_stack.c:107 (discriminator 1)) should_fail_ex (lib/fault-inject.c:52 lib/fault-inject.c:153) should_failslab (mm/slub.c:3748) kmem_cache_alloc (mm/slub.c:3763 mm/slub.c:3842 mm/slub.c:3867) inet_bind2_bucket_create (net/ipv4/inet_hashtables.c:135) __inet_hash_connect (net/ipv4/inet_hashtables.c:1100) dccp_v4_connect (net/dccp/ipv4.c:116) __inet_stream_connect (net/ipv4/af_inet.c:676) inet_stream_connect (net/ipv4/af_inet.c:747) __sys_connect_file (net/socket.c:2048 (discriminator 2)) __sys_connect (net/socket.c:2065) __x64_sys_connect (net/socket.c:2072) do_syscall_64 (arch/x86/entry/common.c:52 arch/x86/entry/common.c:83) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:129) RIP: 0033:0x7f03e5284e5d Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 73 9f 1b 00 f7 d8 64 89 01 48 RSP: 002b:00007f03e4641cc8 EFLAGS: 00000246 ORIG_RAX: 000000000000002a RAX: ffffffffffffffda RBX: 00000000004bbf80 RCX: 00007f03e5284e5d RDX: 0000000000000010 RSI: 0000000020000000 RDI: 0000000000000003 RBP: 00000000004bbf80 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 000000000000000b R14: 00007f03e52e5530 R15: 0000000000000000 </TASK>
--- net/ipv4/inet_hashtables.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)
net/ipv4/inet_hashtables.c +24 -1
@@ -1111,10 +1111,33 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row,return 0 ; error: +if (sk_hashed (sk)) { +spinlock_t *lock =inet_ehash_lockp (hinfo, sk->sk_hash); + +sock_prot_inuse_add (net, sk->sk_prot,-1 ); + +spin_lock (lock); +sk_nulls_del_node_init_rcu (sk); +spin_unlock (lock); + + sk->sk_hash =0 ; +inet_sk (sk)->inet_sport =0 ; +inet_sk (sk)->inet_num =0 ; + +if (tw) +inet_twsk_bind_unhash (tw, hinfo); + } +spin_unlock (&head2->lock);if (tb_created)inet_bind_bucket_destroy (hinfo->bind_bucket_cachep, tb); -spin_unlock_bh (&head->lock); +spin_unlock (&head->lock); + +if (tw) +inet_twsk_deschedule_put (tw); + +local_bh_enable (); +return -ENOMEM ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 131/195 RDMA/bnxt_re: Return error for SRQ resize
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kalesh AP <[email protected]>
[ Upstream commit 3687b450c5f32e80f179ce4b09e0454da1449eac ]
SRQ resize is not supported in the driver. But driver is not returning error from bnxt_re_modify_srq() for SRQ resize.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +2 -3
@@ -1710,7 +1710,7 @@ int bnxt_re_modify_srq(struct ib_srq *ib_srq, struct ib_srq_attr *srq_attr,switch (srq_attr_mask) {case IB_SRQ_MAX_WR :/* SRQ resize is not supported */ -break ; +return -EINVAL ;case IB_SRQ_LIMIT :/* Change the SRQ threshold */ if (srq_attr->srq_limit > srq->qplib_srq.max_wqe)
@@ -1725,13 +1725,12 @@ int bnxt_re_modify_srq(struct ib_srq *ib_srq, struct ib_srq_attr *srq_attr,/* On success, update the shadow */ srq->srq_limit = srq_attr->srq_limit;/* No need to Build and send response back to udata */ -break ; +return 0 ;default :ibdev_err (&rdev->ibdev,"Unsupported srq_attr_mask 0x%x" , srq_attr_mask);return -EINVAL ; } -return 0 ; }int bnxt_re_query_srq (struct ib_srq *ib_srq,struct ib_srq_attr *srq_attr)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 149/195 net: ethernet: adi: requires PHYLIB support
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit a9f80df4f51440303d063b55bb98720857693821 ]
This driver uses functions that are supplied by the Kconfig symbol PHYLIB, so select it to ensure that they are built as needed.
When CONFIG_ADIN1110=y and CONFIG_PHYLIB=m, there are multiple build (linker) errors that are resolved by this Kconfig change:
ld: drivers/net/ethernet/adi/adin1110.o: in function `adin1110_net_open':
drivers/net/ethernet/adi/adin1110.c:933: undefined reference to `phy_start'
ld: drivers/net/ethernet/adi/adin1110.o: in function `adin1110_probe_netdevs':
drivers/net/ethernet/adi/adin1110.c:1603: undefined reference to `get_phy_device'
ld: drivers/net/ethernet/adi/adin1110.c:1609: undefined reference to `phy_connect'
ld: drivers/net/ethernet/adi/adin1110.o: in function `adin1110_disconnect_phy':
drivers/net/ethernet/adi/adin1110.c:1226: undefined reference to `phy_disconnect'
ld: drivers/net/ethernet/adi/adin1110.o: in function `devm_mdiobus_alloc':
include/linux/phy.h:455: undefined reference to `devm_mdiobus_alloc_size'
ld: drivers/net/ethernet/adi/adin1110.o: in function `adin1110_register_mdiobus':
drivers/net/ethernet/adi/adin1110.c:529: undefined reference to `__devm_mdiobus_register'
ld: drivers/net/ethernet/adi/adin1110.o: in function `adin1110_net_stop':
drivers/net/ethernet/adi/adin1110.c:958: undefined reference to `phy_stop'
ld: drivers/net/ethernet/adi/adin1110.o: in function `adin1110_disconnect_phy':
drivers/net/ethernet/adi/adin1110.c:1226: undefined reference to `phy_disconnect'
ld: drivers/net/ethernet/adi/adin1110.o: in function `adin1110_adjust_link':
drivers/net/ethernet/adi/adin1110.c:1077: undefined reference to `phy_print_status'
ld: drivers/net/ethernet/adi/adin1110.o: in function `adin1110_ioctl':
drivers/net/ethernet/adi/adin1110.c:790: undefined reference to `phy_do_ioctl'
ld: drivers/net/ethernet/adi/adin1110.o:(.rodata+0xf60): undefined reference to `phy_ethtool_get_link_ksettings'
ld: drivers/net/ethernet/adi/adin1110.o:(.rodata+0xf68): undefined reference to `phy_ethtool_set_link_ksettings'
--- drivers/net/ethernet/adi/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/adi/Kconfig +1 -0
@@ -7,6 +7,7 @@ config NET_VENDOR_ADI bool "Analog Devices devices" default y depends on SPI + select PHYLIB help If you have a network (Ethernet) card belonging to this class, say Y.
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 150/195 nouveau: fix function cast warnings
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 0affdba22aca5573f9d989bcb1d71d32a6a03efe ]
clang-16 warns about casting between incompatible function types:
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c:161:10: error: cast from 'void (*)(const struct firmware *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
161 | .fini = (void(*)(void *))release_firmware,
This one was done to use the generic shadow_fw_release() function as a callback for struct nvbios_source. Change it to use the same prototype as the other five instances, with a trivial helper function that actually calls release_firmware.
--- drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c +7 -1
@@ -154,11 +154,17 @@ shadow_fw_init(struct nvkm_bios *bios, const char *name)return (void *)fw; } +static void +shadow_fw_release (void *fw) +{ +release_firmware (fw); +} +static const struct nvbios_source shadow_fw = { .name ="firmware" , .init = shadow_fw_init, - .fini = (void (*)(void *))release_firmware, + .fini = shadow_fw_release, .read = shadow_fw_read, .rw = false, };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 151/195 x86/numa: Fix the address overlap check in numa_fill_memblks()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alison Schofield <[email protected]>
[ Upstream commit 9b99c17f7510bed2adbe17751fb8abddba5620bc ]
numa_fill_memblks() fills in the gaps in numa_meminfo memblks over a physical address range. To do so, it first creates a list of existing memblks that overlap that address range. The issue is that it is off by one when comparing to the end of the address range, so memblks that do not overlap are selected.
The impact of selecting a memblk that does not actually overlap is that an existing memblk may be filled when the expected action is to do nothing and return NUMA_NO_MEMBLK to the caller. The caller can then add a new NUMA node and memblk.
Replace the broken open-coded search for address overlap with the memblock helper memblock_addrs_overlap(). Update the kernel doc and in code comments.
Suggested by: "Huang, Ying" <[email protected]>
--- arch/x86/mm/numa.c | 19 +++++++------------ include/linux/memblock.h | 2 ++ mm/memblock.c | 5 +++-- 3 files changed, 12 insertions(+), 14 deletions(-)
arch/x86/mm/numa.c +7 -12
@@ -971,14 +971,12 @@ static struct numa_memblk *numa_memblk_list[NR_NODE_MEMBLKS] __initdata;* @start: address to begin fill * @end: address to end fill * -* Find and extend numa_meminfo memblks to cover the @start-@end -* physical address range, such that the first memblk includes -* @start, the last memblk includes @end, and any gaps in between -* are filled. +* Find and extend numa_meminfo memblks to cover the physical +* address range @start-@end * * RETURNS: * 0 : Success -* NUMA_NO_MEMBLK : No memblk exists in @start-@end range +* NUMA_NO_MEMBLK : No memblks exist in address range @start-@end */ int __init numa_fill_memblks (u64 start,u64 end)
@@ -990,17 +988,14 @@ int __init numa_fill_memblks(u64 start, u64 end)/* * Create a list of pointers to numa_meminfo memblks that -* overlap start, end. Exclude (start == bi->end) since -* end addresses in both a CFMWS range and a memblk range -* are exclusive. -* -* This list of pointers is used to make in-place changes -* that fill out the numa_meminfo memblks. +* overlap start, end. The list is used to make in-place +* changes that fill out the numa_meminfo memblks. */ for (int i =0 ; i < mi->nr_blks; i++) {struct numa_memblk *bi = &mi->blk[i]; -if (start < bi->end && end >= bi->start) { +if (memblock_addrs_overlap (start, end - start, bi->start, + bi->end - bi->start)) { blk[count] = &mi->blk[i]; count++; }
include/linux/memblock.h +2 -0
@@ -118,6 +118,8 @@ int memblock_reserve(phys_addr_t base, phys_addr_t size);int memblock_physmem_add (phys_addr_t base,phys_addr_t size);#endif void memblock_trim_memory (phys_addr_t align); +unsigned long memblock_addrs_overlap (phys_addr_t base1,phys_addr_t size1, +phys_addr_t base2,phys_addr_t size2);bool memblock_overlaps_region (struct memblock_type *type,phys_addr_t base,phys_addr_t size);int memblock_mark_hotplug (phys_addr_t base,phys_addr_t size);
mm/memblock.c +3 -2
@@ -175,8 +175,9 @@ static inline phys_addr_t memblock_cap_size(phys_addr_t base, phys_addr_t *size)/* * Address comparison utilities */ -static unsigned long __init_memblock memblock_addrs_overlap (phys_addr_t base1,phys_addr_t size1, -phys_addr_t base2,phys_addr_t size2) +unsigned long __init_memblock +memblock_addrs_overlap (phys_addr_t base1,phys_addr_t size1,phys_addr_t base2, +phys_addr_t size2) {return ((base1 < (base2 + size2)) && (base2 < (base1 + size1))); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 152/195 x86/numa: Fix the sort compare func used in numa_fill_memblks()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alison Schofield <[email protected]>
[ Upstream commit b626070ffc14acca5b87a2aa5f581db98617584c ]
The compare function used to sort memblks into starting address order fails when the result of its u64 address subtraction gets truncated to an int upon return.
The impact of the bad sort is that memblks will be filled out incorrectly. Depending on the set of memblks, a user may see no errors at all but still have a bad fill, or see messages reporting a node overlap that leads to numa init failure:
[] node 0 [mem: ] overlaps with node 1 [mem: ]
[] No NUMA configuration found
Replace with a comparison that can only result in: 1, 0, -1.
--- arch/x86/mm/numa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/mm/numa.c +1 -1
@@ -961,7 +961,7 @@ static int __init cmp_memblk(const void *a, const void *b)const struct numa_memblk *ma = *(const struct numa_memblk **)a;const struct numa_memblk *mb = *(const struct numa_memblk **)b; -return ma->start - mb->start; +return (ma->start > mb->start) - (ma->start < mb->start); }static struct numa_memblk *numa_memblk_list[NR_NODE_MEMBLKS ]__initdata ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 153/195 net: stmmac: Fix incorrect dereference in interrupt handlers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Sakharov <[email protected]>
[ Upstream commit 97dde84026339e4b4af9a6301f825d1828d7874b ]
If 'dev' or 'data' is NULL, the 'priv' variable has an incorrect address when dereferencing calling netdev_err().
Since we get as 'dev_id' or 'data' what was passed as the 'dev' argument to request_irq() during interrupt initialization (that is, the net_device and rx/tx queue pointers initialized at the time of the call) and since there are usually no checks for the 'dev_id' argument in such handlers in other drivers, remove these checks from the handlers in stmmac driver.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 20 ------------------- 1 file changed, 20 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0 -20
@@ -5823,11 +5823,6 @@ static irqreturn_t stmmac_mac_interrupt(int irq, void *dev_id)struct net_device *dev = (struct net_device *)dev_id;struct stmmac_priv *priv =netdev_priv (dev); -if (unlikely (!dev)) { -netdev_err (priv->dev,"%s: invalid dev pointer\n" , __func__); -return IRQ_NONE ; - } -/* Check if adapter is up */ if (test_bit (STMMAC_DOWN , &priv->state))return IRQ_HANDLED ;
@@ -5843,11 +5838,6 @@ static irqreturn_t stmmac_safety_interrupt(int irq, void *dev_id)struct net_device *dev = (struct net_device *)dev_id;struct stmmac_priv *priv =netdev_priv (dev); -if (unlikely (!dev)) { -netdev_err (priv->dev,"%s: invalid dev pointer\n" , __func__); -return IRQ_NONE ; - } -/* Check if adapter is up */ if (test_bit (STMMAC_DOWN , &priv->state))return IRQ_HANDLED ;
@@ -5869,11 +5859,6 @@ static irqreturn_t stmmac_msi_intr_tx(int irq, void *data) dma_conf = container_of(tx_q, struct stmmac_dma_conf, tx_queue[chan]); priv = container_of(dma_conf, struct stmmac_priv, dma_conf); -if (unlikely (!data)) { -netdev_err (priv->dev,"%s: invalid dev pointer\n" , __func__); -return IRQ_NONE ; - } -/* Check if adapter is up */ if (test_bit (STMMAC_DOWN , &priv->state))return IRQ_HANDLED ;
@@ -5900,11 +5885,6 @@ static irqreturn_t stmmac_msi_intr_rx(int irq, void *data) dma_conf = container_of(rx_q, struct stmmac_dma_conf, rx_queue[chan]); priv = container_of(dma_conf, struct stmmac_priv, dma_conf); -if (unlikely (!data)) { -netdev_err (priv->dev,"%s: invalid dev pointer\n" , __func__); -return IRQ_NONE ; - } -/* Check if adapter is up */ if (test_bit (STMMAC_DOWN , &priv->state))return IRQ_HANDLED ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 154/195 ipv4: properly combine dev_base_seq and ipv4.dev_addr_genid
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 081a0e3b0d4c061419d3f4679dec9f68725b17e4 ]
net->dev_base_seq and ipv4.dev_addr_genid are monotonically increasing.
If we XOR their values, we could miss to detect if both values were changed with the same amount.
--- net/ipv4/devinet.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
net/ipv4/devinet.c +17 -4
@@ -1804,6 +1804,21 @@ static int in_dev_dump_addr(struct in_device *in_dev, struct sk_buff *skb,return err; } +/* Combine dev_addr_genid and dev_base_seq to detect changes. +*/ +static u32 inet_base_seq (const struct net *net) +{ +u32 res =atomic_read (&net->ipv4.dev_addr_genid) + + net->dev_base_seq; + +/* Must not return 0 (see nl_dump_check_consistent()). +* Chose a value far away from 0. +*/ +if (!res) + res =0x80000000 ; +return res; +} +static int inet_dump_ifaddr (struct sk_buff *skb,struct netlink_callback *cb) {const struct nlmsghdr *nlh = cb->nlh;
@@ -1855,8 +1870,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) idx =0 ; head = &tgt_net->dev_index_head[h];rcu_read_lock (); - cb->seq =atomic_read (&tgt_net->ipv4.dev_addr_genid) ^ - tgt_net->dev_base_seq; + cb->seq =inet_base_seq (tgt_net);hlist_for_each_entry_rcu (dev, head, index_hlist) {if (idx < s_idx) goto cont;
@@ -2257,8 +2271,7 @@ static int inet_netconf_dump_devconf(struct sk_buff *skb, idx =0 ; head = &net->dev_index_head[h];rcu_read_lock (); - cb->seq =atomic_read (&net->ipv4.dev_addr_genid) ^ - net->dev_base_seq; + cb->seq =inet_base_seq (net);hlist_for_each_entry_rcu (dev, head, index_hlist) {if (idx < s_idx) goto cont;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 155/195 ipv6: properly combine dev_base_seq and ipv6.dev_addr_genid
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit e898e4cd1aab271ca414f9ac6e08e4c761f6913c ]
net->dev_base_seq and ipv6.dev_addr_genid are monotonically increasing.
If we XOR their values, we could miss to detect if both values were changed with the same amount.
--- net/ipv6/addrconf.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
net/ipv6/addrconf.c +18 -3
@@ -706,6 +706,22 @@ static int inet6_netconf_get_devconf(struct sk_buff *in_skb,return err; } +/* Combine dev_addr_genid and dev_base_seq to detect changes. +*/ +static u32 inet6_base_seq (const struct net *net) +{ +u32 res =atomic_read (&net->ipv6.dev_addr_genid) + + net->dev_base_seq; + +/* Must not return 0 (see nl_dump_check_consistent()). +* Chose a value far away from 0. +*/ +if (!res) + res =0x80000000 ; +return res; +} + +static int inet6_netconf_dump_devconf (struct sk_buff *skb,struct netlink_callback *cb) {
@@ -739,8 +755,7 @@ static int inet6_netconf_dump_devconf(struct sk_buff *skb, idx =0 ; head = &net->dev_index_head[h];rcu_read_lock (); - cb->seq =atomic_read (&net->ipv6.dev_addr_genid) ^ - net->dev_base_seq; + cb->seq =inet6_base_seq (net);hlist_for_each_entry_rcu (dev, head, index_hlist) {if (idx < s_idx) goto cont;
@@ -5326,7 +5341,7 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb, }rcu_read_lock (); - cb->seq =atomic_read (&tgt_net->ipv6.dev_addr_genid) ^ tgt_net->dev_base_seq; + cb->seq =inet6_base_seq (tgt_net);for (h = s_h; h <NETDEV_HASHENTRIES ; h++, s_idx =0 ) { idx =0 ; head = &tgt_net->dev_index_head[h];
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 156/195 ata: ahci_ceva: fix error handling for Xilinx GT PHY support
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Radhey Shyam Pandey <[email protected]>
[ Upstream commit 26c8404e162b43dddcb037ba2d0cb58c0ed60aab ]
Platform clock and phy error resources are not cleaned up in Xilinx GT PHY error path.
To fix introduce the function ceva_ahci_platform_enable_resources() which is a customized version of ahci_platform_enable_resources() and inline with SATA IP programming sequence it does:
- Assert SATA reset
- Program PS GTR phy
- Bring SATA by de-asserting the reset
- Wait for GT lane PLL to be locked
ceva_ahci_platform_enable_resources() is also used in the resume path as the same SATA programming sequence (as in probe) should be followed. Also cleanup the mixed usage of ahci_platform_enable_resources() and custom implementation in the probe function as both are not required.
--- drivers/ata/ahci_ceva.c | 125 +++++++++++++++++++++++++--------------- 1 file changed, 79 insertions(+), 46 deletions(-)
drivers/ata/ahci_ceva.c +79 -46
@@ -88,7 +88,6 @@ struct ceva_ahci_priv {u32 axicc;bool is_cci_enabled;int flags; -struct reset_control *rst; }; static unsigned int ceva_ahci_read_id(struct ata_device *dev,
@@ -189,6 +188,60 @@ static struct scsi_host_template ahci_platform_sht = { AHCI_SHT(DRV_NAME), }; +static int ceva_ahci_platform_enable_resources (struct ahci_host_priv *hpriv) +{ +int rc, i; + + rc =ahci_platform_enable_regulators (hpriv); +if (rc) +return rc; + + rc =ahci_platform_enable_clks (hpriv); +if (rc) + goto disable_regulator; + +/* Assert the controller reset */ + rc =ahci_platform_assert_rsts (hpriv); +if (rc) + goto disable_clks; + +for (i =0 ; i < hpriv->nports; i++) { + rc =phy_init (hpriv->phys[i]); +if (rc) + goto disable_rsts; + } + +/* De-assert the controller reset */ +ahci_platform_deassert_rsts (hpriv); + +for (i =0 ; i < hpriv->nports; i++) { + rc =phy_power_on (hpriv->phys[i]); +if (rc) { +phy_exit (hpriv->phys[i]); + goto disable_phys; + } + } + +return 0 ; + +disable_rsts: +ahci_platform_deassert_rsts (hpriv); + +disable_phys: +while (--i >=0 ) { +phy_power_off (hpriv->phys[i]); +phy_exit (hpriv->phys[i]); + } + +disable_clks: +ahci_platform_disable_clks (hpriv); + +disable_regulator: +ahci_platform_disable_regulators (hpriv); + +return rc; +} +static int ceva_ahci_probe (struct platform_device *pdev) {struct device_node *np = pdev->dev.of_node;
@@ -203,47 +256,19 @@ static int ceva_ahci_probe(struct platform_device *pdev)return -ENOMEM ; cevapriv->ahci_pdev = pdev; - - cevapriv->rst =devm_reset_control_get_optional_exclusive (&pdev->dev, -NULL ); -if (IS_ERR (cevapriv->rst)) -dev_err_probe (&pdev->dev,PTR_ERR (cevapriv->rst), -"failed to get reset\n" ); - hpriv =ahci_platform_get_resources (pdev,0 );if (IS_ERR (hpriv))return PTR_ERR (hpriv); -if (!cevapriv->rst) { - rc =ahci_platform_enable_resources (hpriv); -if (rc) -return rc; - }else { -int i; + hpriv->rsts =devm_reset_control_get_optional_exclusive (&pdev->dev, +NULL ); +if (IS_ERR (hpriv->rsts)) +return dev_err_probe (&pdev->dev,PTR_ERR (hpriv->rsts), +"failed to get reset\n" ); - rc =ahci_platform_enable_clks (hpriv); -if (rc) -return rc; -/* Assert the controller reset */ -reset_control_assert (cevapriv->rst); - -for (i =0 ; i < hpriv->nports; i++) { - rc =phy_init (hpriv->phys[i]); -if (rc) -return rc; - } - -/* De-assert the controller reset */ -reset_control_deassert (cevapriv->rst); - -for (i =0 ; i < hpriv->nports; i++) { - rc =phy_power_on (hpriv->phys[i]); -if (rc) { -phy_exit (hpriv->phys[i]); -return rc; - } - } - } + rc =ceva_ahci_platform_enable_resources (hpriv); +if (rc) +return rc;if (of_property_read_bool (np,"ceva,broken-gen2" )) cevapriv->flags =CEVA_FLAG_BROKEN_GEN2 ;
@@ -252,52 +277,60 @@ static int ceva_ahci_probe(struct platform_device *pdev)if (of_property_read_u8_array (np,"ceva,p0-cominit-params" , (u8 *)&cevapriv->pp2c[0 ],4 ) <0 ) {dev_warn (dev,"ceva,p0-cominit-params property not defined\n" ); -return -EINVAL ; + rc = -EINVAL ; + goto disable_resources; }if (of_property_read_u8_array (np,"ceva,p1-cominit-params" , (u8 *)&cevapriv->pp2c[1 ],4 ) <0 ) {dev_warn (dev,"ceva,p1-cominit-params property not defined\n" ); -return -EINVAL ; + rc = -EINVAL ; + goto disable_resources; }/* Read OOB timing value for COMWAKE from device-tree*/ if (of_property_read_u8_array (np,"ceva,p0-comwake-params" , (u8 *)&cevapriv->pp3c[0 ],4 ) <0 ) {dev_warn (dev,"ceva,p0-comwake-params property not defined\n" ); -return -EINVAL ; + rc = -EINVAL ; + goto disable_resources; }if (of_property_read_u8_array (np,"ceva,p1-comwake-params" , (u8 *)&cevapriv->pp3c[1 ],4 ) <0 ) {dev_warn (dev,"ceva,p1-comwake-params property not defined\n" ); -return -EINVAL ; + rc = -EINVAL ; + goto disable_resources; }/* Read phy BURST timing value from device-tree */ if (of_property_read_u8_array (np,"ceva,p0-burst-params" , (u8 *)&cevapriv->pp4c[0 ],4 ) <0 ) {dev_warn (dev,"ceva,p0-burst-params property not defined\n" ); -return -EINVAL ; + rc = -EINVAL ; + goto disable_resources; }if (of_property_read_u8_array (np,"ceva,p1-burst-params" , (u8 *)&cevapriv->pp4c[1 ],4 ) <0 ) {dev_warn (dev,"ceva,p1-burst-params property not defined\n" ); -return -EINVAL ; + rc = -EINVAL ; + goto disable_resources; }/* Read phy RETRY interval timing value from device-tree */ if (of_property_read_u16_array (np,"ceva,p0-retry-params" , (u16 *)&cevapriv->pp5c[0 ],2 ) <0 ) {dev_warn (dev,"ceva,p0-retry-params property not defined\n" ); -return -EINVAL ; + rc = -EINVAL ; + goto disable_resources; }if (of_property_read_u16_array (np,"ceva,p1-retry-params" , (u16 *)&cevapriv->pp5c[1 ],2 ) <0 ) {dev_warn (dev,"ceva,p1-retry-params property not defined\n" ); -return -EINVAL ; + rc = -EINVAL ; + goto disable_resources; }/*
@@ -335,7 +368,7 @@ static int __maybe_unused ceva_ahci_resume(struct device *dev)struct ahci_host_priv *hpriv = host->private_data;int rc; - rc =ahci_platform_enable_resources (hpriv); + rc =ceva_ahci_platform_enable_resources (hpriv);if (rc)return rc;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 157/195 bpf: Fix racing between bpf_timer_cancel_and_free and bpf_timer_cancel
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin KaFai Lau <[email protected]>
[ Upstream commit 0281b919e175bb9c3128bd3872ac2903e9436e3f ]
The following race is possible between bpf_timer_cancel_and_free and bpf_timer_cancel. It will lead a UAF on the timer->timer.
bpf_timer_cancel(); spin_lock(); t = timer->time; spin_unlock(); bpf_timer_cancel_and_free(); spin_lock(); t = timer->timer; timer->timer = NULL; spin_unlock(); hrtimer_cancel(&t->timer); kfree(t); /* UAF on t */ hrtimer_cancel(&t->timer);
In bpf_timer_cancel_and_free, this patch frees the timer->timer after a rcu grace period. This requires a rcu_head addition to the "struct bpf_hrtimer". Another kfree(t) happens in bpf_timer_init, this does not need a kfree_rcu because it is still under the spin_lock and timer->timer has not been visible by others yet.
In bpf_timer_cancel, rcu_read_lock() is added because this helper can be used in a non rcu critical section context (e.g. from a sleepable bpf prog). Other timer->timer usages in helpers.c have been audited, bpf_timer_cancel() is the only place where timer->timer is used outside of the spin_lock.
Another solution considered is to mark a t->flag in bpf_timer_cancel and clear it after hrtimer_cancel() is done. In bpf_timer_cancel_and_free, it busy waits for the flag to be cleared before kfree(t). This patch goes with a straight forward solution and frees timer->timer after a rcu grace period.
--- kernel/bpf/helpers.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/bpf/helpers.c +4 -1
@@ -1091,6 +1091,7 @@ struct bpf_hrtimer {struct bpf_prog *prog;void __rcu *callback_fn;void *value; +struct rcu_head rcu; };/* the actual struct hidden inside uapi struct bpf_timer */
@@ -1312,6 +1313,7 @@ BPF_CALL_1(bpf_timer_cancel, struct bpf_timer_kern *, timer)if (in_nmi ())return -EOPNOTSUPP ; +rcu_read_lock ();__bpf_spin_lock_irqsave (&timer->lock); t = timer->timer;if (!t) {
@@ -1333,6 +1335,7 @@ BPF_CALL_1(bpf_timer_cancel, struct bpf_timer_kern *, timer)* if it was running. */ ret = ret ?:hrtimer_cancel (&t->timer); +rcu_read_unlock ();return ret; }
@@ -1387,7 +1390,7 @@ void bpf_timer_cancel_and_free(void *val)*/ if (this_cpu_read (hrtimer_running) != t)hrtimer_cancel (&t->timer); -kfree (t); +kfree_rcu (t, rcu); } BPF_CALL_2(bpf_kptr_xchg, void *, map_value, void *, ptr)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 158/195 afs: Increase buffer size in afs_update_volume_status()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniil Dulov <[email protected]>
[ Upstream commit 6ea38e2aeb72349cad50e38899b0ba6fbcb2af3d ]
The max length of volume->vid value is 20 characters. So increase idbuf[] size up to 24 to avoid overflow.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
[DH: Actually, it's 20 + NUL, so increase it to 24 and use snprintf()]
--- fs/afs/volume.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/afs/volume.c +2 -2
@@ -341,7 +341,7 @@ static int afs_update_volume_status(struct afs_volume *volume, struct key *key) {struct afs_server_list *new, *old, *discard;struct afs_vldb_entry *vldb; -char idbuf[16 ]; +char idbuf[24 ];int ret, idsz;_enter ("" );
@@ -349,7 +349,7 @@ static int afs_update_volume_status(struct afs_volume *volume, struct key *key)/* We look up an ID by passing it as a decimal string in the * operation's name parameter. */ - idsz =sprintf (idbuf,"%llu" , volume->vid); + idsz =snprintf (idbuf,sizeof (idbuf),"%llu" , volume->vid); vldb =afs_vl_lookup_vldb (volume->cell, key, idbuf, idsz);if (IS_ERR (vldb)) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 132/195 RDMA/irdma: Fix KASAN issue with tasklet
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Marciniszyn <[email protected]>
[ Upstream commit bd97cea7b18a0a553773af806dfbfac27a7c4acb ]
KASAN testing revealed the following issue assocated with freeing an IRQ.
[50006.466686] Call Trace: [50006.466691] <IRQ> [50006.489538] dump_stack+0x5c/0x80 [50006.493475] print_address_description.constprop.6+0x1a/0x150 [50006.499872] ? irdma_sc_process_ceq+0x483/0x790 [irdma] [50006.505742] ? irdma_sc_process_ceq+0x483/0x790 [irdma] [50006.511644] kasan_report.cold.11+0x7f/0x118 [50006.516572] ? irdma_sc_process_ceq+0x483/0x790 [irdma] [50006.522473] irdma_sc_process_ceq+0x483/0x790 [irdma] [50006.528232] irdma_process_ceq+0xb2/0x400 [irdma] [50006.533601] ? irdma_hw_flush_wqes_callback+0x370/0x370 [irdma] [50006.540298] irdma_ceq_dpc+0x44/0x100 [irdma] [50006.545306] tasklet_action_common.isra.14+0x148/0x2c0 [50006.551096] __do_softirq+0x1d0/0xaf8 [50006.555396] irq_exit_rcu+0x219/0x260 [50006.559670] irq_exit+0xa/0x20 [50006.563320] smp_apic_timer_interrupt+0x1bf/0x690 [50006.568645] apic_timer_interrupt+0xf/0x20 [50006.573341] </IRQ>
The issue is that a tasklet could be pending on another core racing the delete of the irq.
Fix by insuring any scheduled tasklet is killed after deleting the irq.
--- drivers/infiniband/hw/irdma/hw.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/infiniband/hw/irdma/hw.c +7 -0
@@ -562,6 +562,13 @@ static void irdma_destroy_irq(struct irdma_pci_f *rf, dev->irq_ops->irdma_dis_irq (dev, msix_vec->idx);irq_update_affinity_hint (msix_vec->irq,NULL );free_irq (msix_vec->irq, dev_id); +if (rf == dev_id) { +tasklet_kill (&rf->dpc_tasklet); + }else { +struct irdma_ceq *iwceq = (struct irdma_ceq *)dev_id; + +tasklet_kill (&iwceq->dpc_tasklet); + } }/**
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 159/195 ipv6: sr: fix possible use-after-free and null-ptr-deref
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasiliy Kovalev <[email protected]>
[ Upstream commit 5559cea2d5aa3018a5f00dd2aca3427ba09b386b ]
The pernet operations structure for the subsystem must be registered before registering the generic netlink family.
--- net/ipv6/seg6.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
net/ipv6/seg6.c +11 -9
@@ -512,22 +512,24 @@ int __init seg6_init(void) {int err; - err =genl_register_family (&seg6_genl_family); + err =register_pernet_subsys (&ip6_segments_ops);if (err) goto out; - err =register_pernet_subsys (&ip6_segments_ops); + err =genl_register_family (&seg6_genl_family);if (err) - goto out_unregister_genl; + goto out_unregister_pernet;#ifdef CONFIG_IPV6_SEG6_LWTUNNEL err =seg6_iptunnel_init ();if (err) - goto out_unregister_pernet; + goto out_unregister_genl; err =seg6_local_init (); -if (err) - goto out_unregister_pernet; +if (err) { +seg6_iptunnel_exit (); + goto out_unregister_genl; + }#endif #ifdef CONFIG_IPV6_SEG6_HMAC
@@ -548,11 +550,11 @@ int __init seg6_init(void)#endif #endif #ifdef CONFIG_IPV6_SEG6_LWTUNNEL -out_unregister_pernet: -unregister_pernet_subsys (&ip6_segments_ops); -#endif out_unregister_genl:genl_unregister_family (&seg6_genl_family); +#endif +out_unregister_pernet: +unregister_pernet_subsys (&ip6_segments_ops); goto out; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 133/195 RDMA/irdma: Validate max_send_wr and max_recv_wr
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shiraz Saleem <[email protected]>
[ Upstream commit ee107186bcfd25d7873258f3f75440e20f5e6416 ]
Validate that max_send_wr and max_recv_wr is within the supported range.
--- drivers/infiniband/hw/irdma/verbs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/irdma/verbs.c +3 -1
@@ -762,7 +762,9 @@ static int irdma_validate_qp_attrs(struct ib_qp_init_attr *init_attr,if (init_attr->cap.max_inline_data > uk_attrs->max_hw_inline || init_attr->cap.max_send_sge > uk_attrs->max_hw_wq_frags || - init_attr->cap.max_recv_sge > uk_attrs->max_hw_wq_frags) + init_attr->cap.max_recv_sge > uk_attrs->max_hw_wq_frags || + init_attr->cap.max_send_wr > uk_attrs->max_hw_wq_quanta || + init_attr->cap.max_recv_wr > uk_attrs->max_hw_rq_quanta)return -EINVAL ;if (rdma_protocol_roce (&iwdev->ibdev,1 )) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 134/195 RDMA/irdma: Set the CQ read threshold for GEN 1
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mustafa Ismail <[email protected]>
[ Upstream commit 666047f3ece9f991774c1fe9b223139a9ef8908d ]
The CQ shadow read threshold is currently not set for GEN 2. This could cause an invalid CQ overflow condition, so remove the GEN check that exclused GEN 1.
--- drivers/infiniband/hw/irdma/verbs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/infiniband/hw/irdma/verbs.c +2 -3
@@ -2121,9 +2121,8 @@ static int irdma_create_cq(struct ib_cq *ibcq, info.cq_base_pa = iwcq->kmem.pa; } -if (dev->hw_attrs.uk_attrs.hw_rev >=IRDMA_GEN_2 ) - info.shadow_read_threshold =min (info.cq_uk_init_info.cq_size /2 , - (u32 )IRDMA_MAX_CQ_READ_THRESH ); + info.shadow_read_threshold =min (info.cq_uk_init_info.cq_size /2 , + (u32 )IRDMA_MAX_CQ_READ_THRESH );if (irdma_sc_cq_init (cq, &info)) {ibdev_dbg (&iwdev->ibdev,"VERBS: init cq fail\n" );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 135/195 RDMA/irdma: Add AE for too many RNRS
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mustafa Ismail <[email protected]>
[ Upstream commit 630bdb6f28ca9e5ff79e244030170ac788478332 ]
Add IRDMA_AE_LLP_TOO_MANY_RNRS to the list of AE's processed as an abnormal asyncronous event.
--- drivers/infiniband/hw/irdma/defs.h | 1 + drivers/infiniband/hw/irdma/hw.c | 1 + 2 files changed, 2 insertions(+)
drivers/infiniband/hw/irdma/defs.h +1 -0
@@ -345,6 +345,7 @@ enum irdma_cqp_op_type {#define IRDMA_AE_LLP_TOO_MANY_KEEPALIVE_RETRIES 0x050b#define IRDMA_AE_LLP_DOUBT_REACHABILITY 0x050c#define IRDMA_AE_LLP_CONNECTION_ESTABLISHED 0x050e +#define IRDMA_AE_LLP_TOO_MANY_RNRS 0x050f#define IRDMA_AE_RESOURCE_EXHAUSTION 0x0520#define IRDMA_AE_RESET_SENT 0x0601#define IRDMA_AE_TERMINATE_SENT 0x0602
drivers/infiniband/hw/irdma/hw.c +1 -0
@@ -379,6 +379,7 @@ static void irdma_process_aeq(struct irdma_pci_f *rf)case IRDMA_AE_LLP_TOO_MANY_RETRIES :case IRDMA_AE_LCE_QP_CATASTROPHIC :case IRDMA_AE_LCE_FUNCTION_CATASTROPHIC : +case IRDMA_AE_LLP_TOO_MANY_RNRS :case IRDMA_AE_LCE_CQ_CATASTROPHIC :case IRDMA_AE_UDA_XMIT_DGRAM_TOO_LONG :default :
Signature · 1 line
2.43.0