5.15.132-rc1 review
Subsystems (13)
Greg Kroah-Hartman
maintainerPATCH 292/511 scsi: fcoe: Fix potential deadlock on &fip->ctlr_lock
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengfeng Ye <[email protected]>
[ Upstream commit 1a1975551943f681772720f639ff42fbaa746212 ]
There is a long call chain that &fip->ctlr_lock is acquired by isr fnic_isr_msix_wq_copy() under hard IRQ context. Thus other process context code acquiring the lock should disable IRQ, otherwise deadlock could happen if the IRQ preempts the execution while the lock is held in process context on the same CPU.
[ISR]fnic_isr_msix_wq_copy()
-> fnic_wq_copy_cmpl_handler()
-> fnic_fcpio_cmpl_handler()
-> fnic_fcpio_flogi_reg_cmpl_handler()
-> fnic_flush_tx()
-> fnic_send_frame()
-> fcoe_ctlr_els_send()
-> spin_lock_bh(&fip->ctlr_lock)
[Process Context]
1. fcoe_ctlr_timer_work()
-> fcoe_ctlr_flogi_send()
-> spin_lock_bh(&fip->ctlr_lock)
2. fcoe_ctlr_recv_work()
-> fcoe_ctlr_recv_handler()
-> fcoe_ctlr_recv_els()
-> fcoe_ctlr_announce()
-> spin_lock_bh(&fip->ctlr_lock)
3. fcoe_ctlr_recv_work()
-> fcoe_ctlr_recv_handler()
-> fcoe_ctlr_recv_els()
-> fcoe_ctlr_flogi_retry()
-> spin_lock_bh(&fip->ctlr_lock)
4. -> fcoe_xmit()
-> fcoe_ctlr_els_send()
-> spin_lock_bh(&fip->ctlr_lock)
spin_lock_bh() is not enough since fnic_isr_msix_wq_copy() is a hardirq.
These flaws were found by an experimental static analysis tool I am developing for irq-related deadlock.
The patch fix the potential deadlocks by spin_lock_irqsave() to disable hard irq.
--- drivers/scsi/fcoe/fcoe_ctlr.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/scsi/fcoe/fcoe_ctlr.c +12 -8
@@ -319,16 +319,17 @@ static void fcoe_ctlr_announce(struct fcoe_ctlr *fip) {struct fcoe_fcf *sel;struct fcoe_fcf *fcf; +unsigned long flags;mutex_lock (&fip->ctlr_mutex); -spin_lock_bh (&fip->ctlr_lock); +spin_lock_irqsave (&fip->ctlr_lock, flags);kfree_skb (fip->flogi_req); fip->flogi_req =NULL ;list_for_each_entry (fcf, &fip->fcfs, list) fcf->flogi_sent =0 ; -spin_unlock_bh (&fip->ctlr_lock); +spin_unlock_irqrestore (&fip->ctlr_lock, flags); sel = fip->sel_fcf;if (sel &ðer_addr_equal (sel->fcf_mac, fip->dest_addr))
@@ -699,6 +700,7 @@ int fcoe_ctlr_els_send(struct fcoe_ctlr *fip, struct fc_lport *lport, {struct fc_frame *fp;struct fc_frame_header *fh; +unsigned long flags;u16 old_xid;u8 op;u8 mac[ETH_ALEN ];
@@ -732,11 +734,11 @@ int fcoe_ctlr_els_send(struct fcoe_ctlr *fip, struct fc_lport *lport, op =FIP_DT_FLOGI ;if (fip->mode ==FIP_MODE_VN2VN )break ; -spin_lock_bh (&fip->ctlr_lock); +spin_lock_irqsave (&fip->ctlr_lock, flags);kfree_skb (fip->flogi_req); fip->flogi_req = skb; fip->flogi_req_send =1 ; -spin_unlock_bh (&fip->ctlr_lock); +spin_unlock_irqrestore (&fip->ctlr_lock, flags);schedule_work (&fip->timer_work);return -EINPROGRESS ;case ELS_FDISC :
@@ -1713,10 +1715,11 @@ static int fcoe_ctlr_flogi_send_locked(struct fcoe_ctlr *fip)static int fcoe_ctlr_flogi_retry (struct fcoe_ctlr *fip) {struct fcoe_fcf *fcf; +unsigned long flags;int error;mutex_lock (&fip->ctlr_mutex); -spin_lock_bh (&fip->ctlr_lock); +spin_lock_irqsave (&fip->ctlr_lock, flags);LIBFCOE_FIP_DBG (fip,"re-sending FLOGI - reselect\n" ); fcf =fcoe_ctlr_select (fip);if (!fcf || fcf->flogi_sent) {
@@ -1727,7 +1730,7 @@ static int fcoe_ctlr_flogi_retry(struct fcoe_ctlr *fip)fcoe_ctlr_solicit (fip,NULL ); error =fcoe_ctlr_flogi_send_locked (fip); } -spin_unlock_bh (&fip->ctlr_lock); +spin_unlock_irqrestore (&fip->ctlr_lock, flags);mutex_unlock (&fip->ctlr_mutex);return error; }
@@ -1744,8 +1747,9 @@ static int fcoe_ctlr_flogi_retry(struct fcoe_ctlr *fip)static void fcoe_ctlr_flogi_send (struct fcoe_ctlr *fip) {struct fcoe_fcf *fcf; +unsigned long flags; -spin_lock_bh (&fip->ctlr_lock); +spin_lock_irqsave (&fip->ctlr_lock, flags); fcf = fip->sel_fcf;if (!fcf || !fip->flogi_req_send) goto unlock;
@@ -1772,7 +1776,7 @@ static void fcoe_ctlr_flogi_send(struct fcoe_ctlr *fip) }else /* XXX */ LIBFCOE_FIP_DBG (fip,"No FCF selected - defer send\n" ); unlock: -spin_unlock_bh (&fip->ctlr_lock); +spin_unlock_irqrestore (&fip->ctlr_lock, flags); }/**
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 293/511 serial: tegra: handle clk prepare error in tegra_uart_hw_init()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yi Yang <[email protected]>
[ Upstream commit 5abd01145d0cc6cd1b7c2fe6ee0b9ea0fa13671e ]
In tegra_uart_hw_init(), the return value of clk_prepare_enable() should be checked since it might fail.
--- drivers/tty/serial/serial-tegra.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/tty/serial/serial-tegra.c +5 -1
@@ -999,7 +999,11 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup) tup->ier_shadow =0 ; tup->current_baud =0 ; -clk_prepare_enable (tup->uart_clk); + ret =clk_prepare_enable (tup->uart_clk); +if (ret) { +dev_err (tup->uport.dev,"could not enable clk\n" ); +return ret; + }/* Reset the UART controller to clear all previous status.*/ reset_control_assert (tup->rst);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 294/511 amba: bus: fix refcount leak
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit e312cbdc11305568554a9e18a2ea5c2492c183f3 ]
commit 5de1540b7bc4 ("drivers/amba: create devices from device tree") increases the refcount of of_node, but not releases it in amba_device_release, so there is refcount leak. By using of_node_put to avoid refcount leak.
--- drivers/amba/bus.c | 1 + 1 file changed, 1 insertion(+)
drivers/amba/bus.c +1 -0
@@ -366,6 +366,7 @@ static void amba_device_release(struct device *dev) {struct amba_device *d =to_amba_device (dev); +of_node_put (d->dev.of_node);if (d->res.parent)release_resource (&d->res);kfree (d);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 295/511 Revert "IB/isert: Fix incorrect release of isert connection"
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
[ Upstream commit dfe261107c080709459c32695847eec96238852b ]
Commit: 699826f4e30a ("IB/isert: Fix incorrect release of isert connection") is causing problems on OPA when DEVICE_REMOVAL is happening.
------------[ cut here ]------------ WARNING: CPU: 52 PID: 2117247 at drivers/infiniband/core/cq.c:359 ib_cq_pool_cleanup+0xac/0xb0 [ib_core] Modules linked in: nfsd nfs_acl target_core_user uio tcm_fc libfc
scsi_transport_fc tcm_loop target_core_pscsi target_core_iblock target_core_file rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lockd grace fscache netfs rfkill rpcrdma rdma_ucm ib_srpt sunrpc ib_isert iscsi_target_mod target_core_mod opa_vnic ib_iser libiscsi ib_umad scsi_transport_iscsi rdma_cm ib_ipoib iw_cm ib_cm hfi1(-) rdmavt ib_uverbs intel_rapl_msr intel_rapl_common sb_edac ib_core x86_pkg_temp_thermal intel_powerclamp coretemp i2c_i801 mxm_wmi rapl iTCO_wdt ipmi_si iTCO_vendor_support mei_me ipmi_devintf mei intel_cstate ioatdma intel_uncore i2c_smbus joydev pcspkr lpc_ich ipmi_msghandler acpi_power_meter acpi_pad xfs libcrc32c sr_mod sd_mod cdrom t10_pi sg crct10dif_pclmul crc32_pclmul crc32c_intel drm_kms_helper drm_shmem_helper ahci libahci ghash_clmulni_intel igb drm libata dca i2c_algo_bit wmi fuse
CPU: 52 PID: 2117247 Comm: modprobe Not tainted 6.5.0-rc1+ #1 Hardware name: Intel Corporation S2600CWR/S2600CW, BIOS SE5C610.86B.01.01.0014.121820151719 12/18/2015 RIP: 0010:ib_cq_pool_cleanup+0xac/0xb0 [ib_core] Code: ff 48 8b 43 40 48 8d 7b 40 48 83 e8 40 4c 39 e7 75 b3 49 83
c4 10 4d 39 fc 75 94 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc cc cc <0f> 0b eb a1 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 0f 1f
RSP: 0018:ffffc10bea13fc80 EFLAGS: 00010206
RAX: 000000000000010c RBX: ffff9bf5c7e66c00 RCX: 000000008020001d
RDX: 000000008020001e RSI: fffff175221f9900 RDI: ffff9bf5c7e67640
RBP: ffff9bf5c7e67600 R08: ffff9bf5c7e64400 R09: 000000008020001d
R10: 0000000040000000 R11: 0000000000000000 R12: ffff9bee4b1e8a18
R13: dead000000000122 R14: dead000000000100 R15: ffff9bee4b1e8a38
FS: 00007ff1e6d38740(0000) GS:ffff9bfd9fb00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005652044ecc68 CR3: 0000000889b5c005 CR4: 00000000001706e0
Call Trace: <TASK> ? __warn+0x80/0x130 ? ib_cq_pool_cleanup+0xac/0xb0 [ib_core] ? report_bug+0x195/0x1a0 ? handle_bug+0x3c/0x70 ? exc_invalid_op+0x14/0x70 ? asm_exc_invalid_op+0x16/0x20 ? ib_cq_pool_cleanup+0xac/0xb0 [ib_core] disable_device+0x9d/0x160 [ib_core] __ib_unregister_device+0x42/0xb0 [ib_core] ib_unregister_device+0x22/0x30 [ib_core] rvt_unregister_device+0x20/0x90 [rdmavt] hfi1_unregister_ib_device+0x16/0xf0 [hfi1] remove_one+0x55/0x1a0 [hfi1] pci_device_remove+0x36/0xa0 device_release_driver_internal+0x193/0x200 driver_detach+0x44/0x90 bus_remove_driver+0x69/0xf0 pci_unregister_driver+0x2a/0xb0 hfi1_mod_cleanup+0xc/0x3c [hfi1] __do_sys_delete_module.constprop.0+0x17a/0x2f0 ? exit_to_user_mode_prepare+0xc4/0xd0 ? syscall_trace_enter.constprop.0+0x126/0x1a0 do_syscall_64+0x5c/0x90 ? syscall_exit_to_user_mode+0x12/0x30 ? do_syscall_64+0x69/0x90 ? syscall_exit_work+0x103/0x130 ? syscall_exit_to_user_mode+0x12/0x30 ? do_syscall_64+0x69/0x90 ? exc_page_fault+0x65/0x150 entry_SYSCALL_64_after_hwframe+0x6e/0xd8 RIP: 0033:0x7ff1e643f5ab Code: 73 01 c3 48 8b 0d 75 a8 1b 00 f7 d8 64 89 01 48 83 c8 ff c3
66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 b0 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 45 a8 1b 00 f7 d8 64 89 01 48
RSP: 002b:00007ffec9103cc8 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
RAX: ffffffffffffffda RBX: 00005615267fdc50 RCX: 00007ff1e643f5ab
RDX: 0000000000000000 RSI: 0000000000000800 RDI: 00005615267fdcb8
RBP: 00005615267fdc50 R08: 0000000000000000 R09: 0000000000000000
R10: 00007ff1e659eac0 R11: 0000000000000206 R12: 00005615267fdcb8
R13: 0000000000000000 R14: 00005615267fdcb8 R15: 00007ffec9105ff8
</TASK> ---[ end trace 0000000000000000 ]---
And...
restrack: ------------[ cut here ]------------ infiniband hfi1_0: BUG: RESTRACK detected leak of resources
restrack: Kernel PD object allocated by ib_isert is not freed
restrack: Kernel CQ object allocated by ib_core is not freed
restrack: Kernel QP object allocated by rdma_cm is not freed
restrack: ------------[ cut here ]------------
--- drivers/infiniband/ulp/isert/ib_isert.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/ulp/isert/ib_isert.c +2 -0
@@ -2570,6 +2570,8 @@ static void isert_wait_conn(struct iscsi_conn *conn)isert_put_unsol_pending_cmds (conn);isert_wait4cmds (conn);isert_wait4logout (isert_conn); + +queue_work (isert_release_wq, &isert_conn->release_work); }static void isert_free_conn (struct iscsi_conn *conn)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 296/511 HID: logitech-dj: Fix error handling in logi_dj_recv_switch_to_dj_mode()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Zhandarovich <[email protected]>
[ Upstream commit 6f20d3261265885f6a6be4cda49d7019728760e0 ]
Presently, if a call to logi_dj_recv_send_report() fails, we do not learn about the error until after sending short HID_OUTPUT_REPORT with hid_hw_raw_request().
To handle this somewhat unlikely issue, return on error in logi_dj_recv_send_report() (minding ugly sleep workaround) and take into account the result of hid_hw_raw_request().
Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE.
--- drivers/hid/hid-logitech-dj.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/hid/hid-logitech-dj.c +4 -1
@@ -1285,6 +1285,9 @@ static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev,* 50 msec should gives enough time to the receiver to be ready. */ msleep (50 ); + +if (retval) +return retval; }/*
@@ -1306,7 +1309,7 @@ static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev, buf[5 ] =0x09 ; buf[6 ] =0x00 ; -hid_hw_raw_request (hdev,REPORT_ID_HIDPP_SHORT , buf, + retval =hid_hw_raw_request (hdev,REPORT_ID_HIDPP_SHORT , buf,HIDPP_REPORT_SHORT_LENGTH ,HID_OUTPUT_REPORT ,HID_REQ_SET_REPORT );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 297/511 HID: multitouch: Correct devm device reference for hidinput input_dev name
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rahul Rameshbabu <[email protected]>
[ Upstream commit 4794394635293a3e74591351fff469cea7ad15a2 ]
Reference the HID device rather than the input device for the devm allocation of the input_dev name. Referencing the input_dev would lead to a use-after-free when the input_dev was unregistered and subsequently fires a uevent that depends on the name. At the point of firing the uevent, the name would be freed by devres management.
Use devm_kasprintf to simplify the logic for allocating memory and formatting the input_dev name string.
--- drivers/hid/hid-multitouch.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/hid/hid-multitouch.c +3 -10
@@ -1594,7 +1594,6 @@ static void mt_post_parse(struct mt_device *td, struct mt_application *app)static int mt_input_configured (struct hid_device *hdev,struct hid_input *hi) {struct mt_device *td =hid_get_drvdata (hdev); -char *name;const char *suffix =NULL ;struct mt_report_data *rdata;struct mt_application *mt_application =NULL ;
@@ -1648,15 +1647,9 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)break ; } -if (suffix) { - name =devm_kzalloc (&hi->input->dev, -strlen (hdev->name) +strlen (suffix) +2 , -GFP_KERNEL ); -if (name) { -sprintf (name,"%s %s" , hdev->name, suffix); - hi->input->name = name; - } - } +if (suffix) + hi->input->name =devm_kasprintf (&hdev->dev,GFP_KERNEL , +"%s %s" , hdev->name, suffix);return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 298/511 x86/speculation: Mark all Skylake CPUs as vulnerable to GDS
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Hansen <[email protected]>
[ Upstream commit c9f4c45c8ec3f07f4f083f9750032a1ec3eab6b2 ]
The Gather Data Sampling (GDS) vulnerability is common to all Skylake processors. However, the "client" Skylakes* are now in this list:
https://www.intel.com/content/www/us/en/support/articles/000022396/processors.html
which means they are no longer included for new vulnerabilities here:
or in other GDS documentation. Thus, they were not included in the original GDS mitigation patches.
Mark SKYLAKE and SKYLAKE_L as vulnerable to GDS to match all the other Skylake CPUs (which include Kaby Lake). Also group the CPUs so that the ones that share the exact same vulnerabilities are next to each other.
Last, move SRBDS to the end of each line. This makes it clear at a glance that SKYLAKE_X is unique. Of the five Skylakes, it is the only "server" CPU and has a different implementation from the clients of the "special register" hardware, making it immune to SRBDS.
This makes the diff much harder to read, but the resulting table is worth it.
I very much appreciate the report from Michael Zhivich about this issue. Despite what level of support a hardware vendor is providing, the kernel very much needs an accurate and up-to-date list of vulnerable CPUs. More reports like this are very welcome.
* Client Skylakes are CPUID 406E3/506E3 which is family 6, models 0x4E and 0x5E, aka INTEL_FAM6_SKYLAKE and INTEL_FAM6_SKYLAKE_L.
--- arch/x86/kernel/cpu/common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/common.c +4 -4
@@ -1149,11 +1149,11 @@ static const struct x86_cpu_id cpu_vuln_blacklist[] __initconst = {VULNBL_INTEL_STEPPINGS (BROADWELL_G ,X86_STEPPING_ANY ,SRBDS ),VULNBL_INTEL_STEPPINGS (BROADWELL_X ,X86_STEPPING_ANY ,MMIO ),VULNBL_INTEL_STEPPINGS (BROADWELL ,X86_STEPPING_ANY ,SRBDS ), -VULNBL_INTEL_STEPPINGS (SKYLAKE_L ,X86_STEPPING_ANY ,SRBDS |MMIO |RETBLEED ),VULNBL_INTEL_STEPPINGS (SKYLAKE_X ,X86_STEPPING_ANY ,MMIO |RETBLEED |GDS ), -VULNBL_INTEL_STEPPINGS (SKYLAKE ,X86_STEPPING_ANY ,SRBDS |MMIO |RETBLEED ), -VULNBL_INTEL_STEPPINGS (KABYLAKE_L ,X86_STEPPING_ANY ,SRBDS |MMIO |RETBLEED |GDS ), -VULNBL_INTEL_STEPPINGS (KABYLAKE ,X86_STEPPING_ANY ,SRBDS |MMIO |RETBLEED |GDS ), +VULNBL_INTEL_STEPPINGS (SKYLAKE_L ,X86_STEPPING_ANY ,MMIO |RETBLEED |GDS |SRBDS ), +VULNBL_INTEL_STEPPINGS (SKYLAKE ,X86_STEPPING_ANY ,MMIO |RETBLEED |GDS |SRBDS ), +VULNBL_INTEL_STEPPINGS (KABYLAKE_L ,X86_STEPPING_ANY ,MMIO |RETBLEED |GDS |SRBDS ), +VULNBL_INTEL_STEPPINGS (KABYLAKE ,X86_STEPPING_ANY ,MMIO |RETBLEED |GDS |SRBDS ),VULNBL_INTEL_STEPPINGS (CANNONLAKE_L ,X86_STEPPING_ANY ,RETBLEED ),VULNBL_INTEL_STEPPINGS (ICELAKE_L ,X86_STEPPING_ANY ,MMIO |MMIO_SBDS |RETBLEED |GDS ), VULNBL_INTEL_STEPPINGS(ICELAKE_D, X86_STEPPING_ANY, MMIO | GDS),
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 299/511 tracing: Remove extra space at the end of hwlat_detector/mode
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikhail Kobuk <[email protected]>
[ Upstream commit 2cf0dee989a8b2501929eaab29473b6b1fa11057 ]
Space is printed after each mode value including the last one:
$ echo \"$(sudo cat /sys/kernel/tracing/hwlat_detector/mode)\" "none [round-robin] per-cpu "
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- kernel/trace/trace_hwlat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_hwlat.c +1 -1
@@ -635,7 +635,7 @@ static int s_mode_show(struct seq_file *s, void *v)else seq_printf (s,"%s" , thread_mode_str[mode]); -if (mode !=MODE_MAX ) +if (mode <MODE_MAX -1 )/* if mode is any but last */ seq_puts (s," " );return 0 ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 300/511 tracing: Fix race issue between cpu buffer write and swap
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Yejian <[email protected]>
[ Upstream commit 3163f635b20e9e1fb4659e74f47918c9dddfe64e ]
Warning happened in rb_end_commit() at code:
if (RB_WARN_ON(cpu_buffer, !local_read(&cpu_buffer->committing)))
WARNING: CPU: 0 PID: 139 at kernel/trace/ring_buffer.c:3142 rb_commit+0x402/0x4a0 Call Trace: ring_buffer_unlock_commit+0x42/0x250 trace_buffer_unlock_commit_regs+0x3b/0x250 trace_event_buffer_commit+0xe5/0x440 trace_event_buffer_reserve+0x11c/0x150 trace_event_raw_event_sched_switch+0x23c/0x2c0 __traceiter_sched_switch+0x59/0x80 __schedule+0x72b/0x1580 schedule+0x92/0x120 worker_thread+0xa0/0x6f0
It is because the race between writing event into cpu buffer and swapping cpu buffer through file per_cpu/cpu0/snapshot:
Write on CPU 0 Swap buffer by per_cpu/cpu0/snapshot on CPU 1
-------- --------
tracing_snapshot_write()
[...] ring_buffer_lock_reserve()
cpu_buffer = buffer->buffers[cpu]; // 1. Suppose find 'cpu_buffer_a';
[...]
rb_reserve_next_event()
[...] ring_buffer_swap_cpu()
if (local_read(&cpu_buffer_a->committing))
goto out_dec;
if (local_read(&cpu_buffer_b->committing))
goto out_dec;
buffer_a->buffers[cpu] = cpu_buffer_b;
buffer_b->buffers[cpu] = cpu_buffer_a;
// 2. cpu_buffer has swapped here.
rb_start_commit(cpu_buffer);
if (unlikely(READ_ONCE(cpu_buffer->buffer)
!= buffer)) { // 3. This check passed due to 'cpu_buffer->buffer'
[...] // has not changed here.
return NULL;
}
cpu_buffer_b->buffer = buffer_a;
cpu_buffer_a->buffer = buffer_b;
[...]
// 4. Reserve event from 'cpu_buffer_a'. ring_buffer_unlock_commit()
[...]
cpu_buffer = buffer->buffers[cpu]; // 5. Now find 'cpu_buffer_b' !!!
rb_commit(cpu_buffer)
rb_end_commit() // 6. WARN for the wrong 'committing' state !!!Based on above analysis, we can easily reproduce by following testcase:
``` bash
#!/bin/bash
dmesg -n 7
sysctl -w kernel.panic_on_warn=1
TR=/sys/kernel/tracing
echo 7 > ${TR}/buffer_size_kb
echo "sched:sched_switch" > ${TR}/set_event
while [ true ]; do
echo 1 > ${TR}/per_cpu/cpu0/snapshot
done &
while [ true ]; do
echo 1 > ${TR}/per_cpu/cpu0/snapshot
done &
while [ true ]; do
echo 1 > ${TR}/per_cpu/cpu0/snapshot
done &
```To fix it, IIUC, we can use smp_call_function_single() to do the swap on the target cpu where the buffer is located, so that above race would be avoided.
--- kernel/trace/trace.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
kernel/trace/trace.c +12 -5
@@ -7496,6 +7496,11 @@ static int tracing_snapshot_open(struct inode *inode, struct file *file)return ret; } +static void tracing_swap_cpu_buffer (void *tr) +{ +update_max_tr_single ((struct trace_array *)tr, current,smp_processor_id ()); +} +static ssize_t tracing_snapshot_write (struct file *filp,const char __user *ubuf,size_t cnt,loff_t *ppos)
@@ -7554,13 +7559,15 @@ tracing_snapshot_write(struct file *filp, const char __user *ubuf, size_t cnt, ret =tracing_alloc_snapshot_instance (tr);if (ret <0 )break ; -local_irq_disable ();/* Now, we're going to swap */ -if (iter->cpu_file ==RING_BUFFER_ALL_CPUS ) +if (iter->cpu_file ==RING_BUFFER_ALL_CPUS ) { +local_irq_disable ();update_max_tr (tr, current,smp_processor_id (),NULL ); -else -update_max_tr_single (tr, current, iter->cpu_file); -local_irq_enable (); +local_irq_enable (); + }else { +smp_call_function_single (iter->cpu_file, tracing_swap_cpu_buffer, + (void *)tr,1 ); + }break ;default :if (tr->allocated_snapshot) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 301/511 mtd: rawnand: brcmnand: Fix mtd oobsize
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: William Zhang <[email protected]>
[ Upstream commit 60177390fa061c62d156f4a546e3efd90df3c183 ]
brcmnand controller can only access the flash spare area up to certain bytes based on the ECC level. It can be less than the actual flash spare area size. For example, for many NAND chip supporting ECC BCH-8, it has 226 bytes spare area. But controller can only uses 218 bytes. So brcmand driver overrides the mtd oobsize with the controller's accessible spare area size. When the nand base driver utilizes the nand_device object, it resets the oobsize back to the actual flash spare aprea size from nand_memory_organization structure and controller may not able to access all the oob area as mtd advises.
This change fixes the issue by overriding the oobsize in the nand_memory_organization structure to the controller's accessible spare area size.
--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +5 -2
@@ -2583,6 +2583,8 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)struct nand_chip *chip = &host->chip;const struct nand_ecc_props *requirements =nanddev_get_ecc_requirements (&chip->base); +struct nand_memory_organization *memorg = +nanddev_get_memorg (&chip->base);struct brcmnand_controller *ctrl = host->ctrl;struct brcmnand_cfg *cfg = &host->hwcfg;char msg[128 ];
@@ -2604,10 +2606,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)if (cfg->spare_area_size > ctrl->max_oob) cfg->spare_area_size = ctrl->max_oob;/* -* Set oobsize to be consistent with controller's spare_area_size, as -* the rest is inaccessible. +* Set mtd and memorg oobsize to be consistent with controller's +* spare_area_size, as the rest is inaccessible. */ mtd->oobsize = cfg->spare_area_size * (mtd->writesize >>FC_SHIFT ); + memorg->oobsize = mtd->oobsize; cfg->device_size = mtd->size; cfg->block_size = mtd->erasesize;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 302/511 phy/rockchip: inno-hdmi: use correct vco_div_5 macro on rk3328
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Karlman <[email protected]>
[ Upstream commit 644c06dfbd0da713f772abf0a8f8581ac78e6264 ]
inno_hdmi_phy_rk3328_clk_set_rate() is using the RK3228 macro when configuring vco_div_5 on RK3328.
Fix this by using correct vco_div_5 macro for RK3328.
--- drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c +2 -2
@@ -790,8 +790,8 @@ static int inno_hdmi_phy_rk3328_clk_set_rate(struct clk_hw *hw, RK3328_PRE_PLL_POWER_DOWN);/* Configure pre-pll */ -inno_update_bits (inno,0xa0 ,RK3228_PCLK_VCO_DIV_5_MASK , -RK3228_PCLK_VCO_DIV_5 (cfg->vco_div_5_en)); +inno_update_bits (inno,0xa0 ,RK3328_PCLK_VCO_DIV_5_MASK , +RK3328_PCLK_VCO_DIV_5 (cfg->vco_div_5_en));inno_write (inno,0xa1 ,RK3328_PRE_PLL_PRE_DIV (cfg->prediv)); val =RK3328_SPREAD_SPECTRUM_MOD_DISABLE ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 303/511 phy/rockchip: inno-hdmi: round fractal pixclock in rk3328 recalc_rate
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Yang <[email protected]>
[ Upstream commit d5ef343c1d62bc4c4c2c393af654a41cb34b449f ]
inno_hdmi_phy_rk3328_clk_recalc_rate() is returning a rate not found in the pre pll config table when the fractal divider is used. This can prevent proper power_on because a tmdsclock for the new rate is not found in the pre pll config table.
Fix this by saving and returning a rounded pixel rate that exist in the pre pll config table.
--- drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c +5 -3
@@ -745,10 +745,12 @@ unsigned long inno_hdmi_phy_rk3328_clk_recalc_rate(struct clk_hw *hw,do_div (vco, (nd * (no_a ==1 ? no_b : no_a) * no_d *2 )); } - inno->pixclock = vco; -dev_dbg (inno->dev,"%s rate %lu\n" , __func__, inno->pixclock); + inno->pixclock =DIV_ROUND_CLOSEST ((unsigned long )vco,1000 ) *1000 ; -return vco; +dev_dbg (inno->dev,"%s rate %lu vco %llu\n" , + __func__, inno->pixclock, vco); + +return inno->pixclock; } static long inno_hdmi_phy_rk3328_clk_round_rate(struct clk_hw *hw,
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 304/511 phy/rockchip: inno-hdmi: do not power on rk3328 post pll on reg write
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Karlman <[email protected]>
[ Upstream commit 19a1d46bd699940a496d3b0d4e142ef99834988c ]
inno_write is used to configure 0xaa reg, that also hold the POST_PLL_POWER_DOWN bit.
When POST_PLL_REFCLK_SEL_TMDS is configured the power down bit is not taken into consideration.
Fix this by keeping the power down bit until configuration is complete. Also reorder the reg write order for consistency.
--- drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c +4 -2
@@ -1023,9 +1023,10 @@ inno_hdmi_phy_rk3328_power_on(struct inno_hdmi_phy *inno,inno_write (inno,0xac ,RK3328_POST_PLL_FB_DIV_7_0 (cfg->fbdiv));if (cfg->postdiv ==1 ) { -inno_write (inno,0xaa ,RK3328_POST_PLL_REFCLK_SEL_TMDS );inno_write (inno,0xab ,RK3328_POST_PLL_FB_DIV_8 (cfg->fbdiv) |RK3328_POST_PLL_PRE_DIV (cfg->prediv)); +inno_write (inno,0xaa ,RK3328_POST_PLL_REFCLK_SEL_TMDS | +RK3328_POST_PLL_POWER_DOWN ); }else { v = (cfg->postdiv /2 ) -1 ; v &=RK3328_POST_PLL_POST_DIV_MASK ;
@@ -1033,7 +1034,8 @@ inno_hdmi_phy_rk3328_power_on(struct inno_hdmi_phy *inno,inno_write (inno,0xab ,RK3328_POST_PLL_FB_DIV_8 (cfg->fbdiv) |RK3328_POST_PLL_PRE_DIV (cfg->prediv));inno_write (inno,0xaa ,RK3328_POST_PLL_POST_DIV_ENABLE | -RK3328_POST_PLL_REFCLK_SEL_TMDS ); +RK3328_POST_PLL_REFCLK_SEL_TMDS | +RK3328_POST_PLL_POWER_DOWN ); }for (v =0 ; v <14 ; v++)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 305/511 rpmsg: glink: Add check for kstrdup
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
[ Upstream commit b5c9ee8296a3760760c7b5d2e305f91412adc795 ]
Add check for the return value of kstrdup() and return the error if it fails in order to avoid NULL pointer dereference.
--- drivers/rpmsg/qcom_glink_native.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/rpmsg/qcom_glink_native.c +4 -0
@@ -222,6 +222,10 @@ static struct glink_channel *qcom_glink_alloc_channel(struct qcom_glink *glink, channel->glink = glink; channel->name =kstrdup (name,GFP_KERNEL ); +if (!channel->name) { +kfree (channel); +return ERR_PTR (-ENOMEM ); + }init_completion (&channel->open_req);init_completion (&channel->open_ack);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 306/511 leds: pwm: Fix error code in led_pwm_create_fwnode()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit cadb2de2a7fd9e955381307de3eddfcc386c208e ]
Negative -EINVAL was intended, not positive EINVAL. Fix it.
--- drivers/leds/leds-pwm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-pwm.c +1 -1
@@ -146,7 +146,7 @@ static int led_pwm_create_fwnode(struct device *dev, struct led_pwm_priv *priv) led.name =to_of_node (fwnode)->name;if (!led.name) { - ret =EINVAL ; + ret = -EINVAL ; goto err_child_out; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 307/511 leds: multicolor: Use rounded division when calculating color components
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Behún <[email protected]>
[ Upstream commit 065d099f1be58187e6629273c50b948a02b7e1bf ]
Given channel intensity, LED brightness and max LED brightness, the multicolor LED framework helper led_mc_calc_color_components() computes the color channel brightness as
chan_brightness = brightness * chan_intensity / max_brightness
Consider the situation when (brightness, intensity, max_brightness) is for example (16, 15, 255), then chan_brightness is computed to 0 although the fractional divison would give 0.94, which should be rounded to 1.
Use DIV_ROUND_CLOSEST here for the division to give more realistic component computation:
chan_brightness = DIV_ROUND_CLOSEST(brightness * chan_intensity,
max_brightness)
--- drivers/leds/led-class-multicolor.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/leds/led-class-multicolor.c +5 -3
@@ -6,6 +6,7 @@#include <linux/device.h> #include <linux/init.h> #include <linux/led-class-multicolor.h> +#include <linux/math.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/uaccess.h>
@@ -19,9 +20,10 @@ int led_mc_calc_color_components(struct led_classdev_mc *mcled_cdev,int i;for (i =0 ; i < mcled_cdev->num_colors; i++) - mcled_cdev->subled_info[i].brightness = brightness * - mcled_cdev->subled_info[i].intensity / - led_cdev->max_brightness; + mcled_cdev->subled_info[i].brightness = +DIV_ROUND_CLOSEST (brightness * + mcled_cdev->subled_info[i].intensity, + led_cdev->max_brightness);return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 308/511 leds: Fix BUG_ON check for LED_COLOR_ID_MULTI that is always false
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Behún <[email protected]>
[ Upstream commit c3f853184bed04105682383c2971798c572226b5 ]
At the time we call
BUG_ON(props.color == LED_COLOR_ID_MULTI);
the props variable is still initialized to zero.
Call the BUG_ON only after we parse fwnode into props.
--- drivers/leds/led-core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/leds/led-core.c +4 -4
@@ -419,15 +419,15 @@ int led_compose_name(struct device *dev, struct led_init_data *init_data,struct fwnode_handle *fwnode = init_data->fwnode;const char *devicename = init_data->devicename; -/* We want to label LEDs that can produce full range of colors -* as RGB, not multicolor */ -BUG_ON (props.color ==LED_COLOR_ID_MULTI ); -if (!led_classdev_name)return -EINVAL ;led_parse_fwnode_props (dev, fwnode, &props); +/* We want to label LEDs that can produce full range of colors +* as RGB, not multicolor */ +BUG_ON (props.color ==LED_COLOR_ID_MULTI ); +if (props.label) {/* * If init_data.devicename is NULL, then it indicates that
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 309/511 leds: trigger: tty: Do not use LED_ON/OFF constants, use led_blink_set_oneshot instead
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Behún <[email protected]>
[ Upstream commit 730094577e0c37e1bc40be37cbd41f71b0a8a2a4 ]
The tty LED trigger uses the obsolete LED_ON & LED_OFF constants when setting LED brightness. This is bad because the LED_ON constant is equal to 1, and so when activating the tty LED trigger on a LED class device with max_brightness greater than 1, the LED is dimmer than it can be (when max_brightness is 255, the LED is very dimm indeed; some devices translate 1/255 to 0, so the LED is OFF all the time).
Instead of directly setting brightness to a specific value, use the led_blink_set_oneshot() function from LED core to configure the blink. This function takes the current configured brightness as blink brightness if not zero, and max brightness otherwise.
This also changes the behavior of the TTY LED trigger. Previously if rx/tx stats kept changing, the LED was ON all the time they kept changing. With this patch the LED will blink on TTY activity.
--- drivers/leds/trigger/ledtrig-tty.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/leds/trigger/ledtrig-tty.c +8 -4
@@ -7,6 +7,8 @@#include <linux/tty.h> #include <uapi/linux/serial.h> +#define LEDTRIG_TTY_INTERVAL 50 +struct ledtrig_tty_data {struct led_classdev *led_cdev;struct delayed_work dwork;
@@ -122,17 +124,19 @@ static void ledtrig_tty_work(struct work_struct *work)if (icount.rx != trigger_data->rx || icount.tx != trigger_data->tx) { -led_set_brightness_sync (trigger_data->led_cdev,LED_ON ); +unsigned long interval =LEDTRIG_TTY_INTERVAL ; + +led_blink_set_oneshot (trigger_data->led_cdev, &interval, + &interval,0 ); trigger_data->rx = icount.rx; trigger_data->tx = icount.tx; - }else { -led_set_brightness_sync (trigger_data->led_cdev,LED_OFF ); } out:mutex_unlock (&trigger_data->mutex); -schedule_delayed_work (&trigger_data->dwork,msecs_to_jiffies (100 )); +schedule_delayed_work (&trigger_data->dwork, +msecs_to_jiffies (LEDTRIG_TTY_INTERVAL *2 )); }static struct attribute *ledtrig_tty_attrs[] = {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 310/511 mtd: spi-nor: Check bus width while setting QE bit
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hsin-Yi Wang <[email protected]>
[ Upstream commit f01d8155a92e33cdaa85d20bfbe6c441907b3c1f ]
spi_nor_write_16bit_sr_and_check() should also check if bus width is 4 before setting QE bit.
--- drivers/mtd/spi-nor/core.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/mtd/spi-nor/core.c +10 -9
@@ -980,21 +980,22 @@ static int spi_nor_write_16bit_sr_and_check(struct spi_nor *nor, u8 sr1) ret =spi_nor_read_cr (nor, &sr_cr[1 ]);if (ret)return ret; - }else if (nor->params->quad_enable) { + }else if (spi_nor_get_protocol_width (nor->read_proto) ==4 && +spi_nor_get_protocol_width (nor->write_proto) ==4 && + nor->params->quad_enable) {/* * If the Status Register 2 Read command (35h) is not * supported, we should at least be sure we don't * change the value of the SR2 Quad Enable bit. * -* We can safely assume that when the Quad Enable method is -* set, the value of the QE bit is one, as a consequence of the -* nor->params->quad_enable() call. +* When the Quad Enable method is set and the buswidth is 4, we +* can safely assume that the value of the QE bit is one, as a +* consequence of the nor->params->quad_enable() call. * -* We can safely assume that the Quad Enable bit is present in -* the Status Register 2 at BIT(1). According to the JESD216 -* revB standard, BFPT DWORDS[15], bits 22:20, the 16-bit -* Write Status (01h) command is available just for the cases -* in which the QE bit is described in SR2 at BIT(1). +* According to the JESD216 revB standard, BFPT DWORDS[15], +* bits 22:20, the 16-bit Write Status (01h) command is +* available just for the cases in which the QE bit is +* described in SR2 at BIT(1). */ sr_cr[1 ] =SR2_QUAD_EN_BIT1 ; }else {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 311/511 mtd: rawnand: fsmc: handle clk prepare error in fsmc_nand_resume()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yi Yang <[email protected]>
[ Upstream commit a5a88125d00612586e941ae13e7fcf36ba8f18a7 ]
In fsmc_nand_resume(), the return value of clk_prepare_enable() should be checked since it might fail.
--- drivers/mtd/nand/raw/fsmc_nand.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/mtd/nand/raw/fsmc_nand.c +6 -1
@@ -1202,9 +1202,14 @@ static int fsmc_nand_suspend(struct device *dev)static int fsmc_nand_resume (struct device *dev) {struct fsmc_nand_data *host =dev_get_drvdata (dev); +int ret;if (host) { -clk_prepare_enable (host->clk); + ret =clk_prepare_enable (host->clk); +if (ret) { +dev_err (dev,"failed to enable clk\n" ); +return ret; + }if (host->dev_timings)fsmc_nand_setup (host, host->dev_timings);nand_reset (&host->nand,0 );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 312/511 um: Fix hostaudio build errors
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit db4bfcba7bb8d10f00bba2a3da6b9a9c2a1d7b71 ]
Use "select" to ensure that the required kconfig symbols are set as expected.
Drop HOSTAUDIO since it is now equivalent to UML_SOUND.
Set CONFIG_SOUND=m in ARCH=um defconfig files to maintain the status quo of the default configs.
Allow SOUND with UML regardless of HAS_IOMEM. Otherwise there is a kconfig warning for unmet dependencies. (This was not an issue when SOUND was defined in arch/um/drivers/Kconfig. I have done 50 randconfig builds and didn't find any issues.)
This fixes build errors when CONFIG_SOUND is not set:
ld: arch/um/drivers/hostaudio_kern.o: in function `hostaudio_cleanup_module':
hostaudio_kern.c:(.exit.text+0xa): undefined reference to `unregister_sound_mixer'
ld: hostaudio_kern.c:(.exit.text+0x15): undefined reference to `unregister_sound_dsp'
ld: arch/um/drivers/hostaudio_kern.o: in function `hostaudio_init_module':
hostaudio_kern.c:(.init.text+0x19): undefined reference to `register_sound_dsp'
ld: hostaudio_kern.c:(.init.text+0x31): undefined reference to `register_sound_mixer'
ld: hostaudio_kern.c:(.init.text+0x49): undefined reference to `unregister_sound_dsp'
and this kconfig warning:
WARNING: unmet direct dependencies detected for SOUND
--- arch/um/configs/i386_defconfig | 1 + arch/um/configs/x86_64_defconfig | 1 + arch/um/drivers/Kconfig | 16 +++------------- arch/um/drivers/Makefile | 2 +- sound/Kconfig | 2 +- 5 files changed, 7 insertions(+), 15 deletions(-)
arch/um/configs/i386_defconfig +1 -0
@@ -35,6 +35,7 @@ CONFIG_TTY_CHAN=y CONFIG_XTERM_CHAN=y CONFIG_CON_CHAN="pts" CONFIG_SSL_CHAN="pts" +CONFIG_SOUND=m CONFIG_UML_SOUND=m CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y
arch/um/configs/x86_64_defconfig +1 -0
@@ -33,6 +33,7 @@ CONFIG_TTY_CHAN=y CONFIG_XTERM_CHAN=y CONFIG_CON_CHAN="pts" CONFIG_SSL_CHAN="pts" +CONFIG_SOUND=m CONFIG_UML_SOUND=m CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y
arch/um/drivers/Kconfig +3 -13
@@ -104,24 +104,14 @@ config SSL_CHAN config UML_SOUND tristate "Sound support" + depends on SOUND + select SOUND_OSS_CORE help This option enables UML sound support. If enabled, it will pull in - soundcore and the UML hostaudio relay, which acts as a intermediary + the UML hostaudio relay, which acts as a intermediary between the host's dsp and mixer devices and the UML sound system. It is safe to say 'Y' here. -config SOUND - tristate - default UML_SOUND - -config SOUND_OSS_CORE - bool - default UML_SOUND - -config HOSTAUDIO - tristate - default UML_SOUND - endmenu menu "UML Network Devices"
arch/um/drivers/Makefile +1 -1
@@ -54,7 +54,7 @@ obj-$(CONFIG_UML_NET) += net.o obj-$(CONFIG_MCONSOLE) += mconsole.o obj-$(CONFIG_MMAPPER) += mmapper_kern.o obj-$(CONFIG_BLK_DEV_UBD) += ubd.o -obj-$(CONFIG_HOSTAUDIO) += hostaudio.o +obj-$(CONFIG_UML_SOUND) += hostaudio.o obj-$(CONFIG_NULL_CHAN) += null.o obj-$(CONFIG_PORT_CHAN) += port.o obj-$(CONFIG_PTY_CHAN) += pty.o
sound/Kconfig +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only menuconfig SOUND tristate "Sound card support" - depends on HAS_IOMEM + depends on HAS_IOMEM || UML help If you have a sound card in your computer, i.e. if it can say more than an occasional beep, say Y.
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 313/511 dmaengine: ste_dma40: Add missing IRQ check in d40_probe
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: ruanjinjie <[email protected]>
[ Upstream commit c05ce6907b3d6e148b70f0bb5eafd61dcef1ddc1 ]
Check for the return value of platform_get_irq(): if no interrupt is specified, it wouldn't make sense to call request_irq().
--- drivers/dma/ste_dma40.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/dma/ste_dma40.c +4 -0
@@ -3597,6 +3597,10 @@ static int __init d40_probe(struct platform_device *pdev)spin_lock_init (&base->lcla_pool.lock); base->irq =platform_get_irq (pdev,0 ); +if (base->irq <0 ) { + ret = base->irq; + goto destroy_cache; + } ret =request_irq (base->irq, d40_handle_interrupt,0 ,D40_NAME , base);if (ret) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 314/511 cpufreq: Fix the race condition while updating the transition_task of policy
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liao Chang <[email protected]>
[ Upstream commit 61bfbf7951ba561dcbdd5357702d3cbc2d447812 ]
The field 'transition_task' of policy structure is used to track the task which is performing the frequency transition. Using this field to print a warning once detect a case where the same task is calling _begin() again before completing the preivous frequency transition via the _end().
However, there is a potential race condition in _end() and _begin() APIs while updating the field 'transition_task' of policy, the scenario is depicted below:
Task A Task B
/* 1st freq transition */
Invoke _begin() {
...
...
}
/* 2nd freq transition */
Invoke _begin() {
... //waiting for A to
... //clear
... //transition_ongoing
... //in _end() for
... //the 1st transition
|
Change the frequency |
|
Invoke _end() { |
... |
... |
transition_ongoing = false; V
transition_ongoing = true;
transition_task = current;
transition_task = NULL;
... //A overwrites the task
... //performing the transition
... //result in error warning.
}To fix this race condition, the transition_lock of policy structure is now acquired before updating policy structure in _end() API. Which ensure that only one task can update the 'transition_task' field at a time.
--- drivers/cpufreq/cpufreq.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/cpufreq/cpufreq.c +2 -0
@@ -450,8 +450,10 @@ void cpufreq_freq_transition_end(struct cpufreq_policy *policy, policy->cur, policy->cpuinfo.max_freq); +spin_lock (&policy->transition_lock); policy->transition_ongoing = false; policy->transition_task =NULL ; +spin_unlock (&policy->transition_lock);wake_up (&policy->transition_wait); }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 315/511 virtio_ring: fix avail_wrap_counter in virtqueue_add_packed
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Yao <[email protected]>
[ Upstream commit 1acfe2c1225899eab5ab724c91b7e1eb2881b9ab ]
In current packed virtqueue implementation, the avail_wrap_counter won't flip, in the case when the driver supplies a descriptor chain with a length equals to the queue size; total_sg == vq->packed.vring.num.
Let’s assume the following situation:
vq->packed.vring.num=4vq->packed.next_avail_idx: 1vq->packed.avail_wrap_counter: 0
Then the driver adds a descriptor chain containing 4 descriptors.
We expect the following result with avail_wrap_counter flipped:vq->packed.next_avail_idx: 1 vq->packed.avail_wrap_counter: 1
But, the current implementation gives the following result:vq->packed.next_avail_idx: 1 vq->packed.avail_wrap_counter: 0
To reproduce the bug, you can set a packed queue size as small as possible, so that the driver is more likely to provide a descriptor chain with a length equal to the packed queue size. For example, in qemu run following commands:
sudo qemu-system-x86_64 \
-enable-kvm \
-nographic \
-kernel "path/to/kernel_image" \
-m 1G \
-drive file="path/to/rootfs",if=none,id=disk \
-device virtio-blk,drive=disk \
-drive file="path/to/disk_image",if=none,id=rwdisk \
-device virtio-blk,drive=rwdisk,packed=on,queue-size=4,\
indirect_desc=off \
-append "console=ttyS0 root=/dev/vda rw init=/bin/bash"
Inside the VM, create a directory and mount the rwdisk device on it. The rwdisk will hang and mount operation will not complete.
This commit fixes the wrap counter error by flipping the packed.avail_wrap_counter, when start of descriptor chain equals to the end of descriptor chain (head == i).
Message-Id: <[email protected]>
--- drivers/virtio/virtio_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virtio/virtio_ring.c +1 -1
@@ -1271,7 +1271,7 @@ static inline int virtqueue_add_packed(struct virtqueue *_vq, } } -if (i < head) +if (i <= head) vq->packed.avail_wrap_counter ^=1 ;/* We're using some buffers from the free list. */
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 316/511 igmp: limit igmpv3_newpack() packet size to IP_MAX_MTU
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit c3b704d4a4a265660e665df51b129e8425216ed1 upstream.
This is a follow up of commit 915d975b2ffa ("net: deal with integer overflows in kmalloc_reserve()") based on David Laight feedback.
Back in 2010, I failed to realize malicious users could set dev->mtu to arbitrary values. This mtu has been since limited to 0x7fffffff but regardless of how big dev->mtu is, it makes no sense for igmpv3_newpack() to allocate more than IP_MAX_MTU and risk various skb fields overflows.
--- net/ipv4/igmp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv4/igmp.c +2 -1
@@ -353,8 +353,9 @@ static struct sk_buff *igmpv3_newpack(ststruct flowi4 fl4;int hlen =LL_RESERVED_SPACE (dev);int tlen = dev->needed_tailroom; -unsigned int size = mtu; +unsigned int size; + size =min (mtu,IP_MAX_MTU );while (1 ) { skb =alloc_skb (size + hlen + tlen,GFP_ATOMIC | __GFP_NOWARN);
Greg Kroah-Hartman
maintainerPATCH 317/511 netfilter: ipset: add the missing IP_SET_HASH_WITH_NET0 macro for ip_set_hash_netportnet.c
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <[email protected]>
commit 050d91c03b28ca479df13dfb02bcd2c60dd6a878 upstream.
The missing IP_SET_HASH_WITH_NET0 macro in ip_set_hash_netportnet can lead to the use of wrong CIDR_POS(c) for calculating array offsets, which can lead to integer underflow. As a result, it leads to slab out-of-bound access.
This patch adds back the IP_SET_HASH_WITH_NET0 macro to ip_set_hash_netportnet to address the issue.
--- net/netfilter/ipset/ip_set_hash_netportnet.c | 1 + 1 file changed, 1 insertion(+)
net/netfilter/ipset/ip_set_hash_netportnet.c +1 -0
@@ -36,6 +36,7 @@ MODULE_ALIAS("ip_set_hash:net,port,net")#define IP_SET_HASH_WITH_PROTO #define IP_SET_HASH_WITH_NETS #define IPSET_NET_COUNT 2 +#define IP_SET_HASH_WITH_NET0 /* IPv4 variant */
Greg Kroah-Hartman
maintainerPATCH 318/511 netfilter: xt_u32: validate user space input
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wander Lairson Costa <[email protected]>
commit 69c5d284f67089b4750d28ff6ac6f52ec224b330 upstream.
The xt_u32 module doesn't validate the fields in the xt_u32 structure. An attacker may take advantage of this to trigger an OOB read by setting the size fields with a value beyond the arrays boundaries.
Add a checkentry function to validate the structure.
This was originally reported by the ZDI project (ZDI-CAN-18408).
--- net/netfilter/xt_u32.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
net/netfilter/xt_u32.c +21 -0
@@ -96,11 +96,32 @@ static bool u32_mt(const struct sk_buffreturn ret ^ data->invert; } +static int u32_mt_checkentry (const struct xt_mtchk_param *par) +{ +const struct xt_u32 *data = par->matchinfo; +const struct xt_u32_test *ct; +unsigned int i; + +if (data->ntests >ARRAY_SIZE (data->tests)) +return -EINVAL ; + +for (i =0 ; i < data->ntests; ++i) { + ct = &data->tests[i]; + +if (ct->nnums >ARRAY_SIZE (ct->location) || + ct->nvalues >ARRAY_SIZE (ct->value)) +return -EINVAL ; + } + +return 0 ; +} +static struct xt_match xt_u32_mt_reg__read_mostly = { .name ="u32" , .revision =0 , .family =NFPROTO_UNSPEC , .match = u32_mt, + .checkentry = u32_mt_checkentry, .matchsize =sizeof (struct xt_u32 ), .me =THIS_MODULE , };
Greg Kroah-Hartman
maintainerPATCH 319/511 netfilter: xt_sctp: validate the flag_info count
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wander Lairson Costa <[email protected]>
commit e99476497687ef9e850748fe6d232264f30bc8f9 upstream.
sctp_mt_check doesn't validate the flag_count field. An attacker can take advantage of that to trigger a OOB read and leak memory information.
Add the field validation in the checkentry function.
--- net/netfilter/xt_sctp.c | 2 ++ 1 file changed, 2 insertions(+)
net/netfilter/xt_sctp.c +2 -0
@@ -150,6 +150,8 @@ static int sctp_mt_check(const struct xt {const struct xt_sctp_info *info = par->matchinfo; +if (info->flag_count >ARRAY_SIZE (info->flag_info)) +return -EINVAL ;if (info->flags & ~XT_SCTP_VALID_FLAGS )return -EINVAL ;if (info->invflags & ~XT_SCTP_VALID_FLAGS )
Greg Kroah-Hartman
maintainerPATCH 320/511 skbuff: skb_segment, Call zero copy functions before using skbuff frags
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mohamed Khalfella <[email protected]>
commit 2ea35288c83b3d501a88bc17f2df8f176b5cc96f upstream.
Commit bf5c25d60861 ("skbuff: in skb_segment, call zerocopy functions once per nskb") added the call to zero copy functions in skb_segment(). The change introduced a bug in skb_segment() because skb_orphan_frags() may possibly change the number of fragments or allocate new fragments altogether leaving nrfrags and frag to point to the old values. This can cause a panic with stacktrace like the one below.
[ 193.894380] BUG: kernel NULL pointer dereference, address: 00000000000000bc [ 193.895273] CPU: 13 PID: 18164 Comm: vh-net-17428 Kdump: loaded Tainted: G O 5.15.123+ #26 [ 193.903919] RIP: 0010:skb_segment+0xb0e/0x12f0 [ 194.021892] Call Trace: [ 194.027422] <TASK> [ 194.072861] tcp_gso_segment+0x107/0x540 [ 194.082031] inet_gso_segment+0x15c/0x3d0 [ 194.090783] skb_mac_gso_segment+0x9f/0x110 [ 194.095016] __skb_gso_segment+0xc1/0x190 [ 194.103131] netem_enqueue+0x290/0xb10 [sch_netem] [ 194.107071] dev_qdisc_enqueue+0x16/0x70 [ 194.110884] __dev_queue_xmit+0x63b/0xb30 [ 194.121670] bond_start_xmit+0x159/0x380 [bonding] [ 194.128506] dev_hard_start_xmit+0xc3/0x1e0 [ 194.131787] __dev_queue_xmit+0x8a0/0xb30 [ 194.138225] macvlan_start_xmit+0x4f/0x100 [macvlan] [ 194.141477] dev_hard_start_xmit+0xc3/0x1e0 [ 194.144622] sch_direct_xmit+0xe3/0x280 [ 194.147748] __dev_queue_xmit+0x54a/0xb30 [ 194.154131] tap_get_user+0x2a8/0x9c0 [tap] [ 194.157358] tap_sendmsg+0x52/0x8e0 [tap] [ 194.167049] handle_tx_zerocopy+0x14e/0x4c0 [vhost_net] [ 194.173631] handle_tx+0xcd/0xe0 [vhost_net] [ 194.176959] vhost_worker+0x76/0xb0 [vhost] [ 194.183667] kthread+0x118/0x140 [ 194.190358] ret_from_fork+0x1f/0x30 [ 194.193670] </TASK>
In this case calling skb_orphan_frags() updated nr_frags leaving nrfrags local variable in skb_segment() stale. This resulted in the code hitting i >= nrfrags prematurely and trying to move to next frag_skb using list_skb pointer, which was NULL, and caused kernel panic. Move the call to zero copy functions before using frags and nr_frags.
--- net/core/skbuff.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-)
net/core/skbuff.c +20 -14
@@ -4001,21 +4001,20 @@ struct sk_buff *skb_segment(struct sk_bustruct sk_buff *segs =NULL ;struct sk_buff *tail =NULL ;struct sk_buff *list_skb =skb_shinfo (head_skb)->frag_list; -skb_frag_t *frag =skb_shinfo (head_skb)->frags;unsigned int mss =skb_shinfo (head_skb)->gso_size;unsigned int doffset = head_skb->data -skb_mac_header (head_skb); -struct sk_buff *frag_skb = head_skb;unsigned int offset = doffset;unsigned int tnl_hlen =skb_tnl_header_len (head_skb);unsigned int partial_segs =0 ;unsigned int headroom;unsigned int len = head_skb->len; +struct sk_buff *frag_skb; +skb_frag_t *frag;__be16 proto;bool csum, sg; -int nfrags =skb_shinfo (head_skb)->nr_frags;int err = -ENOMEM ;int i =0 ; -int pos; +int nfrags, pos;if ((skb_shinfo (head_skb)->gso_type &SKB_GSO_DODGY ) && mss !=GSO_BY_FRAGS && mss !=skb_headlen (head_skb)) {
@@ -4092,6 +4091,13 @@ normal: headroom =skb_headroom (head_skb); pos =skb_headlen (head_skb); +if (skb_orphan_frags (head_skb,GFP_ATOMIC )) +return ERR_PTR (-ENOMEM ); + + nfrags =skb_shinfo (head_skb)->nr_frags; + frag =skb_shinfo (head_skb)->frags; + frag_skb = head_skb; + do { struct sk_buff *nskb; skb_frag_t *nskb_frag;
@@ -4112,6 +4118,10 @@ normal: (skb_headlen(list_skb) == len || sg)) {BUG_ON (skb_headlen (list_skb) > len); + nskb =skb_clone (list_skb,GFP_ATOMIC ); +if (unlikely (!nskb)) + goto err; + i =0 ; nfrags =skb_shinfo (list_skb)->nr_frags; frag =skb_shinfo (list_skb)->frags;
@@ -4130,12 +4140,8 @@ normal: frag++; } - nskb =skb_clone (list_skb,GFP_ATOMIC ); list_skb = list_skb->next; -if (unlikely (!nskb)) - goto err; -if (unlikely (pskb_trim (nskb, len))) {kfree_skb (nskb); goto err;
@@ -4211,12 +4217,16 @@ normal:skb_shinfo (nskb)->flags |=skb_shinfo (head_skb)->flags &SKBFL_SHARED_FRAG ; -if (skb_orphan_frags (frag_skb,GFP_ATOMIC ) || -skb_zerocopy_clone (nskb, frag_skb,GFP_ATOMIC )) +if (skb_zerocopy_clone (nskb, frag_skb,GFP_ATOMIC )) goto err;while (pos < offset + len) {if (i >= nfrags) { +if (skb_orphan_frags (list_skb,GFP_ATOMIC ) || +skb_zerocopy_clone (nskb, list_skb, +GFP_ATOMIC )) + goto err; + i =0 ; nfrags =skb_shinfo (list_skb)->nr_frags; frag =skb_shinfo (list_skb)->frags;
@@ -4230,10 +4240,6 @@ normal: i--; frag--; } -if (skb_orphan_frags (frag_skb,GFP_ATOMIC ) || -skb_zerocopy_clone (nskb, frag_skb, -GFP_ATOMIC )) - goto err; list_skb = list_skb->next; }
Greg Kroah-Hartman
maintainerPATCH 321/511 igb: set max size RX buffer when store bad packet is enabled
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Radoslaw Tyl <[email protected]>
commit bb5ed01cd2428cd25b1c88a3a9cba87055eb289f upstream.
Increase the RX buffer size to 3K when the SBP bit is on. The size of the RX buffer determines the number of pages allocated which may not be sufficient for receive frames larger than the set MTU size.
--- drivers/net/ethernet/intel/igb/igb_main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +7 -4
@@ -4737,6 +4737,10 @@ void igb_configure_rx_ring(struct igb_adstatic void igb_set_rx_buffer_len (struct igb_adapter *adapter,struct igb_ring *rx_ring) { +#if (PAGE_SIZE <8192 ) +struct e1000_hw *hw = &adapter->hw; +#endif +/* set build_skb and buffer size flags */ clear_ring_build_skb_enabled (rx_ring);clear_ring_uses_large_buffer (rx_ring);
@@ -4747,10 +4751,9 @@ static void igb_set_rx_buffer_len(structset_ring_build_skb_enabled (rx_ring);#if (PAGE_SIZE <8192 ) -if (adapter->max_frame_size <=IGB_MAX_FRAME_BUILD_SKB ) -return ; - -set_ring_uses_large_buffer (rx_ring); +if (adapter->max_frame_size >IGB_MAX_FRAME_BUILD_SKB || +rd32 (E1000_RCTL ) &E1000_RCTL_SBP ) +set_ring_uses_large_buffer (rx_ring);#endif }
Greg Kroah-Hartman
maintainerPATCH 322/511 PM / devfreq: Fix leak in devfreq_dev_release()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Brezillon <[email protected]>
commit 5693d077595de721f9ddbf9d37f40e5409707dfe upstream.
srcu_init_notifier_head() allocates resources that need to be released with a srcu_cleanup_notifier_head() call.
Reported by kmemleak.
--- drivers/devfreq/devfreq.c | 1 + 1 file changed, 1 insertion(+)
drivers/devfreq/devfreq.c +1 -0
@@ -762,6 +762,7 @@ static void devfreq_dev_release(struct ddev_pm_opp_put_opp_table (devfreq->opp_table);mutex_destroy (&devfreq->lock); +srcu_cleanup_notifier_head (&devfreq->transition_notifier_list);kfree (devfreq); }
Greg Kroah-Hartman
maintainerPATCH 323/511 ALSA: pcm: Fix missing fixup call in compat hw_refine ioctl
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 358040e3807754944dbddf948a23c6d914297ed7 upstream.
The update of rate_num/den and msbits were factored out to fixup_unreferenced_params() function to be called explicitly after the hw_refine or hw_params procedure. It's called from snd_pcm_hw_refine_user(), but it's forgotten in the PCM compat ioctl. This ended up with the incomplete rate_num/den and msbits parameters when 32bit compat ioctl is used.
This patch adds the missing call in snd_pcm_ioctl_hw_params_compat().
--- sound/core/pcm_compat.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/core/pcm_compat.c +6 -2
@@ -253,10 +253,14 @@ static int snd_pcm_ioctl_hw_params_compa goto error; } -if (refine) +if (refine) { err =snd_pcm_hw_refine (substream, data); -else +if (err <0 ) + goto error; + err =fixup_unreferenced_params (substream, data); + }else { err =snd_pcm_hw_params (substream, data); + }if (err <0 ) goto error; if (copy_to_user(data32, data, sizeof(*data32)) ||
Greg Kroah-Hartman
maintainerPATCH 324/511 rcu: dump vmalloc memory info safely
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zqiang <[email protected]>
commit c83ad36a18c02c0f51280b50272327807916987f upstream.
Currently, for double invoke call_rcu(), will dump rcu_head objects memory info, if the objects is not allocated from the slab allocator, the vmalloc_dump_obj() will be invoke and the vmap_area_lock spinlock need to be held, since the call_rcu() can be invoked in interrupt context, therefore, there is a possibility of spinlock deadlock scenarios.
And in Preempt-RT kernel, the rcutorture test also trigger the following lockdep warning:
BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48
in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 1, name: swapper/0preempt_count: 1, expected: 0
RCU nest depth: 1, expected: 1
3 locks held by swapper/0/1:
#0: ffffffffb534ee80 (fullstop_mutex){+.+.}-{4:4}, at: torture_init_begin+0x24/0xa0 #1: ffffffffb5307940 (rcu_read_lock){....}-{1:3}, at: rcu_torture_init+0x1ec7/0x2370 #2: ffffffffb536af40 (vmap_area_lock){+.+.}-{3:3}, at: find_vmap_area+0x1f/0x70
irq event stamp: 565512 hardirqs last enabled at (565511): [<ffffffffb379b138>] __call_rcu_common+0x218/0x940 hardirqs last disabled at (565512): [<ffffffffb5804262>] rcu_torture_init+0x20b2/0x2370 softirqs last enabled at (399112): [<ffffffffb36b2586>] __local_bh_enable_ip+0x126/0x170 softirqs last disabled at (399106): [<ffffffffb43fef59>] inet_register_protosw+0x9/0x1d0 Preemption disabled at: [<ffffffffb58040c3>] rcu_torture_init+0x1f13/0x2370 CPU: 0 PID: 1 Comm: swapper/0 Tainted: G W 6.5.0-rc4-rt2-yocto-preempt-rt+ #15 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.org 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x68/0xb0 dump_stack+0x14/0x20 __might_resched+0x1aa/0x280 ? __pfx_rcu_torture_err_cb+0x10/0x10 rt_spin_lock+0x53/0x130 ? find_vmap_area+0x1f/0x70 find_vmap_area+0x1f/0x70 vmalloc_dump_obj+0x20/0x60 mem_dump_obj+0x22/0x90 __call_rcu_common+0x5bf/0x940 ? debug_smp_processor_id+0x1b/0x30 call_rcu_hurry+0x14/0x20 rcu_torture_init+0x1f82/0x2370 ? __pfx_rcu_torture_leak_cb+0x10/0x10 ? __pfx_rcu_torture_leak_cb+0x10/0x10 ? __pfx_rcu_torture_init+0x10/0x10 do_one_initcall+0x6c/0x300 ? debug_smp_processor_id+0x1b/0x30 kernel_init_freeable+0x2b9/0x540 ? __pfx_kernel_init+0x10/0x10 kernel_init+0x1f/0x150 ret_from_fork+0x40/0x50 ? __pfx_kernel_init+0x10/0x10 ret_from_fork_asm+0x1b/0x30 </TASK>
The previous patch fixes this by using the deadlock-safe best-effort version of find_vm_area. However, in case of failure print the fact that the pointer was a vmalloc pointer so that we print at least something.
--- mm/util.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
mm/util.c +3 -1
@@ -1110,7 +1110,9 @@ void mem_dump_obj(void *object)if (vmalloc_dump_obj (object))return ; -if (virt_addr_valid (object)) +if (is_vmalloc_addr (object)) + type ="vmalloc memory" ; +else if (virt_addr_valid (object)) type ="non-slab/vmalloc memory" ;else if (object ==NULL ) type ="NULL pointer" ;
Greg Kroah-Hartman
maintainerPATCH 325/511 printk: ringbuffer: Fix truncating buffer size min_t cast
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
commit 53e9e33ede37a247d926db5e4a9e56b55204e66c upstream.
If an output buffer size exceeded U16_MAX, the min_t(u16, ...) cast in copy_data() was causing writes to truncate. This manifested as output bytes being skipped, seen as %NUL bytes in pstore dumps when the available record size was larger than 65536. Fix the cast to no longer truncate the calculation.
--- kernel/printk/printk_ringbuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/printk/printk_ringbuffer.c +1 -1
@@ -1724,7 +1724,7 @@ static bool copy_data(struct prb_data_riif (!buf || !buf_size)return true; - data_size =min_t (u16, buf_size, len); + data_size = min_t(unsigned int, buf_size, len);memcpy (&buf[0 ], data, data_size);/* LMM(copy_data:A) */ return true;
Greg Kroah-Hartman
maintainerPATCH 326/511 scsi: core: Fix the scsi_set_resid() documentation
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit f669b8a683e4ee26fa5cafe19d71cec1786b556a upstream.
Because scsi_finish_command() subtracts the residual from the buffer length, residual overflows must not be reported. Reflect this in the SCSI documentation. See also commit 9237f04e12cc ("scsi: core: Fix scsi_get/set_resid() interface")
--- Documentation/scsi/scsi_mid_low_api.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/scsi/scsi_mid_low_api.rst +2 -2
@@ -1190,11 +1190,11 @@ Members of interest: - pointer to scsi_device object that this command is associated with. resid - - an LLD should set this signed integer to the requested + - an LLD should set this unsigned integer to the requested transfer length (i.e. 'request_bufflen') less the number of bytes that are actually transferred. 'resid' is preset to 0 so an LLD can ignore it if it cannot detect - underruns (overruns should be rare). If possible an LLD + underruns (overruns should not be reported). An LLD should set 'resid' prior to invoking 'done'. The most interesting case is data transfers from a SCSI target device (e.g. READs) that underrun.
Greg Kroah-Hartman
maintainerPATCH 327/511 mm/vmalloc: add a safer version of find_vm_area() for debug
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joel Fernandes (Google) <[email protected]>
commit 0818e739b5c061b0251c30152380600fb9b84c0c upstream.
It is unsafe to dump vmalloc area information when trying to do so from some contexts. Add a safer trylock version of the same function to do a best-effort VMA finding and use it from vmalloc_dump_obj().
--- mm/vmalloc.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-)
mm/vmalloc.c +22 -4
@@ -3823,14 +3823,32 @@ void pcpu_free_vm_areas(struct vm_struct#ifdef CONFIG_PRINTK bool vmalloc_dump_obj (void *object) { -struct vm_struct *vm;void *objp = (void *)PAGE_ALIGN ((unsigned long )object); +const void *caller; +struct vm_struct *vm; +struct vmap_area *va; +unsigned long addr; +unsigned int nr_pages; + +if (!spin_trylock (&vmap_area_lock)) +return false; + va =__find_vmap_area ((unsigned long )objp); +if (!va) { +spin_unlock (&vmap_area_lock); +return false; + } - vm =find_vm_area (objp); -if (!vm) + vm = va->vm; +if (!vm) { +spin_unlock (&vmap_area_lock);return false; + } + addr = (unsigned long )vm->addr; + caller = vm->caller; + nr_pages = vm->nr_pages; +spin_unlock (&vmap_area_lock);pr_cont (" %u-page vmalloc region starting at %#lx allocated at %pS\n" , - vm->nr_pages, (unsigned long )vm->addr, vm->caller); + nr_pages, addr, caller);return true; }#endif
Greg Kroah-Hartman
maintainerPATCH 328/511 media: i2c: ccs: Check rules is non-NULL
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit 607bcc4213d998d051541d8f10b5bbb7d546c0be upstream.
Fix the following smatch warning:
drivers/media/i2c/ccs/ccs-data.c:524 ccs_data_parse_rules() warn: address of NULL pointer 'rules'
The CCS static data rule parser does not check an if rule has been obtained before checking for other rule types (which depend on the if rule). In practice this means parsing invalid CCS static data could lead to dereferencing a NULL pointer.
--- drivers/media/i2c/ccs/ccs-data.c | 101 +++++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 45 deletions(-)
drivers/media/i2c/ccs/ccs-data.c +56 -45
@@ -464,8 +464,7 @@ static int ccs_data_parse_rules(struct b rule_payload = __rule_type +1 ; rule_plen2 = rule_plen -sizeof (*__rule_type); -switch (*__rule_type) { -case CCS_DATA_BLOCK_RULE_ID_IF : { +if (*__rule_type ==CCS_DATA_BLOCK_RULE_ID_IF ) {const struct __ccs_data_block_rule_if *__if_rules = rule_payload; const size_t __num_if_rules =
@@ -514,49 +513,61 @@ static int ccs_data_parse_rules(struct b rules->if_rules = if_rule; rules->num_if_rules = __num_if_rules; } -break ; - } -case CCS_DATA_BLOCK_RULE_ID_READ_ONLY_REGS : - rval =ccs_data_parse_reg_rules (bin, &rules->read_only_regs, - &rules->num_read_only_regs, - rule_payload, - rule_payload + rule_plen2, - dev); -if (rval) -return rval; -break ; -case CCS_DATA_BLOCK_RULE_ID_FFD : - rval =ccs_data_parse_ffd (bin, &rules->frame_format, - rule_payload, - rule_payload + rule_plen2, - dev); -if (rval) -return rval; -break ; -case CCS_DATA_BLOCK_RULE_ID_MSR : - rval =ccs_data_parse_reg_rules (bin, - &rules->manufacturer_regs, - &rules->num_manufacturer_regs, - rule_payload, - rule_payload + rule_plen2, - dev); -if (rval) -return rval; -break ; -case CCS_DATA_BLOCK_RULE_ID_PDAF_READOUT : - rval =ccs_data_parse_pdaf_readout (bin, - &rules->pdaf_readout, - rule_payload, - rule_payload + rule_plen2, - dev); -if (rval) -return rval; -break ; -default : -dev_dbg (dev, -"Don't know how to handle rule type %u!\n" , - *__rule_type); -return -EINVAL ; + }else { +/* Check there was an if rule before any other rules */ +if (bin->base && !rules) +return -EINVAL ; + +switch (*__rule_type) { +case CCS_DATA_BLOCK_RULE_ID_READ_ONLY_REGS : + rval =ccs_data_parse_reg_rules (bin, + rules ? + &rules->read_only_regs :NULL , + rules ? + &rules->num_read_only_regs :NULL , + rule_payload, + rule_payload + rule_plen2, + dev); +if (rval) +return rval; +break ; +case CCS_DATA_BLOCK_RULE_ID_FFD : + rval =ccs_data_parse_ffd (bin, rules ? + &rules->frame_format :NULL , + rule_payload, + rule_payload + rule_plen2, + dev); +if (rval) +return rval; +break ; +case CCS_DATA_BLOCK_RULE_ID_MSR : + rval =ccs_data_parse_reg_rules (bin, + rules ? + &rules->manufacturer_regs :NULL , + rules ? + &rules->num_manufacturer_regs :NULL , + rule_payload, + rule_payload + rule_plen2, + dev); +if (rval) +return rval; +break ; +case CCS_DATA_BLOCK_RULE_ID_PDAF_READOUT : + rval =ccs_data_parse_pdaf_readout (bin, + rules ? + &rules->pdaf_readout :NULL , + rule_payload, + rule_payload + rule_plen2, + dev); +if (rval) +return rval; +break ; +default : +dev_dbg (dev, +"Don't know how to handle rule type %u!\n" , + *__rule_type); +return -EINVAL ; + } } __next_rule = __next_rule + rule_hlen + rule_plen; }
Greg Kroah-Hartman
maintainerPATCH 329/511 PCI: rockchip: Use 64-bit mask on MSI 64-bit PCI address
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rick Wertenbroek <[email protected]>
commit cdb50033dd6dfcf02ae3d4ee56bc1a9555be6d36 upstream.
A 32-bit mask was used on the 64-bit PCI address used for mapping MSIs. This would result in the upper 32 bits being unintentionally zeroed and MSIs getting mapped to incorrect PCI addresses if the address had any of the upper bits set.
Replace 32-bit mask by appropriate 64-bit mask.
--- drivers/pci/controller/pcie-rockchip.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pci/controller/pcie-rockchip.h +3 -3
@@ -159,7 +159,9 @@#define PCIE_RC_CONFIG_THP_CAP (PCIE_RC_CONFIG_BASE + 0x274)#define PCIE_RC_CONFIG_THP_CAP_NEXT_MASK GENMASK(31, 20) -#define PCIE_ADDR_MASK 0xffffff00 +#define MAX_AXI_IB_ROOTPORT_REGION_NUM 3 +#define MIN_AXI_ADDR_BITS_PASSED 8 +#define PCIE_ADDR_MASK GENMASK_ULL(63, MIN_AXI_ADDR_BITS_PASSED)#define PCIE_CORE_AXI_CONF_BASE 0xc00000#define PCIE_CORE_OB_REGION_ADDR0 (PCIE_CORE_AXI_CONF_BASE + 0x0)#define PCIE_CORE_OB_REGION_ADDR0_NUM_BITS 0x3f
@@ -186,8 +188,6 @@#define AXI_WRAPPER_TYPE1_CFG 0xb#define AXI_WRAPPER_NOR_MSG 0xc -#define MAX_AXI_IB_ROOTPORT_REGION_NUM 3 -#define MIN_AXI_ADDR_BITS_PASSED 8#define PCIE_RC_SEND_PME_OFF 0x11960#define ROCKCHIP_VENDOR_ID 0x1d87#define PCIE_LINK_IS_L2 (x) \
Greg Kroah-Hartman
maintainerPATCH 330/511 ipmi_si: fix a memleak in try_smi_init()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yi Yang <[email protected]>
commit 6cf1a126de2992b4efe1c3c4d398f8de4aed6e3f upstream.
Kmemleak reported the following leak info in try_smi_init():
unreferenced object 0xffff00018ecf9400 (size 1024):
comm "modprobe", pid 2707763, jiffies 4300851415 (age 773.308s) backtrace:
[<000000004ca5b312>] __kmalloc+0x4b8/0x7b0
[<00000000953b1072>] try_smi_init+0x148/0x5dc [ipmi_si]
[<000000006460d325>] 0xffff800081b10148
[<0000000039206ea5>] do_one_initcall+0x64/0x2a4
[<00000000601399ce>] do_init_module+0x50/0x300
[<000000003c12ba3c>] load_module+0x7a8/0x9e0
[<00000000c246fffe>] __se_sys_init_module+0x104/0x180
[<00000000eea99093>] __arm64_sys_init_module+0x24/0x30
[<0000000021b1ef87>] el0_svc_common.constprop.0+0x94/0x250
[<0000000070f4f8b7>] do_el0_svc+0x48/0xe0
[<000000005a05337f>] el0_svc+0x24/0x3c
[<000000005eb248d6>] el0_sync_handler+0x160/0x164
[<0000000030a59039>] el0_sync+0x160/0x180The problem was that when an error occurred before handlers registration and after allocating new_smi->si_sm, the variable wouldn't be freed in the error handling afterwards since shutdown_smi() hadn't been registered yet. Fix it by adding a kfree() in the error handling path in try_smi_init().
Message-Id: <[email protected]>
--- drivers/char/ipmi/ipmi_si_intf.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/char/ipmi/ipmi_si_intf.c +5 -0
@@ -2081,6 +2081,11 @@ static int try_smi_init(struct smi_info new_smi->io.io_cleanup =NULL ; } +if (rv && new_smi->si_sm) { +kfree (new_smi->si_sm); + new_smi->si_sm =NULL ; + } +return rv; }
Greg Kroah-Hartman
maintainerPATCH 331/511 ARM: OMAP2+: Fix -Warray-bounds warning in _pwrdm_state_switch()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo A. R. Silva <[email protected]>
commit 847fb80cc01a54bc827b02547bb8743bdb59ddab upstream.
If function pwrdm_read_prev_pwrst() returns -EINVAL, we will end up accessing array pwrdm->state_counter through negative index -22. This is wrong and the compiler is legitimately warning us about this potential problem.
Fix this by sanity checking the value stored in variable _prev_ before accessing array pwrdm->state_counter.
Address the following -Warray-bounds warning:arch/arm/mach-omap2/powerdomain.c:178:45: warning: array subscript -22 is below array bounds of 'unsigned int[4]' [-Warray-bounds]
Message-ID: <ZIFVGwImU3kpaGeH@work>
--- arch/arm/mach-omap2/powerdomain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/powerdomain.c +1 -1
@@ -174,7 +174,7 @@ static int _pwrdm_state_switch(struct pobreak ;case PWRDM_STATE_PREV : prev =pwrdm_read_prev_pwrst (pwrdm); -if (pwrdm->state != prev) +if (prev >=0 && pwrdm->state != prev) pwrdm->state_counter[prev]++;if (prev ==PWRDM_POWER_RET )_update_logic_membank_counters (pwrdm);
Greg Kroah-Hartman
maintainerPATCH 332/511 backlight/gpio_backlight: Compare against struct fb_info.device
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit 7b91d017f77c1bda56f27c2f4bbb70de7c6eca08 upstream.
Struct gpio_backlight_platform_data refers to a platform device within the Linux device hierarchy. The test in gpio_backlight_check_fb() compares it against the fbdev device in struct fb_info.dev, which is different. Fix the test by comparing to struct fb_info.device.
Fixes a bug in the backlight driver and prepares fbdev for making struct fb_info.dev optional.
v2:
* move renames into separate patch (Javier, Sam, Michael)
--- drivers/video/backlight/gpio_backlight.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/backlight/gpio_backlight.c +1 -1
@@ -35,7 +35,7 @@ static int gpio_backlight_check_fb(struc {struct gpio_backlight *gbl =bl_get_data (bl); -return gbl->fbdev ==NULL || gbl->fbdev == info->dev; +return gbl->fbdev ==NULL || gbl->fbdev == info->device; }static const struct backlight_ops gpio_backlight_ops = {
Greg Kroah-Hartman
maintainerPATCH 333/511 backlight/bd6107: Compare against struct fb_info.device
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit 992bdddaabfba19bdc77c1c7a4977b2aa41ec891 upstream.
Struct bd6107_platform_data refers to a platform device within the Linux device hierarchy. The test in bd6107_backlight_check_fb() compares it against the fbdev device in struct fb_info.dev, which is different. Fix the test by comparing to struct fb_info.device.
Fixes a bug in the backlight driver and prepares fbdev for making struct fb_info.dev optional.
v2:
* move renames into separate patch (Javier, Sam, Michael)
--- drivers/video/backlight/bd6107.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/backlight/bd6107.c +1 -1
@@ -104,7 +104,7 @@ static int bd6107_backlight_check_fb(str {struct bd6107 *bd =bl_get_data (backlight); -return bd->pdata->fbdev ==NULL || bd->pdata->fbdev == info->dev; +return bd->pdata->fbdev ==NULL || bd->pdata->fbdev == info->device; }static const struct backlight_ops bd6107_backlight_ops = {
Greg Kroah-Hartman
maintainerPATCH 334/511 backlight/lv5207lp: Compare against struct fb_info.device
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit 1ca8819320fd84e7d95b04e7668efc5f9fe9fa5c upstream.
Struct lv5207lp_platform_data refers to a platform device within the Linux device hierarchy. The test in lv5207lp_backlight_check_fb() compares it against the fbdev device in struct fb_info.dev, which is different. Fix the test by comparing to struct fb_info.device.
Fixes a bug in the backlight driver and prepares fbdev for making struct fb_info.dev optional.
v2:
* move renames into separate patch (Javier, Sam, Michael)
--- drivers/video/backlight/lv5207lp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/backlight/lv5207lp.c +1 -1
@@ -67,7 +67,7 @@ static int lv5207lp_backlight_check_fb(s {struct lv5207lp *lv =bl_get_data (backlight); -return lv->pdata->fbdev ==NULL || lv->pdata->fbdev == info->dev; +return lv->pdata->fbdev ==NULL || lv->pdata->fbdev == info->device; }static const struct backlight_ops lv5207lp_backlight_ops = {
Greg Kroah-Hartman
maintainerPATCH 335/511 xtensa: PMU: fix base address for the newer hardware
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Max Filippov <[email protected]>
commit 687eb3c42f4ad81e7c947c50e2d865f692064291 upstream.
With introduction of ERI access control in RG.0 base address of the PMU unit registers has changed. Add support for the new PMU configuration.
--- arch/xtensa/include/asm/core.h | 9 +++++++++ arch/xtensa/kernel/perf_event.c | 17 +++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-)
arch/xtensa/include/asm/core.h +9 -0
@@ -26,4 +26,13 @@#define XCHAL_SPANNING_WAY 0#endif +#ifndef XCHAL_HW_MIN_VERSION +#if defined(XCHAL_HW_MIN_VERSION_MAJOR ) && defined(XCHAL_HW_MIN_VERSION_MINOR ) +#define XCHAL_HW_MIN_VERSION (XCHAL_HW_MIN_VERSION_MAJOR * 100 + \ + XCHAL_HW_MIN_VERSION_MINOR) +#else +#define XCHAL_HW_MIN_VERSION 0 +#endif +#endif +#endif
arch/xtensa/kernel/perf_event.c +13 -4
@@ -13,17 +13,26 @@#include <linux/perf_event.h> #include <linux/platform_device.h> +#include <asm/core.h> #include <asm/processor.h> #include <asm/stacktrace.h> +#define XTENSA_HWVERSION_RG_2015_0 260000 + +#if XCHAL_HW_MIN_VERSION >=XTENSA_HWVERSION_RG_2015_0 +#define XTENSA_PMU_ERI_BASE 0x00101000 +#else +#define XTENSA_PMU_ERI_BASE 0x00001000 +#endif +/* Global control/status for all perf counters */ -#define XTENSA_PMU_PMG 0x1000 +#define XTENSA_PMU_PMG XTENSA_PMU_ERI_BASE/* Perf counter values */ -#define XTENSA_PMU_PM (i) (0x1080 + (i) * 4) +#define XTENSA_PMU_PM (i) (XTENSA_PMU_ERI_BASE + 0x80 + (i) * 4)/* Perf counter control registers */ -#define XTENSA_PMU_PMCTRL (i) (0x1100 + (i) * 4) +#define XTENSA_PMU_PMCTRL (i) (XTENSA_PMU_ERI_BASE + 0x100 + (i) * 4)/* Perf counter status registers */ -#define XTENSA_PMU_PMSTAT (i) (0x1180 + (i) * 4) +#define XTENSA_PMU_PMSTAT (i) (XTENSA_PMU_ERI_BASE + 0x180 + (i) * 4)#define XTENSA_PMU_PMG_PMEN 0x1
Greg Kroah-Hartman
maintainerPATCH 336/511 i3c: master: svc: fix probe failure when no i3c device exist
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Li <[email protected]>
commit 6e13d6528be2f7e801af63c8153b87293f25d736 upstream.
I3C masters are expected to support hot-join. This means at initialization time we might not yet discover any device and this should not be treated as a fatal error.
During the DAA procedure which happens at probe time, if no device has joined, all CCC will be NACKed (from a bus perspective). This leads to an early return with an error code which fails the probe of the master.
Let's avoid this by just telling the core through an I3C_ERROR_M2 return command code that no device was discovered, which is a valid situation. This way the master will no longer bail out and fail to probe for a wrong reason.
--- drivers/i3c/master/svc-i3c-master.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/i3c/master/svc-i3c-master.c +12 -2
@@ -723,6 +723,10 @@ static int svc_i3c_master_do_daa_locked(*/ break ; }else if (SVC_I3C_MSTATUS_NACKED (reg)) { +/* No I3C devices attached */ +if (dev_nb ==0 ) +break ; +/* * A slave device nacked the address, this is * allowed only once, DAA will be stopped and
@@ -1152,11 +1156,17 @@ static int svc_i3c_master_send_ccc_cmd(s {struct svc_i3c_master *master =to_svc_i3c_master (m);bool broadcast = cmd->id <0x80 ; +int ret;if (broadcast) -return svc_i3c_master_send_bdcast_ccc_cmd (master, cmd); + ret =svc_i3c_master_send_bdcast_ccc_cmd (master, cmd);else -return svc_i3c_master_send_direct_ccc_cmd (master, cmd); + ret =svc_i3c_master_send_direct_ccc_cmd (master, cmd); + +if (ret) + cmd->err =I3C_ERROR_M2 ; + +return ret; } static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev,
Greg Kroah-Hartman
maintainerPATCH 337/511 arm64: csum: Fix OoB access in IP checksum code for negative lengths
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 8bd795fedb8450ecbef18eeadbd23ed8fc7630f5 upstream.
Although commit c2c24edb1d9c ("arm64: csum: Fix pathological zero-length calls") added an early return for zero-length input, syzkaller has popped up with an example of a _negative_ length which causes an undefined shift and an out-of-bounds read:
| BUG: KASAN: slab-out-of-bounds in do_csum+0x44/0x254 arch/arm64/lib/csum.c:39 | Read of size 4294966928 at addr ffff0000d7ac0170 by task syz-executor412/5975 | | CPU: 0 PID: 5975 Comm: syz-executor412 Not tainted 6.4.0-rc4-syzkaller-g908f31f2a05b #0 | Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023 | Call trace: | dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:233 | show_stack+0x2c/0x44 arch/arm64/kernel/stacktrace.c:240 | __dump_stack lib/dump_stack.c:88 [inline] | dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106 | print_address_description mm/kasan/report.c:351 [inline] | print_report+0x174/0x514 mm/kasan/report.c:462 | kasan_report+0xd4/0x130 mm/kasan/report.c:572 | kasan_check_range+0x264/0x2a4 mm/kasan/generic.c:187 | __kasan_check_read+0x20/0x30 mm/kasan/shadow.c:31 | do_csum+0x44/0x254 arch/arm64/lib/csum.c:39 | csum_partial+0x30/0x58 lib/checksum.c:128 | gso_make_checksum include/linux/skbuff.h:4928 [inline] | __udp_gso_segment+0xaf4/0x1bc4 net/ipv4/udp_offload.c:332 | udp6_ufo_fragment+0x540/0xca0 net/ipv6/udp_offload.c:47 | ipv6_gso_segment+0x5cc/0x1760 net/ipv6/ip6_offload.c:119 | skb_mac_gso_segment+0x2b4/0x5b0 net/core/gro.c:141 | __skb_gso_segment+0x250/0x3d0 net/core/dev.c:3401 | skb_gso_segment include/linux/netdevice.h:4859 [inline] | validate_xmit_skb+0x364/0xdbc net/core/dev.c:3659 | validate_xmit_skb_list+0x94/0x130 net/core/dev.c:3709 | sch_direct_xmit+0xe8/0x548 net/sched/sch_generic.c:327 | __dev_xmit_skb net/core/dev.c:3805 [inline] | __dev_queue_xmit+0x147c/0x3318 net/core/dev.c:4210 | dev_queue_xmit include/linux/netdevice.h:3085 [inline] | packet_xmit+0x6c/0x318 net/packet/af_packet.c:276 | packet_snd net/packet/af_packet.c:3081 [inline] | packet_sendmsg+0x376c/0x4c98 net/packet/af_packet.c:3113 | sock_sendmsg_nosec net/socket.c:724 [inline] | sock_sendmsg net/socket.c:747 [inline] | __sys_sendto+0x3b4/0x538 net/socket.c:2144
Extend the early return to reject negative lengths as well, aligning our implementation with the generic code in lib/checksum.c
--- arch/arm64/lib/csum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/lib/csum.c +1 -1
@@ -24,7 +24,7 @@ unsigned int __no_sanitize_address do_csconst u64 *ptr;u64 data, sum64 =0 ; -if (unlikely (len ==0 )) +if (unlikely (len <=0 ))return 0 ; offset = (unsigned long )buff &7 ;
Greg Kroah-Hartman
maintainerPATCH 338/511 media: dvb: symbol fixup for dvb_attach()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 86495af1171e1feec79faa9b64c05c89f46e41d1 upstream.
In commit 9011e49d54dc ("modules: only allow symbol_get of EXPORT_SYMBOL_GPL modules") the use of symbol_get is properly restricted to GPL-only marked symbols. This interacts oddly with the DVB logic which only uses dvb_attach() to load the dvb driver which then uses symbol_get().
Fix this up by properly marking all of the dvb_attach attach symbols as EXPORT_SYMBOL_GPL().
--- drivers/media/dvb-frontends/ascot2e.c | 2 +- drivers/media/dvb-frontends/atbm8830.c | 2 +- drivers/media/dvb-frontends/au8522_dig.c | 2 +- drivers/media/dvb-frontends/bcm3510.c | 2 +- drivers/media/dvb-frontends/cx22700.c | 2 +- drivers/media/dvb-frontends/cx22702.c | 2 +- drivers/media/dvb-frontends/cx24110.c | 2 +- drivers/media/dvb-frontends/cx24113.c | 2 +- drivers/media/dvb-frontends/cx24116.c | 2 +- drivers/media/dvb-frontends/cx24120.c | 2 +- drivers/media/dvb-frontends/cx24123.c | 2 +- drivers/media/dvb-frontends/cxd2820r_core.c | 2 +- drivers/media/dvb-frontends/cxd2841er.c | 4 ++-- drivers/media/dvb-frontends/cxd2880/cxd2880_top.c | 2 +- drivers/media/dvb-frontends/dib0070.c | 2 +- drivers/media/dvb-frontends/dib0090.c | 4 ++-- drivers/media/dvb-frontends/dib3000mb.c | 2 +- drivers/media/dvb-frontends/dib3000mc.c | 2 +- drivers/media/dvb-frontends/dib7000m.c | 2 +- drivers/media/dvb-frontends/dib7000p.c | 2 +- drivers/media/dvb-frontends/dib8000.c | 2 +- drivers/media/dvb-frontends/dib9000.c | 2 +- drivers/media/dvb-frontends/drx39xyj/drxj.c | 2 +- drivers/media/dvb-frontends/drxd_hard.c | 2 +- drivers/media/dvb-frontends/drxk_hard.c | 2 +- drivers/media/dvb-frontends/ds3000.c | 2 +- drivers/media/dvb-frontends/dvb-pll.c | 2 +- drivers/media/dvb-frontends/ec100.c | 2 +- drivers/media/dvb-frontends/helene.c | 4 ++-- drivers/media/dvb-frontends/horus3a.c | 2 +- drivers/media/dvb-frontends/isl6405.c | 2 +- drivers/media/dvb-frontends/isl6421.c | 2 +- drivers/media/dvb-frontends/isl6423.c | 2 +- drivers/media/dvb-frontends/itd1000.c | 2 +- drivers/media/dvb-frontends/ix2505v.c | 2 +- drivers/media/dvb-frontends/l64781.c | 2 +- drivers/media/dvb-frontends/lg2160.c | 2 +- drivers/media/dvb-frontends/lgdt3305.c | 2 +- drivers/media/dvb-frontends/lgdt3306a.c | 2 +- drivers/media/dvb-frontends/lgdt330x.c | 2 +- drivers/media/dvb-frontends/lgs8gxx.c | 2 +- drivers/media/dvb-frontends/lnbh25.c | 2 +- drivers/media/dvb-frontends/lnbp21.c | 4 ++-- drivers/media/dvb-frontends/lnbp22.c | 2 +- drivers/media/dvb-frontends/m88ds3103.c | 2 +- drivers/media/dvb-frontends/m88rs2000.c | 2 +- drivers/media/dvb-frontends/mb86a16.c | 2 +- drivers/media/dvb-frontends/mb86a20s.c | 2 +- drivers/media/dvb-frontends/mt312.c | 2 +- drivers/media/dvb-frontends/mt352.c | 2 +- drivers/media/dvb-frontends/nxt200x.c | 2 +- drivers/media/dvb-frontends/nxt6000.c | 2 +- drivers/media/dvb-frontends/or51132.c | 2 +- drivers/media/dvb-frontends/or51211.c | 2 +- drivers/media/dvb-frontends/s5h1409.c | 2 +- drivers/media/dvb-frontends/s5h1411.c | 2 +- drivers/media/dvb-frontends/s5h1420.c | 2 +- drivers/media/dvb-frontends/s5h1432.c | 2 +- drivers/media/dvb-frontends/s921.c | 2 +- drivers/media/dvb-frontends/si21xx.c | 2 +- drivers/media/dvb-frontends/sp887x.c | 2 +- drivers/media/dvb-frontends/stb0899_drv.c | 2 +- drivers/media/dvb-frontends/stb6000.c | 2 +- drivers/media/dvb-frontends/stb6100.c | 2 +- drivers/media/dvb-frontends/stv0288.c | 2 +- drivers/media/dvb-frontends/stv0297.c | 2 +- drivers/media/dvb-frontends/stv0299.c | 2 +- drivers/media/dvb-frontends/stv0367.c | 6 +++--- drivers/media/dvb-frontends/stv0900_core.c | 2 +- drivers/media/dvb-frontends/stv090x.c | 2 +- drivers/media/dvb-frontends/stv6110.c | 2 +- drivers/media/dvb-frontends/stv6110x.c | 2 +- drivers/media/dvb-frontends/tda10021.c | 2 +- drivers/media/dvb-frontends/tda10023.c | 2 +- drivers/media/dvb-frontends/tda10048.c | 2 +- drivers/media/dvb-frontends/tda1004x.c | 4 ++-- drivers/media/dvb-frontends/tda10086.c | 2 +- drivers/media/dvb-frontends/tda665x.c | 2 +- drivers/media/dvb-frontends/tda8083.c | 2 +- drivers/media/dvb-frontends/tda8261.c | 2 +- drivers/media/dvb-frontends/tda826x.c | 2 +- drivers/media/dvb-frontends/ts2020.c | 2 +- drivers/media/dvb-frontends/tua6100.c | 2 +- drivers/media/dvb-frontends/ves1820.c | 2 +- drivers/media/dvb-frontends/ves1x93.c | 2 +- drivers/media/dvb-frontends/zl10036.c | 2 +- drivers/media/dvb-frontends/zl10039.c | 2 +- drivers/media/dvb-frontends/zl10353.c | 2 +- drivers/media/pci/bt8xx/dst.c | 2 +- drivers/media/pci/bt8xx/dst_ca.c | 2 +- drivers/media/pci/ddbridge/ddbridge-dummy-fe.c | 2 +- drivers/media/tuners/fc0011.c | 2 +- drivers/media/tuners/fc0012.c | 2 +- drivers/media/tuners/fc0013.c | 2 +- drivers/media/tuners/max2165.c | 2 +- drivers/media/tuners/mc44s803.c | 2 +- drivers/media/tuners/mt2060.c | 2 +- drivers/media/tuners/mt2131.c | 2 +- drivers/media/tuners/mt2266.c | 2 +- drivers/media/tuners/mxl5005s.c | 2 +- drivers/media/tuners/qt1010.c | 2 +- drivers/media/tuners/tda18218.c | 2 +- drivers/media/tuners/xc4000.c | 2 +- drivers/media/tuners/xc5000.c | 2 +- drivers/staging/media/av7110/sp8870.c | 2 +- 105 files changed, 112 insertions(+), 112 deletions(-)
drivers/media/dvb-frontends/ascot2e.c +1 -1
@@ -533,7 +533,7 @@ struct dvb_frontend *ascot2e_attach(stru priv->i2c_address, priv->i2c);return fe; } -EXPORT_SYMBOL (ascot2e_attach); +EXPORT_SYMBOL_GPL (ascot2e_attach);MODULE_DESCRIPTION ("Sony ASCOT2E terr/cab tuner driver" );MODULE_AUTHOR ("[email protected]" );
drivers/media/dvb-frontends/atbm8830.c +1 -1
@@ -489,7 +489,7 @@ error_out:return NULL ; } -EXPORT_SYMBOL (atbm8830_attach); +EXPORT_SYMBOL_GPL (atbm8830_attach);MODULE_DESCRIPTION ("AltoBeam ATBM8830/8831 GB20600 demodulator driver" );MODULE_AUTHOR ("David T. L. Wong <[email protected]>" );
drivers/media/dvb-frontends/au8522_dig.c +1 -1
@@ -879,7 +879,7 @@ error:au8522_release_state (state);return NULL ; } -EXPORT_SYMBOL (au8522_attach); +EXPORT_SYMBOL_GPL (au8522_attach);static const struct dvb_frontend_ops au8522_ops = { .delsys = {SYS_ATSC ,SYS_DVBC_ANNEX_B },
drivers/media/dvb-frontends/bcm3510.c +1 -1
@@ -835,7 +835,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (bcm3510_attach); +EXPORT_SYMBOL_GPL (bcm3510_attach);static const struct dvb_frontend_ops bcm3510_ops = { .delsys = {SYS_ATSC ,SYS_DVBC_ANNEX_B },
drivers/media/dvb-frontends/cx22700.c +1 -1
@@ -432,4 +432,4 @@ MODULE_DESCRIPTION("Conexant CX22700 DVBMODULE_AUTHOR ("Holger Waechtler" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (cx22700_attach); +EXPORT_SYMBOL_GPL (cx22700_attach);
drivers/media/dvb-frontends/cx22702.c +1 -1
@@ -604,7 +604,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (cx22702_attach); +EXPORT_SYMBOL_GPL (cx22702_attach);static const struct dvb_frontend_ops cx22702_ops = { .delsys = {SYS_DVBT },
drivers/media/dvb-frontends/cx24110.c +1 -1
@@ -653,4 +653,4 @@ MODULE_DESCRIPTION("Conexant CX24110 DVBMODULE_AUTHOR ("Peter Hettkamp" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (cx24110_attach); +EXPORT_SYMBOL_GPL (cx24110_attach);
drivers/media/dvb-frontends/cx24113.c +1 -1
@@ -590,7 +590,7 @@ error:return NULL ; } -EXPORT_SYMBOL (cx24113_attach); +EXPORT_SYMBOL_GPL (cx24113_attach);module_param (debug, int,0644 );MODULE_PARM_DESC (debug,"Activates frontend debugging (default:0)" );
drivers/media/dvb-frontends/cx24116.c +1 -1
@@ -1133,7 +1133,7 @@ struct dvb_frontend *cx24116_attach(cons state->frontend.demodulator_priv = state;return &state->frontend; } -EXPORT_SYMBOL (cx24116_attach); +EXPORT_SYMBOL_GPL (cx24116_attach);/* * Initialise or wake up device
drivers/media/dvb-frontends/cx24120.c +1 -1
@@ -305,7 +305,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (cx24120_attach); +EXPORT_SYMBOL_GPL (cx24120_attach);static int cx24120_test_rom (struct cx24120_state *state) {
drivers/media/dvb-frontends/cx24123.c +1 -1
@@ -1096,7 +1096,7 @@ error:return NULL ; } -EXPORT_SYMBOL (cx24123_attach); +EXPORT_SYMBOL_GPL (cx24123_attach);static const struct dvb_frontend_ops cx24123_ops = { .delsys = {SYS_DVBS },
drivers/media/dvb-frontends/cxd2820r_core.c +1 -1
@@ -536,7 +536,7 @@ struct dvb_frontend *cxd2820r_attach(conreturn pdata.get_dvb_frontend (client); } -EXPORT_SYMBOL (cxd2820r_attach); +EXPORT_SYMBOL_GPL (cxd2820r_attach);static struct dvb_frontend *cxd2820r_get_dvb_frontend (struct i2c_client *client) {
drivers/media/dvb-frontends/cxd2841er.c +2 -2
@@ -3930,14 +3930,14 @@ struct dvb_frontend *cxd2841er_attach_s( {return cxd2841er_attach (cfg, i2c,SYS_DVBS ); } -EXPORT_SYMBOL (cxd2841er_attach_s); +EXPORT_SYMBOL_GPL (cxd2841er_attach_s);struct dvb_frontend *cxd2841er_attach_t_c (struct cxd2841er_config *cfg,struct i2c_adapter *i2c) {return cxd2841er_attach (cfg, i2c,0 ); } -EXPORT_SYMBOL (cxd2841er_attach_t_c); +EXPORT_SYMBOL_GPL (cxd2841er_attach_t_c);static const struct dvb_frontend_ops cxd2841er_dvbs_s2_ops = { .delsys = {SYS_DVBS ,SYS_DVBS2 },
drivers/media/dvb-frontends/cxd2880/cxd2880_top.c +1 -1
@@ -1950,7 +1950,7 @@ struct dvb_frontend *cxd2880_attach(strureturn fe; } -EXPORT_SYMBOL (cxd2880_attach); +EXPORT_SYMBOL_GPL (cxd2880_attach);MODULE_DESCRIPTION ("Sony CXD2880 DVB-T2/T tuner + demod driver" );MODULE_AUTHOR ("Sony Semiconductor Solutions Corporation" );
drivers/media/dvb-frontends/dib0070.c +1 -1
@@ -762,7 +762,7 @@ free_mem: fe->tuner_priv =NULL ;return NULL ; } -EXPORT_SYMBOL (dib0070_attach); +EXPORT_SYMBOL_GPL (dib0070_attach);MODULE_AUTHOR ("Patrick Boettcher <[email protected]>" );MODULE_DESCRIPTION ("Driver for the DiBcom 0070 base-band RF Tuner" );
drivers/media/dvb-frontends/dib0090.c +2 -2
@@ -2634,7 +2634,7 @@ struct dvb_frontend *dib0090_register(streturn NULL ; } -EXPORT_SYMBOL (dib0090_register); +EXPORT_SYMBOL_GPL (dib0090_register);struct dvb_frontend *dib0090_fw_register (struct dvb_frontend *fe,struct i2c_adapter *i2c,const struct dib0090_config *config) {
@@ -2660,7 +2660,7 @@ free_mem: fe->tuner_priv =NULL ;return NULL ; } -EXPORT_SYMBOL (dib0090_fw_register); +EXPORT_SYMBOL_GPL (dib0090_fw_register);MODULE_AUTHOR ("Patrick Boettcher <[email protected]>" );MODULE_AUTHOR ("Olivier Grenie <[email protected]>" );
drivers/media/dvb-frontends/dib3000mb.c +1 -1
@@ -815,4 +815,4 @@ MODULE_AUTHOR(DRIVER_AUTHOR);MODULE_DESCRIPTION (DRIVER_DESC );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (dib3000mb_attach); +EXPORT_SYMBOL_GPL (dib3000mb_attach);
drivers/media/dvb-frontends/dib3000mc.c +1 -1
@@ -935,7 +935,7 @@ error:kfree (st);return NULL ; } -EXPORT_SYMBOL (dib3000mc_attach); +EXPORT_SYMBOL_GPL (dib3000mc_attach);static const struct dvb_frontend_ops dib3000mc_ops = { .delsys = {SYS_DVBT },
drivers/media/dvb-frontends/dib7000m.c +1 -1
@@ -1434,7 +1434,7 @@ error:kfree (st);return NULL ; } -EXPORT_SYMBOL (dib7000m_attach); +EXPORT_SYMBOL_GPL (dib7000m_attach);static const struct dvb_frontend_ops dib7000m_ops = { .delsys = {SYS_DVBT },
drivers/media/dvb-frontends/dib7000p.c +1 -1
@@ -2822,7 +2822,7 @@ void *dib7000p_attach(struct dib7000p_opreturn ops; } -EXPORT_SYMBOL (dib7000p_attach); +EXPORT_SYMBOL_GPL (dib7000p_attach);static const struct dvb_frontend_ops dib7000p_ops = { .delsys = {SYS_DVBT },
drivers/media/dvb-frontends/dib8000.c +1 -1
@@ -4527,7 +4527,7 @@ void *dib8000_attach(struct dib8000_opsreturn ops; } -EXPORT_SYMBOL (dib8000_attach); +EXPORT_SYMBOL_GPL (dib8000_attach);MODULE_AUTHOR ("Olivier Grenie <[email protected], Patrick Boettcher <[email protected]>" );MODULE_DESCRIPTION ("Driver for the DiBcom 8000 ISDB-T demodulator" );
drivers/media/dvb-frontends/dib9000.c +1 -1
@@ -2546,7 +2546,7 @@ error:kfree (st);return NULL ; } -EXPORT_SYMBOL (dib9000_attach); +EXPORT_SYMBOL_GPL (dib9000_attach);static const struct dvb_frontend_ops dib9000_ops = { .delsys = {SYS_DVBT },
drivers/media/dvb-frontends/drx39xyj/drxj.c +1 -1
@@ -12368,7 +12368,7 @@ error:return NULL ; } -EXPORT_SYMBOL (drx39xxj_attach); +EXPORT_SYMBOL_GPL (drx39xxj_attach);static const struct dvb_frontend_ops drx39xxj_ops = { .delsys = {SYS_ATSC ,SYS_DVBC_ANNEX_B },
drivers/media/dvb-frontends/drxd_hard.c +1 -1
@@ -2947,7 +2947,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (drxd_attach); +EXPORT_SYMBOL_GPL (drxd_attach);MODULE_DESCRIPTION ("DRXD driver" );MODULE_AUTHOR ("Micronas" );
drivers/media/dvb-frontends/drxk_hard.c +1 -1
@@ -6846,7 +6846,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (drxk_attach); +EXPORT_SYMBOL_GPL (drxk_attach);MODULE_DESCRIPTION ("DRX-K driver" );MODULE_AUTHOR ("Ralph Metzler" );
drivers/media/dvb-frontends/ds3000.c +1 -1
@@ -859,7 +859,7 @@ struct dvb_frontend *ds3000_attach(constds3000_set_voltage (&state->frontend,SEC_VOLTAGE_OFF );return &state->frontend; } -EXPORT_SYMBOL (ds3000_attach); +EXPORT_SYMBOL_GPL (ds3000_attach);static int ds3000_set_carrier_offset (struct dvb_frontend *fe,s32 carrier_offset_khz)
drivers/media/dvb-frontends/dvb-pll.c +1 -1
@@ -866,7 +866,7 @@ out:return NULL ; } -EXPORT_SYMBOL (dvb_pll_attach); +EXPORT_SYMBOL_GPL (dvb_pll_attach); static int
drivers/media/dvb-frontends/ec100.c +1 -1
@@ -299,7 +299,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (ec100_attach); +EXPORT_SYMBOL_GPL (ec100_attach);static const struct dvb_frontend_ops ec100_ops = { .delsys = {SYS_DVBT },
drivers/media/dvb-frontends/helene.c +2 -2
@@ -1025,7 +1025,7 @@ struct dvb_frontend *helene_attach_s(str priv->i2c_address, priv->i2c);return fe; } -EXPORT_SYMBOL (helene_attach_s); +EXPORT_SYMBOL_GPL (helene_attach_s); struct dvb_frontend *helene_attach(struct dvb_frontend *fe, const struct helene_config *config,
@@ -1061,7 +1061,7 @@ struct dvb_frontend *helene_attach(struc priv->i2c_address, priv->i2c);return fe; } -EXPORT_SYMBOL (helene_attach); +EXPORT_SYMBOL_GPL (helene_attach);static int helene_probe (struct i2c_client *client,const struct i2c_device_id *id)
drivers/media/dvb-frontends/horus3a.c +1 -1
@@ -395,7 +395,7 @@ struct dvb_frontend *horus3a_attach(stru priv->i2c_address, priv->i2c);return fe; } -EXPORT_SYMBOL (horus3a_attach); +EXPORT_SYMBOL_GPL (horus3a_attach);MODULE_DESCRIPTION ("Sony HORUS3A satellite tuner driver" );MODULE_AUTHOR ("Sergey Kozlov <[email protected]>" );
drivers/media/dvb-frontends/isl6405.c +1 -1
@@ -141,7 +141,7 @@ struct dvb_frontend *isl6405_attach(strureturn fe; } -EXPORT_SYMBOL (isl6405_attach); +EXPORT_SYMBOL_GPL (isl6405_attach);MODULE_DESCRIPTION ("Driver for lnb supply and control ic isl6405" );MODULE_AUTHOR ("Hartmut Hackmann & Oliver Endriss" );
drivers/media/dvb-frontends/isl6421.c +1 -1
@@ -213,7 +213,7 @@ struct dvb_frontend *isl6421_attach(strureturn fe; } -EXPORT_SYMBOL (isl6421_attach); +EXPORT_SYMBOL_GPL (isl6421_attach);MODULE_DESCRIPTION ("Driver for lnb supply and control ic isl6421" );MODULE_AUTHOR ("Andrew de Quincey & Oliver Endriss" );
drivers/media/dvb-frontends/isl6423.c +1 -1
@@ -289,7 +289,7 @@ exit: fe->sec_priv =NULL ;return NULL ; } -EXPORT_SYMBOL (isl6423_attach); +EXPORT_SYMBOL_GPL (isl6423_attach);MODULE_DESCRIPTION ("ISL6423 SEC" );MODULE_AUTHOR ("Manu Abraham" );
drivers/media/dvb-frontends/itd1000.c +1 -1
@@ -389,7 +389,7 @@ struct dvb_frontend *itd1000_attach(strureturn fe; } -EXPORT_SYMBOL (itd1000_attach); +EXPORT_SYMBOL_GPL (itd1000_attach);MODULE_AUTHOR ("Patrick Boettcher <[email protected]>" );MODULE_DESCRIPTION ("Integrant ITD1000 driver" );
drivers/media/dvb-frontends/ix2505v.c +1 -1
@@ -302,7 +302,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (ix2505v_attach); +EXPORT_SYMBOL_GPL (ix2505v_attach);module_param_named (debug, ix2505v_debug, int,0644 );MODULE_PARM_DESC (debug,"Turn on/off frontend debugging (default:off)." );
drivers/media/dvb-frontends/l64781.c +1 -1
@@ -593,4 +593,4 @@ MODULE_DESCRIPTION("LSI L64781 DVB-T DemMODULE_AUTHOR ("Holger Waechtler, Marko Kohtala" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (l64781_attach); +EXPORT_SYMBOL_GPL (l64781_attach);
drivers/media/dvb-frontends/lg2160.c +1 -1
@@ -1426,7 +1426,7 @@ struct dvb_frontend *lg2160_attach(constreturn &state->frontend; } -EXPORT_SYMBOL (lg2160_attach); +EXPORT_SYMBOL_GPL (lg2160_attach);MODULE_DESCRIPTION ("LG Electronics LG216x ATSC/MH Demodulator Driver" );MODULE_AUTHOR ("Michael Krufky <[email protected]>" );
drivers/media/dvb-frontends/lgdt3305.c +1 -1
@@ -1148,7 +1148,7 @@ fail:kfree (state);return NULL ; } -EXPORT_SYMBOL (lgdt3305_attach); +EXPORT_SYMBOL_GPL (lgdt3305_attach);static const struct dvb_frontend_ops lgdt3304_ops = { .delsys = {SYS_ATSC ,SYS_DVBC_ANNEX_B },
drivers/media/dvb-frontends/lgdt3306a.c +1 -1
@@ -1859,7 +1859,7 @@ fail:kfree (state);return NULL ; } -EXPORT_SYMBOL (lgdt3306a_attach); +EXPORT_SYMBOL_GPL (lgdt3306a_attach);#ifdef DBG_DUMP
drivers/media/dvb-frontends/lgdt330x.c +1 -1
@@ -928,7 +928,7 @@ struct dvb_frontend *lgdt330x_attach(conreturn lgdt330x_get_dvb_frontend (client); } -EXPORT_SYMBOL (lgdt330x_attach); +EXPORT_SYMBOL_GPL (lgdt330x_attach);static const struct dvb_frontend_ops lgdt3302_ops = { .delsys = {SYS_ATSC ,SYS_DVBC_ANNEX_B },
drivers/media/dvb-frontends/lgs8gxx.c +1 -1
@@ -1043,7 +1043,7 @@ error_out:return NULL ; } -EXPORT_SYMBOL (lgs8gxx_attach); +EXPORT_SYMBOL_GPL (lgs8gxx_attach);MODULE_DESCRIPTION ("Legend Silicon LGS8913/LGS8GXX DMB-TH demodulator driver" );MODULE_AUTHOR ("David T. L. Wong <[email protected]>" );
drivers/media/dvb-frontends/lnbh25.c +1 -1
@@ -173,7 +173,7 @@ struct dvb_frontend *lnbh25_attach(struc __func__, priv->i2c_address);return fe; } -EXPORT_SYMBOL (lnbh25_attach); +EXPORT_SYMBOL_GPL (lnbh25_attach);MODULE_DESCRIPTION ("ST LNBH25 driver" );MODULE_AUTHOR ("[email protected]" );
drivers/media/dvb-frontends/lnbp21.c +2 -2
@@ -155,7 +155,7 @@ struct dvb_frontend *lnbh24_attach(strucreturn lnbx2x_attach (fe, i2c, override_set, override_clear, i2c_addr,LNBH24_TTX ); } -EXPORT_SYMBOL (lnbh24_attach); +EXPORT_SYMBOL_GPL (lnbh24_attach); struct dvb_frontend *lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set,
@@ -164,7 +164,7 @@ struct dvb_frontend *lnbp21_attach(strucreturn lnbx2x_attach (fe, i2c, override_set, override_clear,0x08 ,LNBP21_ISEL ); } -EXPORT_SYMBOL (lnbp21_attach); +EXPORT_SYMBOL_GPL (lnbp21_attach);MODULE_DESCRIPTION ("Driver for lnb supply and control ic lnbp21, lnbh24" );MODULE_AUTHOR ("Oliver Endriss, Igor M. Liplianin" );
drivers/media/dvb-frontends/lnbp22.c +1 -1
@@ -125,7 +125,7 @@ struct dvb_frontend *lnbp22_attach(strucreturn fe; } -EXPORT_SYMBOL (lnbp22_attach); +EXPORT_SYMBOL_GPL (lnbp22_attach);MODULE_DESCRIPTION ("Driver for lnb supply and control ic lnbp22" );MODULE_AUTHOR ("Dominik Kuhlen" );
drivers/media/dvb-frontends/m88ds3103.c +1 -1
@@ -1699,7 +1699,7 @@ struct dvb_frontend *m88ds3103_attach(co *tuner_i2c_adapter = pdata.get_i2c_adapter (client);return pdata.get_dvb_frontend (client); } -EXPORT_SYMBOL (m88ds3103_attach); +EXPORT_SYMBOL_GPL (m88ds3103_attach);static const struct dvb_frontend_ops m88ds3103_ops = { .delsys = {SYS_DVBS ,SYS_DVBS2 },
drivers/media/dvb-frontends/m88rs2000.c +1 -1
@@ -808,7 +808,7 @@ error:return NULL ; } -EXPORT_SYMBOL (m88rs2000_attach); +EXPORT_SYMBOL_GPL (m88rs2000_attach);MODULE_DESCRIPTION ("M88RS2000 DVB-S Demodulator driver" );MODULE_AUTHOR ("Malcolm Priestley [email protected]" );
drivers/media/dvb-frontends/mb86a16.c +1 -1
@@ -1848,6 +1848,6 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (mb86a16_attach); +EXPORT_SYMBOL_GPL (mb86a16_attach);MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Manu Abraham" );
drivers/media/dvb-frontends/mb86a20s.c +1 -1
@@ -2081,7 +2081,7 @@ struct dvb_frontend *mb86a20s_attach(condev_info (&i2c->dev,"Detected a Fujitsu mb86a20s frontend\n" );return &state->frontend; } -EXPORT_SYMBOL (mb86a20s_attach); +EXPORT_SYMBOL_GPL (mb86a20s_attach);static const struct dvb_frontend_ops mb86a20s_ops = { .delsys = {SYS_ISDBT },
drivers/media/dvb-frontends/mt312.c +1 -1
@@ -827,7 +827,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (mt312_attach); +EXPORT_SYMBOL_GPL (mt312_attach);module_param (debug, int,0644 );MODULE_PARM_DESC (debug,"Turn on/off frontend debugging (default:off)." );
drivers/media/dvb-frontends/mt352.c +1 -1
@@ -593,4 +593,4 @@ MODULE_DESCRIPTION("Zarlink MT352 DVB-TMODULE_AUTHOR ("Holger Waechtler, Daniel Mack, Antonio Mancuso" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (mt352_attach); +EXPORT_SYMBOL_GPL (mt352_attach);
drivers/media/dvb-frontends/nxt200x.c +1 -1
@@ -1216,5 +1216,5 @@ MODULE_DESCRIPTION("NXT200X (ATSC 8VSB &MODULE_AUTHOR ("Kirk Lapray, Michael Krufky, Jean-Francois Thibert, and Taylor Jacob" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (nxt200x_attach); +EXPORT_SYMBOL_GPL (nxt200x_attach);
drivers/media/dvb-frontends/nxt6000.c +1 -1
@@ -621,4 +621,4 @@ MODULE_DESCRIPTION("NxtWave NXT6000 DVB-MODULE_AUTHOR ("Florian Schirmer" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (nxt6000_attach); +EXPORT_SYMBOL_GPL (nxt6000_attach);
drivers/media/dvb-frontends/or51132.c +1 -1
@@ -605,4 +605,4 @@ MODULE_AUTHOR("Kirk Lapray");MODULE_AUTHOR ("Trent Piepho" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (or51132_attach); +EXPORT_SYMBOL_GPL (or51132_attach);
drivers/media/dvb-frontends/or51211.c +1 -1
@@ -551,5 +551,5 @@ MODULE_DESCRIPTION("Oren OR51211 VSB [pcMODULE_AUTHOR ("Kirk Lapray" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (or51211_attach); +EXPORT_SYMBOL_GPL (or51211_attach);
drivers/media/dvb-frontends/s5h1409.c +1 -1
@@ -981,7 +981,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (s5h1409_attach); +EXPORT_SYMBOL_GPL (s5h1409_attach);static const struct dvb_frontend_ops s5h1409_ops = { .delsys = {SYS_ATSC ,SYS_DVBC_ANNEX_B },
drivers/media/dvb-frontends/s5h1411.c +1 -1
@@ -900,7 +900,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (s5h1411_attach); +EXPORT_SYMBOL_GPL (s5h1411_attach);static const struct dvb_frontend_ops s5h1411_ops = { .delsys = {SYS_ATSC ,SYS_DVBC_ANNEX_B },
drivers/media/dvb-frontends/s5h1420.c +1 -1
@@ -918,7 +918,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (s5h1420_attach); +EXPORT_SYMBOL_GPL (s5h1420_attach);static const struct dvb_frontend_ops s5h1420_ops = { .delsys = {SYS_DVBS },
drivers/media/dvb-frontends/s5h1432.c +1 -1
@@ -355,7 +355,7 @@ struct dvb_frontend *s5h1432_attach(consreturn &state->frontend; } -EXPORT_SYMBOL (s5h1432_attach); +EXPORT_SYMBOL_GPL (s5h1432_attach);static const struct dvb_frontend_ops s5h1432_ops = { .delsys = {SYS_DVBT },
drivers/media/dvb-frontends/s921.c +1 -1
@@ -495,7 +495,7 @@ struct dvb_frontend *s921_attach(const sreturn &state->frontend; } -EXPORT_SYMBOL (s921_attach); +EXPORT_SYMBOL_GPL (s921_attach);static const struct dvb_frontend_ops s921_ops = { .delsys = {SYS_ISDBT },
drivers/media/dvb-frontends/si21xx.c +1 -1
@@ -936,7 +936,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (si21xx_attach); +EXPORT_SYMBOL_GPL (si21xx_attach);module_param (debug, int,0644 );MODULE_PARM_DESC (debug,"Turn on/off frontend debugging (default:off)." );
drivers/media/dvb-frontends/sp887x.c +1 -1
@@ -626,4 +626,4 @@ MODULE_PARM_DESC(debug, "Turn on/off froMODULE_DESCRIPTION ("Spase sp887x DVB-T demodulator driver" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (sp887x_attach); +EXPORT_SYMBOL_GPL (sp887x_attach);
drivers/media/dvb-frontends/stb0899_drv.c +1 -1
@@ -1638,7 +1638,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (stb0899_attach); +EXPORT_SYMBOL_GPL (stb0899_attach);MODULE_PARM_DESC (verbose,"Set Verbosity level" );MODULE_AUTHOR ("Manu Abraham" );MODULE_DESCRIPTION ("STB0899 Multi-Std frontend" );
drivers/media/dvb-frontends/stb6000.c +1 -1
@@ -232,7 +232,7 @@ struct dvb_frontend *stb6000_attach(strureturn fe; } -EXPORT_SYMBOL (stb6000_attach); +EXPORT_SYMBOL_GPL (stb6000_attach);module_param (debug, int,0644 );MODULE_PARM_DESC (debug,"Turn on/off frontend debugging (default:off)." );
drivers/media/dvb-frontends/stb6100.c +1 -1
@@ -557,7 +557,7 @@ static void stb6100_release(struct dvb_fkfree (state); } -EXPORT_SYMBOL (stb6100_attach); +EXPORT_SYMBOL_GPL (stb6100_attach);MODULE_PARM_DESC (verbose,"Set Verbosity level" );MODULE_AUTHOR ("Manu Abraham" );
drivers/media/dvb-frontends/stv0288.c +1 -1
@@ -590,7 +590,7 @@ error:return NULL ; } -EXPORT_SYMBOL (stv0288_attach); +EXPORT_SYMBOL_GPL (stv0288_attach);module_param (debug_legacy_dish_switch, int,0444 ); MODULE_PARM_DESC(debug_legacy_dish_switch,
drivers/media/dvb-frontends/stv0297.c +1 -1
@@ -710,4 +710,4 @@ MODULE_DESCRIPTION("ST STV0297 DVB-C DemMODULE_AUTHOR ("Dennis Noermann and Andrew de Quincey" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (stv0297_attach); +EXPORT_SYMBOL_GPL (stv0297_attach);
drivers/media/dvb-frontends/stv0299.c +1 -1
@@ -751,4 +751,4 @@ MODULE_DESCRIPTION("ST STV0299 DVB DemodMODULE_AUTHOR ("Ralph Metzler, Holger Waechtler, Peter Schildmann, Felix Domke, Andreas Oberritter, Andrew de Quincey, Kenneth Aafly" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (stv0299_attach); +EXPORT_SYMBOL_GPL (stv0299_attach);
drivers/media/dvb-frontends/stv0367.c +3 -3
@@ -1750,7 +1750,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (stv0367ter_attach); +EXPORT_SYMBOL_GPL (stv0367ter_attach);static int stv0367cab_gate_ctrl (struct dvb_frontend *fe,int enable) {
@@ -2923,7 +2923,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (stv0367cab_attach); +EXPORT_SYMBOL_GPL (stv0367cab_attach);/* * Functions for operation on Digital Devices hardware
@@ -3344,7 +3344,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (stv0367ddb_attach); +EXPORT_SYMBOL_GPL (stv0367ddb_attach);MODULE_PARM_DESC (debug,"Set debug" );MODULE_PARM_DESC (i2c_debug,"Set i2c debug" );
drivers/media/dvb-frontends/stv0900_core.c +1 -1
@@ -1957,7 +1957,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (stv0900_attach); +EXPORT_SYMBOL_GPL (stv0900_attach);MODULE_PARM_DESC (debug,"Set debug" );
drivers/media/dvb-frontends/stv090x.c +1 -1
@@ -5073,7 +5073,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (stv090x_attach); +EXPORT_SYMBOL_GPL (stv090x_attach);static const struct i2c_device_id stv090x_id_table[] = { {"stv090x" ,0 },
drivers/media/dvb-frontends/stv6110.c +1 -1
@@ -427,7 +427,7 @@ struct dvb_frontend *stv6110_attach(strureturn fe; } -EXPORT_SYMBOL (stv6110_attach); +EXPORT_SYMBOL_GPL (stv6110_attach);module_param (debug, int,0644 );MODULE_PARM_DESC (debug,"Turn on/off frontend debugging (default:off)." );
drivers/media/dvb-frontends/stv6110x.c +1 -1
@@ -469,7 +469,7 @@ const struct stv6110x_devctl *stv6110x_adev_info (&stv6110x->i2c->dev,"Attaching STV6110x\n" );return stv6110x->devctl; } -EXPORT_SYMBOL (stv6110x_attach); +EXPORT_SYMBOL_GPL (stv6110x_attach);static const struct i2c_device_id stv6110x_id_table[] = { {"stv6110x" ,0 },
drivers/media/dvb-frontends/tda10021.c +1 -1
@@ -523,4 +523,4 @@ MODULE_DESCRIPTION("Philips TDA10021 DVBMODULE_AUTHOR ("Ralph Metzler, Holger Waechtler, Markus Schulz" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (tda10021_attach); +EXPORT_SYMBOL_GPL (tda10021_attach);
drivers/media/dvb-frontends/tda10023.c +1 -1
@@ -594,4 +594,4 @@ MODULE_DESCRIPTION("Philips TDA10023 DVBMODULE_AUTHOR ("Georg Acher, Hartmut Birr" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (tda10023_attach); +EXPORT_SYMBOL_GPL (tda10023_attach);
drivers/media/dvb-frontends/tda10048.c +1 -1
@@ -1138,7 +1138,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (tda10048_attach); +EXPORT_SYMBOL_GPL (tda10048_attach);static const struct dvb_frontend_ops tda10048_ops = { .delsys = {SYS_DVBT },
drivers/media/dvb-frontends/tda1004x.c +2 -2
@@ -1378,5 +1378,5 @@ MODULE_DESCRIPTION("Philips TDA10045H &MODULE_AUTHOR ("Andrew de Quincey & Robert Schlabbach" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (tda10045_attach); -EXPORT_SYMBOL (tda10046_attach); +EXPORT_SYMBOL_GPL (tda10045_attach); +EXPORT_SYMBOL_GPL (tda10046_attach);
drivers/media/dvb-frontends/tda10086.c +1 -1
@@ -764,4 +764,4 @@ MODULE_DESCRIPTION("Philips TDA10086 DVBMODULE_AUTHOR ("Andrew de Quincey" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (tda10086_attach); +EXPORT_SYMBOL_GPL (tda10086_attach);
drivers/media/dvb-frontends/tda665x.c +1 -1
@@ -227,7 +227,7 @@ struct dvb_frontend *tda665x_attach(strureturn fe; } -EXPORT_SYMBOL (tda665x_attach); +EXPORT_SYMBOL_GPL (tda665x_attach);MODULE_DESCRIPTION ("TDA665x driver" );MODULE_AUTHOR ("Manu Abraham" );
drivers/media/dvb-frontends/tda8083.c +1 -1
@@ -481,4 +481,4 @@ MODULE_DESCRIPTION("Philips TDA8083 DVB-MODULE_AUTHOR ("Ralph Metzler, Holger Waechtler" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (tda8083_attach); +EXPORT_SYMBOL_GPL (tda8083_attach);
drivers/media/dvb-frontends/tda8261.c +1 -1
@@ -188,7 +188,7 @@ exit:return NULL ; } -EXPORT_SYMBOL (tda8261_attach); +EXPORT_SYMBOL_GPL (tda8261_attach);MODULE_AUTHOR ("Manu Abraham" );MODULE_DESCRIPTION ("TDA8261 8PSK/QPSK Tuner" );
drivers/media/dvb-frontends/tda826x.c +1 -1
@@ -164,7 +164,7 @@ struct dvb_frontend *tda826x_attach(strureturn fe; } -EXPORT_SYMBOL (tda826x_attach); +EXPORT_SYMBOL_GPL (tda826x_attach);module_param (debug, int,0644 );MODULE_PARM_DESC (debug,"Turn on/off frontend debugging (default:off)." );
drivers/media/dvb-frontends/ts2020.c +1 -1
@@ -525,7 +525,7 @@ struct dvb_frontend *ts2020_attach(strucreturn fe; } -EXPORT_SYMBOL (ts2020_attach); +EXPORT_SYMBOL_GPL (ts2020_attach);/* * We implement own regmap locking due to legacy DVB attach which uses frontend
drivers/media/dvb-frontends/tua6100.c +1 -1
@@ -186,7 +186,7 @@ struct dvb_frontend *tua6100_attach(stru fe->tuner_priv = priv;return fe; } -EXPORT_SYMBOL (tua6100_attach); +EXPORT_SYMBOL_GPL (tua6100_attach);MODULE_DESCRIPTION ("DVB tua6100 driver" );MODULE_AUTHOR ("Andrew de Quincey" );
drivers/media/dvb-frontends/ves1820.c +1 -1
@@ -434,4 +434,4 @@ MODULE_DESCRIPTION("VLSI VES1820 DVB-C DMODULE_AUTHOR ("Ralph Metzler, Holger Waechtler" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (ves1820_attach); +EXPORT_SYMBOL_GPL (ves1820_attach);
drivers/media/dvb-frontends/ves1x93.c +1 -1
@@ -540,4 +540,4 @@ MODULE_DESCRIPTION("VLSI VES1x93 DVB-S DMODULE_AUTHOR ("Ralph Metzler" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (ves1x93_attach); +EXPORT_SYMBOL_GPL (ves1x93_attach);
drivers/media/dvb-frontends/zl10036.c +1 -1
@@ -496,7 +496,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (zl10036_attach); +EXPORT_SYMBOL_GPL (zl10036_attach);module_param_named (debug, zl10036_debug, int,0644 );MODULE_PARM_DESC (debug,"Turn on/off frontend debugging (default:off)." );
drivers/media/dvb-frontends/zl10039.c +1 -1
@@ -295,7 +295,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (zl10039_attach); +EXPORT_SYMBOL_GPL (zl10039_attach);module_param (debug, int,0644 );MODULE_PARM_DESC (debug,"Turn on/off frontend debugging (default:off)." );
drivers/media/dvb-frontends/zl10353.c +1 -1
@@ -665,4 +665,4 @@ MODULE_DESCRIPTION("Zarlink ZL10353 DVB-MODULE_AUTHOR ("Chris Pascoe" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (zl10353_attach); +EXPORT_SYMBOL_GPL (zl10353_attach);
drivers/media/pci/bt8xx/dst.c +1 -1
@@ -1722,7 +1722,7 @@ struct dst_state *dst_attach(struct dst_return state;/* Manu (DST is a card not a frontend) */ } -EXPORT_SYMBOL (dst_attach); +EXPORT_SYMBOL_GPL (dst_attach);static const struct dvb_frontend_ops dst_dvbt_ops = { .delsys = {SYS_DVBT },
drivers/media/pci/bt8xx/dst_ca.c +1 -1
@@ -668,7 +668,7 @@ struct dvb_device *dst_ca_attach(structreturn NULL ; } -EXPORT_SYMBOL (dst_ca_attach); +EXPORT_SYMBOL_GPL (dst_ca_attach);MODULE_DESCRIPTION ("DST DVB-S/T/C Combo CA driver" );MODULE_AUTHOR ("Manu Abraham" );
drivers/media/pci/ddbridge/ddbridge-dummy-fe.c +1 -1
@@ -112,7 +112,7 @@ struct dvb_frontend *ddbridge_dummy_fe_q state->frontend.demodulator_priv = state;return &state->frontend; } -EXPORT_SYMBOL (ddbridge_dummy_fe_qam_attach); +EXPORT_SYMBOL_GPL (ddbridge_dummy_fe_qam_attach);static const struct dvb_frontend_ops ddbridge_dummy_fe_qam_ops = { .delsys = {SYS_DVBC_ANNEX_A },
drivers/media/tuners/fc0011.c +1 -1
@@ -499,7 +499,7 @@ struct dvb_frontend *fc0011_attach(strucreturn fe; } -EXPORT_SYMBOL (fc0011_attach); +EXPORT_SYMBOL_GPL (fc0011_attach);MODULE_DESCRIPTION ("Fitipower FC0011 silicon tuner driver" );MODULE_AUTHOR ("Michael Buesch <[email protected]>" );
drivers/media/tuners/fc0012.c +1 -1
@@ -495,7 +495,7 @@ err:return fe; } -EXPORT_SYMBOL (fc0012_attach); +EXPORT_SYMBOL_GPL (fc0012_attach);MODULE_DESCRIPTION ("Fitipower FC0012 silicon tuner driver" );MODULE_AUTHOR ("Hans-Frieder Vogt <[email protected]>" );
drivers/media/tuners/fc0013.c +1 -1
@@ -608,7 +608,7 @@ struct dvb_frontend *fc0013_attach(strucreturn fe; } -EXPORT_SYMBOL (fc0013_attach); +EXPORT_SYMBOL_GPL (fc0013_attach);MODULE_DESCRIPTION ("Fitipower FC0013 silicon tuner driver" );MODULE_AUTHOR ("Hans-Frieder Vogt <[email protected]>" );
drivers/media/tuners/max2165.c +1 -1
@@ -410,7 +410,7 @@ struct dvb_frontend *max2165_attach(strureturn fe; } -EXPORT_SYMBOL (max2165_attach); +EXPORT_SYMBOL_GPL (max2165_attach);MODULE_AUTHOR ("David T. L. Wong <[email protected]>" );MODULE_DESCRIPTION ("Maxim MAX2165 silicon tuner driver" );
drivers/media/tuners/mc44s803.c +1 -1
@@ -356,7 +356,7 @@ error:kfree (priv);return NULL ; } -EXPORT_SYMBOL (mc44s803_attach); +EXPORT_SYMBOL_GPL (mc44s803_attach);MODULE_AUTHOR ("Jochen Friedrich" );MODULE_DESCRIPTION ("Freescale MC44S803 silicon tuner driver" );
drivers/media/tuners/mt2060.c +1 -1
@@ -440,7 +440,7 @@ struct dvb_frontend * mt2060_attach(strureturn fe; } -EXPORT_SYMBOL (mt2060_attach); +EXPORT_SYMBOL_GPL (mt2060_attach);static int mt2060_probe (struct i2c_client *client,const struct i2c_device_id *id)
drivers/media/tuners/mt2131.c +1 -1
@@ -274,7 +274,7 @@ struct dvb_frontend * mt2131_attach(stru fe->tuner_priv = priv;return fe; } -EXPORT_SYMBOL (mt2131_attach); +EXPORT_SYMBOL_GPL (mt2131_attach);MODULE_AUTHOR ("Steven Toth" );MODULE_DESCRIPTION ("Microtune MT2131 silicon tuner driver" );
drivers/media/tuners/mt2266.c +1 -1
@@ -336,7 +336,7 @@ struct dvb_frontend * mt2266_attach(strumt2266_calibrate (priv);return fe; } -EXPORT_SYMBOL (mt2266_attach); +EXPORT_SYMBOL_GPL (mt2266_attach);MODULE_AUTHOR ("Olivier DANET" );MODULE_DESCRIPTION ("Microtune MT2266 silicon tuner driver" );
drivers/media/tuners/mxl5005s.c +1 -1
@@ -4128,7 +4128,7 @@ struct dvb_frontend *mxl5005s_attach(str fe->tuner_priv = state;return fe; } -EXPORT_SYMBOL (mxl5005s_attach); +EXPORT_SYMBOL_GPL (mxl5005s_attach);MODULE_DESCRIPTION ("MaxLinear MXL5005S silicon tuner driver" );MODULE_AUTHOR ("Steven Toth" );
drivers/media/tuners/qt1010.c +1 -1
@@ -440,7 +440,7 @@ struct dvb_frontend * qt1010_attach(stru fe->tuner_priv = priv;return fe; } -EXPORT_SYMBOL (qt1010_attach); +EXPORT_SYMBOL_GPL (qt1010_attach);MODULE_DESCRIPTION ("Quantek QT1010 silicon tuner driver" );MODULE_AUTHOR ("Antti Palosaari <[email protected]>" );
drivers/media/tuners/tda18218.c +1 -1
@@ -336,7 +336,7 @@ struct dvb_frontend *tda18218_attach(strreturn fe; } -EXPORT_SYMBOL (tda18218_attach); +EXPORT_SYMBOL_GPL (tda18218_attach);MODULE_DESCRIPTION ("NXP TDA18218HN silicon tuner driver" );MODULE_AUTHOR ("Antti Palosaari <[email protected]>" );
drivers/media/tuners/xc4000.c +1 -1
@@ -1744,7 +1744,7 @@ fail2:xc4000_release (fe);return NULL ; } -EXPORT_SYMBOL (xc4000_attach); +EXPORT_SYMBOL_GPL (xc4000_attach);MODULE_AUTHOR ("Steven Toth, Davide Ferri" );MODULE_DESCRIPTION ("Xceive xc4000 silicon tuner driver" );
drivers/media/tuners/xc5000.c +1 -1
@@ -1460,7 +1460,7 @@ fail:xc5000_release (fe);return NULL ; } -EXPORT_SYMBOL (xc5000_attach); +EXPORT_SYMBOL_GPL (xc5000_attach);MODULE_AUTHOR ("Steven Toth" );MODULE_DESCRIPTION ("Xceive xc5000 silicon tuner driver" );
drivers/staging/media/av7110/sp8870.c +1 -1
@@ -606,4 +606,4 @@ MODULE_DESCRIPTION("Spase SP8870 DVB-T DMODULE_AUTHOR ("Juergen Peitz" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (sp8870_attach); +EXPORT_SYMBOL_GPL (sp8870_attach);
Greg Kroah-Hartman
maintainerPATCH 339/511 media: venus: hfi_venus: Write to VIDC_CTRL_INIT after unmasking interrupts
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
commit d74e481609808330b4625b3691cf01e1f56e255e upstream.
The startup procedure shouldn't be started with interrupts masked, as that may entail silent failures.
Kick off initialization only after the interrupts are unmasked.
--- drivers/media/platform/qcom/venus/hfi_venus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/qcom/venus/hfi_venus.c +1 -1
@@ -453,7 +453,6 @@ static int venus_boot_core(struct venus_void __iomem *wrapper_base = hdev->core->wrapper_base;int ret =0 ; -writel (BIT (VIDC_CTRL_INIT_CTRL_SHIFT ), cpu_cs_base +VIDC_CTRL_INIT );if (IS_V6 (hdev->core)) { mask_val =readl (wrapper_base +WRAPPER_INTR_MASK ); mask_val &= ~(WRAPPER_INTR_MASK_A2HWD_BASK_V6 |
@@ -464,6 +463,7 @@ static int venus_boot_core(struct venus_writel (mask_val, wrapper_base +WRAPPER_INTR_MASK );writel (1 , cpu_cs_base +CPU_CS_SCIACMDARG3 ); +writel (BIT (VIDC_CTRL_INIT_CTRL_SHIFT ), cpu_cs_base +VIDC_CTRL_INIT );while (!ctrl_status && count < max_tries) { ctrl_status =readl (cpu_cs_base +CPU_CS_SCIACMDARG0 );if ((ctrl_status &CPU_CS_SCIACMDARG0_ERROR_STATUS_MASK ) ==4 ) {
Greg Kroah-Hartman
maintainerPATCH 340/511 Revert "scsi: qla2xxx: Fix buffer overrun"
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nilesh Javali <[email protected]>
commit 641671d97b9199f1ba35ccc2222d4b189a6a5de5 upstream.
Revert due to Get PLOGI Template failed.
This reverts commit b68710a8094fdffe8dd4f7a82c82649f479bb453.
--- drivers/scsi/qla2xxx/qla_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_init.c +1 -1
@@ -5575,7 +5575,7 @@ static void qla_get_login_template(scsi___be32 *q;memset (ha->init_cb,0 , ha->init_cb_size); - sz =min_t (int,sizeof (struct fc_els_csp ), ha->init_cb_size); + sz =min_t (int,sizeof (struct fc_els_flogi ), ha->init_cb_size); rval =qla24xx_get_port_login_templ (vha, ha->init_cb_dma, ha->init_cb, sz);if (rval !=QLA_SUCCESS ) {
Greg Kroah-Hartman
maintainerPATCH 341/511 scsi: mpt3sas: Perform additional retries if doorbell read returns 0
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ranjan Kumar <[email protected]>
commit 4ca10f3e31745d35249a727ecd108eb58f0a8c5e upstream.
The driver retries certain register reads 3 times if the returned value is
0. This was done because the controller could return 0 for certain registers if other registers were being accessed concurrently by the BMC.
In certain systems with increased BMC interactions, the register values returned can be 0 for longer than 3 retries. Change the retry count from 3 to 30 for the affected registers to prevent problems with out-of-band management.
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 46 +++++++++++++++++++++++++----------- drivers/scsi/mpt3sas/mpt3sas_base.h | 1 2 files changed, 34 insertions(+), 13 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +33 -13
@@ -139,6 +139,9 @@ _base_get_ioc_facts(struct MPT3SAS_ADAPTstatic void _base_clear_outstanding_commands (struct MPT3SAS_ADAPTER *ioc); +static u32 +_base_readl_ext_retry (const volatile void __iomem *addr); +/** * mpt3sas_base_check_cmd_timeout - Function * to check timeout and command termination due
@@ -214,6 +217,20 @@ _base_readl_aero(const volatile void __ireturn ret_val; } +static u32 +_base_readl_ext_retry (const volatile void __iomem *addr) +{ +u32 i, ret_val; + +for (i =0 ; i <30 ; i++) { + ret_val =readl (addr); +if (ret_val ==0 ) +continue ; + } + +return ret_val; +} +static inline u32 _base_readl (const volatile void __iomem *addr) {
@@ -941,7 +958,7 @@ mpt3sas_halt_firmware(struct MPT3SAS_ADAdump_stack (); - doorbell = ioc->base_readl (&ioc->chip->Doorbell); + doorbell = ioc->base_readl_ext_retry (&ioc->chip->Doorbell);if ((doorbell &MPI2_IOC_STATE_MASK ) ==MPI2_IOC_STATE_FAULT ) {mpt3sas_print_fault_code (ioc, doorbell &MPI2_DOORBELL_DATA_MASK );
@@ -6537,7 +6554,7 @@ mpt3sas_base_get_iocstate(struct MPT3SAS {u32 s, sc; - s = ioc->base_readl (&ioc->chip->Doorbell); + s = ioc->base_readl_ext_retry (&ioc->chip->Doorbell); sc = s &MPI2_IOC_STATE_MASK ;return cooked ? sc : s; }
@@ -6682,7 +6699,7 @@ _base_wait_for_doorbell_ack(struct MPT3S __func__, count, timeout));return 0 ; }else if (int_status &MPI2_HIS_IOC2SYS_DB_STATUS ) { - doorbell = ioc->base_readl (&ioc->chip->Doorbell); + doorbell = ioc->base_readl_ext_retry (&ioc->chip->Doorbell);if ((doorbell &MPI2_IOC_STATE_MASK ) ==MPI2_IOC_STATE_FAULT ) {mpt3sas_print_fault_code (ioc, doorbell);
@@ -6722,7 +6739,7 @@ _base_wait_for_doorbell_not_used(struct count =0 ; cntdn =1000 * timeout; do { - doorbell_reg = ioc->base_readl(&ioc->chip->Doorbell); + doorbell_reg = ioc->base_readl_ext_retry(&ioc->chip->Doorbell); if (!(doorbell_reg & MPI2_DOORBELL_USED)) { dhsprintk(ioc, ioc_info(ioc, "%s: successful count(%d), timeout(%d)\n",
@@ -6870,7 +6887,7 @@ _base_handshake_req_reply_wait(struct MP__le32 *mfp;/* make sure doorbell is not in use */ -if ((ioc->base_readl (&ioc->chip->Doorbell) &MPI2_DOORBELL_USED )) { +if ((ioc->base_readl_ext_retry (&ioc->chip->Doorbell) &MPI2_DOORBELL_USED )) {ioc_err (ioc,"doorbell is in use (line=%d)\n" , __LINE__);return -EFAULT ; }
@@ -6919,7 +6936,7 @@ _base_handshake_req_reply_wait(struct MP }/* read the first two 16-bits, it gives the total length of the reply */ - reply[0 ] =le16_to_cpu (ioc->base_readl (&ioc->chip->Doorbell) + reply[0 ] =le16_to_cpu (ioc->base_readl_ext_retry (&ioc->chip->Doorbell) &MPI2_DOORBELL_DATA_MASK );writel (0 , &ioc->chip->HostInterruptStatus);if ((_base_wait_for_doorbell_int (ioc,5 ))) {
@@ -6927,7 +6944,7 @@ _base_handshake_req_reply_wait(struct MP __LINE__);return -EFAULT ; } - reply[1 ] =le16_to_cpu (ioc->base_readl (&ioc->chip->Doorbell) + reply[1 ] =le16_to_cpu (ioc->base_readl_ext_retry (&ioc->chip->Doorbell) &MPI2_DOORBELL_DATA_MASK );writel (0 , &ioc->chip->HostInterruptStatus);
@@ -6938,10 +6955,10 @@ _base_handshake_req_reply_wait(struct MPreturn -EFAULT ; }if (i >= reply_bytes/2 )/* overflow case */ - ioc->base_readl (&ioc->chip->Doorbell); + ioc->base_readl_ext_retry (&ioc->chip->Doorbell);else reply[i] =le16_to_cpu ( - ioc->base_readl (&ioc->chip->Doorbell) + ioc->base_readl_ext_retry (&ioc->chip->Doorbell) &MPI2_DOORBELL_DATA_MASK );writel (0 , &ioc->chip->HostInterruptStatus); }
@@ -7800,7 +7817,7 @@ _base_diag_reset(struct MPT3SAS_ADAPTER goto out; } - host_diagnostic = ioc->base_readl (&ioc->chip->HostDiagnostic); + host_diagnostic = ioc->base_readl_ext_retry (&ioc->chip->HostDiagnostic);drsprintk (ioc,ioc_info (ioc,"wrote magic sequence: count(%d), host_diagnostic(0x%08x)\n" , count, host_diagnostic));
@@ -7820,7 +7837,7 @@ _base_diag_reset(struct MPT3SAS_ADAPTERfor (count =0 ; count < (300000000 /MPI2_HARD_RESET_PCIE_SECOND_READ_DELAY_MICRO_SEC ); count++) { - host_diagnostic = ioc->base_readl (&ioc->chip->HostDiagnostic); + host_diagnostic = ioc->base_readl_ext_retry (&ioc->chip->HostDiagnostic);if (host_diagnostic ==0xFFFFFFFF ) { ioc_info(ioc,
@@ -8210,10 +8227,13 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPT ioc->rdpq_array_enable_assigned =0 ; ioc->use_32bit_dma = false; ioc->dma_mask =64 ; -if (ioc->is_aero_ioc) +if (ioc->is_aero_ioc) { ioc->base_readl = &_base_readl_aero; -else + ioc->base_readl_ext_retry = &_base_readl_ext_retry; + }else { ioc->base_readl = &_base_readl; + ioc->base_readl_ext_retry = &_base_readl; + } r =mpt3sas_base_map_resources (ioc);if (r) goto out_free_resources;
drivers/scsi/mpt3sas/mpt3sas_base.h +1 -0
@@ -1618,6 +1618,7 @@ struct MPT3SAS_ADAPTER {u8 diag_trigger_active;u8 atomic_desc_capable;BASE_READ_REG base_readl; +BASE_READ_REG base_readl_ext_retry;struct SL_WH_MASTER_TRIGGER_T diag_trigger_master;struct SL_WH_EVENT_TRIGGERS_T diag_trigger_event;struct SL_WH_SCSI_TRIGGERS_T diag_trigger_scsi;
Greg Kroah-Hartman
maintainerPATCH 342/511 ntb: Drop packets when qp link is down
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Jiang <[email protected]>
commit f195a1a6fe416882984f8bd6c61afc1383171860 upstream.
Currently when the transport receive packets after netdev has closed the transport returns error and triggers tx errors to be incremented and carrier to be stopped. There is no reason to return error if the device is already closed. Drop the packet and return 0.
--- drivers/ntb/ntb_transport.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/ntb/ntb_transport.c +5 -1
@@ -2276,9 +2276,13 @@ int ntb_transport_tx_enqueue(struct ntb_struct ntb_queue_entry *entry;int rc; -if (!qp || !qp->link_is_up || !len) +if (!qp || !len)return -EINVAL ; +/* If the qp link is down already, just ignore. */ +if (!qp->link_is_up) +return 0 ; + entry =ntb_list_rm (&qp->ntb_tx_free_q_lock, &qp->tx_free_q);if (!entry) { qp->tx_err_no_buf++;
Greg Kroah-Hartman
maintainerPATCH 343/511 ntb: Clean up tx tail index on link down
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Jiang <[email protected]>
commit cc79bd2738c2d40aba58b2be6ce47dc0e471df0e upstream.
The tx tail index is not reset when the link goes down. This causes the tail index to go out of sync when the link goes down and comes back up. Refactor the ntb_qp_link_down_reset() and reset the tail index as well.
--- drivers/ntb/ntb_transport.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/ntb/ntb_transport.c +9 -2
@@ -909,7 +909,7 @@ static int ntb_set_mw(struct ntb_transporeturn 0 ; } -static void ntb_qp_link_down_reset (struct ntb_transport_qp *qp) +static void ntb_qp_link_context_reset (struct ntb_transport_qp *qp) { qp->link_is_up = false; qp->active = false;
@@ -932,6 +932,13 @@ static void ntb_qp_link_down_reset(struc qp->tx_async =0 ; } +static void ntb_qp_link_down_reset (struct ntb_transport_qp *qp) +{ +ntb_qp_link_context_reset (qp); +if (qp->remote_rx_info) + qp->remote_rx_info->entry = qp->rx_max_entry -1 ; +} +static void ntb_qp_link_cleanup (struct ntb_transport_qp *qp) {struct ntb_transport_ctx *nt = qp->transport;
@@ -1174,7 +1181,7 @@ static int ntb_transport_init_queue(stru qp->ndev = nt->ndev; qp->client_ready = false; qp->event_handler =NULL ; -ntb_qp_link_down_reset (qp); +ntb_qp_link_context_reset (qp);if (mw_num < qp_count % mw_count) num_qps_mw = qp_count / mw_count +1 ;
Greg Kroah-Hartman
maintainerPATCH 344/511 ntb: Fix calculation ntb_transport_tx_free_entry()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Jiang <[email protected]>
commit 5a7693e6bbf19b22fd6c1d2c4b7beb0a03969e2c upstream.
ntb_transport_tx_free_entry() never returns 0 with the current calculation. If head == tail, then it would return qp->tx_max_entry. Change compare to tail >= head and when they are equal, a 0 would be returned.
--- drivers/ntb/ntb_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ntb/ntb_transport.c +1 -1
@@ -2429,7 +2429,7 @@ unsigned int ntb_transport_tx_free_entryunsigned int head = qp->tx_index;unsigned int tail = qp->remote_rx_info->entry; -return tail > head ? tail - head : qp->tx_max_entry + tail - head; +return tail >= head ? tail - head : qp->tx_max_entry + tail - head; }EXPORT_SYMBOL_GPL (ntb_transport_tx_free_entry);
Greg Kroah-Hartman
maintainerPATCH 345/511 Revert "PCI: Mark NVIDIA T4 GPUs to avoid bus reset"
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Helgaas <[email protected]>
commit 5260bd6d36c83c5b269c33baaaf8c78e520908b0 upstream.
This reverts commit d5af729dc2071273f14cbb94abbc60608142fd83.
d5af729dc207 ("PCI: Mark NVIDIA T4 GPUs to avoid bus reset") avoided Secondary Bus Reset on the T4 because the reset seemed to not work when the T4 was directly attached to a Root Port.
But NVIDIA thinks the issue is probably related to some issue with the Root Port, not with the T4. The T4 provides neither PM nor FLR reset, so masking bus reset compromises this device for assignment scenarios.
Revert d5af729dc207 as requested by Wu Zongyong. This will leave SBR broken in the specific configuration Wu tested, as it was in v6.5, so Wu will debug that further.
--- drivers/pci/quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/quirks.c +1 -1
@@ -3606,7 +3606,7 @@ static void quirk_no_bus_reset(struct pc*/ static void quirk_nvidia_no_bus_reset (struct pci_dev *dev) { -if ((dev->device &0xffc0 ) ==0x2340 || dev->device ==0x1eb8 ) +if ((dev->device &0xffc0 ) ==0x2340 )quirk_no_bus_reset (dev); } DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
Greg Kroah-Hartman
maintainerPATCH 346/511 procfs: block chmod on /proc/thread-self/comm
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksa Sarai <[email protected]>
commit ccf61486fe1e1a48e18c638d1813cda77b3c0737 upstream.
Due to an oversight in commit 1b3044e39a89 ("procfs: fix pthread cross-thread naming if !PR_DUMPABLE") in switching from REG to NOD, chmod operations on /proc/thread-self/comm were no longer blocked as they are on almost all other procfs files.
A very similar situation with /proc/self/environ was used to as a root exploit a long time ago, but procfs has SB_I_NOEXEC so this is simply a correctness issue.
Ref: https://lwn.net/Articles/191954/
Ref: 6d76fa58b050 ("Don't allow chmod() on the /proc/<pid>/ files")
Message-Id: <[email protected]>
--- fs/proc/base.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/proc/base.c +2 -1
@@ -3544,7 +3544,8 @@ static int proc_tid_comm_permission(stru }static const struct inode_operations proc_tid_comm_inode_operations = { - .permission = proc_tid_comm_permission, + .setattr = proc_setattr, + .permission = proc_tid_comm_permission, };/*
Greg Kroah-Hartman
maintainerPATCH 347/511 parisc: Fix /proc/cpuinfo output for lscpu
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit 9f5ba4b3e1b3c123eeca5d2d09161e8720048b5c upstream.
The lscpu command is broken since commit cab56b51ec0e ("parisc: Fix device names in /proc/iomem") added the PA pathname to all PA devices, includig the CPUs.
lscpu parses /proc/cpuinfo and now believes it found different CPU types since every CPU is listed with an unique identifier (PA pathname).
Fix this problem by simply dropping the PA pathname when listing the CPUs in /proc/cpuinfo. There is no need to show the pathname in this procfs file.
--- arch/parisc/kernel/processor.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
arch/parisc/kernel/processor.c +10 -3
@@ -372,10 +372,18 @@ int show_cpuinfo (struct seq_file *m, void *v) { unsigned long cpu; +char cpu_name[60 ], *p; + +/* strip PA path from CPU name to not confuse lscpu */ +strlcpy (cpu_name,per_cpu (cpu_data,0 ).dev->name,sizeof (cpu_name)); + p =strrchr (cpu_name,'[' ); +if (p) + *(--p) =0 ;for_each_online_cpu (cpu) { -const struct cpuinfo_parisc *cpuinfo = &per_cpu (cpu_data, cpu);#ifdef CONFIG_SMP +const struct cpuinfo_parisc *cpuinfo = &per_cpu (cpu_data, cpu); +if (0 == cpuinfo->hpa)continue ;#endif
@@ -420,8 +428,7 @@ show_cpuinfo (struct seq_file *m, void *seq_printf (m,"model\t\t: %s - %s\n" , boot_cpu_data.pdc.sys_model_name, - cpuinfo->dev ? - cpuinfo->dev->name :"Unknown" ); + cpu_name); seq_printf(m, "hversion\t: 0x%08x\n" "sversion\t: 0x%08x\n",
Greg Kroah-Hartman
maintainerPATCH 348/511 bpf: Fix issue in verifying allow_ptr_leaks
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yafang Shao <[email protected]>
commit d75e30dddf73449bc2d10bb8e2f1a2c446bc67a2 upstream.
After we converted the capabilities of our networking-bpf program from cap_sys_admin to cap_net_admin+cap_bpf, our networking-bpf program failed to start. Because it failed the bpf verifier, and the error log is "R3 pointer comparison prohibited".
A simple reproducer as follows,
SEC("cls-ingress")
int ingress(struct __sk_buff *skb)
{
struct iphdr *iph = (void *)(long)skb->data + sizeof(struct ethhdr);
if ((long)(iph + 1) > (long)skb->data_end)
return TC_ACT_STOLEN;
return TC_ACT_OK;
}Per discussion with Yonghong and Alexei [1], comparison of two packet pointers is not a pointer leak. This patch fixes it.
Our local kernel is 6.1.y and we expect this fix to be backported to 6.1.y, so stable is CCed.
[1]. https://lore.kernel.org/bpf/CAADnVQ+Nmspr7Si+pxWn8zkE7hX-7s93ugwC+94aXSy4uQ9vBg@mail.gmail.com/
--- kernel/bpf/verifier.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
kernel/bpf/verifier.c +9 -8
@@ -9193,6 +9193,12 @@ static int check_cond_jmp_op(struct bpf_return -EINVAL ; } +/* check src2 operand */ + err =check_reg_arg (env, insn->dst_reg,SRC_OP ); +if (err) +return err; + + dst_reg = ®s[insn->dst_reg];if (BPF_SRC (insn->code) ==BPF_X ) {if (insn->imm !=0 ) {verbose (env,"BPF_JMP/JMP32 uses reserved fields\n" );
@@ -9204,12 +9210,13 @@ static int check_cond_jmp_op(struct bpf_if (err)return err; -if (is_pointer_value (env, insn->src_reg)) { + src_reg = ®s[insn->src_reg]; +if (!(reg_is_pkt_pointer_any (dst_reg) &®_is_pkt_pointer_any (src_reg)) && +is_pointer_value (env, insn->src_reg)) {verbose (env,"R%d pointer comparison prohibited\n" , insn->src_reg);return -EACCES ; } - src_reg = ®s[insn->src_reg]; }else {if (insn->src_reg !=BPF_REG_0 ) {verbose (env,"BPF_JMP/JMP32 uses reserved fields\n" );
@@ -9217,12 +9224,6 @@ static int check_cond_jmp_op(struct bpf_ } } -/* check src2 operand */ - err =check_reg_arg (env, insn->dst_reg,SRC_OP ); -if (err) -return err; - - dst_reg = ®s[insn->dst_reg]; is_jmp32 =BPF_CLASS (insn->code) ==BPF_JMP32 ;if (BPF_SRC (insn->code) ==BPF_K ) {
Greg Kroah-Hartman
maintainerPATCH 349/511 dlm: fix plock lookup when using multiple lockspaces
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Aring <[email protected]>
commit 7c53e847ff5e97f033fdd31f71949807633d506b upstream.
All posix lock ops, for all lockspaces (gfs2 file systems) are sent to userspace (dlm_controld) through a single misc device. The dlm_controld daemon reads the ops from the misc device and sends them to other cluster nodes using separate, per-lockspace cluster api communication channels. The ops for a single lockspace are ordered at this level, so that the results are received in the same sequence that the requests were sent. When the results are sent back to the kernel via the misc device, they are again funneled through the single misc device for all lockspaces. When the dlm code in the kernel processes the results from the misc device, these results will be returned in the same sequence that the requests were sent, on a per-lockspace basis. A recent change in this request/reply matching code missed the "per-lockspace" check (fsid comparison) when matching request and reply, so replies could be incorrectly matched to requests from other lockspaces.
--- fs/dlm/plock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/dlm/plock.c +3 -3
@@ -466,7 +466,8 @@ static ssize_t dev_write(struct file *fi } }else {list_for_each_entry (iter, &recv_list, list) { -if (!iter->info.wait) { +if (!iter->info.wait && + iter->info.fsid == info.fsid) { op = iter;break ; }
@@ -478,8 +479,7 @@ static ssize_t dev_write(struct file *fiif (info.wait)WARN_ON (op->info.optype !=DLM_PLOCK_OP_LOCK );else -WARN_ON (op->info.fsid != info.fsid || - op->info.number != info.number || +WARN_ON (op->info.number != info.number || op->info.owner != info.owner || op->info.optype != info.optype);
Greg Kroah-Hartman
maintainerPATCH 350/511 dccp: Fix out of bounds access in DCCP error handler
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit 977ad86c2a1bcaf58f01ab98df5cc145083c489c upstream.
There was a previous attempt to fix an out-of-bounds access in the DCCP error handlers, but that fix assumed that the error handlers only want to access the first 8 bytes of the DCCP header. Actually, they also look at the DCCP sequence number, which is stored beyond 8 bytes, so an explicit pskb_may_pull() is required.
--- net/dccp/ipv4.c | 13 +++++++++---- net/dccp/ipv6.c | 15 ++++++++++----- 2 files changed, 19 insertions(+), 9 deletions(-)
net/dccp/ipv4.c +9 -4
@@ -250,12 +250,17 @@ static int dccp_v4_err(struct sk_buff *sint err;struct net *net =dev_net (skb->dev); -/* Only need dccph_dport & dccph_sport which are the first -* 4 bytes in dccp header. +/* For the first __dccp_basic_hdr_len() check, we only need dh->dccph_x, +* which is in byte 7 of the dccp header. * Our caller (icmp_socket_deliver()) already pulled 8 bytes for us. +* +* Later on, we want to access the sequence number fields, which are +* beyond 8 bytes, so we have to pskb_may_pull() ourselves. */ - BUILD_BUG_ON(offsetofend(struct dccp_hdr, dccph_sport) > 8); - BUILD_BUG_ON(offsetofend(struct dccp_hdr, dccph_dport) > 8); + dh = (struct dccp_hdr *)(skb->data + offset); +if (!pskb_may_pull (skb, offset +__dccp_basic_hdr_len (dh))) +return -EINVAL ; + iph = (struct iphdr *)skb->data; dh = (struct dccp_hdr *)(skb->data + offset); sk = __inet_lookup_established(net, &dccp_hashinfo,
net/dccp/ipv6.c +10 -5
@@ -74,7 +74,7 @@ static inline __u64 dccp_v6_init_sequencstatic int dccp_v6_err (struct sk_buff *skb,struct inet6_skb_parm *opt,u8 type,u8 code,int offset,__be32 info) { -const struct ipv6hdr *hdr = (const struct ipv6hdr *)skb->data; +const struct ipv6hdr *hdr;const struct dccp_hdr *dh;struct dccp_sock *dp;struct ipv6_pinfo *np;
@@ -83,12 +83,17 @@ static int dccp_v6_err(struct sk_buff *s__u64 seq;struct net *net =dev_net (skb->dev); -/* Only need dccph_dport & dccph_sport which are the first -* 4 bytes in dccp header. +/* For the first __dccp_basic_hdr_len() check, we only need dh->dccph_x, +* which is in byte 7 of the dccp header. * Our caller (icmpv6_notify()) already pulled 8 bytes for us. +* +* Later on, we want to access the sequence number fields, which are +* beyond 8 bytes, so we have to pskb_may_pull() ourselves. */ - BUILD_BUG_ON(offsetofend(struct dccp_hdr, dccph_sport) > 8); - BUILD_BUG_ON(offsetofend(struct dccp_hdr, dccph_dport) > 8); + dh = (struct dccp_hdr *)(skb->data + offset); +if (!pskb_may_pull (skb, offset +__dccp_basic_hdr_len (dh))) +return -EINVAL ; + hdr = (const struct ipv6hdr *)skb->data; dh = (struct dccp_hdr *)(skb->data + offset); sk = __inet6_lookup_established(net, &dccp_hashinfo,
Greg Kroah-Hartman
maintainerPATCH 351/511 X.509: if signature is unsupported skip validation
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thore Sommer <[email protected]>
commit ef5b52a631f8c18353e80ccab8408b963305510c upstream.
When the hash algorithm for the signature is not available the digest size is 0 and the signature in the certificate is marked as unsupported.
When validating a self-signed certificate, this needs to be checked, because otherwise trying to validate the signature will fail with an warning:
Loading compiled-in X.509 certificates
WARNING: CPU: 0 PID: 1 at crypto/rsa-pkcs1pad.c:537 \ pkcs1pad_verify+0x46/0x12c
...
Problem loading in-kernel X.509 certificate (-22)
--- crypto/asymmetric_keys/x509_public_key.c | 5 +++++ 1 file changed, 5 insertions(+)
crypto/asymmetric_keys/x509_public_key.c +5 -0
@@ -128,6 +128,11 @@ int x509_check_for_self_signed(struct x5 goto out; } +if (cert->unsupported_sig) { + ret =0 ; + goto out; + } + ret =public_key_verify_signature (cert->pub, cert->sig);if (ret <0 ) {if (ret == -ENOPKG ) {
Greg Kroah-Hartman
maintainerPATCH 352/511 net: handle ARPHRD_PPP in dev_is_mac_header_xmit()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Dichtel <[email protected]>
commit a4f39c9f14a634e4cd35fcd338c239d11fcc73fc upstream.
The goal is to support a bpf_redirect() from an ethernet device (ingress) to a ppp device (egress).
The l2 header is added automatically by the ppp driver, thus the ethernet header should be removed.
--- include/linux/if_arp.h | 4 ++++ 1 file changed, 4 insertions(+)
include/linux/if_arp.h +4 -0
@@ -53,6 +53,10 @@ static inline bool dev_is_mac_header_xmicase ARPHRD_NONE :case ARPHRD_RAWIP :case ARPHRD_PIMREG : +/* PPP adds its l2 header automatically in ppp_start_xmit(). +* This makes it look like an l3 device to __bpf_redirect() and tcf_mirred_init(). +*/ +case ARPHRD_PPP :return false;default :return true;
Greg Kroah-Hartman
maintainerPATCH 353/511 fsverity: skip PKCS#7 parser when keyring is empty
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 919dc320956ea353a7fb2d84265195ad5ef525ac upstream.
If an fsverity builtin signature is given for a file but the ".fs-verity" keyring is empty, there's no real reason to run the PKCS#7 parser. Skip this to avoid the PKCS#7 attack surface when builtin signature support is configured into the kernel but is not being used.
This is a hardening improvement, not a fix per se, but I've added Fixes and Cc stable to get it out to more users.
--- fs/verity/signature.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
fs/verity/signature.c +16 -0
@@ -54,6 +54,22 @@ int fsverity_verify_signature(const strureturn 0 ; } +if (fsverity_keyring->keys.nr_leaves_on_tree ==0 ) { +/* +* The ".fs-verity" keyring is empty, due to builtin signatures +* being supported by the kernel but not actually being used. +* In this case, verify_pkcs7_signature() would always return an +* error, usually ENOKEY. It could also be EBADMSG if the +* PKCS#7 is malformed, but that isn't very important to +* distinguish. So, just skip to ENOKEY to avoid the attack +* surface of the PKCS#7 parser, which would otherwise be +* reachable by any task able to execute FS_IOC_ENABLE_VERITY. +*/ +fsverity_err (inode, +"fs-verity keyring is empty, rejecting signed file!" ); +return -ENOKEY ; + } + d =kzalloc (sizeof (*d) + hash_alg->digest_size,GFP_KERNEL );if (!d)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 354/511 mmc: renesas_sdhi: register irqs before registering controller
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
commit 74f45de394d979cc7770271f92fafa53e1ed3119 upstream.
IRQs should be ready to serve when we call mmc_add_host() via tmio_mmc_host_probe(). To achieve that, ensure that all irqs are masked before registering the handlers.
--- drivers/mmc/host/renesas_sdhi_core.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/mmc/host/renesas_sdhi_core.c +7 -3
@@ -975,6 +975,8 @@ int renesas_sdhi_probe(struct platform_d host->sdcard_irq_setbit_mask =TMIO_STAT_ALWAYS_SET_27 ; host->sdcard_irq_mask_all =TMIO_MASK_ALL_RCAR2 ; host->reset = renesas_sdhi_reset; + }else { + host->sdcard_irq_mask_all =TMIO_MASK_ALL ; }/* Orginally registers were 16 bit apart, could be 32 or 64 nowadays */
@@ -1071,9 +1073,7 @@ int renesas_sdhi_probe(struct platform_d host->ops.hs400_complete = renesas_sdhi_hs400_complete; } - ret =tmio_mmc_host_probe (host); -if (ret <0 ) - goto edisclk; +sd_ctrl_write32_as_16_and_16 (host,CTL_IRQ_MASK , host->sdcard_irq_mask_all); num_irqs =platform_irq_count (pdev);if (num_irqs <0 ) {
@@ -1100,6 +1100,10 @@ int renesas_sdhi_probe(struct platform_d goto eirq; } + ret =tmio_mmc_host_probe (host); +if (ret <0 ) + goto edisclk; +dev_info (&pdev->dev,"%s base at %pa, max clock rate %u MHz\n" ,mmc_hostname (host->mmc), &res->start, host->mmc->f_max /1000000 );
Greg Kroah-Hartman
maintainerPATCH 355/511 pstore/ram: Check start of empty przs during init
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Enlin Mu <[email protected]>
commit fe8c3623ab06603eb760444a032d426542212021 upstream.
After commit 30696378f68a ("pstore/ram: Do not treat empty buffers as valid"), initialization would assume a prz was valid after seeing that the buffer_size is zero (regardless of the buffer start position). This unchecked start value means it could be outside the bounds of the buffer, leading to future access panics when written to:
sysdump_panic_event+0x3b4/0x5b8 atomic_notifier_call_chain+0x54/0x90 panic+0x1c8/0x42c die+0x29c/0x2a8 die_kernel_fault+0x68/0x78 __do_kernel_fault+0x1c4/0x1e0 do_bad_area+0x40/0x100 do_translation_fault+0x68/0x80 do_mem_abort+0x68/0xf8 el1_da+0x1c/0xc0 __raw_writeb+0x38/0x174 __memcpy_toio+0x40/0xac persistent_ram_update+0x44/0x12c persistent_ram_write+0x1a8/0x1b8 ramoops_pstore_write+0x198/0x1e8 pstore_console_write+0x94/0xe0 ...
To avoid this, also check if the prz start is 0 during the initialization phase. If not, the next prz sanity check case will discover it (start > size) and zap the buffer back to a sane state.
--- fs/pstore/ram_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/pstore/ram_core.c +1 -1
@@ -518,7 +518,7 @@ static int persistent_ram_post_init(stru sig ^=PERSISTENT_RAM_SIG ;if (prz->buffer->sig == sig) { -if (buffer_size (prz) ==0 ) { +if (buffer_size (prz) ==0 &&buffer_start (prz) ==0 ) {pr_debug ("found existing empty buffer\n" );return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 356/511 arm64: sdei: abort running SDEI handlers during crash
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: D Scott Phillips <[email protected]>
commit 5cd474e57368f0957c343bb21e309cf82826b1ef upstream.
Interrupts are blocked in SDEI context, per the SDEI spec: "The client interrupts cannot preempt the event handler." If we crashed in the SDEI handler-running context (as with ACPI's AGDI) then we need to clean up the SDEI state before proceeding to the crash kernel so that the crash kernel can have working interrupts.
Track the active SDEI handler per-cpu so that we can COMPLETE_AND_RESUME the handler, discarding the interrupted context.
--- arch/arm64/include/asm/sdei.h | 6 ++++++ arch/arm64/kernel/entry.S | 27 +++++++++++++++++++++++++-- arch/arm64/kernel/sdei.c | 3 +++ arch/arm64/kernel/smp.c | 8 ++++---- drivers/firmware/arm_sdei.c | 19 +++++++++++++++++++ include/linux/arm_sdei.h | 2 ++ 6 files changed, 59 insertions(+), 6 deletions(-)
arch/arm64/include/asm/sdei.h +6 -0
@@ -17,6 +17,9 @@#include <asm/virt.h> +DECLARE_PER_CPU(struct sdei_registered_event *, sdei_active_normal_event); +DECLARE_PER_CPU(struct sdei_registered_event *, sdei_active_critical_event); +extern unsigned long sdei_exit_mode;/* Software Delegated Exception entry point from firmware*/
@@ -29,6 +32,9 @@ asmlinkage void __sdei_asm_entry_trampolunsigned long pc, unsigned long pstate); +/* Abort a running handler. Context is discarded. */ +void __sdei_handler_abort (void ); +/* * The above entry point does the minimum to call C code. This function does * anything else, before calling the driver.
arch/arm64/kernel/entry.S +25 -2
@@ -1005,9 +1005,13 @@ SYM_CODE_START(__sdei_asm_handler) mov x19, x1 -#if defined(CONFIG_VMAP_STACK) || defined(CONFIG_SHADOW_CALL_STACK) + /* Store the registered-event for crash_smp_send_stop() */ ldrb w4, [x19, #SDEI_EVENT_PRIORITY] -#endif + cbnz w4, 1f + adr_this_cpu dst=x5, sym=sdei_active_normal_event, tmp=x6 + b 2f +1: adr_this_cpu dst=x5, sym=sdei_active_critical_event, tmp=x6 +2: str x19, [x5] #ifdef CONFIG_VMAP_STACK /*
@@ -1072,6 +1076,14 @@ SYM_CODE_START(__sdei_asm_handler) ldr_l x2, sdei_exit_mode + /* Clear the registered-event seen by crash_smp_send_stop() */ + ldrb w3, [x4, #SDEI_EVENT_PRIORITY] + cbnz w3, 1f + adr_this_cpu dst=x5, sym=sdei_active_normal_event, tmp=x6 + b 2f +1: adr_this_cpu dst=x5, sym=sdei_active_critical_event, tmp=x6 +2: str xzr, [x5] + alternative_if_not ARM64_UNMAP_KERNEL_AT_EL0 sdei_handler_exit exit_mode=x2 alternative_else_nop_endif
@@ -1082,4 +1094,15 @@ alternative_else_nop_endif #endif SYM_CODE_END(__sdei_asm_handler) NOKPROBE(__sdei_asm_handler) + +SYM_CODE_START(__sdei_handler_abort) + mov_q x0, SDEI_1_0_FN_SDEI_EVENT_COMPLETE_AND_RESUME + adr x1, 1f + ldr_l x2, sdei_exit_mode + sdei_handler_exit exit_mode=x2 + // exit the handler and jump to the next instruction. + // Exit will stomp x0-x17, PSTATE, ELR_ELx, and SPSR_ELx. +1: ret +SYM_CODE_END(__sdei_handler_abort) +NOKPROBE(__sdei_handler_abort) #endif /* CONFIG_ARM_SDE_INTERFACE */
arch/arm64/kernel/sdei.c +3 -0
@@ -47,6 +47,9 @@ DEFINE_PER_CPU(unsigned long *, sdei_sha DEFINE_PER_CPU(unsigned long *, sdei_shadow_call_stack_critical_ptr);#endif +DEFINE_PER_CPU(struct sdei_registered_event *, sdei_active_normal_event); +DEFINE_PER_CPU(struct sdei_registered_event *, sdei_active_critical_event); +static void _free_sdei_stack (unsigned long *__percpu *ptr,int cpu) {unsigned long *p;
arch/arm64/kernel/smp.c +4 -4
@@ -1073,10 +1073,8 @@ void crash_smp_send_stop(void)* If this cpu is the only one alive at this point in time, online or * not, there are no stop messages to be sent around, so just back out. */ -if (num_other_online_cpus () ==0 ) { -sdei_mask_local_cpu (); -return ; - } +if (num_other_online_cpus () ==0 ) + goto skip_ipi;cpumask_copy (&mask, cpu_online_mask);cpumask_clear_cpu (smp_processor_id (), &mask);
@@ -1095,7 +1093,9 @@ void crash_smp_send_stop(void)pr_warn ("SMP: failed to stop secondary CPUs %*pbl\n" ,cpumask_pr_args (&mask)); +skip_ipi:sdei_mask_local_cpu (); +sdei_handler_abort (); }bool smp_crash_stop_failed (void )
drivers/firmware/arm_sdei.c +19 -0
@@ -1095,3 +1095,22 @@ int sdei_event_handler(struct pt_regs *rreturn err; }NOKPROBE_SYMBOL (sdei_event_handler); + +void sdei_handler_abort (void ) +{ +/* +* If the crash happened in an SDEI event handler then we need to +* finish the handler with the firmware so that we can have working +* interrupts in the crash kernel. +*/ +if (__this_cpu_read (sdei_active_critical_event)) { +pr_warn ("still in SDEI critical event context, attempting to finish handler.\n" ); +__sdei_handler_abort (); +__this_cpu_write (sdei_active_critical_event,NULL ); + } +if (__this_cpu_read (sdei_active_normal_event)) { +pr_warn ("still in SDEI normal event context, attempting to finish handler.\n" ); +__sdei_handler_abort (); +__this_cpu_write (sdei_active_normal_event,NULL ); + } +}
include/linux/arm_sdei.h +2 -0
@@ -47,10 +47,12 @@ int sdei_unregister_ghes(struct ghes *ghint sdei_mask_local_cpu (void );int sdei_unmask_local_cpu (void );void __init sdei_init (void ); +void sdei_handler_abort (void );#else static inline int sdei_mask_local_cpu (void ) {return 0 ; }static inline int sdei_unmask_local_cpu (void ) {return 0 ; }static inline void sdei_init (void ) { } +static inline void sdei_handler_abort (void ) { }#endif /* CONFIG_ARM_SDE_INTERFACE */
Greg Kroah-Hartman
maintainerPATCH 357/511 s390/ipl: add missing secure/has_secure file to ipl type unknown
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Schnelle <[email protected]>
commit ea5717cb13468323a7c3dd394748301802991f39 upstream.
OS installers are relying on /sys/firmware/ipl/has_secure to be present on machines supporting secure boot. This file is present for all IPL types, but not the unknown type, which prevents a secure installation when an LPAR is booted in HMC via FTP(s), because this is an unknown IPL type in linux. While at it, also add the secure file.
--- arch/s390/kernel/ipl.c | 2 ++ 1 file changed, 2 insertions(+)
arch/s390/kernel/ipl.c +2 -0
@@ -502,6 +502,8 @@ static struct attribute_group ipl_ccw_atstatic struct attribute *ipl_unknown_attrs[] = { &sys_ipl_type_attr.attr, + &sys_ipl_secure_attr.attr, + &sys_ipl_has_secure_attr.attr,NULL , };
Greg Kroah-Hartman
maintainerPATCH 358/511 crypto: stm32 - fix loop iterating through scatterlist for DMA
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Bourgoin <[email protected]>
commit d9c83f71eeceed2cb54bb78be84f2d4055fd9a1f upstream.
We were reading the length of the scatterlist sg after copying value of tsg inside.
So we are using the size of the previous scatterlist and for the first one we are using an unitialised value.
Fix this by copying tsg in sg[0] before reading the size.
--- drivers/crypto/stm32/stm32-hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/stm32/stm32-hash.c +1 -1
@@ -565,9 +565,9 @@ static int stm32_hash_dma_send(struct st }for_each_sg (rctx->sg, tsg, rctx->nents, i) { + sg[0 ] = *tsg; len = sg->length; - sg[0 ] = *tsg;if (sg_is_last (sg)) {if (hdev->dma_mode ==1 ) { len = (ALIGN (sg->length,16 ) -16 );
Greg Kroah-Hartman
maintainerPATCH 359/511 cpufreq: brcmstb-avs-cpufreq: Fix -Warray-bounds bug
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo A. R. Silva <[email protected]>
commit e520d0b6be950ce3738cf4b9bd3b392be818f1dc upstream.
Allocate extra space for terminating element at:
drivers/cpufreq/brcmstb-avs-cpufreq.c:
449 table[i].frequency = CPUFREQ_TABLE_END;
and add code comment to make this clear.
This fixes the following -Warray-bounds warning seen after building
ARM with multi_v7_defconfig (GCC 13):
In function 'brcm_avs_get_freq_table',
inlined from 'brcm_avs_cpufreq_init' at drivers/cpufreq/brcmstb-avs-cpufreq.c:623:15:drivers/cpufreq/brcmstb-avs-cpufreq.c:449:28: warning: array subscript 5 is outside array bounds of 'void[60]' [-Warray-bounds=]
449 | table[i].frequency = CPUFREQ_TABLE_END;
In file included from include/linux/node.h:18,
from include/linux/cpu.h:17,
from include/linux/cpufreq.h:12,
from drivers/cpufreq/brcmstb-avs-cpufreq.c:44:
In function 'devm_kmalloc_array',
inlined from 'devm_kcalloc' at include/linux/device.h:328:9,
inlined from 'brcm_avs_get_freq_table' at drivers/cpufreq/brcmstb-avs-cpufreq.c:437:10,
inlined from 'brcm_avs_cpufreq_init' at drivers/cpufreq/brcmstb-avs-cpufreq.c:623:15:include/linux/device.h:323:16: note: at offset 60 into object of size 60 allocated by 'devm_kmalloc'
323 | return devm_kmalloc(dev, bytes, flags);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy() and help us make progress towards globally enabling -Warray-bounds.
--- drivers/cpufreq/brcmstb-avs-cpufreq.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/cpufreq/brcmstb-avs-cpufreq.c +5 -1
@@ -434,7 +434,11 @@ brcm_avs_get_freq_table(struct device *dif (ret)return ERR_PTR (ret); - table =devm_kcalloc (dev,AVS_PSTATE_MAX +1 ,sizeof (*table), +/* +* We allocate space for the 5 different P-STATES AVS, +* plus extra space for a terminating element. +*/ + table =devm_kcalloc (dev,AVS_PSTATE_MAX +1 +1 ,sizeof (*table),GFP_KERNEL );if (!table)return ERR_PTR (-ENOMEM );
Greg Kroah-Hartman
maintainerPATCH 360/511 usb: typec: tcpm: set initial svdm version based on pd revision
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: RD Babiera <[email protected]>
commit c97cd0b4b54eb42aed7f6c3c295a2d137f6d2416 upstream.
When sending Discover Identity messages to a Port Partner that uses Power Delivery v2 and SVDM v1, we currently send PD v2 messages with SVDM v2.0, expecting the port partner to respond with its highest supported SVDM version as stated in Section 6.4.4.2.3 in the Power Delivery v3 specification. However, sending SVDM v2 to some Power Delivery v2 port partners results in a NAK whereas sending SVDM v1 does not.
NAK messages can be handled by the initiator (PD v3 section 6.4.4.2.5.1), and one solution could be to resend Discover Identity on a lower SVDM version if possible. But, Section 6.4.4.3 of PD v2 states that "A NAK response Should be taken as an indication not to retry that particular Command."
Instead, we can set the SVDM version to the maximum one supported by the negotiated PD revision. When operating in PD v2, this obeys Section 6.4.4.2.3, which states the SVDM field "Shall be set to zero to indicate Version 1.0." In PD v3, the SVDM field "Shall be set to 01b to indicate Version 2.0."
--- drivers/usb/typec/tcpm/tcpm.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-)
drivers/usb/typec/tcpm/tcpm.c +31 -4
@@ -3862,6 +3862,29 @@ static enum typec_cc_status tcpm_pwr_opm } } +static void tcpm_set_initial_svdm_version (struct tcpm_port *port) +{ +switch (port->negotiated_rev) { +case PD_REV30 : +break ; +/* +* 6.4.4.2.3 Structured VDM Version +* 2.0 states "At this time, there is only one version (1.0) defined. +* This field Shall be set to zero to indicate Version 1.0." +* 3.0 states "This field Shall be set to 01b to indicate Version 2.0." +* To ensure that we follow the Power Delivery revision we are currently +* operating on, downgrade the SVDM version to the highest one supported +* by the Power Delivery revision. +*/ +case PD_REV20 : +typec_partner_set_svdm_version (port->partner,SVDM_VER_1_0 ); +break ; +default : +typec_partner_set_svdm_version (port->partner,SVDM_VER_1_0 ); +break ; + } +} +static void run_state_machine (struct tcpm_port *port) {int ret;
@@ -4086,10 +4109,12 @@ static void run_state_machine(struct tcp* For now, this driver only supports SOP for DISCOVER_IDENTITY, thus using * port->explicit_contract to decide whether to send the command. */ -if (port->explicit_contract) +if (port->explicit_contract) { +tcpm_set_initial_svdm_version (port);mod_send_discover_delayed_work (port,0 ); -else + }else { port->send_discover = false; + }/* * 6.3.5
@@ -4372,10 +4397,12 @@ static void run_state_machine(struct tcp* For now, this driver only supports SOP for DISCOVER_IDENTITY, thus using * port->explicit_contract. */ -if (port->explicit_contract) +if (port->explicit_contract) { +tcpm_set_initial_svdm_version (port);mod_send_discover_delayed_work (port,0 ); -else + }else { port->send_discover = false; + }power_supply_changed (port->psy);break ;
Greg Kroah-Hartman
maintainerPATCH 361/511 usb: typec: bus: verify partner exists in typec_altmode_attention
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: RD Babiera <[email protected]>
commit f23643306430f86e2f413ee2b986e0773e79da31 upstream.
Some usb hubs will negotiate DisplayPort Alt mode with the device but will then negotiate a data role swap after entering the alt mode. The data role swap causes the device to unregister all alt modes, however the usb hub will still send Attention messages even after failing to reregister the Alt Mode. type_altmode_attention currently does not verify whether or not a device's altmode partner exists, which results in a NULL pointer error when dereferencing the typec_altmode and typec_altmode_ops belonging to the altmode partner.
Verify the presence of a device's altmode partner before sending the Attention message to the Alt Mode driver.
--- drivers/usb/typec/bus.c | 12 ++++++++++-- drivers/usb/typec/tcpm/tcpm.c | 3 ++- include/linux/usb/typec_altmode.h | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-)
drivers/usb/typec/bus.c +10 -2
@@ -154,12 +154,20 @@ EXPORT_SYMBOL_GPL(typec_altmode_exit);* * Notifies the partner of @adev about Attention command. */ -void typec_altmode_attention (struct typec_altmode *adev,u32 vdo) +int typec_altmode_attention (struct typec_altmode *adev,u32 vdo) { -struct typec_altmode *pdev = &to_altmode (adev)->partner->adev; +struct altmode *partner =to_altmode (adev)->partner; +struct typec_altmode *pdev; + +if (!partner) +return -ENODEV ; + + pdev = &partner->adev;if (pdev->ops && pdev->ops->attention) pdev->ops->attention (pdev, vdo); + +return 0 ; }EXPORT_SYMBOL_GPL (typec_altmode_attention);
drivers/usb/typec/tcpm/tcpm.c +2 -1
@@ -1863,7 +1863,8 @@ static void tcpm_handle_vdm_request(stru }break ;case ADEV_ATTENTION : -typec_altmode_attention (adev, p[1 ]); +if (typec_altmode_attention (adev, p[1 ])) +tcpm_log (port,"typec_altmode_attention no port partner altmode" );break ; } }
include/linux/usb/typec_altmode.h +1 -1
@@ -67,7 +67,7 @@ struct typec_altmode_ops {int typec_altmode_enter (struct typec_altmode *altmode,u32 *vdo);int typec_altmode_exit (struct typec_altmode *altmode); -void typec_altmode_attention (struct typec_altmode *altmode,u32 vdo); +int typec_altmode_attention (struct typec_altmode *altmode,u32 vdo);int typec_altmode_vdm (struct typec_altmode *altmode,const u32 header,const u32 *vdo,int count); int typec_altmode_notify(struct typec_altmode *altmode, unsigned long conf,
Greg Kroah-Hartman
maintainerPATCH 362/511 USB: core: Unite old scheme and new scheme descriptor reads
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 85d07c55621676d47d873d2749b88f783cd4d5a1 upstream.
In preparation for reworking the usb_get_device_descriptor() routine, it is desirable to unite the two different code paths responsible for initially determining endpoint 0's maximum packet size in a newly discovered USB device. Making this determination presents a chicken-and-egg sort of problem, in that the only way to learn the maxpacket value is to get it from the device descriptor retrieved from the device, but communicating with the device to retrieve a descriptor requires us to know beforehand the ep0 maxpacket size.
In practice this problem is solved in two different ways, referred to in hub.c as the "old scheme" and the "new scheme". The old scheme (which is the approach recommended by the USB-2 spec) involves asking the device to send just the first eight bytes of its device descriptor. Such a transfer uses packets containing no more than eight bytes each, and every USB device must have an ep0 maxpacket size
Quoted 1 line
= 8, so this should succeed. Since the bMaxPacketSize0 field of the
device descriptor lies within the first eight bytes, this is all we need.
The new scheme is an imitation of the technique used in an early Windows USB implementation, giving it the happy advantage of working with a wide variety of devices (some of them at the time would not work with the old scheme, although that's probably less true now). It involves making an initial guess of the ep0 maxpacket size, asking the device to send up to 64 bytes worth of its device descriptor (which is only 18 bytes long), and then resetting the device to clear any error condition that might have resulted from the guess being wrong. The initial guess is determined by the connection speed; it should be correct in all cases other than full speed, for which the allowed values are 8, 16, 32, and 64 (in this case the initial guess is 64).
The reason for this patch is that the old- and new-scheme parts of hub_port_init() use different code paths, one involving usb_get_device_descriptor() and one not, for their initial reads of the device descriptor. Since these reads have essentially the same purpose and are made under essentially the same circumstances, this is illogical. It makes more sense to have both of them use a common subroutine.
This subroutine does basically what the new scheme's code did, because that approach is more general than the one used by the old scheme. It only needs to know how many bytes to transfer and whether or not it is being called for the first iteration of a retry loop (in case of certain time-out errors). There are two main differences from the former code:
We initialize the bDescriptorType field of the transfer buffer to 0 before performing the transfer, to avoid possibly accessing an uninitialized value afterward.
We read the device descriptor into a temporary buffer rather than storing it directly into udev->descriptor, which the old scheme implementation used to do.
Since the whole point of this first read of the device descriptor is to determine the bMaxPacketSize0 value, that is what the new routine returns (or an error code). The value is stored in a local variable rather than in udev->descriptor. As a side effect, this necessitates moving a section of code that checks the bcdUSB field for SuperSpeed devices until after the full device descriptor has been retrieved.
--- drivers/usb/core/hub.c | 173 ++++++++++++++++++++++++++----------------------- 1 file changed, 94 insertions(+), 79 deletions(-)
drivers/usb/core/hub.c +94 -79
@@ -4666,6 +4666,67 @@ static int hub_enable_device(struct usb_return hcd->driver->enable_device (hcd, udev); } +/* +* Get the bMaxPacketSize0 value during initialization by reading the +* device's device descriptor. Since we don't already know this value, +* the transfer is unsafe and it ignores I/O errors, only testing for +* reasonable received values. +* +* For "old scheme" initialization, size will be 8 so we read just the +* start of the device descriptor, which should work okay regardless of +* the actual bMaxPacketSize0 value. For "new scheme" initialization, +* size will be 64 (and buf will point to a sufficiently large buffer), +* which might not be kosher according to the USB spec but it's what +* Windows does and what many devices expect. +* +* Returns: bMaxPacketSize0 or a negative error code. +*/ +static int get_bMaxPacketSize0 (struct usb_device *udev, +struct usb_device_descriptor *buf,int size,bool first_time) +{ +int i, rc; + +/* +* Retry on all errors; some devices are flakey. +* 255 is for WUSB devices, we actually need to use +* 512 (WUSB1.0[4.8.1]). +*/ +for (i =0 ; i <GET_MAXPACKET0_TRIES ; ++i) { +/* Start with invalid values in case the transfer fails */ + buf->bDescriptorType = buf->bMaxPacketSize0 =0 ; + rc =usb_control_msg (udev,usb_rcvaddr0pipe (), +USB_REQ_GET_DESCRIPTOR ,USB_DIR_IN , +USB_DT_DEVICE <<8 ,0 , + buf, size, + initial_descriptor_timeout); +switch (buf->bMaxPacketSize0) { +case 8 :case 16 :case 32 :case 64 :case 255 : +if (buf->bDescriptorType ==USB_DT_DEVICE ) { + rc = buf->bMaxPacketSize0; +break ; + } + fallthrough; +default : +if (rc >=0 ) + rc = -EPROTO ; +break ; + } + +/* +* Some devices time out if they are powered on +* when already connected. They need a second +* reset, so return early. But only on the first +* attempt, lest we get into a time-out/reset loop. +*/ +if (rc >0 || (rc == -ETIMEDOUT && first_time && + udev->speed >USB_SPEED_FULL )) +break ; + } +return rc; +} + +#define GET_DESCRIPTOR_BUFSIZE 64 +/* Reset device, (re)assign address, get device descriptor. * Device connection must be stable, no more debouncing needed. * Returns device in USB_STATE_ADDRESS, except on error.
@@ -4690,6 +4751,12 @@ hub_port_init(struct usb_hub *hub, strucint devnum = udev->devnum;const char *driver_name;bool do_new_scheme; +int maxp0; +struct usb_device_descriptor *buf; + + buf =kmalloc (GET_DESCRIPTOR_BUFSIZE ,GFP_NOIO ); +if (!buf) +return -ENOMEM ;/* root hub ports have a slightly longer reset period * (from USB 2.0 spec, section 7.1.7.5)
@@ -4804,9 +4871,6 @@ hub_port_init(struct usb_hub *hub, strucfor (retries =0 ; retries <GET_DESCRIPTOR_TRIES ; (++retries,msleep (100 ))) {if (do_new_scheme) { -struct usb_device_descriptor *buf; -int r =0 ; - retval =hub_enable_device (udev);if (retval <0 ) { dev_err(&udev->dev,
@@ -4815,52 +4879,8 @@ hub_port_init(struct usb_hub *hub, struc goto fail; } -#define GET_DESCRIPTOR_BUFSIZE 64 - buf =kmalloc (GET_DESCRIPTOR_BUFSIZE ,GFP_NOIO ); -if (!buf) { - retval = -ENOMEM ; -continue ; - } - -/* Retry on all errors; some devices are flakey. -* 255 is for WUSB devices, we actually need to use -* 512 (WUSB1.0[4.8.1]). -*/ -for (operations =0 ; operations <GET_MAXPACKET0_TRIES ; - ++operations) { - buf->bMaxPacketSize0 =0 ; - r =usb_control_msg (udev,usb_rcvaddr0pipe (), -USB_REQ_GET_DESCRIPTOR ,USB_DIR_IN , -USB_DT_DEVICE <<8 ,0 , - buf,GET_DESCRIPTOR_BUFSIZE , - initial_descriptor_timeout); -switch (buf->bMaxPacketSize0) { -case 8 :case 16 :case 32 :case 64 :case 255 : -if (buf->bDescriptorType == -USB_DT_DEVICE ) { - r =0 ; -break ; - } - fallthrough; -default : -if (r ==0 ) - r = -EPROTO ; -break ; - } -/* -* Some devices time out if they are powered on -* when already connected. They need a second -* reset. But only on the first attempt, -* lest we get into a time out/reset loop -*/ -if (r ==0 || (r == -ETIMEDOUT && - retries ==0 && - udev->speed >USB_SPEED_FULL )) -break ; - } - udev->descriptor.bMaxPacketSize0 = - buf->bMaxPacketSize0; -kfree (buf); + maxp0 =get_bMaxPacketSize0 (udev, buf, +GET_DESCRIPTOR_BUFSIZE , retries ==0 ); retval =hub_port_reset (hub, port1, udev, delay, false);if (retval <0 )/* error or disconnect */
@@ -4871,14 +4891,13 @@ hub_port_init(struct usb_hub *hub, struc retval = -ENODEV ; goto fail; } -if (r) { -if (r != -ENODEV ) +if (maxp0 <0 ) { +if (maxp0 != -ENODEV )dev_err (&udev->dev,"device descriptor read/64, error %d\n" , - r); - retval = -EMSGSIZE ; + maxp0); + retval = maxp0;continue ; } -#undef GET_DESCRIPTOR_BUFSIZE }/*
@@ -4924,19 +4943,17 @@ hub_port_init(struct usb_hub *hub, strucbreak ; } - retval =usb_get_device_descriptor (udev,8 ); -if (retval <8 ) { +/* !do_new_scheme || wusb */ + maxp0 =get_bMaxPacketSize0 (udev, buf,8 , retries ==0 ); +if (maxp0 <0 ) { + retval = maxp0;if (retval != -ENODEV )dev_err (&udev->dev,"device descriptor read/8, error %d\n" , retval); -if (retval >=0 ) - retval = -EMSGSIZE ; }else {u32 delay; - retval =0 ; - delay = udev->parent->hub_delay; udev->hub_delay =min_t (u32, delay,USB_TP_TRANSMISSION_DELAY_MAX );
@@ -4953,27 +4970,10 @@ hub_port_init(struct usb_hub *hub, strucif (retval) goto fail; -/* -* Some superspeed devices have finished the link training process -* and attached to a superspeed hub port, but the device descriptor -* got from those devices show they aren't superspeed devices. Warm -* reset the port attached by the devices can fix them. -*/ -if ((udev->speed >=USB_SPEED_SUPER ) && - (le16_to_cpu (udev->descriptor.bcdUSB) <0x0300 )) { -dev_err (&udev->dev,"got a wrong device descriptor, " -"warm reset device\n" ); -hub_port_reset (hub, port1, udev, -HUB_BH_RESET_TIME , true); - retval = -EINVAL ; - goto fail; - } - -if (udev->descriptor.bMaxPacketSize0 ==0xff || - udev->speed >=USB_SPEED_SUPER ) +if (maxp0 ==0xff || udev->speed >=USB_SPEED_SUPER ) i =512 ;else - i = udev->descriptor.bMaxPacketSize0; + i = maxp0;if (usb_endpoint_maxp (&udev->ep0.desc) != i) {if (udev->speed ==USB_SPEED_LOW || !(i ==8 || i ==16 || i ==32 || i ==64 )) {
@@ -4999,6 +4999,20 @@ hub_port_init(struct usb_hub *hub, struc goto fail; } +/* +* Some superspeed devices have finished the link training process +* and attached to a superspeed hub port, but the device descriptor +* got from those devices show they aren't superspeed devices. Warm +* reset the port attached by the devices can fix them. +*/ +if ((udev->speed >=USB_SPEED_SUPER ) && + (le16_to_cpu (udev->descriptor.bcdUSB) <0x0300 )) { +dev_err (&udev->dev,"got a wrong device descriptor, warm reset device\n" ); +hub_port_reset (hub, port1, udev,HUB_BH_RESET_TIME , true); + retval = -EINVAL ; + goto fail; + } +usb_detect_quirks (udev);if (udev->wusb ==0 &&le16_to_cpu (udev->descriptor.bcdUSB) >=0x0201 ) {
@@ -5019,6 +5033,7 @@ fail:hub_port_disable (hub, port1,0 );update_devnum (udev, devnum);/* for disconnect processing */ } +kfree (buf);return retval; }
Greg Kroah-Hartman
maintainerPATCH 363/511 USB: core: Change usb_get_device_descriptor() API
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit de28e469da75359a2bb8cd8778b78aa64b1be1f4 upstream.
The usb_get_device_descriptor() routine reads the device descriptor from the udev device and stores it directly in udev->descriptor. This interface is error prone, because the USB subsystem expects in-memory copies of a device's descriptors to be immutable once the device has been initialized.
The interface is changed so that the device descriptor is left in a kmalloc-ed buffer, not copied into the usb_device structure. A pointer to the buffer is returned to the caller, who is then responsible for kfree-ing it. The corresponding changes needed in the various callers are fairly small.
--- drivers/usb/core/hcd.c | 10 +++++++--- drivers/usb/core/hub.c | 44 +++++++++++++++++++++++--------------------- drivers/usb/core/message.c | 29 ++++++++++++----------------- drivers/usb/core/usb.h | 4 ++-- 4 files changed, 44 insertions(+), 43 deletions(-)
drivers/usb/core/hcd.c +7 -3
@@ -983,6 +983,7 @@ static int register_root_hub(struct usb_ {struct device *parent_dev = hcd->self.controller;struct usb_device *usb_dev = hcd->self.root_hub; +struct usb_device_descriptor *descr;const int devnum =1 ;int retval;
@@ -994,13 +995,16 @@ static int register_root_hub(struct usb_mutex_lock (&usb_bus_idr_lock); usb_dev->ep0.desc.wMaxPacketSize =cpu_to_le16 (64 ); - retval =usb_get_device_descriptor (usb_dev,USB_DT_DEVICE_SIZE ); -if (retval !=sizeof usb_dev->descriptor) { + descr =usb_get_device_descriptor (usb_dev); +if (IS_ERR (descr)) { + retval =PTR_ERR (descr);mutex_unlock (&usb_bus_idr_lock);dev_dbg (parent_dev,"can't read %s device descriptor %d\n" ,dev_name (&usb_dev->dev), retval); -return (retval <0 ) ? retval : -EMSGSIZE ; +return retval; } + usb_dev->descriptor = *descr; +kfree (descr);if (le16_to_cpu (usb_dev->descriptor.bcdUSB) >=0x0201 ) { retval =usb_get_bos_descriptor (usb_dev);
drivers/usb/core/hub.c +23 -21
104 lines not on this page · raw message
drivers/usb/core/message.c +12 -17
@@ -1039,40 +1039,35 @@ char *usb_cache_string(struct usb_device }/* -* usb_get_device_descriptor - (re)reads the device descriptor (usbcore) -* @dev: the device whose device descriptor is being updated -* @size: how much of the descriptor to read +* usb_get_device_descriptor - read the device descriptor +* @udev: the device whose device descriptor should be read * * Context: task context, might sleep. * -* Updates the copy of the device descriptor stored in the device structure, -* which dedicates space for this purpose. -* * Not exported, only for use by the core. If drivers really want to read * the device descriptor directly, they can call usb_get_descriptor() with * type = USB_DT_DEVICE and index = 0. * -* This call is synchronous, and may not be used in an interrupt context. -* -* Return: The number of bytes received on success, or else the status code -* returned by the underlying usb_control_msg() call. +* Returns: a pointer to a dynamically allocated usb_device_descriptor +* structure (which the caller must deallocate), or an ERR_PTR value. */ -int usb_get_device_descriptor (struct usb_device *dev,unsigned int size) +struct usb_device_descriptor *usb_get_device_descriptor (struct usb_device *udev) {struct usb_device_descriptor *desc;int ret; -if (size >sizeof (*desc)) -return -EINVAL ; desc =kmalloc (sizeof (*desc),GFP_NOIO );if (!desc) -return -ENOMEM ; +return ERR_PTR (-ENOMEM ); + + ret =usb_get_descriptor (udev,USB_DT_DEVICE ,0 , desc,sizeof (*desc)); +if (ret ==sizeof (*desc)) +return desc; - ret =usb_get_descriptor (dev,USB_DT_DEVICE ,0 , desc, size);if (ret >=0 ) -memcpy (&dev->descriptor, desc, size); + ret = -EMSGSIZE ;kfree (desc); -return ret; +return ERR_PTR (ret); }/*
drivers/usb/core/usb.h +2 -2
@@ -42,8 +42,8 @@ extern bool usb_endpoint_is_ignored(stru struct usb_endpoint_descriptor *epd);extern int usb_remove_device (struct usb_device *udev); -extern int usb_get_device_descriptor (struct usb_device *dev, -unsigned int size); +extern struct usb_device_descriptor *usb_get_device_descriptor ( +struct usb_device *udev);extern int usb_set_isoch_delay (struct usb_device *dev);extern int usb_get_bos_descriptor (struct usb_device *dev);extern void usb_release_bos_descriptor (struct usb_device *dev);
Greg Kroah-Hartman
maintainerPATCH 364/511 USB: core: Fix race by not overwriting udev->descriptor in hub_port_init()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit ff33299ec8bb80cdcc073ad9c506bd79bb2ed20b upstream.
Syzbot reported an out-of-bounds read in sysfs.c:read_descriptors():
BUG: KASAN: slab-out-of-bounds in read_descriptors+0x263/0x280 drivers/usb/core/sysfs.c:883 Read of size 8 at addr ffff88801e78b8c8 by task udevd/5011 CPU: 0 PID: 5011 Comm: udevd Not tainted 6.4.0-rc6-syzkaller-00195-g40f71e7cd3c6 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106 print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:351 print_report mm/kasan/report.c:462 [inline] kasan_report+0x11c/0x130 mm/kasan/report.c:572 read_descriptors+0x263/0x280 drivers/usb/core/sysfs.c:883 ... Allocated by task 758: ... __do_kmalloc_node mm/slab_common.c:966 [inline] __kmalloc+0x5e/0x190 mm/slab_common.c:979 kmalloc include/linux/slab.h:563 [inline] kzalloc include/linux/slab.h:680 [inline] usb_get_configuration+0x1f7/0x5170 drivers/usb/core/config.c:887 usb_enumerate_device drivers/usb/core/hub.c:2407 [inline] usb_new_device+0x12b0/0x19d0 drivers/usb/core/hub.c:2545
As analyzed by Khazhy Kumykov, the cause of this bug is a race between read_descriptors() and hub_port_init(): The first routine uses a field in udev->descriptor, not expecting it to change, while the second overwrites it.
Prior to commit 45bf39f8df7f ("USB: core: Don't hold device lock while reading the "descriptors" sysfs file") this race couldn't occur, because the routines were mutually exclusive thanks to the device locking. Removing that locking from read_descriptors() exposed it to the race.
The best way to fix the bug is to keep hub_port_init() from changing udev->descriptor once udev has been initialized and registered. Drivers expect the descriptors stored in the kernel to be immutable; we should not undermine this expectation. In fact, this change should have been made long ago.
So now hub_port_init() will take an additional argument, specifying a buffer in which to store the device descriptor it reads. (If udev has not yet been initialized, the buffer pointer will be NULL and then hub_port_init() will store the device descriptor in udev as before.) This eliminates the data race responsible for the out-of-bounds read.
The changes to hub_port_init() appear more extensive than they really are, because of indentation changes resulting from an attempt to avoid writing to other parts of the usb_device structure after it has been initialized. Similar changes should be made to the code that reads the BOS descriptor, but that can be handled in a separate patch later on. This patch is sufficient to fix the bug found by syzbot.
--- drivers/usb/core/hub.c | 114 ++++++++++++++++++++++++++++++------------------- 1 file changed, 70 insertions(+), 44 deletions(-)
drivers/usb/core/hub.c +70 -44
@@ -4741,10 +4741,17 @@ static int get_bMaxPacketSize0(struct us* the port lock. For a newly detected device that is not accessible * through any global pointers, it's not necessary to lock the device, * but it is still necessary to lock the port. +* +* For a newly detected device, @dev_descr must be NULL. The device +* descriptor retrieved from the device will then be stored in +* @udev->descriptor. For an already existing device, @dev_descr +* must be non-NULL. The device descriptor will be stored there, +* not in @udev->descriptor, because descriptors for registered +* devices are meant to be immutable. */ static int hub_port_init (struct usb_hub *hub,struct usb_device *udev,int port1, -int retry_counter) +int retry_counter,struct usb_device_descriptor *dev_descr) {struct usb_device *hdev = hub->hdev;struct usb_hcd *hcd =bus_to_hcd (hdev->bus);
@@ -4756,6 +4763,7 @@ hub_port_init(struct usb_hub *hub, strucint devnum = udev->devnum;const char *driver_name;bool do_new_scheme; +const bool initial = !dev_descr;int maxp0;struct usb_device_descriptor *buf, *descr;
@@ -4794,32 +4802,34 @@ hub_port_init(struct usb_hub *hub, struc } oldspeed = udev->speed; -/* USB 2.0 section 5.5.3 talks about ep0 maxpacket ... -* it's fixed size except for full speed devices. -* For Wireless USB devices, ep0 max packet is always 512 (tho -* reported as 0xff in the device descriptor). WUSB1.0[4.8.1]. -*/ -switch (udev->speed) { -case USB_SPEED_SUPER_PLUS : -case USB_SPEED_SUPER : -case USB_SPEED_WIRELESS :/* fixed at 512 */ - udev->ep0.desc.wMaxPacketSize =cpu_to_le16 (512 ); -break ; -case USB_SPEED_HIGH :/* fixed at 64 */ - udev->ep0.desc.wMaxPacketSize =cpu_to_le16 (64 ); -break ; -case USB_SPEED_FULL :/* 8, 16, 32, or 64 */ -/* to determine the ep0 maxpacket size, try to read -* the device descriptor to get bMaxPacketSize0 and -* then correct our initial guess. +if (initial) { +/* USB 2.0 section 5.5.3 talks about ep0 maxpacket ... +* it's fixed size except for full speed devices. +* For Wireless USB devices, ep0 max packet is always 512 (tho +* reported as 0xff in the device descriptor). WUSB1.0[4.8.1]. */ - udev->ep0.desc.wMaxPacketSize =cpu_to_le16 (64 ); -break ; -case USB_SPEED_LOW :/* fixed at 8 */ - udev->ep0.desc.wMaxPacketSize =cpu_to_le16 (8 ); -break ; -default : - goto fail; +switch (udev->speed) { +case USB_SPEED_SUPER_PLUS : +case USB_SPEED_SUPER : +case USB_SPEED_WIRELESS :/* fixed at 512 */ + udev->ep0.desc.wMaxPacketSize =cpu_to_le16 (512 ); +break ; +case USB_SPEED_HIGH :/* fixed at 64 */ + udev->ep0.desc.wMaxPacketSize =cpu_to_le16 (64 ); +break ; +case USB_SPEED_FULL :/* 8, 16, 32, or 64 */ +/* to determine the ep0 maxpacket size, try to read +* the device descriptor to get bMaxPacketSize0 and +* then correct our initial guess. +*/ + udev->ep0.desc.wMaxPacketSize =cpu_to_le16 (64 ); +break ; +case USB_SPEED_LOW :/* fixed at 8 */ + udev->ep0.desc.wMaxPacketSize =cpu_to_le16 (8 ); +break ; +default : + goto fail; + } }if (udev->speed ==USB_SPEED_WIRELESS )
@@ -4842,22 +4852,24 @@ hub_port_init(struct usb_hub *hub, strucif (udev->speed <USB_SPEED_SUPER )dev_info (&udev->dev,"%s %s USB device number %d using %s\n" , - (udev->config) ?"reset" :"new" , speed, + (initial ?"new" :"reset" ), speed, devnum, driver_name); -/* Set up TT records, if needed */ -if (hdev->tt) { - udev->tt = hdev->tt; - udev->ttport = hdev->ttport; - }else if (udev->speed !=USB_SPEED_HIGH - && hdev->speed ==USB_SPEED_HIGH ) { -if (!hub->tt.hub) { -dev_err (&udev->dev,"parent hub has no TT\n" ); - retval = -EINVAL ; - goto fail; +if (initial) { +/* Set up TT records, if needed */ +if (hdev->tt) { + udev->tt = hdev->tt; + udev->ttport = hdev->ttport; + }else if (udev->speed !=USB_SPEED_HIGH + && hdev->speed ==USB_SPEED_HIGH ) { +if (!hub->tt.hub) { +dev_err (&udev->dev,"parent hub has no TT\n" ); + retval = -EINVAL ; + goto fail; + } + udev->tt = &hub->tt; + udev->ttport = port1; } - udev->tt = &hub->tt; - udev->ttport = port1; }/* Why interleave GET_DESCRIPTOR and SET_ADDRESS this way?
@@ -4886,6 +4898,12 @@ hub_port_init(struct usb_hub *hub, struc maxp0 =get_bMaxPacketSize0 (udev, buf,GET_DESCRIPTOR_BUFSIZE , retries ==0 ); +if (maxp0 >0 && !initial && + maxp0 != udev->descriptor.bMaxPacketSize0) { +dev_err (&udev->dev,"device reset changed ep0 maxpacket size!\n" ); + retval = -ENODEV ; + goto fail; + } retval =hub_port_reset (hub, port1, udev, delay, false);if (retval <0 )/* error or disconnect */
@@ -4959,6 +4977,12 @@ hub_port_init(struct usb_hub *hub, struc }else {u32 delay; +if (!initial && maxp0 != udev->descriptor.bMaxPacketSize0) { +dev_err (&udev->dev,"device reset changed ep0 maxpacket size!\n" ); + retval = -ENODEV ; + goto fail; + } + delay = udev->parent->hub_delay; udev->hub_delay =min_t (u32, delay,USB_TP_TRANSMISSION_DELAY_MAX );
@@ -5002,7 +5026,10 @@ hub_port_init(struct usb_hub *hub, struc retval); goto fail; } - udev->descriptor = *descr; +if (initial) + udev->descriptor = *descr; +else + *dev_descr = *descr;kfree (descr);/*
@@ -5305,7 +5332,7 @@ static void hub_port_connect(struct usb_ }/* reset (non-USB 3.0 devices) and get descriptor */ - status =hub_port_init (hub, udev, port1, i); + status =hub_port_init (hub, udev, port1, i,NULL );if (status <0 ) goto loop;
@@ -5921,7 +5948,7 @@ static int usb_reset_and_verify_device(sstruct usb_device *parent_hdev = udev->parent;struct usb_hub *parent_hub;struct usb_hcd *hcd =bus_to_hcd (udev->bus); -struct usb_device_descriptor descriptor = udev->descriptor; +struct usb_device_descriptor descriptor;struct usb_host_bos *bos;int i, j, ret =0 ;int port1 = udev->portnum;
@@ -5963,7 +5990,7 @@ static int usb_reset_and_verify_device(s/* ep0 maxpacket size may change; let the HCD know about it. * Other endpoints will be handled by re-enumeration. */ usb_ep0_reinit (udev); - ret =hub_port_init (parent_hub, udev, port1, i); + ret =hub_port_init (parent_hub, udev, port1, i, &descriptor);if (ret >=0 || ret == -ENOTCONN || ret == -ENODEV )break ; }
@@ -5975,7 +6002,6 @@ static int usb_reset_and_verify_device(s/* Device might have changed firmware (DFU or similar) */ if (descriptors_changed (udev, &descriptor, bos)) {dev_info (&udev->dev,"device firmware changed\n" ); - udev->descriptor = descriptor;/* for disconnect() calls */ goto re_enumerate; }
Greg Kroah-Hartman
maintainerPATCH 365/511 USB: core: Fix oversight in SuperSpeed initialization
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 59cf445754566984fd55af19ba7146c76e6627bc upstream.
Commit 85d07c556216 ("USB: core: Unite old scheme and new scheme descriptor reads") altered the way USB devices are enumerated following detection, and in the process it messed up the initialization of SuperSpeed (or faster) devices:
[ 31.650759] usb 2-1: new SuperSpeed Plus Gen 2x1 USB device number 2 using xhci_hcd [ 31.663107] usb 2-1: device descriptor read/8, error -71 [ 31.952697] usb 2-1: new SuperSpeed Plus Gen 2x1 USB device number 3 using xhci_hcd [ 31.965122] usb 2-1: device descriptor read/8, error -71 [ 32.080991] usb usb2-port1: attempt power cycle
...
The problem was caused by the commit forgetting that in SuperSpeed or faster devices, the device descriptor uses a logarithmic encoding of the bMaxPacketSize0 value. (For some reason I thought the 255 case in the switch statement was meant for these devices, but it isn't -- it was meant for Wireless USB and is no longer needed.)
We can fix the oversight by testing for buf->bMaxPacketSize0 = 9 (meaning 512, the actual maxpacket size for ep0 on all SuperSpeed devices) and straightening out the logic that checks and adjusts our initial guesses of the maxpacket value.
--- drivers/usb/core/hub.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-)
drivers/usb/core/hub.c +24 -12
@@ -4705,7 +4705,7 @@ static int get_bMaxPacketSize0(struct us buf, size, initial_descriptor_timeout);switch (buf->bMaxPacketSize0) { -case 8 :case 16 :case 32 :case 64 :case 255 : +case 8 :case 16 :case 32 :case 64 :case 9 :if (buf->bDescriptorType ==USB_DT_DEVICE ) { rc = buf->bMaxPacketSize0;break ;
@@ -4999,23 +4999,35 @@ hub_port_init(struct usb_hub *hub, strucif (retval) goto fail; -if (maxp0 ==0xff || udev->speed >=USB_SPEED_SUPER ) - i =512 ; -else - i = maxp0; -if (usb_endpoint_maxp (&udev->ep0.desc) != i) { -if (udev->speed ==USB_SPEED_LOW || - !(i ==8 || i ==16 || i ==32 || i ==64 )) { -dev_err (&udev->dev,"Invalid ep0 maxpacket: %d\n" , i); - retval = -EMSGSIZE ; - goto fail; - } +/* +* Check the ep0 maxpacket guess and correct it if necessary. +* maxp0 is the value stored in the device descriptor; +* i is the value it encodes (logarithmic for SuperSpeed or greater). +*/ + i = maxp0; +if (udev->speed >=USB_SPEED_SUPER ) { +if (maxp0 <=16 ) + i =1 << maxp0; +else + i =0 ;/* Invalid */ + } +if (usb_endpoint_maxp (&udev->ep0.desc) == i) { + ;/* Initial ep0 maxpacket guess is right */ + }else if ((udev->speed ==USB_SPEED_FULL || + udev->speed ==USB_SPEED_HIGH ) && + (i ==8 || i ==16 || i ==32 || i ==64 )) { +/* Initial guess is wrong; use the descriptor's value */ if (udev->speed ==USB_SPEED_FULL )dev_dbg (&udev->dev,"ep0 maxpacket = %d\n" , i);else dev_warn (&udev->dev,"Using ep0 maxpacket: %d\n" , i); udev->ep0.desc.wMaxPacketSize =cpu_to_le16 (i);usb_ep0_reinit (udev); + }else { +/* Initial guess is wrong and descriptor's value is invalid */ +dev_err (&udev->dev,"Invalid ep0 maxpacket: %d\n" , maxp0); + retval = -EMSGSIZE ; + goto fail; } descr =usb_get_device_descriptor (udev);
Greg Kroah-Hartman
maintainerPATCH 366/511 x86/sgx: Break up long non-preemptible delays in sgx_vepc_release()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jack Wang <[email protected]>
commit 3d7d72a34e05b23e21bafc8bfb861e73c86b31f3 upstream.
On large enclaves we hit the softlockup warning with following call trace:
xa_erase() sgx_vepc_release() __fput() task_work_run() do_exit()
The latency issue is similar to the one fixed in:
8795359e35bc ("x86/sgx: Silence softlockup detection when releasing large enclaves")
The test system has 64GB of enclave memory, and all is assigned to a single VM. Release of 'vepc' takes a longer time and causes long latencies, which triggers the softlockup warning.
Add cond_resched() to give other tasks a chance to run and reduce latencies, which also avoids the softlockup detector.
[ mingo: Rewrote the changelog. ]
--- arch/x86/kernel/cpu/sgx/virt.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/kernel/cpu/sgx/virt.c +3 -0
@@ -167,6 +167,7 @@ static int sgx_vepc_release(struct inodecontinue ;xa_erase (&vepc->page_array, index); +cond_resched (); }/*
@@ -185,6 +186,7 @@ static int sgx_vepc_release(struct inodelist_add_tail (&epc_page->list, &secs_pages);xa_erase (&vepc->page_array, index); +cond_resched (); }/*
@@ -206,6 +208,7 @@ static int sgx_vepc_release(struct inodeif (sgx_vepc_free_page (epc_page))list_add_tail (&epc_page->list, &secs_pages); +cond_resched (); }if (!list_empty (&secs_pages))
Greg Kroah-Hartman
maintainerPATCH 367/511 perf/x86/uncore: Correct the number of CHAs on EMR
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kan Liang <[email protected]>
commit 6f7f984fa85b305799076a1bcec941b9377587de upstream.
Starting from SPR, the basic uncore PMON information is retrieved from the discovery table (resides in an MMIO space populated by BIOS). It is called the discovery method. The existing value of the type->num_boxes is from the discovery table.
On some SPR variants, there is a firmware bug that makes the value from the discovery table incorrect. We use the value from the SPR_MSR_UNC_CBO_CONFIG MSR to replace the one from the discovery table:
38776cc45eb7 ("perf/x86/uncore: Correct the number of CHAs on SPR")
Unfortunately, the SPR_MSR_UNC_CBO_CONFIG isn't available for the EMR XCC (Always returns 0), but the above firmware bug doesn't impact the EMR XCC.
Don't let the value from the MSR replace the existing value from the discovery table.
--- arch/x86/events/intel/uncore_snbep.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
arch/x86/events/intel/uncore_snbep.c +11 -1
@@ -6078,8 +6078,18 @@ void spr_uncore_cpu_init(void) type =uncore_find_type_by_id (uncore_msr_uncores,UNCORE_SPR_CHA );if (type) { +/* +* The value from the discovery table (stored in the type->num_boxes +* of UNCORE_SPR_CHA) is incorrect on some SPR variants because of a +* firmware bug. Using the value from SPR_MSR_UNC_CBO_CONFIG to replace it. +*/ rdmsrl (SPR_MSR_UNC_CBO_CONFIG , num_cbo); - type->num_boxes = num_cbo; +/* +* The MSR doesn't work on the EMR XCC, but the firmware bug doesn't impact +* the EMR XCC. Don't let the value from the MSR replace the existing value. +*/ +if (num_cbo) + type->num_boxes = num_cbo; } spr_uncore_iio_free_running.num_boxes =uncore_type_max_boxes (uncore_msr_uncores,UNCORE_SPR_IIO ); }
Greg Kroah-Hartman
maintainerPATCH 368/511 tracing: Zero the pipe cpumask on alloc to avoid spurious -EBUSY
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Foster <[email protected]>
commit 3d07fa1dd19035eb0b13ae6697efd5caa9033e74 upstream.
The pipe cpumask used to serialize opens between the main and percpu trace pipes is not zeroed or initialized. This can result in spurious -EBUSY returns if underlying memory is not fully zeroed. This has been observed by immediate failure to read the main trace_pipe file on an otherwise newly booted and idle system:
# cat /sys/kernel/debug/tracing/trace_pipe cat: /sys/kernel/debug/tracing/trace_pipe: Device or resource busy
Zero the allocation of pipe_cpumask to avoid the problem.
--- kernel/trace/trace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace.c +2 -2
@@ -9350,7 +9350,7 @@ static struct trace_array *trace_array_cif (!alloc_cpumask_var (&tr->tracing_cpumask,GFP_KERNEL )) goto out_free_tr; -if (!alloc_cpumask_var (&tr->pipe_cpumask,GFP_KERNEL )) +if (!zalloc_cpumask_var (&tr->pipe_cpumask,GFP_KERNEL )) goto out_free_tr; tr->trace_flags = global_trace.trace_flags & ~ZEROED_TRACE_FLAGS ;
@@ -10208,7 +10208,7 @@ __init static int tracer_alloc_buffers(vif (trace_create_savedcmd () <0 ) goto out_free_temp_buffer; -if (!alloc_cpumask_var (&global_trace.pipe_cpumask,GFP_KERNEL )) +if (!zalloc_cpumask_var (&global_trace.pipe_cpumask,GFP_KERNEL )) goto out_free_savedcmd;/* TODO: make the number of buffers hot pluggable with CPUS */
Greg Kroah-Hartman
maintainerPATCH 369/511 md/md-bitmap: remove unnecessary local variable in backlog_store()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
commit b4d129640f194ffc4cc64c3e97f98ae944c072e8 upstream.
Local variable is definied first in the beginning of backlog_store(), there is no need to define it again.
--- drivers/md/md-bitmap.c | 2 -- 1 file changed, 2 deletions(-)
drivers/md/md-bitmap.c +0 -2
@@ -2512,8 +2512,6 @@ backlog_store(struct mddev *mddev, constmddev_destroy_serial_pool (mddev,NULL , false); }else if (backlog && !mddev->serial_info_pool) {/* serial_info_pool is needed since backlog is not zero */ -struct md_rdev *rdev; -rdev_for_each (rdev, mddev)mddev_create_serial_pool (mddev, rdev, false); }
Greg Kroah-Hartman
maintainerPATCH 370/511 Revert "drm/amdgpu: install stub fence into potential unused fence pointers"
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
This reverts commit 4921792e04f2125b5eadef9dbe9417a8354c7eff which is commit 187916e6ed9d0c3b3abc27429f7a5f8c936bd1f0 upstream.
It is reported to cause a lot of log spam, so should be reverted.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -4
@@ -2260,7 +2260,6 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(stamdgpu_vm_bo_base_init (&bo_va->base, vm, bo); bo_va->ref_count =1 ; - bo_va->last_pt_update =dma_fence_get_stub ();INIT_LIST_HEAD (&bo_va->valids);INIT_LIST_HEAD (&bo_va->invalids);
@@ -2975,8 +2974,7 @@ int amdgpu_vm_init(struct amdgpu_device vm->update_funcs = &amdgpu_vm_cpu_funcs; else vm->update_funcs = &amdgpu_vm_sdma_funcs; - - vm->last_update =dma_fence_get_stub (); + vm->last_update =NULL ; vm->last_unlocked =dma_fence_get_stub ();mutex_init (&vm->eviction_lock);
@@ -3119,7 +3117,7 @@ int amdgpu_vm_make_compute(struct amdgpu vm->update_funcs = &amdgpu_vm_sdma_funcs; }dma_fence_put (vm->last_update); - vm->last_update =dma_fence_get_stub (); + vm->last_update =NULL ; vm->is_compute_context = true;/* Free the shadow bo for compute VM */
Greg Kroah-Hartman
maintainerPATCH 371/511 udf: initialize newblock to 0
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tom Rix <[email protected]>
commit 23970a1c9475b305770fd37bebfec7a10f263787 upstream.
The clang build reports this errorfs/udf/inode.c:805:6: error: variable 'newblock' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
if (*err < 0)
^~~~~~~~newblock is never set before error handling jump. Initialize newblock to 0 and remove redundant settings.
Message-Id: <[email protected]>
--- fs/udf/inode.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/udf/inode.c +1 -3
@@ -695,7 +695,7 @@ static sector_t inode_getblk(struct inodstruct kernel_lb_addr eloc, tmpeloc;int c =1 ;loff_t lbcount =0 , b_off =0 ; -udf_pblk_t newblocknum, newblock; +udf_pblk_t newblocknum, newblock =0 ;sector_t offset =0 ;int8_t etype;struct udf_inode_info *iinfo =UDF_I (inode);
@@ -798,7 +798,6 @@ static sector_t inode_getblk(struct inod ret =udf_do_extend_file (inode, &prev_epos, laarr, hole_len);if (ret <0 ) { *err = ret; - newblock =0 ; goto out_free; } c =0 ;
@@ -861,7 +860,6 @@ static sector_t inode_getblk(struct inod goal, err);if (!newblocknum) { *err = -ENOSPC ; - newblock =0 ; goto out_free; }if (isBeyondEOF)
Greg Kroah-Hartman
maintainerPATCH 372/511 net/ipv6: SKB symmetric hash should incorporate transport ports
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quan Tian <[email protected]>
commit a5e2151ff9d5852d0ababbbcaeebd9646af9c8d9 upstream.
__skb_get_hash_symmetric() was added to compute a symmetric hash over the protocol, addresses and transport ports, by commit eb70db875671 ("packet: Use symmetric hash for PACKET_FANOUT_HASH."). It uses flow_keys_dissector_symmetric_keys as the flow_dissector to incorporate IPv4 addresses, IPv6 addresses and ports. However, it should not specify the flag as FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL, which stops further dissection when an IPv6 flow label is encountered, making transport ports not being incorporated in such case.
As a consequence, the symmetric hash is based on 5-tuple for IPv4 but 3-tuple for IPv6 when flow label is present. It caused a few problems, e.g. when nft symhash and openvswitch l4_sym rely on the symmetric hash to perform load balancing as different L4 flows between two given IPv6 addresses would always get the same symmetric hash, leading to uneven traffic distribution.
Removing the use of FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL makes sure the symmetric hash is based on 5-tuple for both IPv4 and IPv6 consistently.
--- net/core/flow_dissector.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/core/flow_dissector.c +1 -2
@@ -1614,8 +1614,7 @@ u32 __skb_get_hash_symmetric(const strucmemset (&keys,0 ,sizeof (keys));__skb_flow_dissect (NULL , skb, &flow_keys_dissector_symmetric, - &keys,NULL ,0 ,0 ,0 , -FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL ); + &keys,NULL ,0 ,0 ,0 ,0 );return __flow_hash_from_keys (&keys, &hashrnd); }
Greg Kroah-Hartman
maintainerPATCH 373/511 io_uring: always lock in io_apoll_task_func
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
From: Dylan Yudaken <[email protected]>
[ upstream commit c06c6c5d276707e04cedbcc55625e984922118aa ]
This is required for the failure case (io_req_complete_failed) and is missing.
The alternative would be to only lock in the failure path, however all of the non-error paths in io_poll_check_events that do not do not return IOU_POLL_NO_ACTION end up locking anyway. The only extraneous lock would be for the multishot poll overflowing the CQE ring, however multishot poll would probably benefit from being locked as it will allow completions to be batched.
So it seems reasonable to lock always.
--- io_uring/io_uring.c | 1 + 1 file changed, 1 insertion(+)
io_uring/io_uring.c +1 -0
@@ -5716,6 +5716,7 @@ static void io_apoll_task_func(struct ioif (ret >0 )return ; +io_tw_lock (req->ctx, locked);io_poll_remove_entries (req);spin_lock (&ctx->completion_lock);hash_del (&req->hash_node);
Greg Kroah-Hartman
maintainerPATCH 374/511 io_uring: break out of iowq iopoll on teardown
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
[ upstream commit 45500dc4e01c167ee063f3dcc22f51ced5b2b1e9 ]
io-wq will retry iopoll even when it failed with -EAGAIN. If that races with task exit, which sets TIF_NOTIFY_SIGNAL for all its workers, such workers might potentially infinitely spin retrying iopoll again and again and each time failing on some allocation / waiting / etc. Don't keep spinning if io-wq is dying.
--- io_uring/io-wq.c | 10 ++++++++++ io_uring/io-wq.h | 1 + io_uring/io_uring.c | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-)
io_uring/io-wq.c +10 -0
@@ -176,6 +176,16 @@ static void io_worker_ref_put(struct io_complete (&wq->worker_done); } +bool io_wq_worker_stopped (void ) +{ +struct io_worker *worker = current->pf_io_worker; + +if (WARN_ON_ONCE (!io_wq_current_is_worker ())) +return true; + +return test_bit (IO_WQ_BIT_EXIT , &worker->wqe->wq->state); +} +static void io_worker_cancel_cb (struct io_worker *worker) {struct io_wqe_acct *acct =io_wqe_get_acct (worker);
io_uring/io-wq.h +1 -0
@@ -129,6 +129,7 @@ void io_wq_hash_work(struct io_wq_work *int io_wq_cpu_affinity (struct io_wq *wq,cpumask_var_t mask);int io_wq_max_workers (struct io_wq *wq,int *new_count); +bool io_wq_worker_stopped (void );static inline bool io_wq_is_hashed (struct io_wq_work *work) {
io_uring/io_uring.c +2 -1
@@ -7069,7 +7069,8 @@ static void io_wq_submit_work(struct io_*/ if (ret != -EAGAIN || !(req->ctx->flags &IORING_SETUP_IOPOLL ))break ; - +if (io_wq_worker_stopped ()) +break ;/* * If REQ_F_NOWAIT is set, then don't wait or retry with * poll. -EAGAIN is final for that case.
Greg Kroah-Hartman
maintainerPATCH 375/511 io_uring: break iopolling on signal
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
[ upstream commit dc314886cb3d0e4ab2858003e8de2917f8a3ccbd ]
Don't keep spinning iopoll with a signal set. It'll eventually return back, e.g. by virtue of need_resched(), but it's not a nice user experience.
--- io_uring/io_uring.c | 5 +++++ 1 file changed, 5 insertions(+)
io_uring/io_uring.c +5 -0
@@ -2668,6 +2668,11 @@ static int io_iopoll_check(struct io_rinbreak ; } ret =io_do_iopoll (ctx, &nr_events, min); + +if (task_sigpending (current)) { + ret = -EINTR ; + goto out; + } }while (!ret && nr_events < min && !need_resched ()); out:mutex_unlock (&ctx->uring_lock);
Greg Kroah-Hartman
maintainerPATCH 376/511 scsi: qla2xxx: Adjust IOCB resource on qpair create
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quinn Tran <[email protected]>
commit efa74a62aaa2429c04fe6cb277b3bf6739747d86 upstream.
During NVMe queue creation, a new qpair is created. FW resource limit needs to be re-adjusted to take into account the new qpair. Otherwise, NVMe command can not go through. This issue was discovered while testing/forcing FW execution to fail at load time.
Add call to readjust IOCB and exchange limit.
In addition, get FW state command and require FW to be running. Otherwise, error is generated.
--- drivers/scsi/qla2xxx/qla_gbl.h | 1 drivers/scsi/qla2xxx/qla_init.c | 52 +++++++++++++++++++++++++--------------- drivers/scsi/qla2xxx/qla_mbx.c | 3 ++ drivers/scsi/qla2xxx/qla_nvme.c | 1 4 files changed, 38 insertions(+), 19 deletions(-)
drivers/scsi/qla2xxx/qla_gbl.h +1 -0
@@ -143,6 +143,7 @@ void qla_edif_sess_down(struct scsi_qla_void qla_edif_clear_appdata (struct scsi_qla_host *vha,struct fc_port *fcport);const char *sc_to_str (uint16_t cmd); +void qla_adjust_iocb_limit (scsi_qla_host_t *vha);/* * Global Data in qla_os.c source file.
drivers/scsi/qla2xxx/qla_init.c +33 -19
74 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_mbx.c +3 -0
@@ -2207,6 +2207,9 @@ qla2x00_get_firmware_state(scsi_qla_hostql_dbg (ql_dbg_mbx + ql_dbg_verbose, vha,0x1054 ,"Entered %s.\n" , __func__); +if (!ha->flags.fw_started) +return QLA_FUNCTION_FAILED ; + mcp->mb[0 ] =MBC_GET_FIRMWARE_STATE ; mcp->out_mb =MBX_0 ;if (IS_FWI2_CAPABLE (vha->hw))
drivers/scsi/qla2xxx/qla_nvme.c +1 -0
@@ -127,6 +127,7 @@ static int qla_nvme_alloc_queue(struct n "Failed to allocate qpair\n");return -EINVAL ; } +qla_adjust_iocb_limit (vha); } *handle = qpair;
Greg Kroah-Hartman
maintainerPATCH 377/511 scsi: qla2xxx: Limit TMF to 8 per function
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quinn Tran <[email protected]>
commit a8ec192427e0516436e61f9ca9eb49c54eadfe0a upstream.
Per FW recommendation, 8 TMF's can be outstanding for each function. Previously, it allowed 8 per target.
Limit TMF to 8 per function.
--- drivers/scsi/qla2xxx/qla_def.h | 9 +++--- drivers/scsi/qla2xxx/qla_init.c | 55 ++++++++++++++++++++++++---------------- drivers/scsi/qla2xxx/qla_os.c | 2 + 3 files changed, 41 insertions(+), 25 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +5 -4
@@ -453,6 +453,7 @@ static inline be_id_t port_id_to_be_id(p }struct tmf_arg { +struct list_head tmf_elem;struct qla_qpair *qpair;struct fc_port *fcport;struct scsi_qla_host *vha;
@@ -2523,7 +2524,6 @@ enum rscn_addr_format { typedef struct fc_port { struct list_head list; struct scsi_qla_host *vha; - struct list_head tmf_pending; unsigned int conf_compl_supported:1; unsigned int deleted:2;
@@ -2544,9 +2544,6 @@ typedef struct fc_port { unsigned int do_prli_nvme:1;uint8_t nvme_flag; -uint8_t active_tmf; -#define MAX_ACTIVE_TMF 8 -uint8_t node_name[WWN_SIZE ];uint8_t port_name[WWN_SIZE ];port_id_t d_id;
@@ -4626,6 +4623,8 @@ struct qla_hw_data {uint32_t flt_region_aux_img_status_sec; };uint8_t active_image; +uint8_t active_tmf; +#define MAX_ACTIVE_TMF 8/* Needed for BEACON */ uint16_t beacon_blink_led;
@@ -4640,6 +4639,8 @@ struct qla_hw_data {struct qla_msix_entry *msix_entries; +struct list_head tmf_pending; +struct list_head tmf_active;struct list_head vp_list;/* list of VP */ unsigned long vp_idx_map[(MAX_MULTI_ID_FABRIC /8 ) /sizeof (unsigned long )];
drivers/scsi/qla2xxx/qla_init.c +34 -21
114 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_os.c +2 -0
@@ -2973,6 +2973,8 @@ qla2x00_probe_one(struct pci_dev *pdev,atomic_set (&ha->num_pend_mbx_stage3,0 );atomic_set (&ha->zio_threshold,DEFAULT_ZIO_THRESHOLD ); ha->last_zio_threshold =DEFAULT_ZIO_THRESHOLD ; +INIT_LIST_HEAD (&ha->tmf_pending); +INIT_LIST_HEAD (&ha->tmf_active);/* Assign ISP specific operations. */ if (IS_QLA2100 (ha)) {
Greg Kroah-Hartman
maintainerPATCH 378/511 scsi: qla2xxx: Fix deletion race condition
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quinn Tran <[email protected]>
commit 6dfe4344c168c6ca20fe7640649aacfcefcccb26 upstream.
System crash when using debug kernel due to link list corruption. The cause of the link list corruption is due to session deletion was allowed to queue up twice. Here's the internal trace that show the same port was allowed to double queue for deletion on different cpu.
20808683956 015 qla2xxx [0000:13:00.1]-e801:4: Scheduling sess ffff93ebf9306800 for deletion 50:06:0e:80:12:48:ff:50 fc4_type 1 20808683957 027 qla2xxx [0000:13:00.1]-e801:4: Scheduling sess ffff93ebf9306800 for deletion 50:06:0e:80:12:48:ff:50 fc4_type 1
Move the clearing/setting of deleted flag lock.
--- drivers/scsi/qla2xxx/qla_init.c | 16 ++++++++++++++-- drivers/scsi/qla2xxx/qla_target.c | 14 +++++++------- 2 files changed, 21 insertions(+), 9 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +14 -2
@@ -503,6 +503,7 @@ staticvoid qla24xx_handle_adisc_event (scsi_qla_host_t *vha,struct event_arg *ea) {struct fc_port *fcport = ea->fcport; +unsigned long flags; ql_dbg(ql_dbg_disc, vha, 0x20d2, "%s %8phC DS %d LS %d rc %d login %d|%d rscn %d|%d lid %d\n",
@@ -517,9 +518,15 @@ void qla24xx_handle_adisc_event(scsi_qlaql_dbg (ql_dbg_disc, vha,0x2066 ,"%s %8phC: adisc fail: post delete\n" , __func__, ea->fcport->port_name); + +spin_lock_irqsave (&vha->work_lock, flags);/* deleted = 0 & logout_on_delete = force fw cleanup */ - fcport->deleted =0 ; +if (fcport->deleted ==QLA_SESS_DELETED ) + fcport->deleted =0 ; + fcport->logout_on_delete =1 ; +spin_unlock_irqrestore (&vha->work_lock, flags); +qlt_schedule_sess_for_deletion (ea->fcport);return ; }
@@ -1441,7 +1448,6 @@ void __qla24xx_handle_gpdb_event(scsi_qlspin_lock_irqsave (&vha->hw->tgt.sess_lock, flags); ea->fcport->login_gen++; - ea->fcport->deleted =0 ; ea->fcport->logout_on_delete =1 ;if (!ea->fcport->login_succ && !IS_SW_RESV_ADDR (ea->fcport->d_id)) {
@@ -6147,6 +6153,8 @@ qla2x00_reg_remote_port(scsi_qla_host_tvoid qla2x00_update_fcport (scsi_qla_host_t *vha,fc_port_t *fcport) { +unsigned long flags; +if (IS_SW_RESV_ADDR (fcport->d_id))return ;
@@ -6156,7 +6164,11 @@ qla2x00_update_fcport(scsi_qla_host_t *vqla2x00_set_fcport_disc_state (fcport,DSC_UPD_FCPORT ); fcport->login_retry = vha->hw->login_retry_count; fcport->flags &= ~(FCF_LOGIN_NEEDED |FCF_ASYNC_SENT ); + +spin_lock_irqsave (&vha->work_lock, flags); fcport->deleted =0 ; +spin_unlock_irqrestore (&vha->work_lock, flags); +if (vha->hw->current_topology ==ISP_CFG_NL ) fcport->logout_on_delete =0 ;else
drivers/scsi/qla2xxx/qla_target.c +7 -7
@@ -1089,10 +1089,6 @@ void qlt_free_session_done(struct work_s (struct imm_ntfy_from_isp *)sess->iocb, SRB_NACK_LOGO); } -spin_lock_irqsave (&vha->work_lock, flags); - sess->flags &= ~FCF_ASYNC_SENT ; -spin_unlock_irqrestore (&vha->work_lock, flags); -spin_lock_irqsave (&ha->tgt.sess_lock, flags);if (sess->se_sess) { sess->se_sess =NULL ;
@@ -1102,7 +1098,6 @@ void qlt_free_session_done(struct work_sqla2x00_set_fcport_disc_state (sess,DSC_DELETED ); sess->fw_login_state =DSC_LS_PORT_UNAVAIL ; - sess->deleted =QLA_SESS_DELETED ;if (sess->login_succ && !IS_SW_RESV_ADDR (sess->d_id)) { vha->fcport_count--;
@@ -1154,10 +1149,15 @@ void qlt_free_session_done(struct work_s sess->explicit_logout =0 ;spin_unlock_irqrestore (&ha->tgt.sess_lock, flags); - sess->free_pending =0 ;qla2x00_dfs_remove_rport (vha, sess); +spin_lock_irqsave (&vha->work_lock, flags); + sess->flags &= ~FCF_ASYNC_SENT ; + sess->deleted =QLA_SESS_DELETED ; + sess->free_pending =0 ; +spin_unlock_irqrestore (&vha->work_lock, flags); +ql_dbg (ql_dbg_disc, vha,0xf001 ,"Unregistration of sess %p %8phC finished fcp_cnt %d\n" , sess, sess->port_name, vha->fcport_count);
@@ -1206,12 +1206,12 @@ void qlt_unreg_sess(struct fc_port *sess* management from being sent. */ sess->flags |=FCF_ASYNC_SENT ; + sess->deleted =QLA_SESS_DELETION_IN_PROGRESS ;spin_unlock_irqrestore (&sess->vha->work_lock, flags);if (sess->se_sess) vha->hw->tgt.tgt_ops->clear_nacl_from_fcport_map (sess); - sess->deleted =QLA_SESS_DELETION_IN_PROGRESS ;qla2x00_set_fcport_disc_state (sess,DSC_DELETE_PEND ); sess->last_rscn_gen = sess->rscn_gen; sess->last_login_gen = sess->login_gen;
Greg Kroah-Hartman
maintainerPATCH 379/511 scsi: qla2xxx: fix inconsistent TMF timeout
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quinn Tran <[email protected]>
commit 009e7fe4a1ed52276b332842a6b6e23b07200f2d upstream.
Different behavior were experienced of session being torn down vs not when TMF is timed out. When FW detects the time out, the session is torn down. When driver detects the time out, the session is not torn down.
Allow TMF error to return to upper layer without session tear down.
--- drivers/scsi/qla2xxx/qla_isr.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/qla2xxx/qla_isr.c +0 -1
@@ -2513,7 +2513,6 @@ qla24xx_tm_iocb_entry(scsi_qla_host_t *vcase CS_PORT_BUSY :case CS_INCOMPLETE :case CS_PORT_UNAVAILABLE : -case CS_TIMEOUT :case CS_RESET :if (atomic_read (&fcport->state) ==FCS_ONLINE ) { ql_dbg(ql_dbg_disc, fcport->vha, 0x3021,
Greg Kroah-Hartman
maintainerPATCH 380/511 scsi: qla2xxx: Fix command flush during TMF
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quinn Tran <[email protected]>
commit da7c21b72aa86e990af5f73bce6590b8d8d148d0 upstream.
For each TMF request, driver iterates through each qpair and flushes commands associated to the TMF. At the end of the qpair flush, a Marker is used to complete the flush transaction. This process was repeated for each qpair. The multiple flush and marker for this TMF request seems to cause confusion for FW.
Instead, 1 flush is sent to FW. Driver would wait for FW to go through all the I/Os on each qpair to be read then return. Driver then closes out the transaction with a Marker.
--- drivers/scsi/qla2xxx/qla_init.c | 74 +++++++++++++++++++++------------------- drivers/scsi/qla2xxx/qla_iocb.c | 1 drivers/scsi/qla2xxx/qla_os.c | 9 ++-- 3 files changed, 45 insertions(+), 39 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +39 -35
@@ -2004,12 +2004,11 @@ qla2x00_tmf_iocb_timeout(void *data)int rc, h;unsigned long flags; -if (sp->type ==SRB_MARKER ) { -complete (&tmf->u.tmf.comp); -return ; - } +if (sp->type ==SRB_MARKER ) + rc =QLA_FUNCTION_FAILED ; +else + rc =qla24xx_async_abort_cmd (sp, false); - rc =qla24xx_async_abort_cmd (sp, false);if (rc) {spin_lock_irqsave (sp->qpair->qp_lock_ptr, flags);for (h =1 ; h < sp->qpair->req->num_outstanding_cmds; h++) {
@@ -2131,6 +2130,17 @@ static void qla2x00_tmf_sp_done(srb_t *scomplete (&tmf->u.tmf.comp); } +static int qla_tmf_wait (struct tmf_arg *arg) +{ +/* there are only 2 types of error handling that reaches here, lun or target reset */ +if (arg->flags & (TCF_LUN_RESET |TCF_ABORT_TASK_SET |TCF_CLEAR_TASK_SET )) +return qla2x00_eh_wait_for_pending_commands (arg->vha, + arg->fcport->d_id.b24, arg->lun,WAIT_LUN ); +else +return qla2x00_eh_wait_for_pending_commands (arg->vha, + arg->fcport->d_id.b24, arg->lun,WAIT_TARGET ); +} +static int __qla2x00_async_tm_cmd (struct tmf_arg *arg) {
@@ -2138,8 +2148,9 @@ __qla2x00_async_tm_cmd(struct tmf_arg *astruct srb_iocb *tm_iocb;srb_t *sp;int rval =QLA_FUNCTION_FAILED ; -fc_port_t *fcport = arg->fcport; +u32 chip_gen, login_gen; +u64 jif;if (TMF_NOT_READY (arg->fcport)) { ql_dbg(ql_dbg_taskm, vha, 0x8032,
@@ -2184,8 +2195,27 @@ __qla2x00_async_tm_cmd(struct tmf_arg *a "TM IOCB failed (%x).\n", rval); } -if (!test_bit (UNLOADING , &vha->dpc_flags) && !IS_QLAFX00 (vha->hw)) - rval =qla26xx_marker (arg); +if (!test_bit (UNLOADING , &vha->dpc_flags) && !IS_QLAFX00 (vha->hw)) { + chip_gen = vha->hw->chip_reset; + login_gen = fcport->login_gen; + + jif = jiffies; +if (qla_tmf_wait (arg)) { +ql_log (ql_log_info, vha,0x803e , +"Waited %u ms Nexus=%ld:%06x:%llu.\n" , +jiffies_to_msecs (jiffies - jif), vha->host_no, + fcport->d_id.b24, arg->lun); + } + +if (chip_gen == vha->hw->chip_reset && login_gen == fcport->login_gen) { + rval =qla26xx_marker (arg); + }else { +ql_log (ql_log_info, vha,0x803e , +"Skip Marker due to disruption. Nexus=%ld:%06x:%llu.\n" , + vha->host_no, fcport->d_id.b24, arg->lun); + rval =QLA_FUNCTION_FAILED ; + } + } done_free_sp:/* ref: INIT */
@@ -2263,9 +2293,8 @@ qla2x00_async_tm_cmd(fc_port_t *fcport, uint32_t tag) {struct scsi_qla_host *vha = fcport->vha; -struct qla_qpair *qpair;struct tmf_arg a; -int i, rval =QLA_SUCCESS ; +int rval =QLA_SUCCESS ;if (TMF_NOT_READY (fcport))return QLA_SUSPENDED ;
@@ -2285,34 +2314,9 @@ qla2x00_async_tm_cmd(fc_port_t *fcport,if (qla_get_tmf (&a))return QLA_FUNCTION_FAILED ; -if (vha->hw->mqenable) { -for (i =0 ; i < vha->hw->num_qpairs; i++) { - qpair = vha->hw->queue_pair_map[i]; -if (!qpair) -continue ; - -if (TMF_NOT_READY (fcport)) { -ql_log (ql_log_warn, vha,0x8026 , -"Unable to send TM due to disruption.\n" ); - rval =QLA_SUSPENDED ; -break ; - } - - a.qpair = qpair; - a.flags = flags|TCF_NOTMCMD_TO_TARGET ; - rval =__qla2x00_async_tm_cmd (&a); -if (rval) -break ; - } - } - -if (rval) - goto bailout; - a.qpair = vha->hw->base_qpair; rval =__qla2x00_async_tm_cmd (&a); -bailout:qla_put_tmf (&a);return rval; }
drivers/scsi/qla2xxx/qla_iocb.c +1 -0
@@ -3887,6 +3887,7 @@ qla_marker_iocb(srb_t *sp, struct mrk_en { mrk->entry_type =MARKER_TYPE ; mrk->modifier = sp->u.iocb_cmd.u.tmf.modifier; + mrk->handle =make_handle (sp->qpair->req->id, sp->handle);if (sp->u.iocb_cmd.u.tmf.modifier !=MK_SYNC_ALL ) { mrk->nport_handle =cpu_to_le16 (sp->u.iocb_cmd.u.tmf.loop_id);int_to_scsilun (sp->u.iocb_cmd.u.tmf.lun, (struct scsi_lun *)&mrk->lun);
drivers/scsi/qla2xxx/qla_os.c +5 -4
@@ -1470,8 +1470,9 @@ qla2xxx_eh_device_reset(struct scsi_cmnd goto eh_reset_failed; } err =3 ; -if (qla2x00_eh_wait_for_pending_commands (vha, sdev->id, - sdev->lun,WAIT_LUN ) !=QLA_SUCCESS ) { +if (qla2x00_eh_wait_for_pending_commands (vha, fcport->d_id.b24, + cmd->device->lun, +WAIT_LUN ) !=QLA_SUCCESS ) {ql_log (ql_log_warn, vha,0x800d ,"wait for pending cmds failed for cmd=%p.\n" , cmd); goto eh_reset_failed;
@@ -1537,8 +1538,8 @@ qla2xxx_eh_target_reset(struct scsi_cmnd goto eh_reset_failed; } err =3 ; -if (qla2x00_eh_wait_for_pending_commands (vha, sdev->id, -0 ,WAIT_TARGET ) !=QLA_SUCCESS ) { +if (qla2x00_eh_wait_for_pending_commands (vha, fcport->d_id.b24,0 , +WAIT_TARGET ) !=QLA_SUCCESS ) {ql_log (ql_log_warn, vha,0x800d ,"wait for pending cmds failed for cmd=%p.\n" , cmd); goto eh_reset_failed;
Greg Kroah-Hartman
maintainerPATCH 381/511 scsi: qla2xxx: Fix erroneous link up failure
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quinn Tran <[email protected]>
commit 5b51f35d127e7bef55fa869d2465e2bca4636454 upstream.
Link up failure occurred where driver failed to see certain events from FW indicating link up (AEN 8011) and fabric login completion (AEN 8014). Without these 2 events, driver would not proceed forward to scan the fabric. The cause of this is due to delay in the receive of interrupt for Mailbox 60 that causes qla to set the fw_started flag late. The late setting of this flag causes other interrupts to be dropped. These dropped interrupts happen to be the link up (AEN 8011) and fabric login completion (AEN 8014).
Set fw_started flag early to prevent interrupts being dropped.
--- drivers/scsi/qla2xxx/qla_init.c | 3 ++- drivers/scsi/qla2xxx/qla_isr.c | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +2 -1
@@ -4817,15 +4817,16 @@ qla2x00_init_rings(scsi_qla_host_t *vha)if (ha->flags.edif_enabled) mid_init_cb->init_cb.frame_payload_size =cpu_to_le16 (ELS_MAX_PAYLOAD ); +QLA_FW_STARTED (ha); rval =qla2x00_init_firmware (vha, ha->init_cb_size); next_check:if (rval) { +QLA_FW_STOPPED (ha);ql_log (ql_log_fatal, vha,0x00d2 ,"Init Firmware **** FAILED ****.\n" ); }else {ql_dbg (ql_dbg_init, vha,0x00d3 ,"Init Firmware -- success.\n" ); -QLA_FW_STARTED (ha); vha->u_ql2xexchoffld = vha->u_ql2xiniexchg =0 ; }
drivers/scsi/qla2xxx/qla_isr.c +5 -1
@@ -1121,8 +1121,12 @@ qla2x00_async_event(scsi_qla_host_t *vhaunsigned long flags;fc_port_t *fcport =NULL ; -if (!vha->hw->flags.fw_started) +if (!vha->hw->flags.fw_started) { +ql_log (ql_log_warn, vha,0x50ff , +"Dropping AEN - %04x %04x %04x %04x.\n" , + mb[0 ], mb[1 ], mb[2 ], mb[3 ]);return ; + }/* Setup to process RIO completion. */ handle_cnt =0 ;
Greg Kroah-Hartman
maintainerPATCH 382/511 scsi: qla2xxx: Turn off noisy message log
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quinn Tran <[email protected]>
commit 8ebaa45163a3fedc885c1dc7d43ea987a2f00a06 upstream.
Some consider noisy log as test failure. Turn off noisy message log.
--- drivers/scsi/qla2xxx/qla_nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_nvme.c +1 -1
@@ -653,7 +653,7 @@ static int qla_nvme_post_cmd(struct nvme rval =qla2x00_start_nvme_mq (sp);if (rval !=QLA_SUCCESS ) { -ql_log (ql_log_warn, vha,0x212d , +ql_dbg (ql_dbg_io + ql_dbg_verbose, vha,0x212d ,"qla2x00_start_nvme_mq failed = %d\n" , rval); sp->priv =NULL ; priv->sp =NULL ;
Greg Kroah-Hartman
maintainerPATCH 383/511 scsi: qla2xxx: Fix session hang in gnl
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quinn Tran <[email protected]>
commit 39d22740712c7563a2e18c08f033deeacdaf66e7 upstream.
Connection does not resume after a host reset / chip reset. The cause of the blockage is due to the FCF_ASYNC_ACTIVE left on. The gnl command was interrupted by the chip reset. On exiting the command, this flag should be turn off to allow relogin to reoccur. Clear this flag to prevent blockage.
--- drivers/scsi/qla2xxx/qla_init.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +3 -2
@@ -1136,7 +1136,7 @@ int qla24xx_async_gnl(struct scsi_qla_hou16 *mb;if (!vha->flags.online || (fcport->flags &FCF_ASYNC_SENT )) -return rval; + goto done;ql_dbg (ql_dbg_disc, vha,0x20d9 ,"Async-gnlist WWPN %8phC \n" , fcport->port_name);
@@ -1190,8 +1190,9 @@ int qla24xx_async_gnl(struct scsi_qla_ho done_free_sp:/* ref: INIT */ kref_put (&sp->cmd_kref, qla2x00_sp_release); + fcport->flags &= ~(FCF_ASYNC_SENT ); done: - fcport->flags &= ~(FCF_ASYNC_ACTIVE |FCF_ASYNC_SENT ); + fcport->flags &= ~(FCF_ASYNC_ACTIVE );return rval; }
Greg Kroah-Hartman
maintainerPATCH 384/511 scsi: qla2xxx: Fix TMF leak through
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quinn Tran <[email protected]>
commit 5d3148d8e8b05f084e607ac3bd55a4c317a9f934 upstream.
Task management can retry up to 5 times when FW resource becomes bottle neck. Between the retries, there is a short sleep. Current code assumes the chip has not reset or session has not changed.
Check for chip reset or session change before sending Task management.
--- drivers/scsi/qla2xxx/qla_init.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +14 -6
@@ -2040,10 +2040,14 @@ static void qla_marker_sp_done(srb_t *spcomplete (&tmf->u.tmf.comp); } -#define START_SP_W_RETRIES (_sp, _rval) \ +#define START_SP_W_RETRIES (_sp, _rval, _chip_gen, _login_gen) \ {\ int cnt = 5; \ do { \ + if (_chip_gen != sp->vha->hw->chip_reset || _login_gen != sp->fcport->login_gen) {\ + _rval = EINVAL; \ + break; \ + } \ _rval = qla2x00_start_sp(_sp); \ if (_rval == EAGAIN) \ msleep(1); \
@@ -2066,6 +2070,7 @@ qla26xx_marker(struct tmf_arg *arg)srb_t *sp;int rval =QLA_FUNCTION_FAILED ;fc_port_t *fcport = arg->fcport; +u32 chip_gen, login_gen;if (TMF_NOT_READY (arg->fcport)) { ql_dbg(ql_dbg_taskm, vha, 0x8039,
@@ -2075,6 +2080,9 @@ qla26xx_marker(struct tmf_arg *arg)return QLA_SUSPENDED ; } + chip_gen = vha->hw->chip_reset; + login_gen = fcport->login_gen; +/* ref: INIT */ sp =qla2xxx_get_qpair_sp (vha, arg->qpair, fcport,GFP_KERNEL );if (!sp)
@@ -2092,7 +2100,7 @@ qla26xx_marker(struct tmf_arg *arg) tm_iocb->u.tmf.loop_id = fcport->loop_id; tm_iocb->u.tmf.vp_index = vha->vp_idx; -START_SP_W_RETRIES (sp, rval); +START_SP_W_RETRIES (sp, rval, chip_gen, login_gen); ql_dbg(ql_dbg_taskm, vha, 0x8006, "Async-marker hdl=%x loop-id=%x portid=%06x modifier=%x lun=%lld qp=%d rval %d.\n",
@@ -2161,6 +2169,9 @@ __qla2x00_async_tm_cmd(struct tmf_arg *areturn QLA_SUSPENDED ; } + chip_gen = vha->hw->chip_reset; + login_gen = fcport->login_gen; +/* ref: INIT */ sp =qla2xxx_get_qpair_sp (vha, arg->qpair, fcport,GFP_KERNEL );if (!sp)
@@ -2178,7 +2189,7 @@ __qla2x00_async_tm_cmd(struct tmf_arg *a tm_iocb->u.tmf.flags = arg->flags; tm_iocb->u.tmf.lun = arg->lun; -START_SP_W_RETRIES (sp, rval); +START_SP_W_RETRIES (sp, rval, chip_gen, login_gen); ql_dbg(ql_dbg_taskm, vha, 0x802f, "Async-tmf hdl=%x loop-id=%x portid=%06x ctrl=%x lun=%lld qp=%d rval=%x.\n",
@@ -2197,9 +2208,6 @@ __qla2x00_async_tm_cmd(struct tmf_arg *a }if (!test_bit (UNLOADING , &vha->dpc_flags) && !IS_QLAFX00 (vha->hw)) { - chip_gen = vha->hw->chip_reset; - login_gen = fcport->login_gen; - jif = jiffies;if (qla_tmf_wait (arg)) { ql_log(ql_log_info, vha, 0x803e,
Greg Kroah-Hartman
maintainerPATCH 385/511 scsi: qla2xxx: Remove unsupported ql2xenabledif option
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manish Rangankar <[email protected]>
commit e9105c4b7a9208a21a9bda133707624f12ddabc2 upstream.
User accidently passed module parameter ql2xenabledif=1 which is unsupported. However, driver still initialized which lead to guard tag errors during device discovery.
Remove unsupported ql2xenabledif=1 option and validate the user input.
--- drivers/scsi/qla2xxx/qla_attr.c | 2 -- drivers/scsi/qla2xxx/qla_dbg.c | 2 +- drivers/scsi/qla2xxx/qla_os.c | 9 +++++++-- 3 files changed, 8 insertions(+), 5 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +0 -2
@@ -3084,8 +3084,6 @@ qla24xx_vport_create(struct fc_vport *fc vha->flags.difdix_supported =1 ;ql_dbg (ql_dbg_user, vha,0x7082 ,"Registered for DIF/DIX type 1 and 3 protection.\n" ); -if (ql2xenabledif ==1 ) - prot =SHOST_DIX_TYPE0_PROTECTION ;scsi_host_set_prot (vha->host, prot |SHOST_DIF_TYPE1_PROTECTION | SHOST_DIF_TYPE2_PROTECTION
drivers/scsi/qla2xxx/qla_dbg.c +1 -1
@@ -18,7 +18,7 @@* | Queue Command and IO tracing | 0x3074 | 0x300b | * | | | 0x3027-0x3028 | * | | | 0x303d-0x3041 | -* | | | 0x302d,0x3033 | +* | | | 0x302e,0x3033 | * | | | 0x3036,0x3038 | * | | | 0x303a | * | DPC Thread | 0x4023 | 0x4002,0x4013 |
drivers/scsi/qla2xxx/qla_os.c +7 -2
@@ -3252,6 +3252,13 @@ qla2x00_probe_one(struct pci_dev *pdev, host->max_id = ha->max_fibre_devices; host->cmd_per_lun =3 ; host->unique_id = host->host_no; + +if (ql2xenabledif && ql2xenabledif !=2 ) { +ql_log (ql_log_warn, base_vha,0x302d , +"Invalid value for ql2xenabledif, resetting it to default (2)\n" ); + ql2xenabledif =2 ; + } +if (IS_T10_PI_CAPABLE (ha) && ql2xenabledif) host->max_cmd_len =32 ;else
@@ -3485,8 +3492,6 @@ skip_dpc: base_vha->flags.difdix_supported =1 ;ql_dbg (ql_dbg_init, base_vha,0x00f1 ,"Registering for DIF/DIX type 1 and 3 protection.\n" ); -if (ql2xenabledif ==1 ) - prot =SHOST_DIX_TYPE0_PROTECTION ;if (ql2xprotmask)scsi_host_set_prot (host, ql2xprotmask);else
Greg Kroah-Hartman
maintainerPATCH 386/511 scsi: qla2xxx: Flush mailbox commands on chip reset
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quinn Tran <[email protected]>
commit 6d0b65569c0a10b27c49bacd8d25bcd406003533 upstream.
Fix race condition between Interrupt thread and Chip reset thread in trying to flush the same mailbox. With the race condition, the "ha->mbx_intr_comp" will get an extra complete() call. The extra complete call create erroneous mailbox timeout condition when the next mailbox is sent where the mailbox call does not wait for interrupt to arrive. Instead, it advances without waiting.
Add lock protection around the check for mailbox completion.
--- drivers/scsi/qla2xxx/qla_def.h | 1 - drivers/scsi/qla2xxx/qla_init.c | 7 ++++--- drivers/scsi/qla2xxx/qla_mbx.c | 4 ---- drivers/scsi/qla2xxx/qla_os.c | 1 - 4 files changed, 4 insertions(+), 9 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +0 -1
@@ -4353,7 +4353,6 @@ struct qla_hw_data {uint8_t aen_mbx_count;atomic_t num_pend_mbx_stage1;atomic_t num_pend_mbx_stage2; -atomic_t num_pend_mbx_stage3;uint16_t frame_payload_size;uint32_t login_retry_count;
drivers/scsi/qla2xxx/qla_init.c +4 -3
@@ -7472,14 +7472,15 @@ qla2x00_abort_isp_cleanup(scsi_qla_host_ }/* purge MBox commands */ -if (atomic_read (&ha->num_pend_mbx_stage3)) { +spin_lock_irqsave (&ha->hardware_lock, flags); +if (test_bit (MBX_INTR_WAIT , &ha->mbx_cmd_flags)) {clear_bit (MBX_INTR_WAIT , &ha->mbx_cmd_flags);complete (&ha->mbx_intr_comp); } +spin_unlock_irqrestore (&ha->hardware_lock, flags); i =0 ; -while (atomic_read (&ha->num_pend_mbx_stage3) || -atomic_read (&ha->num_pend_mbx_stage2) || +while (atomic_read (&ha->num_pend_mbx_stage2) ||atomic_read (&ha->num_pend_mbx_stage1)) {msleep (20 ); i++;
drivers/scsi/qla2xxx/qla_mbx.c +0 -4
@@ -273,7 +273,6 @@ qla2x00_mailbox_command(scsi_qla_host_tspin_unlock_irqrestore (&ha->hardware_lock, flags); wait_time = jiffies; -atomic_inc (&ha->num_pend_mbx_stage3);if (!wait_for_completion_timeout (&ha->mbx_intr_comp, mcp->tov *HZ )) { ql_dbg(ql_dbg_mbx, vha, 0x117a,
@@ -290,7 +289,6 @@ qla2x00_mailbox_command(scsi_qla_host_tspin_unlock_irqrestore (&ha->hardware_lock, flags);atomic_dec (&ha->num_pend_mbx_stage2); -atomic_dec (&ha->num_pend_mbx_stage3); rval =QLA_ABORTED ; goto premature_exit; }
@@ -302,11 +300,9 @@ qla2x00_mailbox_command(scsi_qla_host_t ha->flags.mbox_busy =0 ;spin_unlock_irqrestore (&ha->hardware_lock, flags);atomic_dec (&ha->num_pend_mbx_stage2); -atomic_dec (&ha->num_pend_mbx_stage3); rval =QLA_ABORTED ; goto premature_exit; } -atomic_dec (&ha->num_pend_mbx_stage3);if (time_after (jiffies, wait_time +5 *HZ )) ql_log(ql_log_warn, vha, 0x1015, "cmd=0x%x, waited %d msecs\n",
drivers/scsi/qla2xxx/qla_os.c +0 -1
@@ -2971,7 +2971,6 @@ qla2x00_probe_one(struct pci_dev *pdev, ha->max_exchg =FW_MAX_EXCHANGES_CNT ;atomic_set (&ha->num_pend_mbx_stage1,0 );atomic_set (&ha->num_pend_mbx_stage2,0 ); -atomic_set (&ha->num_pend_mbx_stage3,0 );atomic_set (&ha->zio_threshold,DEFAULT_ZIO_THRESHOLD ); ha->last_zio_threshold =DEFAULT_ZIO_THRESHOLD ;INIT_LIST_HEAD (&ha->tmf_pending);
Greg Kroah-Hartman
maintainerPATCH 387/511 scsi: qla2xxx: Fix smatch warn for qla_init_iocb_limit()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nilesh Javali <[email protected]>
commit b496953dd0444001b12f425ea07d78c1f47e3193 upstream.
Fix indentation for warning reported by smatch:
drivers/scsi/qla2xxx/qla_init.c:4199 qla_init_iocb_limit() warn: inconsistent indenting
--- drivers/scsi/qla2xxx/qla_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_init.c +1 -1
@@ -4205,7 +4205,7 @@ void qla_init_iocb_limit(scsi_qla_host_tu8 i;struct qla_hw_data *ha = vha->hw; -__qla_adjust_iocb_limit (ha->base_qpair); +__qla_adjust_iocb_limit (ha->base_qpair); ha->base_qpair->fwres.iocbs_used =0 ; ha->base_qpair->fwres.exch_used =0 ;
Greg Kroah-Hartman
maintainerPATCH 388/511 scsi: qla2xxx: Error code did not return to upper layer
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quinn Tran <[email protected]>
commit 0ba0b018f94525a6b32f5930f980ce9b62b72e6f upstream.
TMF was returned with an error code. The error code was not preserved to be returned to upper layer. Instead, the error code from the Marker was returned.
Preserve error code from TMF and return it to upper layer.
--- drivers/scsi/qla2xxx/qla_init.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/qla2xxx/qla_init.c +2 -0
@@ -2225,6 +2225,8 @@ __qla2x00_async_tm_cmd(struct tmf_arg *a rval =QLA_FUNCTION_FAILED ; } } +if (tm_iocb->u.tmf.data) + rval = tm_iocb->u.tmf.data; done_free_sp:/* ref: INIT */
Greg Kroah-Hartman
maintainerPATCH 389/511 scsi: qla2xxx: Fix firmware resource tracking
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quinn Tran <[email protected]>
commit e370b64c7db96384a0886a09a9d80406e4c663d7 upstream.
The storage was not draining I/Os and the work load was not spread out across different CPUs evenly. This led to firmware resource counters getting overrun on the busy CPU. This overrun prevented error recovery from happening in a timely manner.
By switching the counter to atomic, it allows the count to be little more accurate to prevent the overrun.
--- drivers/scsi/qla2xxx/qla_def.h | 11 +++++++ drivers/scsi/qla2xxx/qla_dfs.c | 10 ++++++ drivers/scsi/qla2xxx/qla_init.c | 8 +++++ drivers/scsi/qla2xxx/qla_inline.h | 57 +++++++++++++++++++++++++++++++++++++- drivers/scsi/qla2xxx/qla_os.c | 5 ++- 5 files changed, 88 insertions(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +11 -0
@@ -3726,6 +3726,16 @@ struct qla_fw_resources {u16 pad; }; +struct qla_fw_res { +u16 iocb_total; +u16 iocb_limit; +atomic_t iocb_used; + +u16 exch_total; +u16 exch_limit; +atomic_t exch_used; +}; +#define QLA_IOCB_PCT_LIMIT 95/*Queue pair data structure */
@@ -4768,6 +4778,7 @@ struct qla_hw_data {spinlock_t sadb_lock;/* protects list */ struct els_reject elsrej;u8 edif_post_stop_cnt_down; +struct qla_fw_res fwres____cacheline_aligned ; };#define RX_ELS_SIZE (roundup(sizeof(struct enode) + ELS_MAX_PAYLOAD, SMP_CACHE_BYTES))
drivers/scsi/qla2xxx/qla_dfs.c +10 -0
@@ -276,6 +276,16 @@ qla_dfs_fw_resource_cnt_show(struct seq_seq_printf (s,"estimate exchange used[%d] high water limit [%d] n" , exch_used, ha->base_qpair->fwres.exch_limit); + +if (ql2xenforce_iocb_limit ==2 ) { + iocbs_used =atomic_read (&ha->fwres.iocb_used); + exch_used =atomic_read (&ha->fwres.exch_used); +seq_printf (s," estimate iocb2 used [%d] high water limit [%d]\n" , + iocbs_used, ha->fwres.iocb_limit); + +seq_printf (s," estimate exchange2 used[%d] high water limit [%d] \n" , + exch_used, ha->fwres.exch_limit); + } }return 0 ;
drivers/scsi/qla2xxx/qla_init.c +8 -0
@@ -4218,6 +4218,14 @@ void qla_init_iocb_limit(scsi_qla_host_t ha->queue_pair_map[i]->fwres.exch_used =0 ; } } + + ha->fwres.iocb_total = ha->orig_fw_iocb_count; + ha->fwres.iocb_limit = (ha->orig_fw_iocb_count *QLA_IOCB_PCT_LIMIT ) /100 ; + ha->fwres.exch_total = ha->orig_fw_xcb_count; + ha->fwres.exch_limit = (ha->orig_fw_xcb_count *QLA_IOCB_PCT_LIMIT ) /100 ; + +atomic_set (&ha->fwres.iocb_used,0 ); +atomic_set (&ha->fwres.exch_used,0 ); }void qla_adjust_iocb_limit (scsi_qla_host_t *vha)
drivers/scsi/qla2xxx/qla_inline.h +56 -1
84 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_os.c +3 -2
@@ -40,10 +40,11 @@ module_param(ql2xfulldump_on_mpifail, inMODULE_PARM_DESC (ql2xfulldump_on_mpifail,"Set this to take full dump on MPI hang." ); -int ql2xenforce_iocb_limit =1 ; +int ql2xenforce_iocb_limit =2 ;module_param (ql2xenforce_iocb_limit, int,S_IRUGO |S_IWUSR );MODULE_PARM_DESC (ql2xenforce_iocb_limit, -"Enforce IOCB throttling, to avoid FW congestion. (default: 1)" ); +"Enforce IOCB throttling, to avoid FW congestion. (default: 2) " +"1: track usage per queue, 2: track usage per adapter" );/* * CT6 CTX allocation cache
Greg Kroah-Hartman
maintainerPATCH 390/511 fbdev/ep93xx-fb: Do not assign to struct fb_info.dev
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit f90a0e5265b60cdd3c77990e8105f79aa2fac994 upstream.
Do not assing the Linux device to struct fb_info.dev. The call to register_framebuffer() initializes the field to the fbdev device. Drivers should not override its value.
Fixes a bug where the driver incorrectly decreases the hardware device's reference counter and leaks the fbdev device.
v2:
* add Fixes tag (Dan)
--- drivers/video/fbdev/ep93xx-fb.c | 1 - 1 file changed, 1 deletion(-)
drivers/video/fbdev/ep93xx-fb.c +0 -1
@@ -474,7 +474,6 @@ static int ep93xxfb_probe(struct platforif (!info)return -ENOMEM ; - info->dev = &pdev->dev;platform_set_drvdata (pdev, info); fbi = info->par; fbi->mach_info = mach_info;
Greg Kroah-Hartman
maintainerPATCH 391/511 clk: qcom: camcc-sc7180: fix async resume during probe
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit c948ff727e25297f3a703eb5349dd66aabf004e4 upstream.
To make sure that the controller is runtime resumed and its power domain is enabled before accessing its registers during probe, the synchronous runtime PM interface must be used.
--- drivers/clk/qcom/camcc-sc7180.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/camcc-sc7180.c +1 -1
@@ -1677,7 +1677,7 @@ static int cam_cc_sc7180_probe(struct plreturn ret; } - ret =pm_runtime_get (&pdev->dev); + ret =pm_runtime_resume_and_get (&pdev->dev);if (ret)return ret;
Greg Kroah-Hartman
maintainerPATCH 392/511 drm/ast: Fix DRAM init on AST2200
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit 4cfe75f0f14f044dae66ad0e6eea812d038465d9 upstream.
Fix the test for the AST2200 in the DRAM initialization. The value in ast->chip has to be compared against an enum constant instead of a numerical value.
This bug got introduced when the driver was first imported into the kernel.
--- drivers/gpu/drm/ast/ast_post.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/ast/ast_post.c +1 -1
@@ -291,7 +291,7 @@ static void ast_init_dram_reg(struct drm ; }while (ast_read32 (ast,0x10100 ) !=0xa8 ); }else {/* AST2100/1100 */ -if (ast->chip ==AST2100 || ast->chip ==2200 ) +if (ast->chip ==AST2100 || ast->chip ==AST2200 ) dram_reg_info = ast2100_dram_table_data;else dram_reg_info = ast1100_dram_table_data;
Greg Kroah-Hartman
maintainerPATCH 393/511 clk: qcom: turingcc-qcs404: fix missing resume during probe
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit a9f71a033587c9074059132d34c74eabbe95ef26 upstream.
Drivers that enable runtime PM must make sure that the controller is runtime resumed before accessing its registers to prevent the power domain from being disabled.
--- drivers/clk/qcom/turingcc-qcs404.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/clk/qcom/turingcc-qcs404.c +12 -1
@@ -124,11 +124,22 @@ static int turingcc_probe(struct platforreturn ret; } + ret =pm_runtime_resume_and_get (&pdev->dev); +if (ret) +return ret; + ret =qcom_cc_probe (pdev, &turingcc_desc);if (ret <0 ) -return ret; + goto err_put_rpm; + +pm_runtime_put (&pdev->dev);return 0 ; + +err_put_rpm: +pm_runtime_put_sync (&pdev->dev); + +return ret; }static const struct dev_pm_ops turingcc_pm_ops = {
Greg Kroah-Hartman
maintainerPATCH 394/511 lib/test_meminit: allocate pages up to order MAX_ORDER
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Donnellan <[email protected]>
commit efb78fa86e95832b78ca0ba60f3706788a818938 upstream.
test_pages() tests the page allocator by calling alloc_pages() with different orders up to order 10.
However, different architectures and platforms support different maximum contiguous allocation sizes. The default maximum allocation order (MAX_ORDER) is 10, but architectures can use CONFIG_ARCH_FORCE_MAX_ORDER to override this. On platforms where this is less than 10, test_meminit() will blow up with a WARN(). This is expected, so let's not do that.
Replace the hardcoded "10" with the MAX_ORDER macro so that we test allocations up to the expected platform limit.
--- lib/test_meminit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/test_meminit.c +1 -1
@@ -86,7 +86,7 @@ static int __init test_pages(int *total_int failures =0 , num_tests =0 ;int i; -for (i =0 ; i <10 ; i++) +for (i =0 ; i <=MAX_ORDER ; i++) num_tests +=do_alloc_pages_order (i, &failures);REPORT_FAILURES_IN_FN ();
Greg Kroah-Hartman
maintainerPATCH 395/511 parisc: led: Fix LAN receive and transmit LEDs
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit 4db89524b084f712a887256391fc19d9f66c8e55 upstream.
Fix the LAN receive and LAN transmit LEDs, which where swapped up to now.
--- arch/parisc/include/asm/led.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/parisc/include/asm/led.h +2 -2
@@ -11,8 +11,8 @@#define LED1 0x02#define LED0 0x01/* bottom (or furthest left) LED */ -#define LED_LAN_TX LED0/* for LAN transmit activity */ -#define LED_LAN_RCV LED1/* for LAN receive activity */ +#define LED_LAN_RCV LED0/* for LAN receive activity */ +#define LED_LAN_TX LED1/* for LAN transmit activity */ #define LED_DISK_IO LED2/* for disk activity */ #define LED_HEARTBEAT LED3/* heartbeat */
Greg Kroah-Hartman
maintainerPATCH 396/511 parisc: led: Reduce CPU overhead for disk & lan LED computation
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit 358ad816e52d4253b38c2f312e6b1cbd89e0dbf7 upstream.
Older PA-RISC machines have LEDs which show the disk- and LAN-activity. The computation is done in software and takes quite some time, e.g. on a J6500 this may take up to 60% time of one CPU if the machine is loaded via network traffic.
Since most people don't care about the LEDs, start with LEDs disabled and just show a CPU heartbeat LED. The disk and LAN LEDs can be turned on manually via /proc/pdc/led.
--- drivers/parisc/led.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/parisc/led.c +2 -2
@@ -56,8 +56,8 @@static int led_type__read_mostly =-1 ;static unsigned char lastleds;/* LED state from most recent update */ static unsigned int led_heartbeat__read_mostly =1 ; -static unsigned int led_diskio__read_mostly =1 ; -static unsigned int led_lanrxtx__read_mostly =1 ; +static unsigned int led_diskio__read_mostly ; +static unsigned int led_lanrxtx__read_mostly ;static char lcd_text[32 ]__read_mostly ;static char lcd_text_default[32 ]__read_mostly ;static int lcd_no_led_support__read_mostly =0 ;/* KittyHawk doesn't support LED on its LCD */
Greg Kroah-Hartman
maintainerPATCH 397/511 pinctrl: cherryview: fix address_space_handler() argument
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Raag Jadav <[email protected]>
commit d5301c90716a8e20bc961a348182daca00c8e8f0 upstream.
First argument of acpi_*_address_space_handler() APIs is acpi_handle of the device, which is incorrectly passed in driver ->remove() path here. Fix it by passing the appropriate argument and while at it, make both API calls consistent using ACPI_HANDLE().
--- drivers/pinctrl/intel/pinctrl-cherryview.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/pinctrl/intel/pinctrl-cherryview.c +2 -3
@@ -1624,7 +1624,6 @@ static int chv_pinctrl_probe(struct platconst struct intel_pinctrl_soc_data *soc_data;struct intel_community *community;struct device *dev = &pdev->dev; -struct acpi_device *adev =ACPI_COMPANION (dev);struct intel_pinctrl *pctrl;acpi_status status;int ret, irq;
@@ -1687,7 +1686,7 @@ static int chv_pinctrl_probe(struct platif (ret)return ret; - status =acpi_install_address_space_handler (adev->handle, + status =acpi_install_address_space_handler (ACPI_HANDLE (dev), community->acpi_space_id, chv_pinctrl_mmio_access_handler,NULL , pctrl);
@@ -1704,7 +1703,7 @@ static int chv_pinctrl_remove(struct plastruct intel_pinctrl *pctrl =platform_get_drvdata (pdev);const struct intel_community *community = &pctrl->communities[0 ]; -acpi_remove_address_space_handler (ACPI_COMPANION (&pdev->dev), +acpi_remove_address_space_handler (ACPI_HANDLE (&pdev->dev), community->acpi_space_id, chv_pinctrl_mmio_access_handler);
Greg Kroah-Hartman
maintainerPATCH 398/511 dt-bindings: clock: xlnx,versal-clk: drop select:false
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 172044e30b00977784269e8ab72132a48293c654 upstream.
select:false makes the schema basically ignored and not effective, which is clearly not what we want for a device binding.
--- Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml | 2 -- 1 file changed, 2 deletions(-)
Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml +0 -2
@@ -16,8 +16,6 @@ description: | reads required input clock frequencies from the devicetree and acts as clock provider for all clock consumers of PS clocks. -select: false - properties: compatible: const: xlnx,versal-clk
Greg Kroah-Hartman
maintainerPATCH 399/511 clk: imx: pll14xx: dynamically configure PLL for 393216000/361267200Hz
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ahmad Fatoum <[email protected]>
commit 72d00e560d10665e6139c9431956a87ded6e9880 upstream.
Since commit b09c68dc57c9 ("clk: imx: pll14xx: Support dynamic rates"), the driver has the ability to dynamically compute PLL parameters to approximate the requested rates. This is not always used, because the logic is as follows:
- Check if the target rate is hardcoded in the frequency table
- Check if varying only kdiv is possible, so switch over is glitch free
- Compute rate dynamically by iterating over pdiv range
If we skip the frequency table for the 1443x PLL, we find that the computed values differ to the hardcoded ones. This can be valid if the hardcoded values guarantee for example an earlier lock-in or if the divisors are chosen, so that other important rates are more likely to be reached glitch-free.
For rates (393216000 and 361267200, this doesn't seem to be the case:
They are only approximated by existing parameters (393215995 and 361267196 Hz, respectively) and they aren't reachable glitch-free from other hardcoded frequencies. Dropping them from the table allows us to lock-in to these frequencies exactly.
This is immediately noticeable because they are the assigned-clock-rates for IMX8MN_AUDIO_PLL1 and IMX8MN_AUDIO_PLL2, respectively and a look into clk_summary so far showed that they were a few Hz short of the target:
imx8mn-board:~# grep audio_pll[12]_out /sys/kernel/debug/clk/clk_summary audio_pll2_out 0 0 0 361267196 0 0 50000 N audio_pll1_out 1 1 0 393215995 0 0 50000 Y
and afterwards:
imx8mn-board:~# grep audio_pll[12]_out /sys/kernel/debug/clk/clk_summary audio_pll2_out 0 0 0 361267200 0 0 50000 N audio_pll1_out 1 1 0 393216000 0 0 50000 Y
This change is equivalent to adding following hardcoded values:
/* rate mdiv pdiv sdiv kdiv */
PLL_1443X_RATE(393216000, 655, 5, 3, 23593),
PLL_1443X_RATE(361267200, 497, 33, 0, -16882),
--- drivers/clk/imx/clk-pll14xx.c | 2 -- 1 file changed, 2 deletions(-)
drivers/clk/imx/clk-pll14xx.c +0 -2
@@ -60,8 +60,6 @@ static const struct imx_pll14xx_rate_tabPLL_1443X_RATE (650000000U ,325 ,3 ,2 ,0 ),PLL_1443X_RATE (594000000U ,198 ,2 ,2 ,0 ), PLL_1443X_RATE(519750000U, 173, 2, 2, 16384), -PLL_1443X_RATE (393216000U ,262 ,2 ,3 ,9437 ), - PLL_1443X_RATE(361267200U, 361, 3, 3, 17511), }; struct imx_pll14xx_clk imx_1443x_pll = {
Re: [PATCH 5.15 399/511] clk: imx: pll14xx: dynamically configure PLL for 393216000/361267200Hz
Hi Greg,
Quoted 43 lines · Greg Kroah-Hartman
5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ahmad Fatoum <[email protected]>
commit
72d00e560d10665e6139c9431956a87ded6e9880upstream.Since commit
b09c68dc57c9("clk: imx: pll14xx: Support dynamic rates"), the driver has the ability to dynamically compute PLL parameters to approximate the requested rates. This is not always used, because the logic is as follows:- Check if the target rate is hardcoded in the frequency table
- Check if varying only kdiv is possible, so switch over is glitch free
- Compute rate dynamically by iterating over pdiv rangeIf we skip the frequency table for the 1443x PLL, we find that the computed values differ to the hardcoded ones. This can be valid if the hardcoded values guarantee for example an earlier lock-in or if the divisors are chosen, so that other important rates are more likely to be reached glitch-free.
For rates (393216000 and 361267200, this doesn't seem to be the case:
They are only approximated by existing parameters (393215995 and 361267196 Hz, respectively) and they aren't reachable glitch-free from other hardcoded frequencies. Dropping them from the table allows us to lock-in to these frequencies exactly.This is immediately noticeable because they are the assigned-clock-rates for
IMX8MN_AUDIO_PLL1andIMX8MN_AUDIO_PLL2, respectively and a look intoclk_summaryso far showed that they were a few Hz short of the target:imx8mn-board:~# grep audio_pll[12]_out /sys/kernel/debug/clk/clk_summary audio_pll2_out 0 0 0 361267196 0 0 50000 N audio_pll1_out 1 1 0 393215995 0 0 50000 Yand afterwards:
imx8mn-board:~# grep audio_pll[12]_out /sys/kernel/debug/clk/clk_summary audio_pll2_out 0 0 0 361267200 0 0 50000 N audio_pll1_out 1 1 0 393216000 0 0 50000 Y
Quoted 8 lines
This change is equivalent to adding following hardcoded values:
/* rate mdiv pdiv sdiv kdiv */
PLL_1443X_RATE(393216000, 655, 5, 3, 23593),
PLL_1443X_RATE(361267200, 497, 33, 0, -16882),Fixes 053a4ffe2988 ("clk: imx: imx8mm: fix audio pll setting")Cc [email protected] # v5.18+
Patch is only correct for v5.18 onward. Please drop for v5.15.
Is there another syntax that we should've used instead that your tools pick up?
Thanks,
Ahmad
Quoted 23 lines
Signed-off-by Ahmad Fatoum <[email protected]>Signed-off-by Marco Felsch <[email protected]>Signed-off-by Abel Vesa <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/clk/imx/clk-pll14xx.c | 2 -- 1 file changed, 2 deletions(-)drivers/clk/imx/clk-pll14xx.c +0
-2@@ -60,8 +60,6 @@ static const struct imx_pll14xx_rate_tabPLL_1443X_RATE (650000000U ,325 ,3 ,2 ,0 ),PLL_1443X_RATE (594000000U ,198 ,2 ,2 ,0 ), PLL_1443X_RATE(519750000U, 173, 2, 2, 16384), -PLL_1443X_RATE (393216000U ,262 ,2 ,3 ,9437 ), - PLL_1443X_RATE(361267200U, 361, 3, 3, 17511), }; struct imx_pll14xx_clk imx_1443x_pll = {
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Greg Kroah-Hartman
maintainerPATCH 400/511 clk: qcom: gcc-mdm9615: use proper parent for pll0_vote clock
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
commit 1583694bb4eaf186f17131dbc1b83d6057d2749b upstream.
The pll0_vote clock definitely should have pll0 as a parent (instead of pll8).
--- drivers/clk/qcom/gcc-mdm9615.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/gcc-mdm9615.c +1 -1
@@ -58,7 +58,7 @@ static struct clk_regmap pll0_vote = { .enable_mask = BIT(0), .hw.init = &(struct clk_init_data ){ .name ="pll0_vote" , - .parent_names = (const char *[]){"pll8" }, + .parent_names = (const char *[]){"pll0" }, .num_parents =1 , .ops = &clk_pll_vote_ops, },
Greg Kroah-Hartman
maintainerPATCH 401/511 soc: qcom: qmi_encdec: Restrict string length in decode
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Lew <[email protected]>
commit 8d207400fd6b79c92aeb2f33bb79f62dff904ea2 upstream.
The QMI TLV value for strings in a lot of qmi element info structures account for null terminated strings with MAX_LEN + 1. If a string is actually MAX_LEN + 1 length, this will cause an out of bounds access when the NULL character is appended in decoding.
--- drivers/soc/qcom/qmi_encdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/soc/qcom/qmi_encdec.c +2 -2
@@ -534,8 +534,8 @@ static int qmi_decode_string_elem(struct decoded_bytes += rc; } -if (string_len > temp_ei->elem_len) { -pr_err ("%s: String len %d > Max Len %d\n" , +if (string_len >= temp_ei->elem_len) { +pr_err ("%s: String len %d >= Max Len %d\n" , __func__, string_len, temp_ei->elem_len);return -ETOOSMALL ; }else if (string_len > tlv_len) {
Greg Kroah-Hartman
maintainerPATCH 402/511 clk: qcom: q6sstop-qcs404: fix missing resume during probe
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 97112c83f4671a4a722f99a53be4e91fac4091bc upstream.
Drivers that enable runtime PM must make sure that the controller is runtime resumed before accessing its registers to prevent the power domain from being disabled.
--- drivers/clk/qcom/q6sstop-qcs404.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/clk/qcom/q6sstop-qcs404.c +13 -2
@@ -173,21 +173,32 @@ static int q6sstopcc_qcs404_probe(structreturn ret; } + ret =pm_runtime_resume_and_get (&pdev->dev); +if (ret) +return ret; + q6sstop_regmap_config.name ="q6sstop_tcsr" ; desc = &tcsr_qcs404_desc; ret =qcom_cc_probe_by_index (pdev,1 , desc);if (ret) -return ret; + goto err_put_rpm; q6sstop_regmap_config.name ="q6sstop_cc" ; desc = &q6sstop_qcs404_desc; ret =qcom_cc_probe_by_index (pdev,0 , desc);if (ret) -return ret; + goto err_put_rpm; + +pm_runtime_put (&pdev->dev);return 0 ; + +err_put_rpm: +pm_runtime_put_sync (&pdev->dev); + +return ret; }static const struct dev_pm_ops q6sstopcc_pm_ops = {
Greg Kroah-Hartman
maintainerPATCH 403/511 clk: qcom: mss-sc7180: fix missing resume during probe
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit e2349da0fa7ca822cda72f427345b95795358fe7 upstream.
Drivers that enable runtime PM must make sure that the controller is runtime resumed before accessing its registers to prevent the power domain from being disabled.
--- drivers/clk/qcom/mss-sc7180.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/clk/qcom/mss-sc7180.c +12 -1
@@ -87,11 +87,22 @@ static int mss_sc7180_probe(struct platfreturn ret; } + ret =pm_runtime_resume_and_get (&pdev->dev); +if (ret) +return ret; + ret =qcom_cc_probe (pdev, &mss_sc7180_desc);if (ret <0 ) -return ret; + goto err_put_rpm; + +pm_runtime_put (&pdev->dev);return 0 ; + +err_put_rpm: +pm_runtime_put_sync (&pdev->dev); + +return ret; }static const struct dev_pm_ops mss_sc7180_pm_ops = {
Greg Kroah-Hartman
maintainerPATCH 404/511 NFS: Fix a potential data corruption
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 88975a55969e11f26fe3846bf4fbf8e7dc8cbbd4 upstream.
We must ensure that the subrequests are joined back into the head before we can retransmit a request. If the head was not on the commit lists, because the server wrote it synchronously, we still need to add it back to the retransmission list.
Add a call that mirrors the effect of nfs_cancel_remove_inode() for O_DIRECT.
--- fs/nfs/direct.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
fs/nfs/direct.c +19 -1
@@ -509,13 +509,31 @@ out:return result; } +static void nfs_direct_add_page_head (struct list_head *list, +struct nfs_page *req) +{ +struct nfs_page *head = req->wb_head; + +if (!list_empty (&head->wb_list) || !nfs_lock_request (head)) +return ; +if (!list_empty (&head->wb_list)) { +nfs_unlock_request (head); +return ; + } +list_add (&head->wb_list, list); +kref_get (&head->wb_kref); +kref_get (&head->wb_kref); +} +static void nfs_direct_join_group (struct list_head *list,struct inode *inode) {struct nfs_page *req, *subreq;list_for_each_entry (req, list, wb_list) { -if (req->wb_head != req) +if (req->wb_head != req) { +nfs_direct_add_page_head (&req->wb_list, req);continue ; + } subreq = req->wb_this_page;if (subreq == req)continue ;
Greg Kroah-Hartman
maintainerPATCH 405/511 NFSv4/pnfs: minor fix for cleanup path in nfs4_get_device_info
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
commit 96562c45af5c31b89a197af28f79bfa838fb8391 upstream.
It is an almost improbable error case but when page allocating loop in nfs4_get_device_info() fails then we should only free the already allocated pages, as __free_page() can't deal with NULL arguments.
Found by Linux Verification Center (linuxtesting.org).
--- fs/nfs/pnfs_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/pnfs_dev.c +1 -1
@@ -154,7 +154,7 @@ nfs4_get_device_info(struct nfs_server *set_bit (NFS_DEVICEID_NOCACHE , &d->flags); out_free_pages: -for (i =0 ; i < max_pages; i++) +while (--i >=0 )__free_page (pages[i]);kfree (pages); out_free_pdev:
Greg Kroah-Hartman
maintainerPATCH 406/511 bus: mhi: host: Skip MHI reset if device is in RDDM
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qiang Yu <[email protected]>
commit cabce92dd805945a090dc6fc73b001bb35ed083a upstream.
In RDDM EE, device can not process MHI reset issued by host. In case of MHI power off, host is issuing MHI reset and polls for it to get cleared until it times out. Since this timeout can not be avoided in case of RDDM, skip the MHI reset in this scenarios.
--- drivers/bus/mhi/host/pm.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/bus/mhi/host/pm.c +5 -0
@@ -466,6 +466,10 @@ static void mhi_pm_disable_transition(st/* Trigger MHI RESET so that the device will not access host memory */ if (!MHI_PM_IN_FATAL_STATE (mhi_cntrl->pm_state)) { +/* Skip MHI RESET if in RDDM state */ +if (mhi_cntrl->rddm_image &&mhi_get_exec_env (mhi_cntrl) ==MHI_EE_RDDM ) + goto skip_mhi_reset; +dev_dbg (dev,"Triggering MHI Reset in device\n" );mhi_set_mhi_state (mhi_cntrl,MHI_STATE_RESET );
@@ -483,6 +487,7 @@ static void mhi_pm_disable_transition(stmhi_write_reg (mhi_cntrl, mhi_cntrl->bhi,BHI_INTVEC ,0 ); } +skip_mhi_reset:dev_dbg (dev,"Waiting for all pending event ring processing to complete\n" ); mhi_event = mhi_cntrl->mhi_event;
Greg Kroah-Hartman
maintainerPATCH 407/511 kbuild: do not run depmod for make modules_sign
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit 2429742e506a2b5939a62c629c4a46d91df0ada8 ]
Commit 961ab4a3cd66 ("kbuild: merge scripts/Makefile.modsign to scripts/Makefile.modinst") started to run depmod at the end of 'make modules_sign'.
Move the depmod rule to scripts/Makefile.modinst and run it only when $(modules_sign_only) is empty.
--- Makefile | 2 ++ 1 file changed, 2 insertions(+)
Makefile +2 -0
@@ -1835,7 +1835,9 @@ quiet_cmd_depmod = DEPMOD $(MODLIB) modules_install: $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst +ifndef modules_sign_only $(call cmd,depmod) +endif else # CONFIG_MODULES
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 408/511 gfs2: Switch to wait_event in gfs2_logd
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Gruenbacher <[email protected]>
[ Upstream commit 6df373b09b1dcf2f7d579f515f653f89a896d417 ]
In gfs2_logd(), switch from an open-coded wait loop to wait_event_interruptible_timeout().
Stable-dep-of: b74cd55aa9a9 ("gfs2: low-memory forced flush fixes")
--- fs/gfs2/log.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)
fs/gfs2/log.c +5 -12
@@ -1296,7 +1296,6 @@ int gfs2_logd(void *data) {struct gfs2_sbd *sdp = data;unsigned long t =1 ; -DEFINE_WAIT (wait);while (!kthread_should_stop ()) {
@@ -1333,17 +1332,11 @@ int gfs2_logd(void *data)try_to_freeze (); -do { -prepare_to_wait (&sdp->sd_logd_waitq, &wait, -TASK_INTERRUPTIBLE ); -if (!gfs2_ail_flush_reqd (sdp) && - !gfs2_jrnl_flush_reqd (sdp) && - !kthread_should_stop ()) - t =schedule_timeout (t); - }while (t && !gfs2_ail_flush_reqd (sdp) && - !gfs2_jrnl_flush_reqd (sdp) && - !kthread_should_stop ()); -finish_wait (&sdp->sd_logd_waitq, &wait); + t =wait_event_interruptible_timeout (sdp->sd_logd_waitq, +gfs2_ail_flush_reqd (sdp) || +gfs2_jrnl_flush_reqd (sdp) || +kthread_should_stop (), + t); }return 0 ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 409/511 gfs2: low-memory forced flush fixes
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Gruenbacher <[email protected]>
[ Upstream commit b74cd55aa9a9d0aca760028a51343ec79812e410 ]
First, function gfs2_ail_flush_reqd checks the SDF_FORCE_AIL_FLUSH flag to determine if an AIL flush should be forced in low-memory situations. However, it also immediately clears the flag, and when called repeatedly as in function gfs2_logd, the flag will be lost. Fix that by pulling the SDF_FORCE_AIL_FLUSH flag check out of gfs2_ail_flush_reqd.
Second, function gfs2_writepages sets the SDF_FORCE_AIL_FLUSH flag whether or not enough pages were written. If enough pages could be written, flushing the AIL is unnecessary, though.
Third, gfs2_writepages doesn't wake up logd after setting the SDF_FORCE_AIL_FLUSH flag, so it can take a long time for logd to react. It would be preferable to wake up logd, but that hurts the performance of some workloads and we don't quite understand why so far, so don't wake up logd so far.
--- fs/gfs2/aops.c | 4 ++-- fs/gfs2/log.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
fs/gfs2/aops.c +2 -2
@@ -207,13 +207,13 @@ static int gfs2_writepages(struct address_space *mapping,int ret;/* -* Even if we didn't write any pages here, we might still be holding +* Even if we didn't write enough pages here, we might still be holding * dirty pages in the ail. We forcibly flush the ail because we don't * want balance_dirty_pages() to loop indefinitely trying to write out * pages held in the ail that it can't find. */ ret =iomap_writepages (mapping, wbc, &wpc, &gfs2_writeback_ops); -if (ret ==0 ) +if (ret ==0 && wbc->nr_to_write >0 )set_bit (SDF_FORCE_AIL_FLUSH , &sdp->sd_flags);return ret; }
fs/gfs2/log.c +4 -4
@@ -1277,9 +1277,6 @@ static inline int gfs2_ail_flush_reqd(struct gfs2_sbd *sdp) {unsigned int used_blocks = sdp->sd_jdesc->jd_blocks -atomic_read (&sdp->sd_log_blks_free); -if (test_and_clear_bit (SDF_FORCE_AIL_FLUSH , &sdp->sd_flags)) -return 1 ; -return used_blocks +atomic_read (&sdp->sd_log_blks_needed) >=atomic_read (&sdp->sd_log_thresh2); }
@@ -1320,7 +1317,9 @@ int gfs2_logd(void *data) GFS2_LFC_LOGD_JFLUSH_REQD); } -if (gfs2_ail_flush_reqd (sdp)) { +if (test_bit (SDF_FORCE_AIL_FLUSH , &sdp->sd_flags) || +gfs2_ail_flush_reqd (sdp)) { +clear_bit (SDF_FORCE_AIL_FLUSH , &sdp->sd_flags);gfs2_ail1_start (sdp);gfs2_ail1_wait (sdp);gfs2_ail1_empty (sdp,0 );
@@ -1333,6 +1332,7 @@ int gfs2_logd(void *data)try_to_freeze (); t = wait_event_interruptible_timeout(sdp->sd_logd_waitq, + test_bit(SDF_FORCE_AIL_FLUSH, &sdp->sd_flags) || gfs2_ail_flush_reqd(sdp) || gfs2_jrnl_flush_reqd(sdp) || kthread_should_stop(),
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 410/511 kconfig: fix possible buffer overflow
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Meskhidze <[email protected]>
[ Upstream commit a3b7039bb2b22fcd2ad20d59c00ed4e606ce3754 ]
Buffer 'new_argv' is accessed without bound check after accessing with bound check via 'new_argc' index.
--- scripts/kconfig/preprocess.c | 3 +++ 1 file changed, 3 insertions(+)
scripts/kconfig/preprocess.c +3 -0
@@ -396,6 +396,9 @@ static char *eval_clause(const char *str, size_t len, int argc, char *argv[]) p++; } + +if (new_argc >=FUNCTION_MAX_ARGS ) +pperror ("too many function arguments" ); new_argv[new_argc++] = prev;/*
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 411/511 perf trace: Use zfree() to reduce chances of use after free
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 9997d5dd177c52017fa0541bf236a4232c8148e6 ]
Do defensive programming by using zfree() to initialize freed pointers to NULL, so that eventual use after free result in a NULL pointer deref instead of more subtle behaviour.
Stable-dep-of: 7962ef13651a ("perf trace: Really free the evsel->priv area")
--- tools/perf/builtin-trace.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/perf/builtin-trace.c +4 -4
@@ -2287,7 +2287,7 @@ static void syscall__exit(struct syscall *sc)if (!sc)return ; -free (sc->arg_fmt); +zfree (&sc->arg_fmt); } static int trace__sys_enter(struct trace *trace, struct evsel *evsel,
@@ -3129,7 +3129,7 @@ static void evlist__free_syscall_tp_fields(struct evlist *evlist)if (!et || !evsel->tp_format ||strcmp (evsel->tp_format->system,"syscalls" ))continue ; -free (et->fmt); +zfree (&et->fmt);free (et); } }
@@ -4748,11 +4748,11 @@ static void trace__exit(struct trace *trace)int i;strlist__delete (trace->ev_qualifier); -free (trace->ev_qualifier_ids.entries); +zfree (&trace->ev_qualifier_ids.entries);if (trace->syscalls.table) {for (i =0 ; i <= trace->sctbl->syscalls.max_id; i++)syscall__exit (&trace->syscalls.table[i]); -free (trace->syscalls.table); +zfree (&trace->syscalls.table); }syscalltbl__delete (trace->sctbl);zfree (&trace->perfconfig_events);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 412/511 perf trace: Really free the evsel->priv area
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 7962ef13651a9163f07b530607392ea123482e8a ]
In 3cb4d5e00e037c70 ("perf trace: Free syscall tp fields in evsel->priv") it only was freeing if strcmp(evsel->tp_format->system, "syscalls") returned zero, while the corresponding initialization of evsel->priv was being performed if it was _not_ zero, i.e. if the tp system wasn't 'syscalls'.
Just stop looking for that and free it if evsel->priv was set, which should be equivalent.
Also use the pre-existing evsel_trace__delete() function.
This resolves these leaks, detected with:
$ make EXTRA_CFLAGS="-fsanitize=address" BUILD_BPF_SKEL=1 CORESIGHT=1 O=/tmp/build/perf-tools-next -C tools/perf install-bin
=================================================================
==481565==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 40 byte(s) in 1 object(s) allocated from:
#0 0x7f7343cba097 in calloc (/lib64/libasan.so.8+0xba097)
#1 0x987966 in zalloc (/home/acme/bin/perf+0x987966)
#2 0x52f9b9 in evsel_trace__new /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:307
#3 0x52f9b9 in evsel__syscall_tp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:333
#4 0x52f9b9 in evsel__init_raw_syscall_tp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:458
#5 0x52f9b9 in perf_evsel__raw_syscall_newtp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:480
#6 0x540e8b in trace__add_syscall_newtp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:3212
#7 0x540e8b in trace__run /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:3891
#8 0x540e8b in cmd_trace /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:5156
#9 0x5ef262 in run_builtin /home/acme/git/perf-tools-next/tools/perf/perf.c:323
#10 0x4196da in handle_internal_command /home/acme/git/perf-tools-next/tools/perf/perf.c:377
#11 0x4196da in run_argv /home/acme/git/perf-tools-next/tools/perf/perf.c:421
#12 0x4196da in main /home/acme/git/perf-tools-next/tools/perf/perf.c:537
#13 0x7f7342c4a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)Direct leak of 40 byte(s) in 1 object(s) allocated from:
#0 0x7f7343cba097 in calloc (/lib64/libasan.so.8+0xba097)
#1 0x987966 in zalloc (/home/acme/bin/perf+0x987966)
#2 0x52f9b9 in evsel_trace__new /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:307
#3 0x52f9b9 in evsel__syscall_tp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:333
#4 0x52f9b9 in evsel__init_raw_syscall_tp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:458
#5 0x52f9b9 in perf_evsel__raw_syscall_newtp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:480
#6 0x540dd1 in trace__add_syscall_newtp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:3205
#7 0x540dd1 in trace__run /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:3891
#8 0x540dd1 in cmd_trace /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:5156
#9 0x5ef262 in run_builtin /home/acme/git/perf-tools-next/tools/perf/perf.c:323
#10 0x4196da in handle_internal_command /home/acme/git/perf-tools-next/tools/perf/perf.c:377
#11 0x4196da in run_argv /home/acme/git/perf-tools-next/tools/perf/perf.c:421
#12 0x4196da in main /home/acme/git/perf-tools-next/tools/perf/perf.c:537
#13 0x7f7342c4a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)SUMMARY: AddressSanitizer: 80 byte(s) leaked in 2 allocation(s). [root@quaco ~]#
With this we plug all leaks with "perf trace sleep 1".
--- tools/perf/builtin-trace.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
tools/perf/builtin-trace.c +2 -7
@@ -3124,13 +3124,8 @@ static void evlist__free_syscall_tp_fields(struct evlist *evlist)struct evsel *evsel;evlist__for_each_entry (evlist, evsel) { -struct evsel_trace *et = evsel->priv; - -if (!et || !evsel->tp_format ||strcmp (evsel->tp_format->system,"syscalls" )) -continue ; - -zfree (&et->fmt); -free (et); +evsel_trace__delete (evsel->priv); + evsel->priv =NULL ; } }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 413/511 pwm: atmel-tcb: Convert to platform remove callback returning void
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 9609284a76978daf53a54e05cff36873a75e4d13 ]
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void.
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Stable-dep-of: c11622324c02 ("pwm: atmel-tcb: Fix resource freeing in error path and remove")
--- drivers/pwm/pwm-atmel-tcb.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/pwm/pwm-atmel-tcb.c +2 -4
@@ -500,7 +500,7 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)return err; } -static int atmel_tcb_pwm_remove (struct platform_device *pdev) +static void atmel_tcb_pwm_remove (struct platform_device *pdev) {struct atmel_tcb_pwm_chip *tcbpwm =platform_get_drvdata (pdev);
@@ -509,8 +509,6 @@ static int atmel_tcb_pwm_remove(struct platform_device *pdev)clk_disable_unprepare (tcbpwm->slow_clk);clk_put (tcbpwm->slow_clk);clk_put (tcbpwm->clk); - -return 0 ; }static const struct of_device_id atmel_tcb_pwm_dt_ids[] = {
@@ -564,7 +562,7 @@ static struct platform_driver atmel_tcb_pwm_driver = { .pm = &atmel_tcb_pwm_pm_ops, }, .probe = atmel_tcb_pwm_probe, - .remove = atmel_tcb_pwm_remove, + .remove_new = atmel_tcb_pwm_remove, };module_platform_driver (atmel_tcb_pwm_driver);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 414/511 pwm: atmel-tcb: Harmonize resource allocation order
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 0323e8fedd1ef25342cf7abf3a2024f5670362b8 ]
Allocate driver data as first resource in the probe function. This way it can be used during allocation of the other resources (instead of assigning these to local variables first and update driver data only when it's allocated). Also as driver data is allocated using a devm function this should happen first to have the order of freeing resources in the error path and the remove function in reverse.
Stable-dep-of: c11622324c02 ("pwm: atmel-tcb: Fix resource freeing in error path and remove")
--- drivers/pwm/pwm-atmel-tcb.c | 49 +++++++++++++++---------------------- 1 file changed, 20 insertions(+), 29 deletions(-)
drivers/pwm/pwm-atmel-tcb.c +20 -29
@@ -422,13 +422,14 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)struct atmel_tcb_pwm_chip *tcbpwm;const struct atmel_tcb_config *config;struct device_node *np = pdev->dev.of_node; -struct regmap *regmap; -struct clk *clk, *gclk =NULL ; -struct clk *slow_clk;char clk_name[] ="t0_clk" ;int err;int channel; + tcbpwm =devm_kzalloc (&pdev->dev,sizeof (*tcbpwm),GFP_KERNEL ); +if (tcbpwm ==NULL ) +return -ENOMEM ; + err =of_property_read_u32 (np,"reg" , &channel);if (err <0 ) { dev_err(&pdev->dev,
@@ -437,47 +438,37 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)return err; } - regmap =syscon_node_to_regmap (np->parent); -if (IS_ERR (regmap)) -return PTR_ERR (regmap); + tcbpwm->regmap =syscon_node_to_regmap (np->parent); +if (IS_ERR (tcbpwm->regmap)) +return PTR_ERR (tcbpwm->regmap); - slow_clk =of_clk_get_by_name (np->parent,"slow_clk" ); -if (IS_ERR (slow_clk)) -return PTR_ERR (slow_clk); + tcbpwm->slow_clk =of_clk_get_by_name (np->parent,"slow_clk" ); +if (IS_ERR (tcbpwm->slow_clk)) +return PTR_ERR (tcbpwm->slow_clk); clk_name[1 ] += channel; - clk =of_clk_get_by_name (np->parent, clk_name); -if (IS_ERR (clk)) - clk =of_clk_get_by_name (np->parent,"t0_clk" ); -if (IS_ERR (clk)) -return PTR_ERR (clk); + tcbpwm->clk =of_clk_get_by_name (np->parent, clk_name); +if (IS_ERR (tcbpwm->clk)) + tcbpwm->clk =of_clk_get_by_name (np->parent,"t0_clk" ); +if (IS_ERR (tcbpwm->clk)) +return PTR_ERR (tcbpwm->clk); match =of_match_node (atmel_tcb_of_match, np->parent); config = match->data;if (config->has_gclk) { - gclk =of_clk_get_by_name (np->parent,"gclk" ); -if (IS_ERR (gclk)) -return PTR_ERR (gclk); - } - - tcbpwm =devm_kzalloc (&pdev->dev,sizeof (*tcbpwm),GFP_KERNEL ); -if (tcbpwm ==NULL ) { - err = -ENOMEM ; - goto err_slow_clk; + tcbpwm->gclk =of_clk_get_by_name (np->parent,"gclk" ); +if (IS_ERR (tcbpwm->gclk)) +return PTR_ERR (tcbpwm->gclk); } tcbpwm->chip.dev = &pdev->dev; tcbpwm->chip.ops = &atmel_tcb_pwm_ops; tcbpwm->chip.npwm =NPWM ; tcbpwm->channel = channel; - tcbpwm->regmap = regmap; - tcbpwm->clk = clk; - tcbpwm->gclk = gclk; - tcbpwm->slow_clk = slow_clk; tcbpwm->width = config->counter_width; - err =clk_prepare_enable (slow_clk); + err =clk_prepare_enable (tcbpwm->slow_clk);if (err) goto err_slow_clk;
@@ -495,7 +486,7 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)clk_disable_unprepare (tcbpwm->slow_clk); err_slow_clk: -clk_put (slow_clk); +clk_put (tcbpwm->slow_clk);return err; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 415/511 pwm: atmel-tcb: Fix resource freeing in error path and remove
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit c11622324c023415fb69196c5fc3782d2b8cced0 ]
Several resources were not freed in the error path and the remove function. Add the forgotten items.
--- drivers/pwm/pwm-atmel-tcb.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
drivers/pwm/pwm-atmel-tcb.c +17 -6
@@ -450,16 +450,20 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev) tcbpwm->clk =of_clk_get_by_name (np->parent, clk_name);if (IS_ERR (tcbpwm->clk)) tcbpwm->clk =of_clk_get_by_name (np->parent,"t0_clk" ); -if (IS_ERR (tcbpwm->clk)) -return PTR_ERR (tcbpwm->clk); +if (IS_ERR (tcbpwm->clk)) { + err =PTR_ERR (tcbpwm->clk); + goto err_slow_clk; + } match =of_match_node (atmel_tcb_of_match, np->parent); config = match->data;if (config->has_gclk) { tcbpwm->gclk =of_clk_get_by_name (np->parent,"gclk" ); -if (IS_ERR (tcbpwm->gclk)) -return PTR_ERR (tcbpwm->gclk); +if (IS_ERR (tcbpwm->gclk)) { + err =PTR_ERR (tcbpwm->gclk); + goto err_clk; + } } tcbpwm->chip.dev = &pdev->dev;
@@ -470,7 +474,7 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev) err =clk_prepare_enable (tcbpwm->slow_clk);if (err) - goto err_slow_clk; + goto err_gclk;spin_lock_init (&tcbpwm->lock);
@@ -485,6 +489,12 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev) err_disable_clk:clk_disable_unprepare (tcbpwm->slow_clk); +err_gclk: +clk_put (tcbpwm->gclk); + +err_clk: +clk_put (tcbpwm->clk); + err_slow_clk:clk_put (tcbpwm->slow_clk);
@@ -498,8 +508,9 @@ static void atmel_tcb_pwm_remove(struct platform_device *pdev)pwmchip_remove (&tcbpwm->chip);clk_disable_unprepare (tcbpwm->slow_clk); -clk_put (tcbpwm->slow_clk); +clk_put (tcbpwm->gclk);clk_put (tcbpwm->clk); +clk_put (tcbpwm->slow_clk); }static const struct of_device_id atmel_tcb_pwm_dt_ids[] = {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 416/511 backlight: gpio_backlight: Drop output GPIO direction check for initial power state
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ying Liu <[email protected]>
[ Upstream commit fe1328b5b2a087221e31da77e617f4c2b70f3b7f ]
So, let's drop output GPIO direction check and only check GPIO value to set the initial power state.
--- drivers/video/backlight/gpio_backlight.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/video/backlight/gpio_backlight.c +1 -2
@@ -87,8 +87,7 @@ static int gpio_backlight_probe(struct platform_device *pdev)/* Not booted with device tree or no phandle link to the node */ bl->props.power = def_value ?FB_BLANK_UNBLANK :FB_BLANK_POWERDOWN ; - else if (gpiod_get_direction(gbl->gpiod) == 0 && - gpiod_get_value_cansleep(gbl->gpiod) == 0) + else if (gpiod_get_value_cansleep(gbl->gpiod) == 0) bl->props.power = FB_BLANK_POWERDOWN; else bl->props.power = FB_BLANK_UNBLANK;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 417/511 Input: tca6416-keypad - always expect proper IRQ number in i2c client
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <[email protected]>
[ Upstream commit 687fe7dfb736b03ab820d172ea5dbfc1ec447135 ]
Remove option having i2c client contain raw gpio number instead of proper IRQ number. There are no users of this facility in mainline and it will allow cleaning up the driver code with regard to wakeup handling, etc.
Stable-dep-of: cc141c35af87 ("Input: tca6416-keypad - fix interrupt enable disbalance")
--- drivers/input/keyboard/tca6416-keypad.c | 27 +++++++++---------------- include/linux/tca6416_keypad.h | 1 - 2 files changed, 10 insertions(+), 18 deletions(-)
drivers/input/keyboard/tca6416-keypad.c +10 -17
@@ -148,7 +148,7 @@ static int tca6416_keys_open(struct input_dev *dev)if (chip->use_polling)schedule_delayed_work (&chip->dwork,msecs_to_jiffies (100 ));else -enable_irq (chip->irqnum); +enable_irq (chip->client->irq);return 0 ; }
@@ -160,7 +160,7 @@ static void tca6416_keys_close(struct input_dev *dev)if (chip->use_polling)cancel_delayed_work_sync (&chip->dwork);else -disable_irq (chip->irqnum); +disable_irq (chip->client->irq); }static int tca6416_setup_registers (struct tca6416_keypad_chip *chip)
@@ -266,12 +266,7 @@ static int tca6416_keypad_probe(struct i2c_client *client, goto fail1;if (!chip->use_polling) { -if (pdata->irq_is_gpio) - chip->irqnum =gpio_to_irq (client->irq); -else - chip->irqnum = client->irq; - - error = request_threaded_irq(chip->irqnum, NULL, + error = request_threaded_irq(client->irq, NULL, tca6416_keys_isr, IRQF_TRIGGER_FALLING | IRQF_ONESHOT | IRQF_NO_AUTOEN,
@@ -279,7 +274,7 @@ static int tca6416_keypad_probe(struct i2c_client *client,if (error) {dev_dbg (&client->dev,"Unable to claim irq %d; error %d\n" , - chip->irqnum, error); + client->irq, error); goto fail1; } }
@@ -298,8 +293,8 @@ static int tca6416_keypad_probe(struct i2c_client *client, fail2:if (!chip->use_polling) { -free_irq (chip->irqnum, chip); -enable_irq (chip->irqnum); +free_irq (client->irq, chip); +enable_irq (client->irq); } fail1:input_free_device (input);
@@ -312,8 +307,8 @@ static int tca6416_keypad_remove(struct i2c_client *client)struct tca6416_keypad_chip *chip =i2c_get_clientdata (client);if (!chip->use_polling) { -free_irq (chip->irqnum, chip); -enable_irq (chip->irqnum); +free_irq (client->irq, chip); +enable_irq (client->irq); }input_unregister_device (chip->input);
@@ -326,10 +321,9 @@ static int tca6416_keypad_remove(struct i2c_client *client)static int tca6416_keypad_suspend (struct device *dev) {struct i2c_client *client =to_i2c_client (dev); -struct tca6416_keypad_chip *chip =i2c_get_clientdata (client);if (device_may_wakeup (dev)) -enable_irq_wake (chip->irqnum); +enable_irq_wake (client->irq);return 0 ; }
@@ -337,10 +331,9 @@ static int tca6416_keypad_suspend(struct device *dev)static int tca6416_keypad_resume (struct device *dev) {struct i2c_client *client =to_i2c_client (dev); -struct tca6416_keypad_chip *chip =i2c_get_clientdata (client);if (device_may_wakeup (dev)) -disable_irq_wake (chip->irqnum); +disable_irq_wake (client->irq);return 0 ; }
include/linux/tca6416_keypad.h +0 -1
@@ -25,7 +25,6 @@ struct tca6416_keys_platform_data { unsigned int rep:1; /* enable input subsystem auto repeat */uint16_t pinmask;uint16_t invert; -int irq_is_gpio; int use_polling; /* use polling if Interrupt is not connected*/ };#endif
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 418/511 Input: tca6416-keypad - fix interrupt enable disbalance
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <[email protected]>
[ Upstream commit cc141c35af873c6796e043adcb820833bd8ef8c5 ]
The driver has been switched to use IRQF_NO_AUTOEN, but in the error unwinding and remove paths calls to enable_irq() were left in place, which will lead to an incorrect enable counter value.
--- drivers/input/keyboard/tca6416-keypad.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/input/keyboard/tca6416-keypad.c +2 -6
@@ -292,10 +292,8 @@ static int tca6416_keypad_probe(struct i2c_client *client,return 0 ; fail2: -if (!chip->use_polling) { +if (!chip->use_polling)free_irq (client->irq, chip); -enable_irq (client->irq); - } fail1:input_free_device (input);kfree (chip);
@@ -306,10 +304,8 @@ static int tca6416_keypad_remove(struct i2c_client *client) {struct tca6416_keypad_chip *chip =i2c_get_clientdata (client); -if (!chip->use_polling) { +if (!chip->use_polling)free_irq (client->irq, chip); -enable_irq (client->irq); - }input_unregister_device (chip->input);kfree (chip);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 419/511 perf annotate bpf: Dont enclose non-debug code with an assert()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 979e9c9fc9c2a761303585e07fe2699bdd88182f ]
In 616b14b47a86d880 ("perf build: Conditionally define NDEBUG") we started using NDEBUG=1 when DEBUG=1 isn't present, so code that is enclosed with assert() is not called.
In dd317df072071903 ("perf build: Make binutil libraries opt in") we stopped linking against binutils-devel, for licensing reasons.
Recently people asked me why annotation of BPF programs wasn't working, i.e. this:
$ perf annotate bpf_prog_5280546344e3f45c_kfree_skb
was returning:
case SYMBOL_ANNOTATE_ERRNO__NO_LIBOPCODES_FOR_BPF:
scnprintf(buf, buflen, "Please link with binutils's libopcode to enable BPF annotation");
This was on a fedora rpm, so its new enough that I had to try to test by rebuilding using BUILD_NONDISTRO=1, only to get it segfaulting on me.
This combination made this libopcode function not to be called:
assert(bfd_check_format(bfdf, bfd_object));
Changing it to:
if (!bfd_check_format(bfdf, bfd_object)) abort();
Made it work, looking at this "check" function made me realize it changes the 'bfdf' internal state, i.e. we better call it.
So stop using assert() on it, just call it and abort if it fails.
Probably it is better to propagate the error, etc, but it seems it is unlikely to fail from the usage done so far and we really need to stop using libopcodes, so do the quick fix above and move on.
With it we have BPF annotation back working when built with BUILD_NONDISTRO=1:
⬢[acme@toolbox perf-tools-next]$ perf annotate --stdio2 bpf_prog_5280546344e3f45c_kfree_skb | head
No kallsyms or vmlinux with build-id 939bc71a1a51cdc434e60af93c7e734f7d5c0e7e was found
Samples: 12 of event 'cpu-clock:ppp', 4000 Hz, Event count (approx.): 3000000, [percent: local period]
bpf_prog_5280546344e3f45c_kfree_skb() bpf_prog_5280546344e3f45c_kfree_skb
Percent int kfree_skb(struct trace_event_raw_kfree_skb *args) {
nop
33.33 xchg %ax,%ax
push %rbp
mov %rsp,%rbp
sub $0x180,%rsp
push %rbx
push %r13
⬢[acme@toolbox perf-tools-next]$--- tools/perf/util/annotate.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
tools/perf/util/annotate.c +7 -3
@@ -1729,8 +1729,11 @@ static int symbol__disassemble_bpf(struct symbol *sym,perf_exe (tpath,sizeof (tpath)); bfdf =bfd_openr (tpath,NULL ); -assert (bfdf); -assert (bfd_check_format (bfdf, bfd_object)); +if (bfdf ==NULL ) +abort (); + +if (!bfd_check_format (bfdf, bfd_object)) +abort (); s =open_memstream (&buf, &buf_size);if (!s) {
@@ -1778,7 +1781,8 @@ static int symbol__disassemble_bpf(struct symbol *sym,#else disassemble =disassembler (bfdf);#endif -assert (disassemble); +if (disassemble ==NULL ) +abort ();fflush (s); do {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 420/511 x86/virt: Drop unnecessary check on extended CPUID level in cpu_has_svm()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
[ Upstream commit 5df8ecfe3632d5879d1f154f7aa8de441b5d1c89 ]
Drop the explicit check on the extended CPUID level in cpu_has_svm(), the kernel's cached CPUID info will leave the entire SVM leaf unset if said leaf is not supported by hardware. Prior to using cached information, the check was needed to avoid false positives due to Intel's rather crazy CPUID behavior of returning the values of the maximum supported leaf if the specified leaf is unsupported.
--- arch/x86/include/asm/virtext.h | 6 ------ 1 file changed, 6 deletions(-)
arch/x86/include/asm/virtext.h +0 -6
@@ -101,12 +101,6 @@ static inline int cpu_has_svm(const char **msg)return 0 ; } -if (boot_cpu_data.extended_cpuid_level <SVM_CPUID_FUNC ) { -if (msg) - *msg ="can't execute cpuid_8000000a" ; -return 0 ; - } -if (!boot_cpu_has (X86_FEATURE_SVM )) {if (msg) *msg ="svm not available" ;
Signature · 1 line
2.40.1