5.4.278-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 1/202 x86/tsc: Trust initial offset in architectural TSC-adjust MSRs
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel J Blueman <[email protected]>
commit 455f9075f14484f358b3c1d6845b4a438de198a7 upstream.
When the BIOS configures the architectural TSC-adjust MSRs on secondary sockets to correct a constant inter-chassis offset, after Linux brings the cores online, the TSC sync check later resets the core-local MSR to 0, triggering HPET fallback and leading to performance loss.
Fix this by unconditionally using the initial adjust values read from the MSRs. Trusting the initial offsets in this architectural mechanism is a better approach than special-casing workarounds for specific platforms.
--- arch/x86/kernel/tsc_sync.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/x86/kernel/tsc_sync.c +2 -4
@@ -192,11 +192,9 @@ bool tsc_store_and_check_tsc_adjust(bool cur->warned = false;/* -* If a non-zero TSC value for socket 0 may be valid then the default -* adjusted value cannot assumed to be zero either. +* The default adjust value cannot be assumed to be zero on any socket. */ -if (tsc_async_resets) - cur->adjusted = bootval; + cur->adjusted = bootval;/* * Check whether this CPU is the first in a package to come up. In
Greg Kroah-Hartman
maintainerPATCH 10/202 drm/amd/display: Set color_mgmt_changed to true on unsuspend
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joshua Ashton <[email protected]>
[ Upstream commit 2eb9dd497a698dc384c0dd3e0311d541eb2e13dd ]
Otherwise we can end up with a frame on unsuspend where color management is not applied when userspace has not committed themselves.
Fixes re-applying color management on Steam Deck/Gamescope on S3 resume.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -0
@@ -1251,6 +1251,7 @@ static int dm_resume(void *handle)dc_stream_release (dm_new_crtc_state->stream); dm_new_crtc_state->stream =NULL ; } + dm_new_crtc_state->base.color_mgmt_changed = true; }for_each_new_plane_in_state (dm->cached_state, plane, new_plane_state, i) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 11/202 ASoC: rt5645: Fix the electric noise due to the CBJ contacts floating
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Derek Fang <[email protected]>
[ Upstream commit 103abab975087e1f01b76fcb54c91dbb65dbc249 ]
The codec leaves tie combo jack's sleeve/ring2 to floating status default. It would cause electric noise while connecting the active speaker jack during boot or shutdown.
This patch requests a gpio to control the additional jack circuit to tie the contacts to the ground or floating.
--- sound/soc/codecs/rt5645.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
sound/soc/codecs/rt5645.c +25 -0
@@ -414,6 +414,7 @@ struct rt5645_priv {struct regmap *regmap;struct i2c_client *i2c;struct gpio_desc *gpiod_hp_det; +struct gpio_desc *gpiod_cbj_sleeve;struct snd_soc_jack *hp_jack;struct snd_soc_jack *mic_jack;struct snd_soc_jack *btn_jack;
@@ -3169,6 +3170,9 @@ static int rt5645_jack_detect(struct snd_soc_component *component, int jack_inseregmap_update_bits (rt5645->regmap,RT5645_IN1_CTRL2 ,RT5645_CBJ_MN_JD ,0 ); +if (rt5645->gpiod_cbj_sleeve) +gpiod_set_value (rt5645->gpiod_cbj_sleeve,1 ); +msleep (600 );regmap_read (rt5645->regmap,RT5645_IN1_CTRL3 , &val); val &=0x7 ;
@@ -3185,6 +3189,8 @@ static int rt5645_jack_detect(struct snd_soc_component *component, int jack_insesnd_soc_dapm_disable_pin (dapm,"Mic Det Power" );snd_soc_dapm_sync (dapm); rt5645->jack_type =SND_JACK_HEADPHONE ; +if (rt5645->gpiod_cbj_sleeve) +gpiod_set_value (rt5645->gpiod_cbj_sleeve,0 ); }if (rt5645->pdata.level_trigger_irq) regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2,
@@ -3210,6 +3216,9 @@ static int rt5645_jack_detect(struct snd_soc_component *component, int jack_inseif (rt5645->pdata.level_trigger_irq)regmap_update_bits (rt5645->regmap,RT5645_IRQ_CTRL2 ,RT5645_JD_1_1_MASK ,RT5645_JD_1_1_INV ); + +if (rt5645->gpiod_cbj_sleeve) +gpiod_set_value (rt5645->gpiod_cbj_sleeve,0 ); }return rt5645->jack_type;
@@ -3861,6 +3870,16 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,return ret; } + rt5645->gpiod_cbj_sleeve =devm_gpiod_get_optional (&i2c->dev,"cbj-sleeve" , +GPIOD_OUT_LOW ); + +if (IS_ERR (rt5645->gpiod_cbj_sleeve)) { + ret =PTR_ERR (rt5645->gpiod_cbj_sleeve); +dev_info (&i2c->dev,"failed to initialize gpiod, ret=%d\n" , ret); +if (ret != -ENOENT ) +return ret; + } +for (i =0 ; i <ARRAY_SIZE (rt5645->supplies); i++) rt5645->supplies[i].supply = rt5645_supply_names[i];
@@ -4104,6 +4123,9 @@ static int rt5645_i2c_remove(struct i2c_client *i2c)cancel_delayed_work_sync (&rt5645->jack_detect_work);cancel_delayed_work_sync (&rt5645->rcclock_work); +if (rt5645->gpiod_cbj_sleeve) +gpiod_set_value (rt5645->gpiod_cbj_sleeve,0 ); +regulator_bulk_disable (ARRAY_SIZE (rt5645->supplies), rt5645->supplies);return 0 ;
@@ -4121,6 +4143,9 @@ static void rt5645_i2c_shutdown(struct i2c_client *i2c) 0);msleep (20 );regmap_write (rt5645->regmap,RT5645_RESET ,0 ); + +if (rt5645->gpiod_cbj_sleeve) +gpiod_set_value (rt5645->gpiod_cbj_sleeve,0 ); }static struct i2c_driver rt5645_i2c_driver = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 12/202 ASoC: dt-bindings: rt5645: add cbj sleeve gpio property
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Derek Fang <[email protected]>
[ Upstream commit 306b38e3fa727d22454a148a364123709e356600 ]
Add an optional gpio property to control external CBJ circuits to avoid some electric noise caused by sleeve/ring2 contacts floating.
--- Documentation/devicetree/bindings/sound/rt5645.txt | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/sound/rt5645.txt +6 -0
@@ -16,6 +16,11 @@ Optional properties: a GPIO spec for the external headphone detect pin. If jd-mode = 0, we will get the JD status by getting the value of hp-detect-gpios. +- cbj-sleeve-gpios: + a GPIO spec to control the external combo jack circuit to tie the sleeve/ring2 + contacts to the ground or floating. It could avoid some electric noise from the + active speaker jacks. + - realtek,in2-differential Boolean. Indicate MIC2 input are differential, rather than single-ended.
@@ -64,6 +69,7 @@ codec: rt5650@1a { compatible = "realtek,rt5650"; reg = <0x1a>; hp-detect-gpios = <&gpio 19 0>; + cbj-sleeve-gpios = <&gpio 20 0>; interrupt-parent = <&gpio>; interrupts = <7 IRQ_TYPE_EDGE_FALLING>; realtek,dmic-en = "true";
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 13/202 ASoC: da7219-aad: fix usage of device_get_named_child_node()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pierre-Louis Bossart <[email protected]>
[ Upstream commit e8a6a5ad73acbafd98e8fd3f0cbf6e379771bb76 ]
The documentation for device_get_named_child_node() mentions this important point:
"
The caller is responsible for calling fwnode_handle_put() on the returned fwnode pointer.
"
Add fwnode_handle_put() to avoid a leaked reference.
--- sound/soc/codecs/da7219-aad.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/codecs/da7219-aad.c +5 -1
@@ -630,8 +630,10 @@ static struct da7219_aad_pdata *da7219_aad_fw_to_pdata(struct snd_soc_componentreturn NULL ; aad_pdata =devm_kzalloc (dev,sizeof (*aad_pdata),GFP_KERNEL ); -if (!aad_pdata) +if (!aad_pdata) { +fwnode_handle_put (aad_np);return NULL ; + } aad_pdata->irq = i2c->irq;
@@ -706,6 +708,8 @@ static struct da7219_aad_pdata *da7219_aad_fw_to_pdata(struct snd_soc_componentelse aad_pdata->adc_1bit_rpt =DA7219_AAD_ADC_1BIT_RPT_1 ; +fwnode_handle_put (aad_np); +return aad_pdata; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 14/202 drm/amdkfd: Flush the process wq before creating a kfd_process
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lancelot SIX <[email protected]>
[ Upstream commit f5b9053398e70a0c10aa9cb4dd5910ab6bc457c5 ]
There is a race condition when re-creating a kfd_process for a process. This has been observed when a process under the debugger executes exec(3). In this scenario:
- The process executes exec.
- This will eventually release the process's mm, which will cause the kfd_process object associated with the process to be freed (kfd_process_free_notifier decrements the reference count to the kfd_process to 0). This causes kfd_process_ref_release to enqueue kfd_process_wq_release to the kfd_process_wq.
- The debugger receives the PTRACE_EVENT_EXEC notification, and tries to re-enable AMDGPU traps (KFD_IOC_DBG_TRAP_ENABLE).
- When handling this request, KFD tries to re-create a kfd_process. This eventually calls kfd_create_process and kobject_init_and_add.
At this point the call to kobject_init_and_add can fail because the old kfd_process.kobj has not been freed yet by kfd_process_wq_release.
This patch proposes to avoid this race by making sure to drain kfd_process_wq before creating a new kfd_process object. This way, we know that any cleanup task is done executing when we reach kobject_init_and_add.
--- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_process.c +8 -0
@@ -289,6 +289,14 @@ struct kfd_process *kfd_create_process(struct file *filep)if (process) {pr_debug ("Process already found\n" ); }else { +/* If the process just called exec(3), it is possible that the +* cleanup of the kfd_process (following the release of the mm +* of the old process image) is still in the cleanup work queue. +* Make sure to drain any job before trying to recreate any +* resource for this process. +*/ +flush_workqueue (kfd_process_wq); + process =create_process (thread);if (IS_ERR (process)) goto out;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 15/202 nvme: find numa distance only if controller has valid numa id
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nilay Shroff <[email protected]>
[ Upstream commit 863fe60ed27f2c85172654a63c5b827e72c8b2e6 ]
On system where native nvme multipath is configured and iopolicy is set to numa but the nvme controller numa node id is undefined or -1 (NUMA_NO_NODE) then avoid calculating node distance for finding optimal io path. In such case we may access numa distance table with invalid index and that may potentially refer to incorrect memory. So this patch ensures that if the nvme controller numa node id is -1 then instead of calculating node distance for finding optimal io path, we set the numa node distance of such controller to default 10 (LOCAL_DISTANCE).
--- drivers/nvme/host/multipath.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/multipath.c +2 -1
@@ -180,7 +180,8 @@ static struct nvme_ns *__nvme_find_path(struct nvme_ns_head *head, int node)if (nvme_path_is_disabled (ns))continue ; -if (READ_ONCE (head->subsys->iopolicy) ==NVME_IOPOLICY_NUMA ) +if (ns->ctrl->numa_node !=NUMA_NO_NODE && +READ_ONCE (head->subsys->iopolicy) ==NVME_IOPOLICY_NUMA ) distance =node_distance (node, ns->ctrl->numa_node);else distance =LOCAL_DISTANCE ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 16/202 openpromfs: finish conversion to the new mount API
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Sandeen <[email protected]>
[ Upstream commit 8f27829974b025d4df2e78894105d75e3bf349f0 ]
The original mount API conversion inexplicably left out the change from ->remount_fs to ->reconfigure; do that now.
--- fs/openpromfs/inode.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/openpromfs/inode.c +4 -4
@@ -362,10 +362,10 @@ static struct inode *openprom_iget(struct super_block *sb, ino_t ino)return inode; } -static int openprom_remount (struct super_block *sb,int *flags,char *data) +static int openpromfs_reconfigure (struct fs_context *fc) { -sync_filesystem (sb); - *flags |=SB_NOATIME ; +sync_filesystem (fc->root->d_sb); + fc->sb_flags |=SB_NOATIME ;return 0 ; }
@@ -373,7 +373,6 @@ static const struct super_operations openprom_sops = { .alloc_inode = openprom_alloc_inode, .free_inode = openprom_free_inode, .statfs = simple_statfs, - .remount_fs = openprom_remount, };static int openprom_fill_super (struct super_block *s,struct fs_context *fc)
@@ -417,6 +416,7 @@ static int openpromfs_get_tree(struct fs_context *fc)static const struct fs_context_operations openpromfs_context_ops = { .get_tree = openpromfs_get_tree, + .reconfigure = openpromfs_reconfigure, };static int openpromfs_init_fs_context (struct fs_context *fc)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 17/202 crypto: bcm - Fix pointer arithmetic
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Mishin <[email protected]>
[ Upstream commit 2b3460cbf454c6b03d7429e9ffc4fe09322eb1a9 ]
In spu2_dump_omd() value of ptr is increased by ciph_key_len instead of hash_iv_len which could lead to going beyond the buffer boundaries.
Fix this bug by changing ciph_key_len to hash_iv_len.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/crypto/bcm/spu2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/bcm/spu2.c +1 -1
@@ -495,7 +495,7 @@ static void spu2_dump_omd(u8 *omd, u16 hash_key_len, u16 ciph_key_len,if (hash_iv_len) {packet_log (" Hash IV Length %u bytes\n" , hash_iv_len);packet_dump (" hash IV: " , ptr, hash_iv_len); - ptr += ciph_key_len; + ptr += hash_iv_len; }if (ciph_iv_len) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 2/202 tty: n_gsm: fix possible out-of-bounds in gsm0_receive()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Starke <[email protected]>
commit 47388e807f85948eefc403a8a5fdc5b406a65d5a upstream.
Assuming the following:
- side A configures the n_gsm in basic option mode
- side B sends the header of a basic option mode frame with data length 1
- side A switches to advanced option mode
- side B sends 2 data bytes which exceeds gsm->len
Reason: gsm->len is not used in advanced option mode.
- side A switches to basic option mode
- side B keeps sending until gsm0_receive() writes past gsm->buf
Reason: Neither gsm->state nor gsm->len have been reset after reconfiguration.
Fix this by changing gsm->count to gsm->len comparison from equal to less than. Also add upper limit checks against the constant MAX_MRU in gsm0_receive() and gsm1_receive() to harden against memory corruption of gsm->len and gsm->mru.
All other checks remain as we still need to limit the data according to the user configuration and actual payload size.
--- drivers/tty/n_gsm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/tty/n_gsm.c +6 -2
@@ -1974,8 +1974,12 @@ static void gsm0_receive(struct gsm_muxbreak ;case GSM_DATA :/* Data */ gsm->buf[gsm->count++] = c; -if (gsm->count == gsm->len) +if (gsm->count >=MAX_MRU ) { + gsm->bad_size++; + gsm->state =GSM_SEARCH ; + }else if (gsm->count >= gsm->len) { gsm->state =GSM_FCS ; + }break ;case GSM_FCS :/* FCS follows the packet */ gsm->received_fcs = c;
@@ -2055,7 +2059,7 @@ static void gsm1_receive(struct gsm_mux gsm->state =GSM_DATA ;break ;case GSM_DATA :/* Data */ -if (gsm->count > gsm->mru) {/* Allow one for the FCS */ +if (gsm->count > gsm->mru || gsm->count >MAX_MRU ) {/* Allow one for the FCS */ gsm->state =GSM_OVERRUN ; gsm->bad_size++; }else
Greg Kroah-Hartman
maintainerPATCH 3/202 speakup: Fix sizeof() vs ARRAY_SIZE() bug
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 008ab3c53bc4f0b2f20013c8f6c204a3203d0b8b upstream.
The "buf" pointer is an array of u16 values. This code should be using ARRAY_SIZE() (which is 256) instead of sizeof() (which is 512), otherwise it can the still got out of bounds.
--- drivers/staging/speakup/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/speakup/main.c +1 -1
@@ -577,7 +577,7 @@ static u_long get_word(struct vc_data *v } attr_ch =get_char (vc, (u_short *)tmp_pos, &spk_attr); buf[cnt++] = attr_ch; -while (tmpx < vc->vc_cols -1 && cnt <sizeof (buf) -1 ) { +while (tmpx < vc->vc_cols -1 && cnt <ARRAY_SIZE (buf) -1 ) { tmp_pos +=2 ; tmpx++; ch =get_char (vc, (u_short *)tmp_pos, &temp);
Greg Kroah-Hartman
maintainerPATCH 4/202 ring-buffer: Fix a race between readers and resize checks
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Petr Pavlu <[email protected]>
commit c2274b908db05529980ec056359fae916939fdaa upstream.
The reader code in rb_get_reader_page() swaps a new reader page into the ring buffer by doing cmpxchg on old->list.prev->next to point it to the new page. Following that, if the operation is successful, old->list.next->prev gets updated too. This means the underlying doubly-linked list is temporarily inconsistent, page->prev->next or page->next->prev might not be equal back to page for some page in the ring buffer.
The resize operation in ring_buffer_resize() can be invoked in parallel. It calls rb_check_pages() which can detect the described inconsistency and stop further tracing:
[ 190.271762] ------------[ cut here ]------------ [ 190.271771] WARNING: CPU: 1 PID: 6186 at kernel/trace/ring_buffer.c:1467 rb_check_pages.isra.0+0x6a/0xa0 [ 190.271789] Modules linked in: [...] [ 190.271991] Unloaded tainted modules: intel_uncore_frequency(E):1 skx_edac(E):1 [ 190.272002] CPU: 1 PID: 6186 Comm: cmd.sh Kdump: loaded Tainted: G E 6.9.0-rc6-default #5 158d3e1e6d0b091c34c3b96bfd99a1c58306d79f [ 190.272011] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.0-0-gd239552c-rebuilt.opensuse.org 04/01/2014 [ 190.272015] RIP: 0010:rb_check_pages.isra.0+0x6a/0xa0 [ 190.272023] Code: [...] [ 190.272028] RSP: 0018:ffff9c37463abb70 EFLAGS: 00010206 [ 190.272034] RAX: ffff8eba04b6cb80 RBX: 0000000000000007 RCX: ffff8eba01f13d80 [ 190.272038] RDX: ffff8eba01f130c0 RSI: ffff8eba04b6cd00 RDI: ffff8eba0004c700 [ 190.272042] RBP: ffff8eba0004c700 R08: 0000000000010002 R09: 0000000000000000 [ 190.272045] R10: 00000000ffff7f52 R11: ffff8eba7f600000 R12: ffff8eba0004c720 [ 190.272049] R13: ffff8eba00223a00 R14: 0000000000000008 R15: ffff8eba067a8000 [ 190.272053] FS: 00007f1bd64752c0(0000) GS:ffff8eba7f680000(0000) knlGS:0000000000000000 [ 190.272057] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 190.272061] CR2: 00007f1bd6662590 CR3: 000000010291e001 CR4: 0000000000370ef0 [ 190.272070] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 190.272073] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 190.272077] Call Trace: [ 190.272098] <TASK> [ 190.272189] ring_buffer_resize+0x2ab/0x460 [ 190.272199] __tracing_resize_ring_buffer.part.0+0x23/0xa0 [ 190.272206] tracing_resize_ring_buffer+0x65/0x90 [ 190.272216] tracing_entries_write+0x74/0xc0 [ 190.272225] vfs_write+0xf5/0x420 [ 190.272248] ksys_write+0x67/0xe0 [ 190.272256] do_syscall_64+0x82/0x170 [ 190.272363] entry_SYSCALL_64_after_hwframe+0x76/0x7e [ 190.272373] RIP: 0033:0x7f1bd657d263 [ 190.272381] Code: [...] [ 190.272385] RSP: 002b:00007ffe72b643f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 [ 190.272391] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f1bd657d263 [ 190.272395] RDX: 0000000000000002 RSI: 0000555a6eb538e0 RDI: 0000000000000001 [ 190.272398] RBP: 0000555a6eb538e0 R08: 000000000000000a R09: 0000000000000000 [ 190.272401] R10: 0000555a6eb55190 R11: 0000000000000246 R12: 00007f1bd6662500 [ 190.272404] R13: 0000000000000002 R14: 00007f1bd6667c00 R15: 0000000000000002 [ 190.272412] </TASK> [ 190.272414] ---[ end trace 0000000000000000 ]---
Note that ring_buffer_resize() calls rb_check_pages() only if the parent trace_buffer has recording disabled. Recent commit d78ab792705c ("tracing: Stop current tracer when resizing buffer") causes that it is now always the case which makes it more likely to experience this issue.
The window to hit this race is nonetheless very small. To help reproducing it, one can add a delay loop in rb_get_reader_page():
ret = rb_head_page_replace(reader, cpu_buffer->reader_page); if (!ret)
goto spin;
for (unsigned i = 0; i < 1U << 26; i++) /* inserted delay loop */
__asm__ __volatile__ ("" : : : "memory");
rb_list_head(reader->list.next)->prev = &cpu_buffer->reader_page->list;
.. and then run the following commands on the target system:
echo 1 > /sys/kernel/tracing/events/sched/sched_switch/enable while true; do
echo 16 > /sys/kernel/tracing/buffer_size_kb; sleep 0.1 echo 8 > /sys/kernel/tracing/buffer_size_kb; sleep 0.1
done &
while true; do
for i in /sys/kernel/tracing/per_cpu/*; do
timeout 0.1 cat $i/trace_pipe; sleep 0.2
done
done
To fix the problem, make sure ring_buffer_resize() doesn't invoke rb_check_pages() concurrently with a reader operating on the same ring_buffer_per_cpu by taking its cpu_buffer->reader_lock.
--- kernel/trace/ring_buffer.c | 9 +++++++++ 1 file changed, 9 insertions(+)
kernel/trace/ring_buffer.c +9 -0
@@ -1235,6 +1235,11 @@ static int rb_check_list(struct ring_buf* * As a safety measure we check to make sure the data pages have not * been corrupted. +* +* Callers of this function need to guarantee that the list of pages doesn't get +* modified during the check. In particular, if it's possible that the function +* is invoked with concurrent readers which can swap in a new reader page then +* the caller should take cpu_buffer->reader_lock. */ static int rb_check_pages (struct ring_buffer_per_cpu *cpu_buffer) {
@@ -1951,8 +1956,12 @@ int ring_buffer_resize(struct ring_buffe*/ synchronize_rcu ();for_each_buffer_cpu (buffer, cpu) { +unsigned long flags; + cpu_buffer = buffer->buffers[cpu]; +raw_spin_lock_irqsave (&cpu_buffer->reader_lock, flags);rb_check_pages (cpu_buffer); +raw_spin_unlock_irqrestore (&cpu_buffer->reader_lock, flags); }atomic_dec (&buffer->record_disabled); }
Greg Kroah-Hartman
maintainerPATCH 5/202 net: smc91x: Fix m68k kernel compilation for ColdFire CPU
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thorsten Blum <[email protected]>
commit 5eefb477d21a26183bc3499aeefa991198315a2d upstream.
Compiling the m68k kernel with support for the ColdFire CPU family fails with the following error:
In file included from drivers/net/ethernet/smsc/smc91x.c:80:drivers/net/ethernet/smsc/smc91x.c: In function ‘smc_reset’:drivers/net/ethernet/smsc/smc91x.h:160:40: error: implicit declaration of function ‘_swapw’; did you mean ‘swap’? [-Werror=implicit-function-declaration]
160 | #define SMC_outw(lp, v, a, r) writew(_swapw(v), (a) + (r))
| ^~~~~~drivers/net/ethernet/smsc/smc91x.h:904:25: note: in expansion of macro ‘SMC_outw’
904 | SMC_outw(lp, x, ioaddr, BANK_SELECT); \
| ^~~~~~~~
drivers/net/ethernet/smsc/smc91x.c:250:9: note: in expansion of macro ‘SMC_SELECT_BANK’
250 | SMC_SELECT_BANK(lp, 2);
| ^~~~~~~~~~~~~~~cc1: some warnings being treated as errors
The function _swapw() was removed in commit d97cf70af097 ("m68k: use asm-generic/io.h for non-MMU io access functions"), but is still used in drivers/net/ethernet/smsc/smc91x.h.
Use ioread16be() and iowrite16be() to resolve the error.
--- drivers/net/ethernet/smsc/smc91x.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/smsc/smc91x.h +2 -2
@@ -175,8 +175,8 @@ static inline void mcf_outsw(void *a, unwritew (*wp++, a); } -#define SMC_inw (a, r) _swapw(readw((a) + (r))) -#define SMC_outw (lp, v, a, r) writew(_swapw(v), (a) + (r)) +#define SMC_inw (a, r) ioread16be((a) + (r)) +#define SMC_outw (lp, v, a, r) iowrite16be(v, (a) + (r))#define SMC_insw (a, r, p, l) mcf_insw(a + r, p, l)#define SMC_outsw (a, r, p, l) mcf_outsw(a + r, p, l)
Greg Kroah-Hartman
maintainerPATCH 6/202 nilfs2: fix unexpected freezing of nilfs_segctor_sync()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit 936184eadd82906992ff1f5ab3aada70cce44cee upstream.
A potential and reproducible race issue has been identified where nilfs_segctor_sync() would block even after the log writer thread writes a checkpoint, unless there is an interrupt or other trigger to resume log writing.
This turned out to be because, depending on the execution timing of the log writer thread running in parallel, the log writer thread may skip responding to nilfs_segctor_sync(), which causes a call to schedule() waiting for completion within nilfs_segctor_sync() to lose the opportunity to wake up.
The reason why waking up the task waiting in nilfs_segctor_sync() may be skipped is that updating the request generation issued using a shared sequence counter and adding an wait queue entry to the request wait queue to the log writer, are not done atomically. There is a possibility that log writing and request completion notification by nilfs_segctor_wakeup() may occur between the two operations, and in that case, the wait queue entry is not yet visible to nilfs_segctor_wakeup() and the wake-up of nilfs_segctor_sync() will be carried over until the next request occurs.
Fix this issue by performing these two operations simultaneously within the lock section of sc_state_lock. Also, following the memory barrier guidelines for event waiting loops, move the call to set_current_state() in the same location into the event waiting loop to ensure that a memory barrier is inserted just before the event condition determination.
--- fs/nilfs2/segment.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
fs/nilfs2/segment.c +13 -4
@@ -2207,19 +2207,28 @@ static int nilfs_segctor_sync(struct nilstruct nilfs_segctor_wait_request wait_req;int err =0 ; -spin_lock (&sci->sc_state_lock);init_wait (&wait_req.wq); wait_req.err =0 ;atomic_set (&wait_req.done,0 ); +init_waitqueue_entry (&wait_req.wq, current); + +/* +* To prevent a race issue where completion notifications from the +* log writer thread are missed, increment the request sequence count +* "sc_seq_request" and insert a wait queue entry using the current +* sequence number into the "sc_wait_request" queue at the same time +* within the lock section of "sc_state_lock". +*/ +spin_lock (&sci->sc_state_lock); wait_req.seq = ++sci->sc_seq_request; +add_wait_queue (&sci->sc_wait_request, &wait_req.wq);spin_unlock (&sci->sc_state_lock); -init_waitqueue_entry (&wait_req.wq, current); -add_wait_queue (&sci->sc_wait_request, &wait_req.wq); -set_current_state (TASK_INTERRUPTIBLE );wake_up (&sci->sc_wait_daemon);for (;;) { +set_current_state (TASK_INTERRUPTIBLE ); +if (atomic_read (&wait_req.done)) { err = wait_req.err;break ;
Greg Kroah-Hartman
maintainerPATCH 7/202 nilfs2: fix potential hang in nilfs_detach_log_writer()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit eb85dace897c5986bc2f36b3c783c6abb8a4292e upstream.
Syzbot has reported a potential hang in nilfs_detach_log_writer() called during nilfs2 unmount.
Analysis revealed that this is because nilfs_segctor_sync(), which synchronizes with the log writer thread, can be called after nilfs_segctor_destroy() terminates that thread, as shown in the call trace below:
nilfs_detach_log_writer
nilfs_segctor_destroy
nilfs_segctor_kill_thread --> Shut down log writer thread
flush_work
nilfs_iput_work_func
nilfs_dispose_list
iput
nilfs_evict_inode
nilfs_transaction_commit
nilfs_construct_segment (if inode needs sync)
nilfs_segctor_sync --> Attempt to synchronize with
log writer thread
*** DEADLOCK ***Fix this issue by changing nilfs_segctor_sync() so that the log writer thread returns normally without synchronizing after it terminates, and by forcing tasks that are already waiting to complete once after the thread terminates.
The skipped inode metadata flushout will then be processed together in the subsequent cleanup work in nilfs_segctor_destroy().
--- fs/nilfs2/segment.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
fs/nilfs2/segment.c +18 -3
@@ -2229,6 +2229,14 @@ static int nilfs_segctor_sync(struct nilfor (;;) {set_current_state (TASK_INTERRUPTIBLE ); +/* +* Synchronize only while the log writer thread is alive. +* Leave flushing out after the log writer thread exits to +* the cleanup work in nilfs_segctor_destroy(). +*/ +if (!sci->sc_task) +break ; +if (atomic_read (&wait_req.done)) { err = wait_req.err;break ;
@@ -2244,7 +2252,7 @@ static int nilfs_segctor_sync(struct nilreturn err; } -static void nilfs_segctor_wakeup (struct nilfs_sc_info *sci,int err) +static void nilfs_segctor_wakeup (struct nilfs_sc_info *sci,int err,bool force) {struct nilfs_segctor_wait_request *wrq, *n;unsigned long flags;
@@ -2252,7 +2260,7 @@ static void nilfs_segctor_wakeup(structspin_lock_irqsave (&sci->sc_wait_request.lock, flags);list_for_each_entry_safe (wrq, n, &sci->sc_wait_request.head, wq.entry) {if (!atomic_read (&wrq->done) && -nilfs_cnt32_ge (sci->sc_seq_done, wrq->seq)) { + (force ||nilfs_cnt32_ge (sci->sc_seq_done, wrq->seq))) { wrq->err = err;atomic_set (&wrq->done,1 ); }
@@ -2392,7 +2400,7 @@ static void nilfs_segctor_notify(structif (mode ==SC_LSEG_SR ) { sci->sc_state &= ~NILFS_SEGCTOR_COMMIT ; sci->sc_seq_done = sci->sc_seq_accepted; -nilfs_segctor_wakeup (sci, err); +nilfs_segctor_wakeup (sci, err, false); sci->sc_flush_request =0 ; }else {if (mode ==SC_FLUSH_FILE )
@@ -2774,6 +2782,13 @@ static void nilfs_segctor_destroy(struct || sci->sc_seq_request != sci->sc_seq_done);spin_unlock (&sci->sc_state_lock); +/* +* Forcibly wake up tasks waiting in nilfs_segctor_sync(), which can +* be called from delayed iput() via nilfs_evict_inode() and can race +* with the above log writer thread termination. +*/ +nilfs_segctor_wakeup (sci,0 , true); +if (flush_work (&sci->sc_iput_work)) flag = true;
Greg Kroah-Hartman
maintainerPATCH 8/202 wifi: cfg80211: fix the order of arguments for trace events of the tx_rx_evt class
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Artemiev <[email protected]>
[ Upstream commit 9ef369973cd2c97cce3388d2c0c7e3c056656e8a ]
The declarations of the tx_rx_evt class and the rdev_set_antenna event use the wrong order of arguments in the TP_ARGS macro.
Fix the order of arguments in the TP_ARGS macro.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- net/wireless/trace.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/wireless/trace.h +2 -2
@@ -1630,7 +1630,7 @@ TRACE_EVENT(rdev_return_void_tx_rx, DECLARE_EVENT_CLASS(tx_rx_evt, TP_PROTO(struct wiphy *wiphy, u32 tx, u32 rx), - TP_ARGS(wiphy, rx, tx), + TP_ARGS(wiphy, tx, rx), TP_STRUCT__entry( WIPHY_ENTRY __field(u32, tx)
@@ -1647,7 +1647,7 @@ DECLARE_EVENT_CLASS(tx_rx_evt,DEFINE_EVENT (tx_rx_evt, rdev_set_antenna, TP_PROTO(struct wiphy *wiphy, u32 tx, u32 rx), -TP_ARGS (wiphy, rx, tx) +TP_ARGS (wiphy, tx, rx) ); DECLARE_EVENT_CLASS(wiphy_netdev_id_evt,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 9/202 net: usb: qmi_wwan: add Telit FN920C04 compositions
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniele Palmas <[email protected]>
[ Upstream commit 0b8fe5bd73249dc20be2e88a12041f8920797b59 ]
Add the following Telit FN920C04 compositions:
0x10a0: rmnet + tty (AT/NMEA) + tty (AT) + tty (diag)
T: Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 5 Spd=480 MxCh= 0 D: Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10a0 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN920 S: SerialNumber=92c4c4d8 C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x10a4: rmnet + tty (AT) + tty (AT) + tty (diag)
T: Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 8 Spd=480 MxCh= 0 D: Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10a4 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN920 S: SerialNumber=92c4c4d8 C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x10a9: rmnet + tty (AT) + tty (diag) + DPL (data packet logging) + adb
T: Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 9 Spd=480 MxCh= 0 D: Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10a9 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN920 S: SerialNumber=92c4c4d8 C: #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none) E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none) E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/net/usb/qmi_wwan.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/usb/qmi_wwan.c +3 -0
@@ -1323,6 +1323,9 @@ static const struct usb_device_id products[] = { {QMI_QUIRK_SET_DTR(0x1bc7, 0x1060, 2)}, /* Telit LN920 */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1070, 2)}, /* Telit FN990 */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1080, 2)}, /* Telit FE990 */ + {QMI_QUIRK_SET_DTR(0x1bc7, 0x10a0, 0)}, /* Telit FN920C04 */ + {QMI_QUIRK_SET_DTR(0x1bc7, 0x10a4, 0)}, /* Telit FN920C04 */ + {QMI_QUIRK_SET_DTR(0x1bc7, 0x10a9, 0)}, /* Telit FN920C04 */ {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */ {QMI_FIXED_INTF(0x1bc7, 0x1101, 3)}, /* Telit ME910 dual modem */ {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainercover 5.4.278-rc1 review
This is the start of the stable review cycle for the 5.4.278 release. There are 202 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 15 Jun 2024 11:31:50 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.278-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.4.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.4.278-rc1
Sergey Shtylyov <[email protected]>
nfs: fix undefined behavior in nfs_block_bits()
Harald Freudenberger <[email protected]>
s390/ap: Fix crash in AP internal function modify_bitmap()
Baokun Li <[email protected]>
ext4: fix mb_cache_entry's e_refcnt leak in ext4_xattr_block_cache_find()
Mike Gilbert <[email protected]>
sparc: move struct termio to asm/termios.h
Eric Dumazet <[email protected]>
xsk: validate user input for XDP_{UMEM|COMPLETION}_FILL_RING
Eric Dumazet <[email protected]>
net: fix __dst_negative_advice() race
Daniel Thompson <[email protected]>
kdb: Use format-specifiers rather than memset() for padding in kdb_read()
Daniel Thompson <[email protected]>
kdb: Merge identical case statements in kdb_read()
Daniel Thompson <[email protected]>
kdb: Fix console handling when editing and tab-completing commands
Daniel Thompson <[email protected]>
kdb: Use format-strings rather than '\0' injection in kdb_read()
Daniel Thompson <[email protected]>
kdb: Fix buffer overflow during tab-complete
Sam Ravnborg <[email protected]>
sparc64: Fix number of online CPUs
Alexander Shishkin <[email protected]>
intel_th: pci: Add Meteor Lake-S CPU support
Nikita Zhandarovich <[email protected]>
net/9p: fix uninit-value in p9_client_rpc()
xu xin <[email protected]>
net/ipv6: Fix route deleting failure when metric equals 0
Herbert Xu <[email protected]>
crypto: qat - Fix ADF_DEV_RESET_SYNC memory leak
Vitaly Chikunov <[email protected]>
crypto: ecrdsa - Fix module auto-load on add_key
Marc Zyngier <[email protected]>
KVM: arm64: Allow AArch32 PSTATE.M to be restored as System mode
Cai Xinchen <[email protected]>
fbdev: savage: Handle err return when savagefb_check_var failed
Hans Verkuil <[email protected]>
media: v4l2-core: hold videodev_lock until dev reg, finishes
Nathan Chancellor <[email protected]>
media: mxl5xx: Move xpt structures off stack
Hans Verkuil <[email protected]>
media: mc: mark the media devnode as registered from the, start
Yang Xiwen <[email protected]>
arm64: dts: hi3798cv200: fix the size of GICR
Bitterblue Smith <[email protected]>
wifi: rtl8xxxu: Fix the TX power of RTL8192CU, RTL8723AU
Yu Kuai <[email protected]>
md/raid5: fix deadlock that raid5d() wait for itself to clear MD_SB_CHANGE_PENDING
Krzysztof Kozlowski <[email protected]>
arm64: tegra: Correct Tegra132 I2C alias
Christoffer Sandberg <[email protected]>
ACPI: resource: Do IRQ override on TongFang GXxHRXx and GMxHGxx
Sergey Shtylyov <[email protected]>
ata: pata_legacy: make legacy_exit() work again
Bob Zhou <[email protected]>
drm/amdgpu: add error handle to avoid out-of-bounds
Zheyu Ma <[email protected]>
media: lgdt3306a: Add a check against null-pointer-def
Chao Yu <[email protected]>
f2fs: fix to do sanity check on i_xattr_nid in sanity_check_inode()
Linus Torvalds <[email protected]>
x86/mm: Remove broken vsyscall emulation code from the page fault code
Daniel Borkmann <[email protected]>
vxlan: Fix regression when dropping packets due to invalid src addresses
Ryusuke Konishi <[email protected]>
nilfs2: fix use-after-free of timer for log writer thread
Marc Dionne <[email protected]>
afs: Don't cross .backup mountpoint from backup volume
Ming Lei <[email protected]>
io_uring: fail NOP if non-zero op flags is passed in
Jorge Ramirez-Ortiz <[email protected]>
mmc: core: Do not force a retune before RPMB switch
Carlos Llamas <[email protected]>
binder: fix max_thread type inconsistency
Chuck Lever <[email protected]>
SUNRPC: Fix loop termination condition in gss_free_in_token_pages()
Dongli Zhang <[email protected]>
genirq/cpuhotplug, x86/vector: Prevent vector leak during CPU offline
Takashi Iwai <[email protected]>
ALSA: timer: Set lower bound of start tick time
Yue Haibing <[email protected]>
ipvlan: Dont Use skb->sk in ipvlan_process_v{4,6}_outboundUwe Kleine-König <[email protected]>
spi: stm32: Don't warn about spurious interrupts
Masahiro Yamada <[email protected]>
kconfig: fix comparison to constant symbols, 'm', 'n'
Florian Westphal <[email protected]>
netfilter: tproxy: bail out if IP has been disabled on the device
Xiaolei Wang <[email protected]>
net:fec: Add fec_enet_deinit()
Parthiban Veerasooran <[email protected]>
net: usb: smsc95xx: fix changing LED_SEL bit value updated from EEPROM
Andre Edich <[email protected]>
smsc95xx: use usbnet->driver_priv
Andre Edich <[email protected]>
smsc95xx: remove redundant function arguments
Roded Zats <[email protected]>
enic: Validate length of nl attributes in enic_set_vf_port
Tetsuo Handa <[email protected]>
dma-buf/sw-sync: don't enable IRQ from sync_print_obj()
Carolina Jubran <[email protected]>
net/mlx5e: Use rx_missed_errors instead of rx_dropped for reporting buffer exhaustion
Sagi Grimberg <[email protected]>
nvmet: fix ns enable/disable possible hang
Andy Shevchenko <[email protected]>
spi: Don't mark message DMA mapped when no transfer in it is
Eric Dumazet <[email protected]>
netfilter: nfnetlink_queue: acquire rcu_read_lock() in instance_destroy_rcu()
Ryosuke Yasuoka <[email protected]>
nfc: nci: Fix handling of zero-length payload packets in nci_rx_work()
Tetsuo Handa <[email protected]>
nfc: nci: Fix kcov check in nci_rx_work()
Wei Fang <[email protected]>
net: fec: avoid lock evasion when reading pps_enable
Jiri Pirko <[email protected]>
virtio: delete vq in vp_find_vqs_msix() when request_irq() fails
Jiangfeng Xiao <[email protected]>
arm64: asm-bug: Add .align 2 to the end of __BUG_ENTRY
Aaron Conole <[email protected]>
openvswitch: Set the skbuff pkt_type for proper pmtud support.
Kuniyuki Iwashima <[email protected]>
tcp: Fix shift-out-of-bounds in dctcp_update_alpha().
Sagi Grimberg <[email protected]>
params: lift param_set_uint_minmax to common code
Hangbin Liu <[email protected]>
ipv6: sr: fix memleak in seg6_hmac_init_algo
Dan Aloni <[email protected]>
sunrpc: fix NFSACL RPC retry on soft mount
Ryosuke Yasuoka <[email protected]>
nfc: nci: Fix uninit-value in nci_rx_work
Masahiro Yamada <[email protected]>
x86/kconfig: Select ARCH_WANT_FRAME_POINTERS again when UNWINDER_FRAME_POINTER=y
Zhu Yanjun <[email protected]>
null_blk: Fix the WARNING: modpost: missing MODULE_DESCRIPTION()
Hans Verkuil <[email protected]>
media: cec: cec-api: add locking in cec_release()
Hans Verkuil <[email protected]>
media: cec: cec-adap: always cancel work in cec_transmit_msg_fh
Tiwei Bie <[email protected]>
um: Fix the -Wmissing-prototypes warning for __switch_mm
Shrikanth Hegde <[email protected]>
powerpc/pseries: Add failure related checks for h_get_mpp and h_get_ppp
Azeem Shaikh <[email protected]>
scsi: qla2xxx: Replace all non-returning strlcpy() with strscpy()
Dan Carpenter <[email protected]>
media: stk1160: fix bounds checking in stk1160_copy_video()
Roberto Sassu <[email protected]>
um: Add winch to winch_handlers before registering winch IRQ
Duoming Zhou <[email protected]>
um: Fix return value in ubd_init()
Marijn Suijten <[email protected]>
drm/msm/dpu: Always flush the slave INTF on the CTL
Fenglin Wu <[email protected]>
Input: pm8xxx-vibrator - correct VIB_MAX_LEVELS calculation
Arnd Bergmann <[email protected]>
Input: ims-pcu - fix printf string overflow
Ian Rogers <[email protected]>
perf stat: Don't display metric header for non-leader uncore events
Ian Rogers <[email protected]>
libsubcmd: Fix parse-options memory leak
Wolfram Sang <[email protected]>
serial: sh-sci: protect invalidating RXDMA on shutdown
Chao Yu <[email protected]>
f2fs: fix to release node block count in error path of f2fs_new_node_page()
Ian Rogers <[email protected]>
perf ui browser: Avoid SEGV on title
Randy Dunlap <[email protected]>
extcon: max8997: select IRQ_DOMAIN instead of depending on it
Ian Rogers <[email protected]>
perf ui browser: Don't save pointer to stack memory
Ian Rogers <[email protected]>
perf ui: Update use of pthread mutex
yaowenbin <[email protected]>
perf top: Fix TUI exit screen refresh race condition
Huai-Yuan Liu <[email protected]>
ppdev: Add an error check in register_device
Christophe JAILLET <[email protected]>
ppdev: Remove usage of the deprecated ida_simple_xx() API
Dan Carpenter <[email protected]>
stm class: Fix a double free in stm_register_device()
Chris Wulff <[email protected]>
usb: gadget: u_audio: Clear uac pointer when freed.
Miklos Szeredi <[email protected]>
ovl: remove upper umask handling from ovl_create_upper()
Michal Simek <[email protected]>
microblaze: Remove early printk call from cpuinfo-static.c
Michal Simek <[email protected]>
microblaze: Remove gcc flag for non existing early_printk.c file
Thomas Haemmerle <[email protected]>
iio: pressure: dps310: support negative temperature values
Arnd Bergmann <[email protected]>
greybus: arche-ctrl: move device table to its right location
Andy Shevchenko <[email protected]>
serial: max3100: Fix bitwise types
Andy Shevchenko <[email protected]>
serial: max3100: Update uart_driver_registered on driver removal
Andy Shevchenko <[email protected]>
serial: max3100: Lock port->lock when calling uart_handle_cts_change()
Arnd Bergmann <[email protected]>
firmware: dmi-id: add a release callback function
Chen Ni <[email protected]>
dmaengine: idma64: Add check for dma_set_max_seg_size
Pierre-Louis Bossart <[email protected]>
soundwire: cadence: fix invalid PDI offset
Bard Liao <[email protected]>
soundwire: cadence_master: improve PDI allocation
Pierre-Louis Bossart <[email protected]>
soundwire: intel: don't filter out PDI0/1
Pierre-Louis Bossart <[email protected]>
soundwire: cadence/intel: simplify PDI/port mapping
Namhyung Kim <[email protected]>
perf annotate: Get rid of duplicate --group option item
Martin Liška <[email protected]>
perf annotate: Add --demangle and --demangle-kernel
Rui Miguel Silva <[email protected]>
greybus: lights: check return of get_channel_from_mode
Arnaldo Carvalho de Melo <[email protected]>
perf probe: Add missing libgen.h header needed for using basename()
Vitalii Bursov <[email protected]>
sched/fair: Allow disabling sched_balance_newidle with sched_relax_domain_level
Valentin Schneider <[email protected]>
sched/topology: Don't set SD_BALANCE_WAKE on cpuset domain relax
Eric Dumazet <[email protected]>
af_packet: do not call packet_read_pending() from tpacket_destruct_skb()
Eric Dumazet <[email protected]>
netrom: fix possible dead-lock in nr_rt_ioctl()
Leon Romanovsky <[email protected]>
RDMA/IPoIB: Fix format truncation compilation errors
Edward Liaw <[email protected]>
selftests/kcmp: remove unused open mode
Gautam Menghani <[email protected]>
selftests/kcmp: Make the test output consistent and clear
Chuck Lever <[email protected]>
SUNRPC: Fix gss_free_in_token_pages()
Aleksandr Aprelkov <[email protected]>
sunrpc: removed redundant procp check
Jan Kara <[email protected]>
ext4: avoid excessive credit estimate in ext4_tmpfile()
Adrian Hunter <[email protected]>
x86/insn: Fix PUSH instruction in x86 instruction decoder opcode map
Chengchang Tang <[email protected]>
RDMA/hns: Use complete parentheses in macros
Marek Vasut <[email protected]>
drm/panel: simple: Add missing Innolux G121X1-L03 format, flags, connector
Steven Rostedt <[email protected]>
ASoC: tracing: Export SND_SOC_DAPM_DIR_OUT to its value
Huai-Yuan Liu <[email protected]>
drm/arm/malidp: fix a possible null pointer dereference
Randy Dunlap <[email protected]>
fbdev: sh7760fb: allow modular build
YueHaibing <[email protected]>
platform/x86: wmi: Make two functions static
Ricardo Ribalda <[email protected]>
media: radio-shark2: Avoid led_names truncations
Aleksandr Burakov <[email protected]>
media: ngene: Add dvb_ca_en50221_init return value check
Arnd Bergmann <[email protected]>
fbdev: sisfb: hide unused variables
Arnd Bergmann <[email protected]>
powerpc/fsl-soc: hide unused const variable
Justin Green <[email protected]>
drm/mediatek: Add 0 size check to mtk_drm_gem_obj
Arnd Bergmann <[email protected]>
fbdev: shmobile: fix snprintf truncation
Maxim Korotkov <[email protected]>
mtd: rawnand: hynix: fixed typo
Srinivasan Shanmugam <[email protected]>
drm/amd/display: Fix potential index out of bounds in color transformation function
Hangbin Liu <[email protected]>
ipv6: sr: fix invalid unregister error path
Hangbin Liu <[email protected]>
ipv6: sr: fix incorrect unregister order
Hangbin Liu <[email protected]>
ipv6: sr: add missing seg6_local_exit
Ilya Maximets <[email protected]>
net: openvswitch: fix overwriting ct original tuple for ICMPv6
Eric Dumazet <[email protected]>
net: usb: smsc95xx: stop lying about skb->truesize
Breno Leitao <[email protected]>
af_unix: Fix data races in unix_release_sock/unix_stream_sendmsg
Linus Walleij <[email protected]>
net: ethernet: cortina: Locking fixes
Finn Thain <[email protected]>
m68k: mac: Fix reboot hang on Mac IIci
Michael Schmitz <[email protected]>
m68k: Fix spinlock race in kernel thread creation
Eric Dumazet <[email protected]>
net: usb: sr9700: stop lying about skb->truesize
Eric Dumazet <[email protected]>
usb: aqc111: stop lying about skb->truesize
Dan Carpenter <[email protected]>
wifi: mwl8k: initialize cmd->addr[] properly
Bui Quang Minh <[email protected]>
scsi: qedf: Ensure the copied buf is NUL terminated
Bui Quang Minh <[email protected]>
scsi: bfa: Ensure the copied buf is NUL terminated
Chen Ni <[email protected]>
HID: intel-ish-hid: ipc: Add check for pci_alloc_irq_vectors
Guenter Roeck <[email protected]>
Revert "sh: Handle calling csum_partial with misaligned data"
Geert Uytterhoeven <[email protected]>
sh: kprobes: Merge arch_copy_kprobe() into arch_prepare_kprobe()
Nikita Zhandarovich <[email protected]>
wifi: ar5523: enable proper endpoint verification
Nikita Zhandarovich <[email protected]>
wifi: carl9170: add a proper sanity check for endpoints
Finn Thain <[email protected]>
macintosh/via-macii: Fix "BUG: sleeping function called from invalid context"
Eric Dumazet <[email protected]>
tcp: avoid premature drops in tcp_add_backlog()
Lu Wei <[email protected]>
tcp: fix a signed-integer-overflow bug in tcp_add_backlog()
Eric Dumazet <[email protected]>
tcp: minor optimization in tcp_add_backlog()
Dmitry Baryshkov <[email protected]>
wifi: ath10k: populate board data for WCN3990
Su Hui <[email protected]>
wifi: ath10k: Fix an error code problem in ath10k_dbg_sta_write_peer_debug_trigger()
Ard Biesheuvel <[email protected]>
x86/purgatory: Switch to the position-independent small code model
Yuri Karpov <[email protected]>
scsi: hpsa: Fix allocation size for Scsi_Host private data
Xingui Yang <[email protected]>
scsi: libsas: Fix the failure of adding phy with zero-address to port
Viresh Kumar <[email protected]>
cpufreq: exit() callback is optional
Rafael J. Wysocki <[email protected]>
cpufreq: Rearrange locking in cpufreq_remove_dev()
Rafael J. Wysocki <[email protected]>
cpufreq: Split cpufreq_offline()
Rafael J. Wysocki <[email protected]>
cpufreq: Reorganize checks in cpufreq_offline()
Arnd Bergmann <[email protected]>
ACPI: disable -Wstringop-truncation
Zenghui Yu <[email protected]>
irqchip/alpine-msi: Fix off-by-one in allocation error path
Andrew Halaney <[email protected]>
scsi: ufs: core: Perform read back after disabling UIC_COMMAND_COMPL
Andrew Halaney <[email protected]>
scsi: ufs: core: Perform read back after disabling interrupts
Andrew Halaney <[email protected]>
scsi: ufs: cdns-pltfrm: Perform read back after writing HCLKDIV
Andrew Halaney <[email protected]>
scsi: ufs: qcom: Perform read back after writing reset bit
Arnd Bergmann <[email protected]>
qed: avoid truncating work queue length
Guixiong Wei <[email protected]>
x86/boot: Ignore relocations in .notes sections in walk_relocs() too
Baochen Qiang <[email protected]>
wifi: ath10k: poll service ready message before failing
Yu Kuai <[email protected]>
md: fix resync softlockup when bitmap size is less than array size
Zhu Yanjun <[email protected]>
null_blk: Fix missing mutex_destroy() at module removal
Ilya Denisyev <[email protected]>
jffs2: prevent xattr node from overflowing the eraseblock
Peter Oberparleiter <[email protected]>
s390/cio: fix tracepoint subchannel type field
Arnd Bergmann <[email protected]>
crypto: ccp - drop platform ifdef checks
Al Viro <[email protected]>
parisc: add missing export of __cmpxchg_u8()
Arnd Bergmann <[email protected]>
nilfs2: fix out-of-range warning
Brian Kubisiak <[email protected]>
ecryptfs: Fix buffer size for tag 66 packet
Laurent Pinchart <[email protected]>
firmware: raspberrypi: Use correct device for DMA mappings
Aleksandr Mishin <[email protected]>
crypto: bcm - Fix pointer arithmetic
Eric Sandeen <[email protected]>
openpromfs: finish conversion to the new mount API
Nilay Shroff <[email protected]>
nvme: find numa distance only if controller has valid numa id
Lancelot SIX <[email protected]>
drm/amdkfd: Flush the process wq before creating a kfd_process
Pierre-Louis Bossart <[email protected]>
ASoC: da7219-aad: fix usage of device_get_named_child_node()
Derek Fang <[email protected]>
ASoC: dt-bindings: rt5645: add cbj sleeve gpio property
Derek Fang <[email protected]>
ASoC: rt5645: Fix the electric noise due to the CBJ contacts floating
Joshua Ashton <[email protected]>
drm/amd/display: Set color_mgmt_changed to true on unsuspend
Daniele Palmas <[email protected]>
net: usb: qmi_wwan: add Telit FN920C04 compositions
Igor Artemiev <[email protected]>
wifi: cfg80211: fix the order of arguments for trace events of the tx_rx_evt class
Ryusuke Konishi <[email protected]>
nilfs2: fix potential hang in nilfs_detach_log_writer()
Ryusuke Konishi <[email protected]>
nilfs2: fix unexpected freezing of nilfs_segctor_sync()
Thorsten Blum <[email protected]>
net: smc91x: Fix m68k kernel compilation for ColdFire CPU
Petr Pavlu <[email protected]>
ring-buffer: Fix a race between readers and resize checks
Dan Carpenter <[email protected]>
speakup: Fix sizeof() vs ARRAY_SIZE() bug
Daniel Starke <[email protected]>
tty: n_gsm: fix possible out-of-bounds in gsm0_receive()
Daniel J Blueman <[email protected]>
x86/tsc: Trust initial offset in architectural TSC-adjust MSRs
-------------
Diffstat:
Documentation/devicetree/bindings/sound/rt5645.txt | 6 + Makefile | 4 +- arch/arm64/boot/dts/hisilicon/hi3798cv200.dtsi | 2 +- arch/arm64/boot/dts/nvidia/tegra132-norrin.dts | 4 +- arch/arm64/boot/dts/nvidia/tegra132.dtsi | 2 +- arch/arm64/include/asm/asm-bug.h | 1 + arch/arm64/kvm/guest.c | 1 + arch/m68k/kernel/entry.S | 4 +- arch/m68k/mac/misc.c | 36 ++--- arch/microblaze/kernel/Makefile | 1 - arch/microblaze/kernel/cpu/cpuinfo-static.c | 2 +- arch/parisc/kernel/parisc_ksyms.c | 1 + arch/powerpc/include/asm/hvcall.h | 2 +- arch/powerpc/platforms/pseries/lpar.c | 6 +- arch/powerpc/platforms/pseries/lparcfg.c | 6 +- arch/powerpc/sysdev/fsl_msi.c | 2 + arch/sh/kernel/kprobes.c | 7 +- arch/sh/lib/checksum.S | 67 +++------ arch/sparc/include/asm/smp_64.h | 2 - arch/sparc/include/uapi/asm/termbits.h | 10 -- arch/sparc/include/uapi/asm/termios.h | 9 ++ arch/sparc/kernel/prom_64.c | 4 +- arch/sparc/kernel/setup_64.c | 1 - arch/sparc/kernel/smp_64.c | 14 -- arch/um/drivers/line.c | 14 +- arch/um/drivers/ubd_kern.c | 4 +- arch/um/include/asm/mmu.h | 2 - arch/um/include/shared/skas/mm_id.h | 2 + arch/x86/Kconfig.debug | 5 +- arch/x86/entry/vsyscall/vsyscall_64.c | 28 +--- arch/x86/include/asm/processor.h | 1 - arch/x86/kernel/apic/vector.c | 9 +- arch/x86/kernel/tsc_sync.c | 6 +- arch/x86/lib/x86-opcode-map.txt | 2 +- arch/x86/mm/fault.c | 27 +--- arch/x86/purgatory/Makefile | 3 +- arch/x86/tools/relocs.c | 9 ++ crypto/ecrdsa.c | 1 + drivers/acpi/acpica/Makefile | 1 + drivers/acpi/resource.c | 12 ++ drivers/android/binder.c | 4 +- drivers/ata/pata_legacy.c | 8 +- drivers/block/null_blk_main.c | 3 + drivers/char/ppdev.c | 21 ++- drivers/cpufreq/cpufreq.c | 85 ++++++----- drivers/crypto/bcm/spu2.c | 2 +- drivers/crypto/ccp/sp-platform.c | 14 +- drivers/crypto/qat/qat_common/adf_aer.c | 19 +-- drivers/dma-buf/sync_debug.c | 4 +- drivers/dma/idma64.c | 4 +- drivers/extcon/Kconfig | 3 +- drivers/firmware/dmi-id.c | 7 +- drivers/firmware/raspberrypi.c | 7 +- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 3 + drivers/gpu/drm/amd/amdkfd/kfd_process.c | 8 ++ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 + .../gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c | 5 + drivers/gpu/drm/arm/malidp_mw.c | 5 +- drivers/gpu/drm/mediatek/mtk_drm_gem.c | 3 + .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 3 - drivers/gpu/drm/panel/panel-simple.c | 3 + drivers/hid/intel-ish-hid/ipc/pci-ish.c | 5 + drivers/hwtracing/intel_th/pci.c | 5 + drivers/hwtracing/stm/core.c | 11 +- drivers/iio/pressure/dps310.c | 11 +- drivers/infiniband/hw/hns/hns_roce_hem.h | 12 +- drivers/infiniband/ulp/ipoib/ipoib_vlan.c | 8 +- drivers/input/misc/ims-pcu.c | 4 +- drivers/input/misc/pm8xxx-vibrator.c | 7 +- drivers/irqchip/irq-alpine-msi.c | 2 +- drivers/macintosh/via-macii.c | 11 +- drivers/md/md-bitmap.c | 6 +- drivers/md/raid5.c | 15 +- drivers/media/cec/cec-adap.c | 3 +- drivers/media/cec/cec-api.c | 3 + drivers/media/dvb-frontends/lgdt3306a.c | 5 + drivers/media/dvb-frontends/mxl5xx.c | 22 +-- drivers/media/mc/mc-devnode.c | 5 +- drivers/media/pci/ngene/ngene-core.c | 4 +- drivers/media/radio/radio-shark2.c | 2 +- drivers/media/usb/stk1160/stk1160-video.c | 20 ++- drivers/media/v4l2-core/v4l2-dev.c | 3 + drivers/mmc/core/host.c | 3 +- drivers/mtd/nand/raw/nand_hynix.c | 2 +- drivers/net/ethernet/cisco/enic/enic_main.c | 12 ++ drivers/net/ethernet/cortina/gemini.c | 12 +- drivers/net/ethernet/freescale/fec_main.c | 10 ++ drivers/net/ethernet/freescale/fec_ptp.c | 14 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +- drivers/net/ethernet/qlogic/qed/qed_main.c | 9 +- drivers/net/ethernet/smsc/smc91x.h | 4 +- drivers/net/ipvlan/ipvlan_core.c | 4 +- drivers/net/usb/aqc111.c | 8 +- drivers/net/usb/qmi_wwan.c | 3 + drivers/net/usb/smsc95xx.c | 120 ++++++++-------- drivers/net/usb/sr9700.c | 10 +- drivers/net/vxlan.c | 4 - drivers/net/wireless/ath/ar5523/ar5523.c | 14 ++ drivers/net/wireless/ath/ath10k/core.c | 3 + drivers/net/wireless/ath/ath10k/debugfs_sta.c | 2 +- drivers/net/wireless/ath/ath10k/hw.h | 1 + drivers/net/wireless/ath/ath10k/targaddrs.h | 3 + drivers/net/wireless/ath/ath10k/wmi.c | 26 +++- drivers/net/wireless/ath/carl9170/usb.c | 32 +++++ drivers/net/wireless/marvell/mwl8k.c | 2 +- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 26 ++-- drivers/nvme/host/multipath.c | 3 +- drivers/nvme/target/configfs.c | 8 ++ drivers/platform/x86/xiaomi-wmi.c | 4 +- drivers/s390/cio/trace.h | 2 +- drivers/s390/crypto/ap_bus.c | 2 +- drivers/scsi/bfa/bfad_debugfs.c | 4 +- drivers/scsi/hpsa.c | 2 +- drivers/scsi/libsas/sas_expander.c | 3 +- drivers/scsi/qedf/qedf_debugfs.c | 2 +- drivers/scsi/qla2xxx/qla_init.c | 8 +- drivers/scsi/qla2xxx/qla_mr.c | 20 +-- drivers/scsi/ufs/cdns-pltfrm.c | 2 +- drivers/scsi/ufs/ufs-qcom.h | 12 +- drivers/scsi/ufs/ufshcd.c | 4 +- drivers/soundwire/cadence_master.c | 156 +++++---------------- drivers/soundwire/cadence_master.h | 34 +---- drivers/soundwire/intel.c | 134 ++++-------------- drivers/spi/spi-stm32.c | 2 +- drivers/spi/spi.c | 4 + drivers/staging/greybus/arche-apb-ctrl.c | 1 + drivers/staging/greybus/arche-platform.c | 9 +- drivers/staging/greybus/light.c | 8 +- drivers/staging/speakup/main.c | 2 +- drivers/tty/n_gsm.c | 8 +- drivers/tty/serial/max3100.c | 22 ++- drivers/tty/serial/sh-sci.c | 5 + drivers/usb/gadget/function/u_audio.c | 2 + drivers/video/fbdev/Kconfig | 4 +- drivers/video/fbdev/savage/savagefb_driver.c | 5 +- drivers/video/fbdev/sh_mobile_lcdcfb.c | 2 +- drivers/video/fbdev/sis/init301.c | 3 +- drivers/virtio/virtio_pci_common.c | 4 +- fs/afs/mntpt.c | 5 + fs/ecryptfs/keystore.c | 4 +- fs/ext4/namei.c | 2 +- fs/ext4/xattr.c | 4 +- fs/f2fs/inode.c | 6 + fs/f2fs/node.c | 2 +- fs/io_uring.c | 2 + fs/jffs2/xattr.c | 3 + fs/nfs/internal.h | 4 +- fs/nilfs2/ioctl.c | 2 +- fs/nilfs2/segment.c | 63 +++++++-- fs/openpromfs/inode.c | 8 +- fs/overlayfs/dir.c | 3 - include/linux/moduleparam.h | 2 + include/net/dst_ops.h | 2 +- include/net/sock.h | 13 +- include/trace/events/asoc.h | 2 + kernel/cgroup/cpuset.c | 2 +- kernel/debug/kdb/kdb_io.c | 99 +++++++------ kernel/irq/cpuhotplug.c | 16 +-- kernel/params.c | 18 +++ kernel/sched/topology.c | 9 +- kernel/trace/ring_buffer.c | 9 ++ net/9p/client.c | 2 + net/ipv4/netfilter/nf_tproxy_ipv4.c | 2 + net/ipv4/route.c | 22 ++- net/ipv4/tcp_dctcp.c | 13 +- net/ipv4/tcp_ipv4.c | 14 +- net/ipv6/route.c | 34 +++-- net/ipv6/seg6.c | 5 +- net/ipv6/seg6_hmac.c | 42 ++++-- net/netfilter/nfnetlink_queue.c | 2 + net/netrom/nr_route.c | 19 +-- net/nfc/nci/core.c | 17 ++- net/openvswitch/actions.c | 6 + net/openvswitch/flow.c | 3 +- net/packet/af_packet.c | 3 +- net/sunrpc/auth_gss/svcauth_gss.c | 12 +- net/sunrpc/clnt.c | 1 + net/sunrpc/svc.c | 2 - net/sunrpc/xprtsock.c | 18 --- net/unix/af_unix.c | 2 +- net/wireless/trace.h | 4 +- net/xdp/xsk.c | 2 + net/xfrm/xfrm_policy.c | 11 +- scripts/kconfig/symbol.c | 6 +- sound/core/timer.c | 10 ++ sound/soc/codecs/da7219-aad.c | 6 +- sound/soc/codecs/rt5645.c | 25 ++++ tools/arch/x86/lib/x86-opcode-map.txt | 2 +- tools/lib/subcmd/parse-options.c | 8 +- tools/perf/Documentation/perf-annotate.txt | 7 + tools/perf/builtin-annotate.c | 6 +- tools/perf/ui/browser.c | 26 ++-- tools/perf/ui/browser.h | 2 +- tools/perf/ui/browsers/annotate.c | 2 +- tools/perf/ui/setup.c | 5 +- tools/perf/ui/tui/helpline.c | 5 +- tools/perf/ui/tui/progress.c | 8 +- tools/perf/ui/tui/setup.c | 12 +- tools/perf/ui/tui/util.c | 18 +-- tools/perf/ui/ui.h | 4 +- tools/perf/util/probe-event.c | 1 + tools/perf/util/stat-display.c | 3 + tools/testing/selftests/kcmp/kcmp_test.c | 8 +- 203 files changed, 1153 insertions(+), 1030 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 19/202 ecryptfs: Fix buffer size for tag 66 packet
5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Kubisiak <[email protected]>
[ Upstream commit 85a6a1aff08ec9f5b929d345d066e2830e8818e5 ]
The 'TAG 66 Packet Format' description is missing the cipher code and checksum fields that are packed into the message packet. As a result, the buffer allocated for the packet is 3 bytes too small and write_tag_66_packet() will write up to 3 bytes past the end of the buffer.
Fix this by increasing the size of the allocation so the whole packet will always fit in the buffer.
This fixes the below kasan slab-out-of-bounds bug:
BUG: KASAN: slab-out-of-bounds in ecryptfs_generate_key_packet_set+0x7d6/0xde0 Write of size 1 at addr ffff88800afbb2a5 by task touch/181 CPU: 0 PID: 181 Comm: touch Not tainted 6.6.13-gnu #1 4c9534092be820851bb687b82d1f92a426598dc6 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2/GNU Guix 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x4c/0x70 print_report+0xc5/0x610 ? ecryptfs_generate_key_packet_set+0x7d6/0xde0 ? kasan_complete_mode_report_info+0x44/0x210 ? ecryptfs_generate_key_packet_set+0x7d6/0xde0 kasan_report+0xc2/0x110 ? ecryptfs_generate_key_packet_set+0x7d6/0xde0 __asan_store1+0x62/0x80 ecryptfs_generate_key_packet_set+0x7d6/0xde0 ? __pfx_ecryptfs_generate_key_packet_set+0x10/0x10 ? __alloc_pages+0x2e2/0x540 ? __pfx_ovl_open+0x10/0x10 [overlay 30837f11141636a8e1793533a02e6e2e885dad1d] ? dentry_open+0x8f/0xd0 ecryptfs_write_metadata+0x30a/0x550 ? __pfx_ecryptfs_write_metadata+0x10/0x10 ? ecryptfs_get_lower_file+0x6b/0x190 ecryptfs_initialize_file+0x77/0x150 ecryptfs_create+0x1c2/0x2f0 path_openat+0x17cf/0x1ba0 ? __pfx_path_openat+0x10/0x10 do_filp_open+0x15e/0x290 ? __pfx_do_filp_open+0x10/0x10 ? __kasan_check_write+0x18/0x30 ? _raw_spin_lock+0x86/0xf0 ? __pfx__raw_spin_lock+0x10/0x10 ? __kasan_check_write+0x18/0x30 ? alloc_fd+0xf4/0x330 do_sys_openat2+0x122/0x160 ? __pfx_do_sys_openat2+0x10/0x10 __x64_sys_openat+0xef/0x170 ? __pfx___x64_sys_openat+0x10/0x10 do_syscall_64+0x60/0xd0 entry_SYSCALL_64_after_hwframe+0x6e/0xd8 RIP: 0033:0x7f00a703fd67 Code: 25 00 00 41 00 3d 00 00 41 00 74 37 64 8b 04 25 18 00 00 00 85 c0 75 5b 44 89 e2 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 0f 87 85 00 00 00 48 83 c4 68 5d 41 5c c3 0f 1f RSP: 002b:00007ffc088e30b0 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007ffc088e3368 RCX: 00007f00a703fd67 RDX: 0000000000000941 RSI: 00007ffc088e48d7 RDI: 00000000ffffff9c RBP: 00007ffc088e48d7 R08: 0000000000000001 R09: 0000000000000000 R10: 00000000000001b6 R11: 0000000000000246 R12: 0000000000000941 R13: 0000000000000000 R14: 00007ffc088e48d7 R15: 00007f00a7180040 </TASK> Allocated by task 181: kasan_save_stack+0x2f/0x60 kasan_set_track+0x29/0x40 kasan_save_alloc_info+0x25/0x40 __kasan_kmalloc+0xc5/0xd0 __kmalloc+0x66/0x160 ecryptfs_generate_key_packet_set+0x6d2/0xde0 ecryptfs_write_metadata+0x30a/0x550 ecryptfs_initialize_file+0x77/0x150 ecryptfs_create+0x1c2/0x2f0 path_openat+0x17cf/0x1ba0 do_filp_open+0x15e/0x290 do_sys_openat2+0x122/0x160 __x64_sys_openat+0xef/0x170 do_syscall_64+0x60/0xd0 entry_SYSCALL_64_after_hwframe+0x6e/0xd8
--- fs/ecryptfs/keystore.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ecryptfs/keystore.c +3 -1
@@ -300,9 +300,11 @@ write_tag_66_packet(char *signature, u8 cipher_code,* | Key Identifier Size | 1 or 2 bytes | * | Key Identifier | arbitrary | * | File Encryption Key Size | 1 or 2 bytes | +* | Cipher Code | 1 byte | * | File Encryption Key | arbitrary | +* | Checksum | 2 bytes | */ - data_len = (5 +ECRYPTFS_SIG_SIZE_HEX + crypt_stat->key_size); + data_len = (8 +ECRYPTFS_SIG_SIZE_HEX + crypt_stat->key_size); *packet =kmalloc (data_len,GFP_KERNEL ); message = *packet;if (!message) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 28/202 x86/boot: Ignore relocations in .notes sections in walk_relocs() too
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guixiong Wei <[email protected]>
[ Upstream commit 76e9762d66373354b45c33b60e9a53ef2a3c5ff2 ]
Commit:
aaa8736370db ("x86, relocs: Ignore relocations in .notes section")
... only started ignoring the .notes sections in print_absolute_relocs(), but the same logic should also by applied in walk_relocs() to avoid such relocations.
[ mingo: Fixed various typos in the changelog, removed extra curly braces from the code. ]
--- arch/x86/tools/relocs.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/x86/tools/relocs.c +9 -0
@@ -689,6 +689,15 @@ static void walk_relocs(int (*process)(struct section *sec, Elf_Rel *rel,if (!(sec_applies->shdr.sh_flags &SHF_ALLOC )) {continue ; } + +/* +* Do not perform relocations in .notes sections; any +* values there are meant for pre-boot consumption (e.g. +* startup_xen). +*/ +if (sec_applies->shdr.sh_type ==SHT_NOTE ) +continue ; + sh_symtab = sec_symtab->symtab; sym_strtab = sec_symtab->link->strtab;for (j =0 ; j < sec->shdr.sh_size/sizeof (Elf_Rel); j++) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 29/202 qed: avoid truncating work queue length
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 954fd908f177604d4cce77e2a88cc50b29bad5ff ]
clang complains that the temporary string for the name passed into alloc_workqueue() is too short for its contents:
drivers/net/ethernet/qlogic/qed/qed_main.c:1218:3: error: 'snprintf' will always be truncated; specified size is 16, but format string expands to at least 18 [-Werror,-Wformat-truncation]
There is no need for a temporary buffer, and the actual name of a workqueue is 32 bytes (WQ_NAME_LEN), so just use the interface as intended to avoid the truncation.
--- drivers/net/ethernet/qlogic/qed/qed_main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/ethernet/qlogic/qed/qed_main.c +4 -5
@@ -1177,7 +1177,6 @@ static void qed_slowpath_task(struct work_struct *work)static int qed_slowpath_wq_start (struct qed_dev *cdev) {struct qed_hwfn *hwfn; -char name[NAME_SIZE ];int i;if (IS_VF (cdev))
@@ -1186,11 +1185,11 @@ static int qed_slowpath_wq_start(struct qed_dev *cdev)for_each_hwfn (cdev, i) { hwfn = &cdev->hwfns[i]; -snprintf (name,NAME_SIZE ,"slowpath-%02x:%02x.%02x" , - cdev->pdev->bus->number, -PCI_SLOT (cdev->pdev->devfn), hwfn->abs_pf_id); + hwfn->slowpath_wq =alloc_workqueue ("slowpath-%02x:%02x.%02x" , +0 ,0 , cdev->pdev->bus->number, +PCI_SLOT (cdev->pdev->devfn), + hwfn->abs_pf_id); - hwfn->slowpath_wq =alloc_workqueue (name,0 ,0 );if (!hwfn->slowpath_wq) {DP_NOTICE (hwfn,"Cannot create slowpath workqueue\n" );return -ENOMEM ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 30/202 scsi: ufs: qcom: Perform read back after writing reset bit
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Halaney <[email protected]>
[ Upstream commit c4d28e06b0c94636f6e35d003fa9ebac0a94e1ae ]
Currently, the reset bit for the UFS provided reset controller (used by its phy) is written to, and then a mb() happens to try and ensure that hit the device. Immediately afterwards a usleep_range() occurs.
mb() ensures that the write completes, but completion doesn't mean that it isn't stored in a buffer somewhere. The recommendation for ensuring this bit has taken effect on the device is to perform a read back to force it to make it all the way to the device. This is documented in device-io.rst and a talk by Will Deacon on this can be seen over here:
https://youtu.be/i6DayghhA8Q?si=MiyxB5cKJXSaoc01&t=1678
Let's do that to ensure the bit hits the device. By doing so and guaranteeing the ordering against the immediately following usleep_range(), the mb() can safely be removed.
--- drivers/scsi/ufs/ufs-qcom.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/scsi/ufs/ufs-qcom.h +6 -6
@@ -155,10 +155,10 @@ static inline void ufs_qcom_assert_reset(struct ufs_hba *hba) 1 << OFFSET_UFS_PHY_SOFT_RESET, REG_UFS_CFG1);/* -* Make sure assertion of ufs phy reset is written to -* register before returning +* Dummy read to ensure the write takes effect before doing any sort +* of delay */ -mb (); +ufshcd_readl (hba,REG_UFS_CFG1 ); }static inline void ufs_qcom_deassert_reset (struct ufs_hba *hba)
@@ -167,10 +167,10 @@ static inline void ufs_qcom_deassert_reset(struct ufs_hba *hba) 0 << OFFSET_UFS_PHY_SOFT_RESET, REG_UFS_CFG1);/* -* Make sure de-assertion of ufs phy reset is written to -* register before returning +* Dummy read to ensure the write takes effect before doing any sort +* of delay */ -mb (); +ufshcd_readl (hba,REG_UFS_CFG1 ); }struct ufs_qcom_bus_vote {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 31/202 scsi: ufs: cdns-pltfrm: Perform read back after writing HCLKDIV
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Halaney <[email protected]>
[ Upstream commit b715c55daf598aac8fa339048e4ca8a0916b332e ]
Currently, HCLKDIV is written to and then completed with an mb().
mb() ensures that the write completes, but completion doesn't mean that it isn't stored in a buffer somewhere. The recommendation for ensuring this bit has taken effect on the device is to perform a read back to force it to make it all the way to the device. This is documented in device-io.rst and a talk by Will Deacon on this can be seen over here:
https://youtu.be/i6DayghhA8Q?si=MiyxB5cKJXSaoc01&t=1678
Let's do that to ensure the bit hits the device. Because the mb()'s purpose wasn't to add extra ordering (on top of the ordering guaranteed by writel()/readl()), it can safely be removed.
--- drivers/scsi/ufs/cdns-pltfrm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ufs/cdns-pltfrm.c +1 -1
@@ -56,7 +56,7 @@ static int cdns_ufs_set_hclkdiv(struct ufs_hba *hba)* Make sure the register was updated, * UniPro layer will not work with an incorrect value. */ -mb (); +ufshcd_readl (hba,CDNS_UFS_REG_HCLKDIV );return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 32/202 scsi: ufs: core: Perform read back after disabling interrupts
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Halaney <[email protected]>
[ Upstream commit e4a628877119bd40164a651d20321247b6f94a8b ]
Currently, interrupts are cleared and disabled prior to registering the interrupt. An mb() is used to complete the clear/disable writes before the interrupt is registered.
mb() ensures that the write completes, but completion doesn't mean that it isn't stored in a buffer somewhere. The recommendation for ensuring these bits have taken effect on the device is to perform a read back to force it to make it all the way to the device. This is documented in device-io.rst and a talk by Will Deacon on this can be seen over here:
https://youtu.be/i6DayghhA8Q?si=MiyxB5cKJXSaoc01&t=1678
Let's do that to ensure these bits hit the device. Because the mb()'s purpose wasn't to add extra ordering (on top of the ordering guaranteed by writel()/readl()), it can safely be removed.
--- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ufs/ufshcd.c +1 -1
@@ -8424,7 +8424,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)* Make sure that UFS interrupts are disabled and any pending interrupt * status is cleared before registering UFS interrupt handler. */ -mb (); +ufshcd_readl (hba,REG_INTERRUPT_ENABLE );/* IRQ registration */ err =devm_request_irq (dev, irq, ufshcd_intr,IRQF_SHARED ,UFSHCD , hba);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 33/202 scsi: ufs: core: Perform read back after disabling UIC_COMMAND_COMPL
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Halaney <[email protected]>
[ Upstream commit 4bf3855497b60765ca03b983d064b25e99b97657 ]
Currently, the UIC_COMMAND_COMPL interrupt is disabled and a wmb() is used to complete the register write before any following writes.
wmb() ensures the writes complete in that order, but completion doesn't mean that it isn't stored in a buffer somewhere. The recommendation for ensuring this bit has taken effect on the device is to perform a read back to force it to make it all the way to the device. This is documented in device-io.rst and a talk by Will Deacon on this can be seen over here:
https://youtu.be/i6DayghhA8Q?si=MiyxB5cKJXSaoc01&t=1678
Let's do that to ensure the bit hits the device. Because the wmb()'s purpose wasn't to add extra ordering (on top of the ordering guaranteed by writel()/readl()), it can safely be removed.
--- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ufs/ufshcd.c +1 -1
@@ -3731,7 +3731,7 @@ static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, struct uic_command *cmd)* Make sure UIC command completion interrupt is disabled before * issuing UIC command. */ -wmb (); +ufshcd_readl (hba,REG_INTERRUPT_ENABLE ); reenable_intr = true; } ret =__ufshcd_send_uic_cmd (hba, cmd, false);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 34/202 irqchip/alpine-msi: Fix off-by-one in allocation error path
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zenghui Yu <[email protected]>
[ Upstream commit ff3669a71afa06208de58d6bea1cc49d5e3fcbd1 ]
When alpine_msix_gic_domain_alloc() fails, there is an off-by-one in the number of interrupts to be freed.
Fix it by passing the number of successfully allocated interrupts, instead of the relative index of the last allocated one.
--- drivers/irqchip/irq-alpine-msi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-alpine-msi.c +1 -1
@@ -165,7 +165,7 @@ static int alpine_msix_middle_domain_alloc(struct irq_domain *domain,return 0 ; err_sgi: -irq_domain_free_irqs_parent (domain, virq, i -1 ); +irq_domain_free_irqs_parent (domain, virq, i);alpine_msix_free_sgi (priv, sgi, nr_irqs);return err; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 35/202 ACPI: disable -Wstringop-truncation
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit a3403d304708f60565582d60af4316289d0316a0 ]
gcc -Wstringop-truncation warns about copying a string that results in a missing nul termination:
drivers/acpi/acpica/tbfind.c: In function 'acpi_tb_find_table':drivers/acpi/acpica/tbfind.c:60:9: error: 'strncpy' specified bound 6 equals destination size [-Werror=stringop-truncation]
60 | strncpy(header.oem_id, oem_id, ACPI_OEM_ID_SIZE);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/acpi/acpica/tbfind.c:61:9: error: 'strncpy' specified bound 8 equals destination size [-Werror=stringop-truncation]
61 | strncpy(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~The code works as intended, and the warning could be addressed by using a memcpy(), but turning the warning off for this file works equally well and may be easier to merge.
--- drivers/acpi/acpica/Makefile | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/acpica/Makefile +1 -0
@@ -5,6 +5,7 @@ ccflags-y := -D_LINUX -DBUILDING_ACPICA ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT +CFLAGS_tbfind.o += $(call cc-disable-warning, stringop-truncation) # use acpi.o to put all files here into acpi.o modparam namespace obj-y += acpi.o
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 36/202 cpufreq: Reorganize checks in cpufreq_offline()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
[ Upstream commit e1e962c5b9edbc628a335bcdbd010331a12d3e5b ]
Notice that cpufreq_offline() only needs to check policy_is_inactive() once and rearrange the code in there to make that happen.
No expected functional impact.
Stable-dep-of: b8f85833c057 ("cpufreq: exit() callback is optional")
--- drivers/cpufreq/cpufreq.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/cpufreq/cpufreq.c +12 -12
@@ -1567,24 +1567,18 @@ static int cpufreq_offline(unsigned int cpu) }down_write (&policy->rwsem); +if (has_target ())cpufreq_stop_governor (policy);cpumask_clear_cpu (cpu, policy->cpus); -if (policy_is_inactive (policy)) { -if (has_target ()) -strncpy (policy->last_governor, policy->governor->name, -CPUFREQ_NAME_LEN ); -else - policy->last_policy = policy->policy; - }else if (cpu == policy->cpu) { -/* Nominate new CPU */ - policy->cpu =cpumask_any (policy->cpus); - } - -/* Start governor again for active policy */ if (!policy_is_inactive (policy)) { +/* Nominate a new CPU if necessary. */ +if (cpu == policy->cpu) + policy->cpu =cpumask_any (policy->cpus); + +/* Start the governor again for the active policy. */ if (has_target ()) { ret =cpufreq_start_governor (policy);if (ret)
@@ -1594,6 +1588,12 @@ static int cpufreq_offline(unsigned int cpu) goto unlock; } +if (has_target ()) +strncpy (policy->last_governor, policy->governor->name, +CPUFREQ_NAME_LEN ); +else + policy->last_policy = policy->policy; +if (cpufreq_thermal_control_enabled (cpufreq_driver)) {cpufreq_cooling_unregister (policy->cdev); policy->cdev =NULL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 37/202 cpufreq: Split cpufreq_offline()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
[ Upstream commit fddd8f86dff4a24742a7f0322ccbb34c6c1c9850 ]
Split the "core" part running under the policy rwsem out of cpufreq_offline() to allow the locking in cpufreq_remove_dev() to be rearranged more easily.
As a side-effect this eliminates the unlock label that's not needed any more.
No expected functional impact.
Stable-dep-of: b8f85833c057 ("cpufreq: exit() callback is optional")
--- drivers/cpufreq/cpufreq.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-)
drivers/cpufreq/cpufreq.c +19 -14
@@ -1553,21 +1553,10 @@ static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif)return 0 ; } -static int cpufreq_offline (unsigned int cpu) +static void __cpufreq_offline (unsigned int cpu,struct cpufreq_policy *policy) { -struct cpufreq_policy *policy;int ret; -pr_debug ("%s: unregistering CPU %u\n" , __func__, cpu); - - policy =cpufreq_cpu_get_raw (cpu); -if (!policy) { -pr_debug ("%s: No cpu_data found\n" , __func__); -return 0 ; - } - -down_write (&policy->rwsem); -if (has_target ())cpufreq_stop_governor (policy);
@@ -1585,7 +1574,7 @@ static int cpufreq_offline(unsigned int cpu)pr_err ("%s: Failed to start governor\n" , __func__); } - goto unlock; +return ; }if (has_target ())
@@ -1615,8 +1604,24 @@ static int cpufreq_offline(unsigned int cpu) cpufreq_driver->exit (policy); policy->freq_table =NULL ; } +} + +static int cpufreq_offline (unsigned int cpu) +{ +struct cpufreq_policy *policy; + +pr_debug ("%s: unregistering CPU %u\n" , __func__, cpu); + + policy =cpufreq_cpu_get_raw (cpu); +if (!policy) { +pr_debug ("%s: No cpu_data found\n" , __func__); +return 0 ; + } + +down_write (&policy->rwsem); + +__cpufreq_offline (cpu, policy); -unlock:up_write (&policy->rwsem);return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 20/202 nilfs2: fix out-of-range warning
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit c473bcdd80d4ab2ae79a7a509a6712818366e32a ]
clang-14 points out that v_size is always smaller than a 64KB page size if that is configured by the CPU architecture:
fs/nilfs2/ioctl.c:63:19: error: result of comparison of constant 65536 with expression of type '__u16' (aka 'unsigned short') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
if (argv->v_size > PAGE_SIZE)
~~~~~~~~~~~~ ^ ~~~~~~~~~This is ok, so just shut up that warning with a cast.
--- fs/nilfs2/ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nilfs2/ioctl.c +1 -1
@@ -59,7 +59,7 @@ static int nilfs_ioctl_wrap_copy(struct the_nilfs *nilfs,if (argv->v_nmembs ==0 )return 0 ; -if (argv->v_size >PAGE_SIZE ) +if ((size_t )argv->v_size >PAGE_SIZE )return -EINVAL ;/*
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 38/202 cpufreq: Rearrange locking in cpufreq_remove_dev()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
[ Upstream commit f339f3541701d824a0256ad4bf14c26ceb6d79c3 ]
Currently, cpufreq_remove_dev() invokes the ->exit() driver callback without holding the policy rwsem which is inconsistent with what happens if ->exit() is invoked directly from cpufreq_offline().
It also manipulates the real_cpus mask and removes the CPU device symlink without holding the policy rwsem, but cpufreq_offline() holds the rwsem around the modifications thereof.
For consistency, modify cpufreq_remove_dev() to hold the policy rwsem until the ->exit() callback has been called (or it has been determined that it is not necessary to call it).
Stable-dep-of: b8f85833c057 ("cpufreq: exit() callback is optional")
--- drivers/cpufreq/cpufreq.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/cpufreq/cpufreq.c +14 -7
@@ -1639,19 +1639,26 @@ static void cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif)if (!policy)return ; +down_write (&policy->rwsem); +if (cpu_online (cpu)) -cpufreq_offline (cpu); +__cpufreq_offline (cpu, policy);cpumask_clear_cpu (cpu, policy->real_cpus);remove_cpu_dev_symlink (policy, dev); -if (cpumask_empty (policy->real_cpus)) { -/* We did light-weight exit earlier, do full tear down now */ -if (cpufreq_driver->offline) - cpufreq_driver->exit (policy); - -cpufreq_policy_free (policy); +if (!cpumask_empty (policy->real_cpus)) { +up_write (&policy->rwsem); +return ; } + +/* We did light-weight exit earlier, do full tear down now */ +if (cpufreq_driver->offline) + cpufreq_driver->exit (policy); + +up_write (&policy->rwsem); + +cpufreq_policy_free (policy); }/**
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 39/202 cpufreq: exit() callback is optional
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viresh Kumar <[email protected]>
[ Upstream commit b8f85833c05730d631576008daaa34096bc7f3ce ]
The exit() callback is optional and shouldn't be called without checking a valid pointer first.
Also, we must clear freq_table pointer even if the exit() callback isn't present.
--- drivers/cpufreq/cpufreq.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/cpufreq/cpufreq.c +7 -4
@@ -1600,10 +1600,13 @@ static void __cpufreq_offline(unsigned int cpu, struct cpufreq_policy *policy)*/ if (cpufreq_driver->offline) { cpufreq_driver->offline (policy); - }else if (cpufreq_driver->exit) { - cpufreq_driver->exit (policy); - policy->freq_table =NULL ; +return ; } + +if (cpufreq_driver->exit) + cpufreq_driver->exit (policy); + + policy->freq_table =NULL ; }static int cpufreq_offline (unsigned int cpu)
@@ -1653,7 +1656,7 @@ static void cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif) }/* We did light-weight exit earlier, do full tear down now */ -if (cpufreq_driver->offline) +if (cpufreq_driver->offline && cpufreq_driver->exit) cpufreq_driver->exit (policy);up_write (&policy->rwsem);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 40/202 scsi: libsas: Fix the failure of adding phy with zero-address to port
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xingui Yang <[email protected]>
[ Upstream commit 06036a0a5db34642c5dbe22021a767141f010b7a ]
As of commit 7d1d86518118 ("[SCSI] libsas: fix false positive 'device attached' conditions"), reset the phy->entacted_sas_addr address to a zero-address when the link rate is less than 1.5G.
Currently we find that when a new device is attached, and the link rate is less than 1.5G, but the device type is not NO_DEVICE, for example: the link rate is SAS_PHY_RESET_IN_PROGRESS and the device type is stp. After setting the phy->entacted_sas_addr address to the zero address, the port will continue to be created for the phy with the zero-address, and other phys with the zero-address will be tried to be added to the new port:
[562240.051197] sas: ex 500e004aaaaaaa1f phy19:U:0 attached: 0000000000000000 (no device) // phy19 is deleted but still on the parent port's phy_list [562240.062536] sas: ex 500e004aaaaaaa1f phy0 new device attached [562240.062616] sas: ex 500e004aaaaaaa1f phy00:U:5 attached: 0000000000000000 (stp) [562240.062680] port-7:7:0: trying to add phy phy-7:7:19 fails: it's already part of another port
Therefore, it should be the same as sas_get_phy_attached_dev(). Only when device_type is SAS_PHY_UNUSED, sas_address is set to the 0 address.
--- drivers/scsi/libsas/sas_expander.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/libsas/sas_expander.c +1 -2
@@ -256,8 +256,7 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp)/* help some expanders that fail to zero sas_address in the 'no * device' case */ -if (phy->attached_dev_type ==SAS_PHY_UNUSED || - phy->linkrate <SAS_LINK_RATE_1_5_GBPS ) +if (phy->attached_dev_type ==SAS_PHY_UNUSED )memset (phy->attached_sas_addr,0 ,SAS_ADDR_SIZE );else memcpy (phy->attached_sas_addr, dr->attached_sas_addr,SAS_ADDR_SIZE );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 41/202 scsi: hpsa: Fix allocation size for Scsi_Host private data
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuri Karpov <[email protected]>
[ Upstream commit 504e2bed5d50610c1836046c0c195b0a6dba9c72 ]
struct Scsi_Host private data contains pointer to struct ctlr_info.
Restore allocation of only 8 bytes to store pointer in struct Scsi_Host private data area.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/scsi/hpsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/hpsa.c +1 -1
@@ -5810,7 +5810,7 @@ static int hpsa_scsi_host_alloc(struct ctlr_info *h) {struct Scsi_Host *sh; - sh =scsi_host_alloc (&hpsa_driver_template,sizeof (struct ctlr_info )); + sh =scsi_host_alloc (&hpsa_driver_template,sizeof (struct ctlr_info *));if (sh ==NULL ) {dev_err (&h->pdev->dev,"scsi_host_alloc failed\n" );return -ENOMEM ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 42/202 x86/purgatory: Switch to the position-independent small code model
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ard Biesheuvel <[email protected]>
[ Upstream commit cba786af84a0f9716204e09f518ce3b7ada8555e ]
On x86, the ordinary, position dependent small and kernel code models only support placement of the executable in 32-bit addressable memory, due to the use of 32-bit signed immediates to generate references to global variables. For the kernel, this implies that all global variables must reside in the top 2 GiB of the kernel virtual address space, where the implicit address bits 63:32 are equal to sign bit 31.
This means the kernel code model is not suitable for other bare metal executables such as the kexec purgatory, which can be placed arbitrarily in the physical address space, where its address may no longer be representable as a sign extended 32-bit quantity. For this reason, commit
e16c2983fba0 ("x86/purgatory: Change compiler flags from -mcmodel=kernel to -mcmodel=large to fix kexec relocation errors")
switched to the large code model, which uses 64-bit immediates for all symbol references, including function calls, in order to avoid relying on any assumptions regarding proximity of symbols in the final executable.
The large code model is rarely used, clunky and the least likely to operate in a similar fashion when comparing GCC and Clang, so it is best avoided. This is especially true now that Clang 18 has started to emit executable code in two separate sections (.text and .ltext), which triggers an issue in the kexec loading code at runtime.
The SUSE bugzilla fixes tag points to gcc 13 having issues with the large model too and that perhaps the large model should simply not be used at all.
Instead, use the position independent small code model, which makes no assumptions about placement but only about proximity, where all referenced symbols must be within -/+ 2 GiB, i.e., in range for a RIP-relative reference. Use hidden visibility to suppress the use of a GOT, which carries absolute addresses that are not covered by static ELF relocations, and is therefore incompatible with the kexec loader's relocation logic.
[ bp: Massage commit message. ]
--- arch/x86/purgatory/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/purgatory/Makefile +2 -1
@@ -32,7 +32,8 @@ KCOV_INSTRUMENT := n # make up the standalone purgatory.ro PURGATORY_CFLAGS_REMOVE := -mcmodel=kernel -PURGATORY_CFLAGS := -mcmodel=large -ffreestanding -fno-zero-initialized-in-bss -g0 +PURGATORY_CFLAGS := -mcmodel=small -ffreestanding -fno-zero-initialized-in-bss -g0 +PURGATORY_CFLAGS += -fpic -fvisibility=hidden PURGATORY_CFLAGS += $(DISABLE_STACKLEAK_PLUGIN) -DDISABLE_BRANCH_PROFILING # Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 43/202 wifi: ath10k: Fix an error code problem in ath10k_dbg_sta_write_peer_debug_trigger()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Su Hui <[email protected]>
[ Upstream commit c511a9c12674d246916bb16c479d496b76983193 ]
Clang Static Checker (scan-build) warns:
drivers/net/wireless/ath/ath10k/debugfs_sta.c:line 429, column 3 Value stored to 'ret' is never read.
Return 'ret' rather than 'count' when 'ret' stores an error code.
--- drivers/net/wireless/ath/ath10k/debugfs_sta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/debugfs_sta.c +1 -1
@@ -438,7 +438,7 @@ ath10k_dbg_sta_write_peer_debug_trigger(struct file *file, } out:mutex_unlock (&ar->conf_mutex); -return count; +return ret ?: count; }static const struct file_operations fops_peer_debug_trigger = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 44/202 wifi: ath10k: populate board data for WCN3990
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit f1f1b5b055c9f27a2f90fd0f0521f5920e9b3c18 ]
Specify board data size (and board.bin filename) for the WCN3990 platform.
--- drivers/net/wireless/ath/ath10k/core.c | 3 +++ drivers/net/wireless/ath/ath10k/hw.h | 1 + drivers/net/wireless/ath/ath10k/targaddrs.h | 3 +++ 3 files changed, 7 insertions(+)
drivers/net/wireless/ath/ath10k/core.c +3 -0
@@ -579,6 +579,9 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .max_spatial_stream = 4, .fw = { .dir = WCN3990_HW_1_0_FW_DIR, + .board = WCN3990_HW_1_0_BOARD_DATA_FILE, + .board_size = WCN3990_BOARD_DATA_SZ, + .board_ext_size = WCN3990_BOARD_EXT_DATA_SZ, }, .sw_decrypt_mcast_mgmt = true, .hw_ops = &wcn3990_ops,
drivers/net/wireless/ath/ath10k/hw.h +1 -0
@@ -132,6 +132,7 @@ enum qca9377_chip_id_rev {/* WCN3990 1.0 definitions */ #define WCN3990_HW_1_0_DEV_VERSION ATH10K_HW_WCN3990#define WCN3990_HW_1_0_FW_DIR ATH10K_FW_DIR "/WCN3990/hw1.0" +#define WCN3990_HW_1_0_BOARD_DATA_FILE "board.bin"#define ATH10K_FW_FILE_BASE "firmware"#define ATH10K_FW_API_MAX 6
drivers/net/wireless/ath/ath10k/targaddrs.h +3 -0
@@ -480,4 +480,7 @@ struct host_interest {#define QCA4019_BOARD_DATA_SZ 12064#define QCA4019_BOARD_EXT_DATA_SZ 0 +#define WCN3990_BOARD_DATA_SZ 26328 +#define WCN3990_BOARD_EXT_DATA_SZ 0 +#endif /* __TARGADDRS_H__ */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 45/202 tcp: minor optimization in tcp_add_backlog()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit d519f350967a60b85a574ad8aeac43f2b4384746 ]
If packet is going to be coalesced, sk_sndbuf/sk_rcvbuf values are not used. Defer their access to the point we need them.
Stable-dep-of: ec00ed472bdb ("tcp: avoid premature drops in tcp_add_backlog()")
--- net/ipv4/tcp_ipv4.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
net/ipv4/tcp_ipv4.c +2 -3
@@ -1678,8 +1678,7 @@ int tcp_v4_early_demux(struct sk_buff *skb)bool tcp_add_backlog (struct sock *sk,struct sk_buff *skb) { -u32 limit =READ_ONCE (sk->sk_rcvbuf) +READ_ONCE (sk->sk_sndbuf); -u32 tail_gso_size, tail_gso_segs; +u32 limit, tail_gso_size, tail_gso_segs;struct skb_shared_info *shinfo;const struct tcphdr *th;struct tcphdr *thtail;
@@ -1786,7 +1785,7 @@ bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb)* to reduce memory overhead, so add a little headroom here. * Few sockets backlog are possibly concurrently non empty. */ - limit +=64 *1024 ; + limit =READ_ONCE (sk->sk_rcvbuf) +READ_ONCE (sk->sk_sndbuf) +64 *1024 ;if (unlikely (sk_add_backlog (sk, skb, limit))) {bh_unlock_sock (sk);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 46/202 tcp: fix a signed-integer-overflow bug in tcp_add_backlog()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lu Wei <[email protected]>
[ Upstream commit ec791d8149ff60c40ad2074af3b92a39c916a03f ]
The type of sk_rcvbuf and sk_sndbuf in struct sock is int, and in tcp_add_backlog(), the variable limit is caculated by adding sk_rcvbuf, sk_sndbuf and 64 * 1024, it may exceed the max value of int and overflow. This patch reduces the limit budget by halving the sndbuf to solve this issue since ACK packets are much smaller than the payload.
Stable-dep-of: ec00ed472bdb ("tcp: avoid premature drops in tcp_add_backlog()")
--- net/ipv4/tcp_ipv4.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv4/tcp_ipv4.c +3 -1
@@ -1781,11 +1781,13 @@ bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb)__skb_push (skb, hdrlen); no_coalesce: + limit = (u32 )READ_ONCE (sk->sk_rcvbuf) + (u32)(READ_ONCE (sk->sk_sndbuf) >>1 ); +/* Only socket owner can try to collapse/prune rx queues * to reduce memory overhead, so add a little headroom here. * Few sockets backlog are possibly concurrently non empty. */ - limit =READ_ONCE (sk->sk_rcvbuf) +READ_ONCE (sk->sk_sndbuf) +64 *1024 ; + limit +=64 *1024 ;if (unlikely (sk_add_backlog (sk, skb, limit))) {bh_unlock_sock (sk);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 47/202 tcp: avoid premature drops in tcp_add_backlog()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit ec00ed472bdb7d0af840da68c8c11bff9f4d9caa ]
While testing TCP performance with latest trees,
I saw suspect SOCKET_BACKLOG drops.
tcp_add_backlog() computes its limit with :
limit = (u32)READ_ONCE(sk->sk_rcvbuf) +
(u32)(READ_ONCE(sk->sk_sndbuf) >> 1);
limit += 64 * 1024;This does not take into account that sk->sk_backlog.len is reset only at the very end of __release_sock().
Both sk->sk_backlog.len and sk->sk_rmem_alloc could reach sk_rcvbuf in normal conditions.
We should double sk->sk_rcvbuf contribution in the formula to absorb bubbles in the backlog, which happen more often for very fast flows.
This change maintains decent protection against abuses.
--- net/ipv4/tcp_ipv4.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
net/ipv4/tcp_ipv4.c +11 -2
@@ -1678,7 +1678,7 @@ int tcp_v4_early_demux(struct sk_buff *skb)bool tcp_add_backlog (struct sock *sk,struct sk_buff *skb) { -u32 limit, tail_gso_size, tail_gso_segs; +u32 tail_gso_size, tail_gso_segs;struct skb_shared_info *shinfo;const struct tcphdr *th;struct tcphdr *thtail;
@@ -1687,6 +1687,7 @@ bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb)bool fragstolen;u32 gso_segs;u32 gso_size; +u64 limit;int delta;/* In case all data was pulled from skb frags (in __pskb_pull_tail()),
@@ -1781,7 +1782,13 @@ bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb)__skb_push (skb, hdrlen); no_coalesce: - limit = (u32 )READ_ONCE (sk->sk_rcvbuf) + (u32)(READ_ONCE (sk->sk_sndbuf) >>1 ); +/* sk->sk_backlog.len is reset only at the end of __release_sock(). +* Both sk->sk_backlog.len and sk->sk_rmem_alloc could reach +* sk_rcvbuf in normal conditions. +*/ + limit = ((u64 )READ_ONCE (sk->sk_rcvbuf)) <<1 ; + + limit += ((u32 )READ_ONCE (sk->sk_sndbuf)) >>1 ;/* Only socket owner can try to collapse/prune rx queues * to reduce memory overhead, so add a little headroom here.
@@ -1789,6 +1796,8 @@ bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb)*/ limit +=64 *1024 ; + limit =min_t (u64, limit,UINT_MAX ); +if (unlikely (sk_add_backlog (sk, skb, limit))) {bh_unlock_sock (sk);__NET_INC_STATS (sock_net (sk),LINUX_MIB_TCPBACKLOGDROP );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 21/202 parisc: add missing export of __cmpxchg_u8()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit c57e5dccb06decf3cb6c272ab138c033727149b5 ]
__cmpxchg_u8() had been added (initially) for the sake of drivers/phy/ti/phy-tusb1210.c; the thing is, that drivers is modular, so we need an export
--- arch/parisc/kernel/parisc_ksyms.c | 1 + 1 file changed, 1 insertion(+)
arch/parisc/kernel/parisc_ksyms.c +1 -0
@@ -21,6 +21,7 @@ EXPORT_SYMBOL(memset);#include <linux/atomic.h> EXPORT_SYMBOL (__xchg8);EXPORT_SYMBOL (__xchg32); +EXPORT_SYMBOL (__cmpxchg_u8);EXPORT_SYMBOL (__cmpxchg_u32);EXPORT_SYMBOL (__cmpxchg_u64);#ifdef CONFIG_SMP
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 48/202 macintosh/via-macii: Fix "BUG: sleeping function called from invalid context"
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit d301a71c76ee4c384b4e03cdc320a55f5cf1df05 ]
The via-macii ADB driver calls request_irq() after disabling hard interrupts. But disabling interrupts isn't necessary here because the VIA shift register interrupt was masked during VIA1 initialization.
--- drivers/macintosh/via-macii.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/macintosh/via-macii.c +3 -8
@@ -135,24 +135,19 @@ static int macii_probe(void)/* Initialize the driver */ int macii_init (void ) { -unsigned long flags;int err; -local_irq_save (flags); - err =macii_init_via ();if (err) - goto out; +return err; err =request_irq (IRQ_MAC_ADB , macii_interrupt,0 ,"ADB" , macii_interrupt);if (err) - goto out; +return err; macii_state = idle; -out: -local_irq_restore (flags); -return err; +return 0 ; }/* initialize the hardware */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 49/202 wifi: carl9170: add a proper sanity check for endpoints
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Zhandarovich <[email protected]>
[ Upstream commit b6dd09b3dac89b45d1ea3e3bd035a3859c0369a0 ]
Syzkaller reports [1] hitting a warning which is caused by presence of a wrong endpoint type at the URB sumbitting stage. While there was a check for a specific 4th endpoint, since it can switch types between bulk and interrupt, other endpoints are trusted implicitly. Similar warning is triggered in a couple of other syzbot issues [2].
Fix the issue by doing a comprehensive check of all endpoints taking into account difference between high- and full-speed configuration.
[1] Syzkaller report:
...
WARNING: CPU: 0 PID: 4721 at drivers/usb/core/urb.c:504 usb_submit_urb+0xed6/0x1880 drivers/usb/core/urb.c:504 ... Call Trace: <TASK> carl9170_usb_send_rx_irq_urb+0x273/0x340 drivers/net/wireless/ath/carl9170/usb.c:504 carl9170_usb_init_device drivers/net/wireless/ath/carl9170/usb.c:939 [inline] carl9170_usb_firmware_finish drivers/net/wireless/ath/carl9170/usb.c:999 [inline] carl9170_usb_firmware_step2+0x175/0x240 drivers/net/wireless/ath/carl9170/usb.c:1028 request_firmware_work_func+0x130/0x240 drivers/base/firmware_loader/main.c:1107 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289 worker_thread+0x669/0x1090 kernel/workqueue.c:2436 kthread+0x2e8/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 </TASK>
[2] Related syzkaller crashes:
--- drivers/net/wireless/ath/carl9170/usb.c | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/net/wireless/ath/carl9170/usb.c +32 -0
@@ -1069,6 +1069,38 @@ static int carl9170_usb_probe(struct usb_interface *intf, ar->usb_ep_cmd_is_bulk = true; } +/* Verify that all expected endpoints are present */ +if (ar->usb_ep_cmd_is_bulk) { +u8 bulk_ep_addr[] = { +AR9170_USB_EP_RX |USB_DIR_IN , +AR9170_USB_EP_TX |USB_DIR_OUT , +AR9170_USB_EP_CMD |USB_DIR_OUT , +0 }; +u8 int_ep_addr[] = { +AR9170_USB_EP_IRQ |USB_DIR_IN , +0 }; +if (!usb_check_bulk_endpoints (intf, bulk_ep_addr) || + !usb_check_int_endpoints (intf, int_ep_addr)) + err = -ENODEV ; + }else { +u8 bulk_ep_addr[] = { +AR9170_USB_EP_RX |USB_DIR_IN , +AR9170_USB_EP_TX |USB_DIR_OUT , +0 }; +u8 int_ep_addr[] = { +AR9170_USB_EP_IRQ |USB_DIR_IN , +AR9170_USB_EP_CMD |USB_DIR_OUT , +0 }; +if (!usb_check_bulk_endpoints (intf, bulk_ep_addr) || + !usb_check_int_endpoints (intf, int_ep_addr)) + err = -ENODEV ; + } + +if (err) { +carl9170_free (ar); +return err; + } +usb_set_intfdata (intf, ar);SET_IEEE80211_DEV (ar->hw, &intf->dev);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 50/202 wifi: ar5523: enable proper endpoint verification
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Zhandarovich <[email protected]>
[ Upstream commit e120b6388d7d88635d67dcae6483f39c37111850 ]
Syzkaller reports [1] hitting a warning about an endpoint in use not having an expected type to it.
Fix the issue by checking for the existence of all proper endpoints with their according types intact.
Sadly, this patch has not been tested on real hardware.
[1] Syzkaller report:
------------[ cut here ]------------ usb 1-1: BOGUS urb xfer, pipe 3 != type 1 WARNING: CPU: 0 PID: 3643 at drivers/usb/core/urb.c:504 usb_submit_urb+0xed6/0x1880 drivers/usb/core/urb.c:504 ... Call Trace: <TASK> ar5523_cmd+0x41b/0x780 drivers/net/wireless/ath/ar5523/ar5523.c:275 ar5523_cmd_read drivers/net/wireless/ath/ar5523/ar5523.c:302 [inline] ar5523_host_available drivers/net/wireless/ath/ar5523/ar5523.c:1376 [inline] ar5523_probe+0x14b0/0x1d10 drivers/net/wireless/ath/ar5523/ar5523.c:1655 usb_probe_interface+0x30f/0x7f0 drivers/usb/core/driver.c:396 call_driver_probe drivers/base/dd.c:560 [inline] really_probe+0x249/0xb90 drivers/base/dd.c:639 __driver_probe_device+0x1df/0x4d0 drivers/base/dd.c:778 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:808 __device_attach_driver+0x1d4/0x2e0 drivers/base/dd.c:936 bus_for_each_drv+0x163/0x1e0 drivers/base/bus.c:427 __device_attach+0x1e4/0x530 drivers/base/dd.c:1008 bus_probe_device+0x1e8/0x2a0 drivers/base/bus.c:487 device_add+0xbd9/0x1e90 drivers/base/core.c:3517 usb_set_configuration+0x101d/0x1900 drivers/usb/core/message.c:2170 usb_generic_driver_probe+0xbe/0x100 drivers/usb/core/generic.c:238 usb_probe_device+0xd8/0x2c0 drivers/usb/core/driver.c:293 call_driver_probe drivers/base/dd.c:560 [inline] really_probe+0x249/0xb90 drivers/base/dd.c:639 __driver_probe_device+0x1df/0x4d0 drivers/base/dd.c:778 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:808 __device_attach_driver+0x1d4/0x2e0 drivers/base/dd.c:936 bus_for_each_drv+0x163/0x1e0 drivers/base/bus.c:427 __device_attach+0x1e4/0x530 drivers/base/dd.c:1008 bus_probe_device+0x1e8/0x2a0 drivers/base/bus.c:487 device_add+0xbd9/0x1e90 drivers/base/core.c:3517 usb_new_device.cold+0x685/0x10ad drivers/usb/core/hub.c:2573 hub_port_connect drivers/usb/core/hub.c:5353 [inline] hub_port_connect_change drivers/usb/core/hub.c:5497 [inline] port_event drivers/usb/core/hub.c:5653 [inline] hub_event+0x26cb/0x45d0 drivers/usb/core/hub.c:5735 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289 worker_thread+0x669/0x1090 kernel/workqueue.c:2436 kthread+0x2e8/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 </TASK>
--- drivers/net/wireless/ath/ar5523/ar5523.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/net/wireless/ath/ar5523/ar5523.c +14 -0
@@ -1590,6 +1590,20 @@ static int ar5523_probe(struct usb_interface *intf,struct ar5523 *ar;int error = -ENOMEM ; +static const u8 bulk_ep_addr[] = { +AR5523_CMD_TX_PIPE |USB_DIR_OUT , +AR5523_DATA_TX_PIPE |USB_DIR_OUT , +AR5523_CMD_RX_PIPE |USB_DIR_IN , +AR5523_DATA_RX_PIPE |USB_DIR_IN , +0 }; + +if (!usb_check_bulk_endpoints (intf, bulk_ep_addr)) { +dev_err (&dev->dev, +"Could not find all expected endpoints\n" ); + error = -ENODEV ; + goto out; + } +/* * Load firmware if the device requires it. This will return * -ENXIO on success and we'll get called back afer the usb
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 22/202 crypto: ccp - drop platform ifdef checks
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 42c2d7d02977ef09d434b1f5b354f5bc6c1027ab ]
When both ACPI and OF are disabled, the dev_vdata variable is unused:
drivers/crypto/ccp/sp-platform.c:33:34: error: unused variable 'dev_vdata' [-Werror,-Wunused-const-variable]
This is not a useful configuration, and there is not much point in saving a few bytes when only one of the two is enabled, so just remove all these ifdef checks and rely on of_match_node() and acpi_match_device() returning NULL when these subsystems are disabled.
--- drivers/crypto/ccp/sp-platform.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/crypto/ccp/sp-platform.c +2 -12
@@ -39,44 +39,38 @@ static const struct sp_dev_vdata dev_vdata[] = { }, }; -#ifdef CONFIG_ACPI static const struct acpi_device_id sp_acpi_match[] = { {"AMDI0C00" , (kernel_ulong_t)&dev_vdata[0 ] }, { }, };MODULE_DEVICE_TABLE (acpi, sp_acpi_match); -#endif -#ifdef CONFIG_OF static const struct of_device_id sp_of_match[] = { { .compatible ="amd,ccp-seattle-v1a" , .data = (const void *)&dev_vdata[0 ] }, { }, };MODULE_DEVICE_TABLE (of, sp_of_match); -#endif static struct sp_dev_vdata *sp_get_of_version (struct platform_device *pdev) { -#ifdef CONFIG_OF const struct of_device_id *match; match =of_match_node (sp_of_match, pdev->dev.of_node);if (match && match->data)return (struct sp_dev_vdata *)match->data; -#endif +return NULL ; }static struct sp_dev_vdata *sp_get_acpi_version (struct platform_device *pdev) { -#ifdef CONFIG_ACPI const struct acpi_device_id *match; match =acpi_match_device (sp_acpi_match, &pdev->dev);if (match && match->driver_data)return (struct sp_dev_vdata *)match->driver_data; -#endif +return NULL ; }
@@ -222,12 +216,8 @@ static int sp_platform_resume(struct platform_device *pdev)static struct platform_driver sp_platform_driver = { .driver = { .name ="ccp" , -#ifdef CONFIG_ACPI .acpi_match_table = sp_acpi_match, -#endif -#ifdef CONFIG_OF .of_match_table = sp_of_match, -#endif }, .probe = sp_platform_probe, .remove = sp_platform_remove,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 23/202 s390/cio: fix tracepoint subchannel type field
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Oberparleiter <[email protected]>
[ Upstream commit 8692a24d0fae19f674d51726d179ad04ba95d958 ]
The subchannel-type field "st" of s390_cio_stsch and s390_cio_msch tracepoints is incorrectly filled with the subchannel-enabled SCHIB value "ena". Fix this by assigning the correct value.
--- drivers/s390/cio/trace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/cio/trace.h +1 -1
@@ -50,7 +50,7 @@ DECLARE_EVENT_CLASS(s390_class_schib, __entry->devno = schib->pmcw.dev; __entry->schib = *schib; __entry->pmcw_ena = schib->pmcw.ena; - __entry->pmcw_st = schib->pmcw.ena; + __entry->pmcw_st = schib->pmcw.st; __entry->pmcw_dnv = schib->pmcw.dnv; __entry->pmcw_dev = schib->pmcw.dev; __entry->pmcw_lpm = schib->pmcw.lpm;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 24/202 jffs2: prevent xattr node from overflowing the eraseblock
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Denisyev <[email protected]>
[ Upstream commit c6854e5a267c28300ff045480b5a7ee7f6f1d913 ]
Add a check to make sure that the requested xattr node size is no larger than the eraseblock minus the cleanmarker.
Unlike the usual inode nodes, the xattr nodes aren't split into parts and spread across multiple eraseblocks, which means that a xattr node must not occupy more than one eraseblock. If the requested xattr value is too large, the xattr node can spill onto the next eraseblock, overwriting the nodes and causing errors such as:
jffs2: argh. node added in wrong place at 0x0000b050(2)
jffs2: nextblock 0x0000a000, expected at 0000b00c
jffs2: error: (823) do_verify_xattr_datum: node CRC failed at 0x01e050, read=0xfc892c93, calc=0x000000
jffs2: notice: (823) jffs2_get_inode_nodes: Node header CRC failed at 0x01e00c. {848f,2fc4,0fef511f,59a3d171}
jffs2: Node at 0x0000000c with length 0x00001044 would run over the end of the erase block
jffs2: Perhaps the file system was created with the wrong erase size?
jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000010: 0x1044 instead
This breaks the filesystem and can lead to KASAN crashes such as:
BUG: KASAN: slab-out-of-bounds in jffs2_sum_add_kvec+0x125e/0x15d0 Read of size 4 at addr ffff88802c31e914 by task repro/830 CPU: 0 PID: 830 Comm: repro Not tainted 6.9.0-rc3+ #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Arch Linux 1.16.3-1-1 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0xc6/0x120 print_report+0xc4/0x620 ? __virt_addr_valid+0x308/0x5b0 kasan_report+0xc1/0xf0 ? jffs2_sum_add_kvec+0x125e/0x15d0 ? jffs2_sum_add_kvec+0x125e/0x15d0 jffs2_sum_add_kvec+0x125e/0x15d0 jffs2_flash_direct_writev+0xa8/0xd0 jffs2_flash_writev+0x9c9/0xef0 ? __x64_sys_setxattr+0xc4/0x160 ? do_syscall_64+0x69/0x140 ? entry_SYSCALL_64_after_hwframe+0x76/0x7e [...]
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- fs/jffs2/xattr.c | 3 +++ 1 file changed, 3 insertions(+)
fs/jffs2/xattr.c +3 -0
@@ -1111,6 +1111,9 @@ int do_jffs2_setxattr(struct inode *inode, int xprefix, const char *xname,return rc; request =PAD (sizeof (struct jffs2_raw_xattr ) +strlen (xname) +1 + size); +if (request > c->sector_size - c->cleanmarker_size) +return -ERANGE ; + rc =jffs2_reserve_space (c, request, &length,ALLOC_NORMAL ,JFFS2_SUMMARY_XATTR_SIZE );if (rc) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 25/202 null_blk: Fix missing mutex_destroy() at module removal
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Yanjun <[email protected]>
[ Upstream commit 07d1b99825f40f9c0d93e6b99d79a08d0717bac1 ]
When a mutex lock is not used any more, the function mutex_destroy should be called to mark the mutex lock uninitialized.
--- drivers/block/null_blk_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/block/null_blk_main.c +2 -0
@@ -1868,6 +1868,8 @@ static void __exit null_exit(void)if (g_queue_mode ==NULL_Q_MQ && shared_tags)blk_mq_free_tag_set (&tag_set); + +mutex_destroy (&lock); }module_init (null_init);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 26/202 md: fix resync softlockup when bitmap size is less than array size
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
[ Upstream commit f0e729af2eb6bee9eb58c4df1087f14ebaefe26b ]
Is is reported that for dm-raid10, lvextend + lvchange --syncaction will trigger following softlockup:
kernel:watchdog: BUG: soft lockup - CPU#3 stuck for 26s! [mdX_resync:6976]
CPU: 7 PID: 3588 Comm: mdX_resync Kdump: loaded Not tainted 6.9.0-rc4-next-20240419 #1 RIP: 0010:_raw_spin_unlock_irq+0x13/0x30 Call Trace: <TASK> md_bitmap_start_sync+0x6b/0xf0 raid10_sync_request+0x25c/0x1b40 [raid10] md_do_sync+0x64b/0x1020 md_thread+0xa7/0x170 kthread+0xcf/0x100 ret_from_fork+0x30/0x50 ret_from_fork_asm+0x1a/0x30
And the detailed process is as follows:
md_do_sync
j = mddev->resync_min
while (j < max_sectors)
sectors = raid10_sync_request(mddev, j, &skipped)
if (!md_bitmap_start_sync(..., &sync_blocks))
// md_bitmap_start_sync set sync_blocks to 0
return sync_blocks + sectors_skippe; // sectors = 0;
j += sectors;
// j never change
Root cause is that commit 301867b1c168 ("md/raid10: check slab-out-of-bounds in md_bitmap_get_counter") return early from md_bitmap_get_counter(), without setting returned blocks.
Fix this problem by always set returned blocks from md_bitmap_get_counter"(), as it used to be.
Noted that this patch just fix the softlockup problem in kernel, the case that bitmap size doesn't match array size still need to be fixed.
--- drivers/md/md-bitmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/md/md-bitmap.c +3 -3
@@ -1359,7 +1359,7 @@ __acquires(bitmap->lock)sector_t chunk = offset >> bitmap->chunkshift;unsigned long page = chunk >>PAGE_COUNTER_SHIFT ;unsigned long pageoff = (chunk &PAGE_COUNTER_MASK ) <<COUNTER_BYTE_SHIFT ; -sector_t csize; +sector_t csize = ((sector_t )1 ) << bitmap->chunkshift;int err;if (page >= bitmap->pages) {
@@ -1368,6 +1368,7 @@ __acquires(bitmap->lock)* End-of-device while looking for a whole page or * user set a huge number to sysfs bitmap_set_bits. */ + *blocks = csize - (offset & (csize -1 ));return NULL ; } err =md_bitmap_checkpage (bitmap, page, create,0 );
@@ -1376,8 +1377,7 @@ __acquires(bitmap->lock) bitmap->bp[page].map == NULL) csize = ((sector_t )1 ) << (bitmap->chunkshift +PAGE_COUNTER_SHIFT ); - else - csize = ((sector_t )1 ) << bitmap->chunkshift; + *blocks = csize - (offset & (csize -1 ));if (err <0 )
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 27/202 wifi: ath10k: poll service ready message before failing
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baochen Qiang <[email protected]>
[ Upstream commit e57b7d62a1b2f496caf0beba81cec3c90fad80d5 ]
Currently host relies on CE interrupts to get notified that the service ready message is ready. This results in timeout issue if the interrupt is not fired, due to some unknown reasons. See below logs:
[76321.937866] ath10k_pci 0000:02:00.0: wmi service ready event not received ... [76322.016738] ath10k_pci 0000:02:00.0: Could not init core: -110
And finally it causes WLAN interface bring up failure.
Change to give it one more chance here by polling CE rings, before failing directly.
Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00157-QCARMSWPZ-1
--- drivers/net/wireless/ath/ath10k/wmi.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath10k/wmi.c +23 -3
@@ -1720,12 +1720,32 @@ void ath10k_wmi_put_wmi_channel(struct wmi_channel *ch,int ath10k_wmi_wait_for_service_ready (struct ath10k *ar) { -unsigned long time_left; +unsigned long time_left, i; time_left =wait_for_completion_timeout (&ar->wmi.service_ready,WMI_SERVICE_READY_TIMEOUT_HZ ); -if (!time_left) -return -ETIMEDOUT ; +if (!time_left) { +/* Sometimes the PCI HIF doesn't receive interrupt +* for the service ready message even if the buffer +* was completed. PCIe sniffer shows that it's +* because the corresponding CE ring doesn't fires +* it. Workaround here by polling CE rings once. +*/ +ath10k_warn (ar,"failed to receive service ready completion, polling..\n" ); + +for (i =0 ; i <CE_COUNT ; i++) +ath10k_hif_send_complete_check (ar, i,1 ); + + time_left =wait_for_completion_timeout (&ar->wmi.service_ready, +WMI_SERVICE_READY_TIMEOUT_HZ ); +if (!time_left) { +ath10k_warn (ar,"polling timed out\n" ); +return -ETIMEDOUT ; + } + +ath10k_warn (ar,"service ready completion received, continuing normally\n" ); + } +return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 18/202 firmware: raspberrypi: Use correct device for DMA mappings
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laurent Pinchart <[email protected]>
[ Upstream commit df518a0ae1b982a4dcf2235464016c0c4576a34d ]
The buffer used to transfer data over the mailbox interface is mapped using the client's device. This is incorrect, as the device performing the DMA transfer is the mailbox itself. Fix it by using the mailbox controller device instead.
This requires including the mailbox_controller.h header to dereference the mbox_chan and mbox_controller structures. The header is not meant to be included by clients. This could be fixed by extending the client API with a function to access the controller's device.
--- drivers/firmware/raspberrypi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/firmware/raspberrypi.c +4 -3
@@ -9,6 +9,7 @@#include <linux/dma-mapping.h> #include <linux/kref.h> #include <linux/mailbox_client.h> +#include <linux/mailbox_controller.h> #include <linux/module.h> #include <linux/of_platform.h> #include <linux/platform_device.h>
@@ -96,8 +97,8 @@ int rpi_firmware_property_list(struct rpi_firmware *fw,if (size &3 )return -EINVAL ; - buf =dma_alloc_coherent (fw->cl.dev,PAGE_ALIGN (size), &bus_addr, -GFP_ATOMIC ); + buf =dma_alloc_coherent (fw->chan->mbox->dev,PAGE_ALIGN (size), + &bus_addr,GFP_ATOMIC );if (!buf)return -ENOMEM ;
@@ -125,7 +126,7 @@ int rpi_firmware_property_list(struct rpi_firmware *fw, ret = -EINVAL ; } -dma_free_coherent (fw->cl.dev,PAGE_ALIGN (size), buf, bus_addr); +dma_free_coherent (fw->chan->mbox->dev,PAGE_ALIGN (size), buf, bus_addr);return ret; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 52/202 Revert "sh: Handle calling csum_partial with misaligned data"
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
[ Upstream commit b5319c96292ff877f6b58d349acf0a9dc8d3b454 ]
This reverts commit cadc4e1a2b4d20d0cc0e81f2c6ba0588775e54e5.
Commit cadc4e1a2b4d ("sh: Handle calling csum_partial with misaligned data") causes bad checksum calculations on unaligned data. Reverting it fixes the problem.
# Subtest: checksum
# module: checksum_kunit
1..5
# test_csum_fixed_random_inputs: ASSERTION FAILED at lib/checksum_kunit.c:500 Expected ( u64)result == ( u64)expec, but
( u64)result == 53378 (0xd082)
( u64)expec == 33488 (0x82d0)
# test_csum_fixed_random_inputs: pass:0 fail:1 skip:0 total:1 not ok 1 test_csum_fixed_random_inputs
# test_csum_all_carry_inputs: ASSERTION FAILED at lib/checksum_kunit.c:525 Expected ( u64)result == ( u64)expec, but
( u64)result == 65281 (0xff01)
( u64)expec == 65280 (0xff00)
# test_csum_all_carry_inputs: pass:0 fail:1 skip:0 total:1
not ok 2 test_csum_all_carry_inputs
# test_csum_no_carry_inputs: ASSERTION FAILED at lib/checksum_kunit.c:573 Expected ( u64)result == ( u64)expec, but
( u64)result == 65535 (0xffff)
( u64)expec == 65534 (0xfffe)
# test_csum_no_carry_inputs: pass:0 fail:1 skip:0 total:1
not ok 3 test_csum_no_carry_inputs
# test_ip_fast_csum: pass:1 fail:0 skip:0 total:1
ok 4 test_ip_fast_csum
# test_csum_ipv6_magic: pass:1 fail:0 skip:0 total:1
ok 5 test_csum_ipv6_magic
# checksum: pass:2 fail:3 skip:0 total:5
# Totals: pass:2 fail:3 skip:0 total:5
not ok 22 checksum
--- arch/sh/lib/checksum.S | 67 ++++++++++++------------------------------ 1 file changed, 18 insertions(+), 49 deletions(-)
arch/sh/lib/checksum.S +18 -49
@@ -33,7 +33,8 @@ */ /* - * asmlinkage __wsum csum_partial(const void *buf, int len, __wsum sum); + * unsigned int csum_partial(const unsigned char *buf, int len, + * unsigned int sum); */ .text
@@ -45,31 +46,11 @@ ENTRY(csum_partial) * Fortunately, it is easy to convert 2-byte alignment to 4-byte * alignment for the unrolled loop. */ + mov r5, r1 mov r4, r0 - tst #3, r0 ! Check alignment. - bt/s 2f ! Jump if alignment is ok. - mov r4, r7 ! Keep a copy to check for alignment + tst #2, r0 ! Check alignment. + bt 2f ! Jump if alignment is ok. ! - tst #1, r0 ! Check alignment. - bt 21f ! Jump if alignment is boundary of 2bytes. - - ! buf is odd - tst r5, r5 - add #-1, r5 - bt 9f - mov.b @r4+, r0 - extu.b r0, r0 - addc r0, r6 ! t=0 from previous tst - mov r6, r0 - shll8 r6 - shlr16 r0 - shlr8 r0 - or r0, r6 - mov r4, r0 - tst #2, r0 - bt 2f -21: - ! buf is 2 byte aligned (len could be 0) add #-2, r5 ! Alignment uses up two bytes. cmp/pz r5 ! bt/s 1f ! Jump if we had at least two bytes.
@@ -77,17 +58,16 @@ ENTRY(csum_partial) bra 6f add #2, r5 ! r5 was < 2. Deal with it. 1: + mov r5, r1 ! Save new len for later use. mov.w @r4+, r0 extu.w r0, r0 addc r0, r6 bf 2f add #1, r6 2: - ! buf is 4 byte aligned (len could be 0) - mov r5, r1 mov #-5, r0 - shld r0, r1 - tst r1, r1 + shld r0, r5 + tst r5, r5 bt/s 4f ! if it's =0, go to 4f clrt .align 2
@@ -109,31 +89,30 @@ ENTRY(csum_partial) addc r0, r6 addc r2, r6 movt r0 - dt r1 + dt r5 bf/s 3b cmp/eq #1, r0 - ! here, we know r1==0 - addc r1, r6 ! add carry to r6 + ! here, we know r5==0 + addc r5, r6 ! add carry to r6 4: - mov r5, r0 + mov r1, r0 and #0x1c, r0 tst r0, r0 - bt 6f - ! 4 bytes or more remaining - mov r0, r1 - shlr2 r1 + bt/s 6f + mov r0, r5 + shlr2 r5 mov #0, r2 5: addc r2, r6 mov.l @r4+, r2 movt r0 - dt r1 + dt r5 bf/s 5b cmp/eq #1, r0 addc r2, r6 - addc r1, r6 ! r1==0 here, so it means add carry-bit + addc r5, r6 ! r5==0 here, so it means add carry-bit 6: - ! 3 bytes or less remaining + mov r1, r5 mov #3, r0 and r0, r5 tst r5, r5
@@ -159,16 +138,6 @@ ENTRY(csum_partial) mov #0, r0 addc r0, r6 9: - ! Check if the buffer was misaligned, if so realign sum - mov r7, r0 - tst #1, r0 - bt 10f - mov r6, r0 - shll8 r6 - shlr16 r0 - shlr8 r0 - or r0, r6 -10: rts mov r6, r0
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 61/202 net: ethernet: cortina: Locking fixes
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
[ Upstream commit 812552808f7ff71133fc59768cdc253c5b8ca1bf ]
This fixes a probably long standing problem in the Cortina Gemini ethernet driver: there are some paths in the code where the IRQ registers are written without taking the proper locks.
--- drivers/net/ethernet/cortina/gemini.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/ethernet/cortina/gemini.c +10 -2
@@ -1115,10 +1115,13 @@ static void gmac_tx_irq_enable(struct net_device *netdev, {struct gemini_ethernet_port *port =netdev_priv (netdev);struct gemini_ethernet *geth = port->geth; +unsigned long flags;u32 val, mask;netdev_dbg (netdev,"%s device %d\n" , __func__, netdev->dev_id); +spin_lock_irqsave (&geth->irq_lock, flags); + mask =GMAC0_IRQ0_TXQ0_INTS << (6 * netdev->dev_id + txq);if (en)
@@ -1127,6 +1130,8 @@ static void gmac_tx_irq_enable(struct net_device *netdev, val =readl (geth->base +GLOBAL_INTERRUPT_ENABLE_0_REG ); val = en ? val | mask : val & ~mask;writel (val, geth->base +GLOBAL_INTERRUPT_ENABLE_0_REG ); + +spin_unlock_irqrestore (&geth->irq_lock, flags); }static void gmac_tx_irq (struct net_device *netdev,unsigned int txq_num)
@@ -1432,15 +1437,19 @@ static unsigned int gmac_rx(struct net_device *netdev, unsigned int budget)union gmac_rxdesc_3 word3;struct page *page =NULL ;unsigned int page_offs; +unsigned long flags;unsigned short r, w;union dma_rwptr rw;dma_addr_t mapping;int frag_nr =0 ; +spin_lock_irqsave (&geth->irq_lock, flags); rw.bits32 =readl (ptr_reg);/* Reset interrupt as all packages until here are taken into account */ writel (DEFAULT_Q0_INT_BIT << netdev->dev_id, geth->base +GLOBAL_INTERRUPT_STATUS_1_REG ); +spin_unlock_irqrestore (&geth->irq_lock, flags); + r = rw.bits.rptr; w = rw.bits.wptr;
@@ -1743,10 +1752,9 @@ static irqreturn_t gmac_irq(int irq, void *data)gmac_update_hw_stats (netdev);if (val & (GMAC0_RX_OVERRUN_INT_BIT << (netdev->dev_id *8 ))) { +spin_lock (&geth->irq_lock);writel (GMAC0_RXDERR_INT_BIT << (netdev->dev_id *8 ), geth->base +GLOBAL_INTERRUPT_STATUS_4_REG ); - -spin_lock (&geth->irq_lock);u64_stats_update_begin (&port->ir_stats_syncp); ++port->stats.rx_fifo_errors;u64_stats_update_end (&port->ir_stats_syncp);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 62/202 af_unix: Fix data races in unix_release_sock/unix_stream_sendmsg
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit 540bf24fba16b88c1b3b9353927204b4f1074e25 ]
A data-race condition has been identified in af_unix. In one data path, the write function unix_release_sock() atomically writes to sk->sk_shutdown using WRITE_ONCE. However, on the reader side, unix_stream_sendmsg() does not read it atomically. Consequently, this issue is causing the following KCSAN splat to occur:
BUG: KCSAN: data-race in unix_release_sock / unix_stream_sendmsg
write (marked) to 0xffff88867256ddbb of 1 bytes by task 7270 on cpu 28: unix_release_sock (net/unix/af_unix.c:640) unix_release (net/unix/af_unix.c:1050) sock_close (net/socket.c:659 net/socket.c:1421) __fput (fs/file_table.c:422) __fput_sync (fs/file_table.c:508) __se_sys_close (fs/open.c:1559 fs/open.c:1541) __x64_sys_close (fs/open.c:1541) x64_sys_call (arch/x86/entry/syscall_64.c:33) do_syscall_64 (arch/x86/entry/common.c:?) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130) read to 0xffff88867256ddbb of 1 bytes by task 989 on cpu 14: unix_stream_sendmsg (net/unix/af_unix.c:2273) __sock_sendmsg (net/socket.c:730 net/socket.c:745) ____sys_sendmsg (net/socket.c:2584) __sys_sendmmsg (net/socket.c:2638 net/socket.c:2724) __x64_sys_sendmmsg (net/socket.c:2753 net/socket.c:2750 net/socket.c:2750) x64_sys_call (arch/x86/entry/syscall_64.c:33) do_syscall_64 (arch/x86/entry/common.c:?) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130) value changed: 0x01 -> 0x03
The line numbers are related to commit dd5a440a31fa ("Linux 6.9-rc7").
Commit e1d09c2c2f57 ("af_unix: Fix data races around sk->sk_shutdown.") addressed a comparable issue in the past regarding sk->sk_shutdown. However, it overlooked resolving this particular data path. This patch only offending unix_stream_sendmsg() function, since the other reads seem to be protected by unix_state_lock() as discussed in
--- net/unix/af_unix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/unix/af_unix.c +1 -1
@@ -1890,7 +1890,7 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg, goto out_err; } -if (sk->sk_shutdown &SEND_SHUTDOWN ) +if (READ_ONCE (sk->sk_shutdown) &SEND_SHUTDOWN ) goto pipe_err;while (sent < len) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 63/202 net: usb: smsc95xx: stop lying about skb->truesize
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit d50729f1d60bca822ef6d9c1a5fb28d486bd7593 ]
Some usb drivers try to set small skb->truesize and break core networking stacks.
In this patch, I removed one of the skb->truesize override.
I also replaced one skb_clone() by an allocation of a fresh and small skb, to get minimally sized skbs, like we did in commit 1e2c61172342 ("net: cdc_ncm: reduce skb truesize in rx path") and 4ce62d5b2f7a ("net: usb: ax88179_178a:
stop lying about skb->truesize")
v3: also fix a sparse error ( https://lore.kernel.org/oe-kbuild-all/[email protected]/ )
v2: leave the skb_trim() game because smsc95xx_rx_csum_offload()
needs the csum part. (Jakub)
While we are it, use get_unaligned() in smsc95xx_rx_csum_offload().
--- drivers/net/usb/smsc95xx.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/net/usb/smsc95xx.c +7 -8
@@ -1910,9 +1910,11 @@ static int smsc95xx_reset_resume(struct usb_interface *intf)static void smsc95xx_rx_csum_offload (struct sk_buff *skb) { - skb->csum = *(u16 *)(skb_tail_pointer (skb) -2 ); +u16 *csum_ptr = (u16 *)(skb_tail_pointer (skb) -2 ); + + skb->csum = (__force __wsum )get_unaligned (csum_ptr); skb->ip_summed =CHECKSUM_COMPLETE ; -skb_trim (skb, skb->len -2 ); +skb_trim (skb, skb->len -2 );/* remove csum */ }static int smsc95xx_rx_fixup (struct usbnet *dev,struct sk_buff *skb)
@@ -1970,25 +1972,22 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)if (dev->net->features &NETIF_F_RXCSUM )smsc95xx_rx_csum_offload (skb);skb_trim (skb, skb->len -4 );/* remove fcs */ - skb->truesize = size +sizeof (struct sk_buff );return 1 ; } - ax_skb =skb_clone (skb,GFP_ATOMIC ); + ax_skb =netdev_alloc_skb_ip_align (dev->net, size);if (unlikely (!ax_skb)) {netdev_warn (dev->net,"Error allocating skb\n" );return 0 ; } - ax_skb->len = size; - ax_skb->data = packet; -skb_set_tail_pointer (ax_skb, size); +skb_put (ax_skb, size); +memcpy (ax_skb->data, packet, size);if (dev->net->features &NETIF_F_RXCSUM )smsc95xx_rx_csum_offload (ax_skb);skb_trim (ax_skb, ax_skb->len -4 );/* remove fcs */ - ax_skb->truesize = size +sizeof (struct sk_buff );usbnet_skb_return (dev, ax_skb); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 64/202 net: openvswitch: fix overwriting ct original tuple for ICMPv6
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Maximets <[email protected]>
[ Upstream commit 7c988176b6c16c516474f6fceebe0f055af5eb56 ]
OVS_PACKET_CMD_EXECUTE has 3 main attributes:
- OVS_PACKET_ATTR_KEY - Packet metadata in a netlink format.
- OVS_PACKET_ATTR_PACKET - Binary packet content.
- OVS_PACKET_ATTR_ACTIONS - Actions to execute on the packet.
OVS_PACKET_ATTR_KEY is parsed first to populate sw_flow_key structure with the metadata like conntrack state, input port, recirculation id, etc. Then the packet itself gets parsed to populate the rest of the keys from the packet headers.
Whenever the packet parsing code starts parsing the ICMPv6 header, it first zeroes out fields in the key corresponding to Neighbor Discovery information even if it is not an ND packet.
It is an 'ipv6.nd' field. However, the 'ipv6' is a union that shares the space between 'nd' and 'ct_orig' that holds the original tuple conntrack metadata parsed from the OVS_PACKET_ATTR_KEY.
ND packets should not normally have conntrack state, so it's fine to share the space, but normal ICMPv6 Echo packets or maybe other types of ICMPv6 can have the state attached and it should not be overwritten.
The issue results in all but the last 4 bytes of the destination address being wiped from the original conntrack tuple leading to incorrect packet matching and potentially executing wrong actions in case this packet recirculates within the datapath or goes back to userspace.
ND fields should not be accessed in non-ND packets, so not clearing them should be fine. Executing memset() only for actual ND packets to avoid the issue.
Initializing the whole thing before parsing is needed because ND packet may not contain all the options.
The issue only affects the OVS_PACKET_CMD_EXECUTE path and doesn't affect packets entering OVS datapath from network interfaces, because in this case CT metadata is populated from skb after the packet is already parsed.
--- net/openvswitch/flow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/openvswitch/flow.c +2 -1
@@ -412,7 +412,6 @@ static int parse_icmpv6(struct sk_buff *skb, struct sw_flow_key *key,*/ key->tp.src =htons (icmp->icmp6_type); key->tp.dst =htons (icmp->icmp6_code); -memset (&key->ipv6.nd,0 ,sizeof (key->ipv6.nd)); if (icmp->icmp6_code == 0 && (icmp->icmp6_type == NDISC_NEIGHBOUR_SOLICITATION ||
@@ -421,6 +420,8 @@ static int parse_icmpv6(struct sk_buff *skb, struct sw_flow_key *key,struct nd_msg *nd;int offset; +memset (&key->ipv6.nd,0 ,sizeof (key->ipv6.nd)); +/* In order to process neighbor discovery options, we need the * entire packet. */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 65/202 ipv6: sr: add missing seg6_local_exit
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
[ Upstream commit 3321687e321307629c71b664225b861ebf3e5753 ]
Currently, we only call seg6_local_exit() in seg6_init() if seg6_local_init() failed. But forgot to call it in seg6_exit().
--- net/ipv6/seg6.c | 1 + 1 file changed, 1 insertion(+)
net/ipv6/seg6.c +1 -0
@@ -493,6 +493,7 @@ void seg6_exit(void)seg6_hmac_exit ();#endif #ifdef CONFIG_IPV6_SEG6_LWTUNNEL +seg6_local_exit ();seg6_iptunnel_exit ();#endif unregister_pernet_subsys (&ip6_segments_ops);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 66/202 ipv6: sr: fix incorrect unregister order
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
[ Upstream commit 6e370a771d2985107e82d0f6174381c1acb49c20 ]
Commit 5559cea2d5aa ("ipv6: sr: fix possible use-after-free and null-ptr-deref") changed the register order in seg6_init(). But the unregister order in seg6_exit() is not updated.
--- net/ipv6/seg6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/seg6.c +1 -1
@@ -496,6 +496,6 @@ void seg6_exit(void)seg6_local_exit ();seg6_iptunnel_exit ();#endif -unregister_pernet_subsys (&ip6_segments_ops);genl_unregister_family (&seg6_genl_family); +unregister_pernet_subsys (&ip6_segments_ops); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 67/202 ipv6: sr: fix invalid unregister error path
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
[ Upstream commit 160e9d2752181fcf18c662e74022d77d3164cd45 ]
The error path of seg6_init() is wrong in case CONFIG_IPV6_SEG6_LWTUNNEL is not defined. In that case if seg6_hmac_init() fails, the genl_unregister_family() isn't called.
This issue exist since commit 46738b1317e1 ("ipv6: sr: add option to control lwtunnel support"), and commit 5559cea2d5aa ("ipv6: sr: fix possible use-after-free and null-ptr-deref") replaced unregister_pernet_subsys() with genl_unregister_family() in this error path.
--- net/ipv6/seg6.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv6/seg6.c +2 -0
@@ -480,6 +480,8 @@ int __init seg6_init(void)#endif #ifdef CONFIG_IPV6_SEG6_LWTUNNEL out_unregister_genl: +#endif +#if IS_ENABLED (CONFIG_IPV6_SEG6_LWTUNNEL ) ||IS_ENABLED (CONFIG_IPV6_SEG6_HMAC )genl_unregister_family (&seg6_genl_family);#endif out_unregister_pernet:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 68/202 drm/amd/display: Fix potential index out of bounds in color transformation function
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivasan Shanmugam <[email protected]>
[ Upstream commit 63ae548f1054a0b71678d0349c7dc9628ddd42ca ]
Fixes index out of bounds issue in the color transformation function. The issue could occur when the index 'i' exceeds the number of transfer function points (TRANSFER_FUNC_POINTS).
The fix adds a check to ensure 'i' is within bounds before accessing the transfer function points. If 'i' is out of bounds, an error message is logged and the function returns false to indicate an error.
Reported by smatch:drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_cm_common.c:405 cm_helper_translate_curve_to_hw_format() error: buffer overflow 'output_tf->tf_pts.red' 1025 <= s32max drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_cm_common.c:406 cm_helper_translate_curve_to_hw_format() error: buffer overflow 'output_tf->tf_pts.green' 1025 <= s32max drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_cm_common.c:407 cm_helper_translate_curve_to_hw_format() error: buffer overflow 'output_tf->tf_pts.blue' 1025 <= s32max
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c +5 -0
@@ -380,6 +380,11 @@ bool cm_helper_translate_curve_to_hw_format( i += increment) {if (j == hw_points -1 )break ; +if (i >=TRANSFER_FUNC_POINTS ) { +DC_LOG_ERROR ("Index out of bounds: i=%d, TRANSFER_FUNC_POINTS=%d\n" , + i,TRANSFER_FUNC_POINTS ); +return false; + } rgb_resulted[j].red = output_tf->tf_pts.red[i]; rgb_resulted[j].green = output_tf->tf_pts.green[i]; rgb_resulted[j].blue = output_tf->tf_pts.blue[i];
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 69/202 mtd: rawnand: hynix: fixed typo
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxim Korotkov <[email protected]>
[ Upstream commit 6819db94e1cd3ce24a432f3616cd563ed0c4eaba ]
The function hynix_nand_rr_init() should probably return an error code. Judging by the usage, it seems that the return code is passed up the call stack.
Right now, it always returns 0 and the function hynix_nand_cleanup() in hynix_nand_init() has never been called.
Found by RASU JSC and Linux Verification Center (linuxtesting.org)
--- drivers/mtd/nand/raw/nand_hynix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/nand_hynix.c +1 -1
@@ -402,7 +402,7 @@ static int hynix_nand_rr_init(struct nand_chip *chip)if (ret)pr_warn ("failed to initialize read-retry infrastructure" ); -return 0 ; +return ret; } static void hynix_nand_extract_oobsize(struct nand_chip *chip,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 70/202 fbdev: shmobile: fix snprintf truncation
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 26c8cfb9d1e4b252336d23dd5127a8cbed414a32 ]
The name of the overlay does not fit into the fixed-length field:
drivers/video/fbdev/sh_mobile_lcdcfb.c:1577:2: error: 'snprintf' will always be truncated; specified size is 16, but format string expands to at least 25
Make it short enough by changing the string.
--- drivers/video/fbdev/sh_mobile_lcdcfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/sh_mobile_lcdcfb.c +1 -1
@@ -1580,7 +1580,7 @@ sh_mobile_lcdc_overlay_fb_init(struct sh_mobile_lcdc_overlay *ovl)*/ info->fix = sh_mobile_lcdc_overlay_fix;snprintf (info->fix.id,sizeof (info->fix.id), -"SH Mobile LCDC Overlay %u" , ovl->index); +"SHMobile ovl %u" , ovl->index); info->fix.smem_start = ovl->dma_handle; info->fix.smem_len = ovl->fb_size; info->fix.line_length = ovl->pitch;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 53/202 HID: intel-ish-hid: ipc: Add check for pci_alloc_irq_vectors
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ni <[email protected]>
[ Upstream commit 6baa4524027fd64d7ca524e1717c88c91a354b93 ]
Add a check for the return value of pci_alloc_irq_vectors() and return error if it fails.
--- drivers/hid/intel-ish-hid/ipc/pci-ish.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hid/intel-ish-hid/ipc/pci-ish.c +5 -0
@@ -159,6 +159,11 @@ static int ish_probe(struct pci_dev *pdev, const struct pci_device_id *ent)/* request and enable interrupt */ ret =pci_alloc_irq_vectors (pdev,1 ,1 ,PCI_IRQ_ALL_TYPES ); +if (ret <0 ) { +dev_err (dev,"ISH: Failed to allocate IRQ vectors\n" ); +return ret; + } +if (!pdev->msi_enabled && !pdev->msix_enabled) irq_flag =IRQF_SHARED ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 71/202 drm/mediatek: Add 0 size check to mtk_drm_gem_obj
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin Green <[email protected]>
[ Upstream commit 1e4350095e8ab2577ee05f8c3b044e661b5af9a0 ]
Add a check to mtk_drm_gem_init if we attempt to allocate a GEM object of 0 bytes. Currently, no such check exists and the kernel will panic if a userspace application attempts to allocate a 0x0 GBM buffer.
Tested by attempting to allocate a 0x0 GBM buffer on an MT8188 and verifying that we now return EINVAL.
--- drivers/gpu/drm/mediatek/mtk_drm_gem.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/mediatek/mtk_drm_gem.c +3 -0
@@ -21,6 +21,9 @@ static struct mtk_drm_gem_obj *mtk_drm_gem_init(struct drm_device *dev, size =round_up (size,PAGE_SIZE ); +if (size ==0 ) +return ERR_PTR (-EINVAL ); + mtk_gem_obj =kzalloc (sizeof (*mtk_gem_obj),GFP_KERNEL );if (!mtk_gem_obj)return ERR_PTR (-ENOMEM );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 72/202 powerpc/fsl-soc: hide unused const variable
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 01acaf3aa75e1641442cc23d8fe0a7bb4226efb1 ]
vmpic_msi_feature is only used conditionally, which triggers a rare -Werror=unused-const-variable= warning with gcc:
arch/powerpc/sysdev/fsl_msi.c:567:37: error: 'vmpic_msi_feature' defined but not used [-Werror=unused-const-variable=]
567 | static const struct fsl_msi_feature vmpic_msi_feature =
Hide this one in the same #ifdef as the reference so we can turn on the warning by default.
--- arch/powerpc/sysdev/fsl_msi.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/sysdev/fsl_msi.c +2 -0
@@ -573,10 +573,12 @@ static const struct fsl_msi_feature ipic_msi_feature = { .msiir_offset = 0x38, }; +#ifdef CONFIG_EPAPR_PARAVIRT static const struct fsl_msi_feature vmpic_msi_feature = { .fsl_pic_ip =FSL_PIC_IP_VMPIC , .msiir_offset =0 , }; +#endif static const struct of_device_id fsl_of_msi_ids[] = { {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 73/202 fbdev: sisfb: hide unused variables
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 688cf598665851b9e8cb5083ff1d208ce43d10ff ]
Building with W=1 shows that a couple of variables in this driver are only used in certain configurations:
drivers/video/fbdev/sis/init301.c:239:28: error: 'SiS_Part2CLVX_6' defined but not used [-Werror=unused-const-variable=]
239 | static const unsigned char SiS_Part2CLVX_6[] = { /* 1080i */
| ^~~~~~~~~~~~~~~
drivers/video/fbdev/sis/init301.c:230:28: error: 'SiS_Part2CLVX_5' defined but not used [-Werror=unused-const-variable=]
230 | static const unsigned char SiS_Part2CLVX_5[] = { /* 750p */
| ^~~~~~~~~~~~~~~
drivers/video/fbdev/sis/init301.c:211:28: error: 'SiS_Part2CLVX_4' defined but not used [-Werror=unused-const-variable=]
211 | static const unsigned char SiS_Part2CLVX_4[] = { /* PAL */
| ^~~~~~~~~~~~~~~
drivers/video/fbdev/sis/init301.c:192:28: error: 'SiS_Part2CLVX_3' defined but not used [-Werror=unused-const-variable=]
192 | static const unsigned char SiS_Part2CLVX_3[] = { /* NTSC, 525i, 525p */
| ^~~~~~~~~~~~~~~
drivers/video/fbdev/sis/init301.c:184:28: error: 'SiS_Part2CLVX_2' defined but not used [-Werror=unused-const-variable=]
184 | static const unsigned char SiS_Part2CLVX_2[] = {
| ^~~~~~~~~~~~~~~
drivers/video/fbdev/sis/init301.c:176:28: error: 'SiS_Part2CLVX_1' defined but not used [-Werror=unused-const-variable=]
176 | static const unsigned char SiS_Part2CLVX_1[] = {
| ^~~~~~~~~~~~~~~This started showing up after the definitions were moved into the source file from the header, which was not flagged by the compiler. Move the definition into the appropriate #ifdef block that already exists next to them.
--- drivers/video/fbdev/sis/init301.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/video/fbdev/sis/init301.c +1 -2
@@ -172,7 +172,7 @@ static const unsigned char SiS_HiTVGroup3_2[] = { };/* 301C / 302ELV extended Part2 TV registers (4 tap scaler) */ - +#ifdef CONFIG_FB_SIS_315 static const unsigned char SiS_Part2CLVX_1[] = {0x00 ,0x00 , 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E,
@@ -245,7 +245,6 @@ static const unsigned char SiS_Part2CLVX_6[] = { /* 1080i */ 0xFF,0xFF, }; -#ifdef CONFIG_FB_SIS_315 /* 661 et al LCD data structure (2.03.00) */ static const unsigned char SiS_LCDStruct661[] = {/* 1024x768 */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 74/202 media: ngene: Add dvb_ca_en50221_init return value check
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Burakov <[email protected]>
[ Upstream commit 9bb1fd7eddcab2d28cfc11eb20f1029154dac718 ]
The return value of dvb_ca_en50221_init() is not checked here that may cause undefined behavior in case of nonzero value return.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/media/pci/ngene/ngene-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/pci/ngene/ngene-core.c +3 -1
@@ -1488,7 +1488,9 @@ static int init_channel(struct ngene_channel *chan) }if (dev->ci.en && (io &NGENE_IO_TSOUT )) { -dvb_ca_en50221_init (adapter, dev->ci.en,0 ,1 ); + ret =dvb_ca_en50221_init (adapter, dev->ci.en,0 ,1 ); +if (ret !=0 ) + goto err;set_transfer (chan,1 ); chan->dev->channel[2 ].DataFormatFlags =DF_SWAP32 ;set_transfer (&chan->dev->channel[2 ],1 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 75/202 media: radio-shark2: Avoid led_names truncations
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
[ Upstream commit 1820e16a3019b6258e6009d34432946a6ddd0a90 ]
Increase the size of led_names so it can fit any valid v4l2 device name.
Fixes:drivers/media/radio/radio-shark2.c:197:17: warning: ‘%s’ directive output may be truncated writing up to 35 bytes into a region of size 32 [-Wformat-truncation=]
--- drivers/media/radio/radio-shark2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/radio/radio-shark2.c +1 -1
@@ -62,7 +62,7 @@ struct shark_device {#ifdef SHARK_USE_LEDS struct work_struct led_work;struct led_classdev leds[NO_LEDS ]; -char led_names[NO_LEDS ][32 ]; +char led_names[NO_LEDS ][64 ];atomic_t brightness[NO_LEDS ];unsigned long brightness_new;#endif
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 76/202 platform/x86: wmi: Make two functions static
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: YueHaibing <[email protected]>
[ Upstream commit 713df99a9ef0133c09ad05bac10cf7d0163cd272 ]
Fix sparse warnings:
drivers/platform/x86/xiaomi-wmi.c:26:5: warning: symbol 'xiaomi_wmi_probe' was not declared. Should it be static? drivers/platform/x86/xiaomi-wmi.c:51:6: warning: symbol 'xiaomi_wmi_notify' was not declared. Should it be static?
Stable-dep-of: 290680c2da80 ("platform/x86: xiaomi-wmi: Fix race condition when reporting key events")
--- drivers/platform/x86/xiaomi-wmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/xiaomi-wmi.c +2 -2
@@ -23,7 +23,7 @@ struct xiaomi_wmi {unsigned int key_code; }; -int xiaomi_wmi_probe (struct wmi_device *wdev,const void *context) +static int xiaomi_wmi_probe (struct wmi_device *wdev,const void *context) {struct xiaomi_wmi *data;
@@ -48,7 +48,7 @@ int xiaomi_wmi_probe(struct wmi_device *wdev, const void *context)return input_register_device (data->input_dev); } -void xiaomi_wmi_notify (struct wmi_device *wdev,union acpi_object *dummy) +static void xiaomi_wmi_notify (struct wmi_device *wdev,union acpi_object *dummy) {struct xiaomi_wmi *data;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 77/202 fbdev: sh7760fb: allow modular build
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit 51084f89d687e14d96278241e5200cde4b0985c7 ]
There is no reason to prohibit sh7760fb from being built as a loadable module as suggested by Geert, so change the config symbol from bool to tristate to allow that and change the FB dependency as needed.
--- drivers/video/fbdev/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/fbdev/Kconfig +2 -2
@@ -2031,8 +2031,8 @@ config FB_COBALT depends on FB && MIPS_COBALT config FB_SH7760 - bool "SH7760/SH7763/SH7720/SH7721 LCDC support" - depends on FB=y && (CPU_SUBTYPE_SH7760 || CPU_SUBTYPE_SH7763 \ + tristate "SH7760/SH7763/SH7720/SH7721 LCDC support" + depends on FB && (CPU_SUBTYPE_SH7760 || CPU_SUBTYPE_SH7763 \ || CPU_SUBTYPE_SH7720 || CPU_SUBTYPE_SH7721) select FB_CFB_FILLRECT select FB_CFB_COPYAREA
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 78/202 drm/arm/malidp: fix a possible null pointer dereference
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huai-Yuan Liu <[email protected]>
[ Upstream commit a1f95aede6285dba6dd036d907196f35ae3a11ea ]
In malidp_mw_connector_reset, new memory is allocated with kzalloc, but no check is performed. In order to prevent null pointer dereferencing, ensure that mw_state is checked before calling __drm_atomic_helper_connector_reset.
--- drivers/gpu/drm/arm/malidp_mw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/arm/malidp_mw.c +4 -1
@@ -70,7 +70,10 @@ static void malidp_mw_connector_reset(struct drm_connector *connector)__drm_atomic_helper_connector_destroy_state (connector->state);kfree (connector->state); -__drm_atomic_helper_connector_reset (connector, &mw_state->base); + connector->state =NULL ; + +if (mw_state) +__drm_atomic_helper_connector_reset (connector, &mw_state->base); } static enum drm_connector_status
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 79/202 ASoC: tracing: Export SND_SOC_DAPM_DIR_OUT to its value
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
[ Upstream commit 58300f8d6a48e58d1843199be743f819e2791ea3 ]
The string SND_SOC_DAPM_DIR_OUT is printed in the snd_soc_dapm_path trace event instead of its value:
(((REC->path_dir) == SND_SOC_DAPM_DIR_OUT) ? "->" : "<-")
User space cannot parse this, as it has no idea what SND_SOC_DAPM_DIR_OUT is. Use TRACE_DEFINE_ENUM() to convert it to its value:
(((REC->path_dir) == 1) ? "->" : "<-")
So that user space tools, such as perf and trace-cmd, can parse it correctly.
--- include/trace/events/asoc.h | 2 ++ 1 file changed, 2 insertions(+)
include/trace/events/asoc.h +2 -0
@@ -11,6 +11,8 @@#define DAPM_DIRECT "(direct)"#define DAPM_ARROW (dir) (((dir) == SND_SOC_DAPM_DIR_OUT) ? "->" : "<-") +TRACE_DEFINE_ENUM (SND_SOC_DAPM_DIR_OUT ); +struct snd_soc_jack ;struct snd_soc_card ;struct snd_soc_dapm_widget ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 80/202 drm/panel: simple: Add missing Innolux G121X1-L03 format, flags, connector
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit 11ac72d033b9f577e8ba0c7a41d1c312bb232593 ]
The .bpc = 6 implies .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG , add the missing bus_format. Add missing connector type and bus_flags as well.
Documentation [1] 1.4 GENERAL SPECIFICATI0NS indicates this panel is capable of both RGB 18bit/24bit panel, the current configuration uses 18bit mode, .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG , .bpc = 6.
Support for the 24bit mode would require another entry in panel-simple with .bus_format = MEDIA_BUS_FMT_RGB666_1X7X4_SPWG and .bpc = 8, which is out of scope of this fix.
[1] https://www.distec.de/fileadmin/pdf/produkte/TFT-Displays/Innolux/G121X1-L03_Datasheet.pdf
--- drivers/gpu/drm/panel/panel-simple.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/panel/panel-simple.c +3 -0
@@ -1729,6 +1729,9 @@ static const struct panel_desc innolux_g121x1_l03 = { .unprepare = 200, .disable = 400, }, + .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG, + .bus_flags = DRM_BUS_FLAG_DE_HIGH, + .connector_type = DRM_MODE_CONNECTOR_LVDS, };/*
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 54/202 scsi: bfa: Ensure the copied buf is NUL terminated
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bui Quang Minh <[email protected]>
[ Upstream commit 13d0cecb4626fae67c00c84d3c7851f6b62f7df3 ]
Currently, we allocate a nbytes-sized kernel buffer and copy nbytes from userspace to that buffer. Later, we use sscanf on this buffer but we don't ensure that the string is terminated inside the buffer, this can lead to OOB read when using sscanf. Fix this issue by using memdup_user_nul instead of memdup_user.
--- drivers/scsi/bfa/bfad_debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/bfa/bfad_debugfs.c +2 -2
@@ -250,7 +250,7 @@ bfad_debugfs_write_regrd(struct file *file, const char __user *buf,unsigned long flags;void *kern_buf; - kern_buf =memdup_user (buf, nbytes); + kern_buf =memdup_user_nul (buf, nbytes);if (IS_ERR (kern_buf))return PTR_ERR (kern_buf);
@@ -317,7 +317,7 @@ bfad_debugfs_write_regwr(struct file *file, const char __user *buf,unsigned long flags;void *kern_buf; - kern_buf =memdup_user (buf, nbytes); + kern_buf =memdup_user_nul (buf, nbytes);if (IS_ERR (kern_buf))return PTR_ERR (kern_buf);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 81/202 RDMA/hns: Use complete parentheses in macros
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit 4125269bb9b22e1d8cdf4412c81be8074dbc61ca ]
Use complete parentheses to ensure that macro expansion does not produce unexpected results.
--- drivers/infiniband/hw/hns/hns_roce_hem.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hem.h +6 -6
@@ -62,16 +62,16 @@ enum { (sizeof(struct scatterlist) + sizeof(void *)))#define check_whether_bt_num_3 (type, hop_num) \ - (type < HEM_TYPE_MTT && hop_num == 2) + ((type) < HEM_TYPE_MTT && (hop_num) == 2)#define check_whether_bt_num_2 (type, hop_num) \ - ((type < HEM_TYPE_MTT && hop_num == 1) || \ - (type >= HEM_TYPE_MTT && hop_num == 2)) + (((type) < HEM_TYPE_MTT && (hop_num) == 1) || \ + ((type) >= HEM_TYPE_MTT && (hop_num) == 2))#define check_whether_bt_num_1 (type, hop_num) \ - ((type < HEM_TYPE_MTT && hop_num == HNS_ROCE_HOP_NUM_0) || \ - (type >= HEM_TYPE_MTT && hop_num == 1) || \ - (type >= HEM_TYPE_MTT && hop_num == HNS_ROCE_HOP_NUM_0)) + (((type) < HEM_TYPE_MTT && (hop_num) == HNS_ROCE_HOP_NUM_0) || \ + ((type) >= HEM_TYPE_MTT && (hop_num) == 1) || \ + ((type) >= HEM_TYPE_MTT && (hop_num) == HNS_ROCE_HOP_NUM_0))enum {HNS_ROCE_HEM_PAGE_SHIFT =12 ,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 82/202 x86/insn: Fix PUSH instruction in x86 instruction decoder opcode map
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
[ Upstream commit 59162e0c11d7257cde15f907d19fefe26da66692 ]
The x86 instruction decoder is used not only for decoding kernel instructions. It is also used by perf uprobes (user space probes) and by perf tools Intel Processor Trace decoding. Consequently, it needs to support instructions executed by user space also.
Opcode 0x68 PUSH instruction is currently defined as 64-bit operand size only i.e. (d64). That was based on Intel SDM Opcode Map. However that is contradicted by the Instruction Set Reference section for PUSH in the same manual.
Remove 64-bit operand size only annotation from opcode 0x68 PUSH instruction.
Example:
$ cat pushw.s
.global _start
.text
_start:
pushw $0x1234
mov $0x1,%eax # system call number (sys_exit)
int $0x80
$ as -o pushw.o pushw.s
$ ld -s -o pushw pushw.o
$ objdump -d pushw | tail -4
0000000000401000 <.text>:
401000: 66 68 34 12 pushw $0x1234
401004: b8 01 00 00 00 mov $0x1,%eax
401009: cd 80 int $0x80
$ perf record -e intel_pt//u ./pushw
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.014 MB perf.data ]Before:
$ perf script --insn-trace=disasm
Warning:
1 instruction trace errors
pushw 10349 [000] 10586.869237014: 401000 [unknown] (/home/ahunter/git/misc/rtit-tests/pushw) pushw $0x1234
pushw 10349 [000] 10586.869237014: 401006 [unknown] (/home/ahunter/git/misc/rtit-tests/pushw) addb %al, (%rax)
pushw 10349 [000] 10586.869237014: 401008 [unknown] (/home/ahunter/git/misc/rtit-tests/pushw) addb %cl, %ch
pushw 10349 [000] 10586.869237014: 40100a [unknown] (/home/ahunter/git/misc/rtit-tests/pushw) addb $0x2e, (%rax)
instruction trace error type 1 time 10586.869237224 cpu 0 pid 10349 tid 10349 ip 0x40100d code 6: Trace doesn't match instructionAfter:
$ perf script --insn-trace=disasm
pushw 10349 [000] 10586.869237014: 401000 [unknown] (./pushw) pushw $0x1234
pushw 10349 [000] 10586.869237014: 401004 [unknown] (./pushw) movl $1, %eax--- arch/x86/lib/x86-opcode-map.txt | 2 +- tools/arch/x86/lib/x86-opcode-map.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/lib/x86-opcode-map.txt +1 -1
@@ -148,7 +148,7 @@ AVXcode: 65: SEG=GS (Prefix) 66: Operand-Size (Prefix) 67: Address-Size (Prefix) -68: PUSH Iz (d64) +68: PUSH Iz 69: IMUL Gv,Ev,Iz 6a: PUSH Ib (d64) 6b: IMUL Gv,Ev,Ib
tools/arch/x86/lib/x86-opcode-map.txt +1 -1
@@ -148,7 +148,7 @@ AVXcode: 65: SEG=GS (Prefix) 66: Operand-Size (Prefix) 67: Address-Size (Prefix) -68: PUSH Iz (d64) +68: PUSH Iz 69: IMUL Gv,Ev,Iz 6a: PUSH Ib (d64) 6b: IMUL Gv,Ev,Ib
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 83/202 ext4: avoid excessive credit estimate in ext4_tmpfile()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
[ Upstream commit 35a1f12f0ca857fee1d7a04ef52cbd5f1f84de13 ]
A user with minimum journal size (1024 blocks these days) complained about the following error triggered by generic/697 test in ext4_tmpfile():
run fstests generic/697 at 2024-02-28 05:34:46
JBD2: vfstest wants too many credits credits:260 rsv_credits:0 max:256 EXT4-fs error (device loop0) in __ext4_new_inode:1083: error 28
Indeed the credit estimate in ext4_tmpfile() is huge. EXT4_MAXQUOTAS_INIT_BLOCKS() is 219, then 10 credits from ext4_tmpfile() itself and then ext4_xattr_credits_for_new_inode() adds more credits needed for security attributes and ACLs. Now the EXT4_MAXQUOTAS_INIT_BLOCKS() is in fact unnecessary because we've already initialized quotas with dquot_init() shortly before and so EXT4_MAXQUOTAS_TRANS_BLOCKS() is enough (which boils down to 3 credits).
--- fs/ext4/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/namei.c +1 -1
@@ -2723,7 +2723,7 @@ static int ext4_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) inode =ext4_new_inode_start_handle (dir, mode,NULL ,0 ,NULL ,EXT4_HT_DIR , -EXT4_MAXQUOTAS_INIT_BLOCKS (dir->i_sb) + +EXT4_MAXQUOTAS_TRANS_BLOCKS (dir->i_sb) +4 +EXT4_XATTR_TRANS_BLOCKS ); handle =ext4_journal_current_handle (); err =PTR_ERR (inode);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 84/202 sunrpc: removed redundant procp check
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Aprelkov <[email protected]>
[ Upstream commit a576f36971ab4097b6aa76433532aa1fb5ee2d3b ]
since vs_proc pointer is dereferenced before getting it's address there's no need to check for NULL.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- net/sunrpc/svc.c | 2 -- 1 file changed, 2 deletions(-)
net/sunrpc/svc.c +0 -2
@@ -1255,8 +1255,6 @@ svc_generic_init_request(struct svc_rqst *rqstp,if (rqstp->rq_proc >= versp->vs_nproc) goto err_bad_proc; rqstp->rq_procinfo = procp = &versp->vs_proc[rqstp->rq_proc]; -if (!procp) - goto err_bad_proc;/* Initialize storage for argp and resp */ memset (rqstp->rq_argp,0 , procp->pc_argsize);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 55/202 scsi: qedf: Ensure the copied buf is NUL terminated
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bui Quang Minh <[email protected]>
[ Upstream commit d0184a375ee797eb657d74861ba0935b6e405c62 ]
Currently, we allocate a count-sized kernel buffer and copy count from userspace to that buffer. Later, we use kstrtouint on this buffer but we don't ensure that the string is terminated inside the buffer, this can lead to OOB read when using kstrtouint. Fix this issue by using memdup_user_nul instead of memdup_user.
--- drivers/scsi/qedf/qedf_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qedf/qedf_debugfs.c +1 -1
@@ -172,7 +172,7 @@ qedf_dbg_debug_cmd_write(struct file *filp, const char __user *buffer,if (!count || *ppos)return 0 ; - kern_buf =memdup_user (buffer, count); + kern_buf =memdup_user_nul (buffer, count);if (IS_ERR (kern_buf))return PTR_ERR (kern_buf);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 56/202 wifi: mwl8k: initialize cmd->addr[] properly
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 1d60eabb82694e58543e2b6366dae3e7465892a5 ]
This loop is supposed to copy the mac address to cmd->addr but the i++ increment is missing so it copies everything to cmd->addr[0] and only the last address is recorded.
--- drivers/net/wireless/marvell/mwl8k.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/marvell/mwl8k.c +1 -1
@@ -2714,7 +2714,7 @@ __mwl8k_cmd_mac_multicast_adr(struct ieee80211_hw *hw, int allmulti, cmd->action |=cpu_to_le16 (MWL8K_ENABLE_RX_MULTICAST ); cmd->numaddr =cpu_to_le16 (mc_count);netdev_hw_addr_list_for_each (ha, mc_list) { -memcpy (cmd->addr[i], ha->addr,ETH_ALEN ); +memcpy (cmd->addr[i++], ha->addr,ETH_ALEN ); } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 57/202 usb: aqc111: stop lying about skb->truesize
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 9aad6e45c4e7d16b2bb7c3794154b828fb4384b4 ]
Some usb drivers try to set small skb->truesize and break core networking stacks.
I replace one skb_clone() by an allocation of a fresh and small skb, to get minimally sized skbs, like we did in commit 1e2c61172342 ("net: cdc_ncm: reduce skb truesize in rx path") and 4ce62d5b2f7a ("net: usb: ax88179_178a:
stop lying about skb->truesize")
--- drivers/net/usb/aqc111.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/usb/aqc111.c +3 -5
@@ -1141,17 +1141,15 @@ static int aqc111_rx_fixup(struct usbnet *dev, struct sk_buff *skb)continue ; } -/* Clone SKB */ - new_skb =skb_clone (skb,GFP_ATOMIC ); + new_skb =netdev_alloc_skb_ip_align (dev->net, pkt_len);if (!new_skb) goto err; - new_skb->len = pkt_len; +skb_put (new_skb, pkt_len); +memcpy (new_skb->data, skb->data, pkt_len);skb_pull (new_skb,AQ_RX_HW_PAD ); -skb_set_tail_pointer (new_skb, new_skb->len); - new_skb->truesize =SKB_TRUESIZE (new_skb->len);if (aqc111_data->rx_checksum)aqc111_rx_checksum (new_skb, pkt_desc);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 58/202 net: usb: sr9700: stop lying about skb->truesize
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 05417aa9c0c038da2464a0c504b9d4f99814a23b ]
Some usb drivers set small skb->truesize and break core networking stacks.
In this patch, I removed one of the skb->truesize override.
I also replaced one skb_clone() by an allocation of a fresh and small skb, to get minimally sized skbs, like we did in commit 1e2c61172342 ("net: cdc_ncm: reduce skb truesize in rx path") and 4ce62d5b2f7a ("net: usb: ax88179_178a:
stop lying about skb->truesize")
--- drivers/net/usb/sr9700.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/net/usb/sr9700.c +3 -7
@@ -418,19 +418,15 @@ static int sr9700_rx_fixup(struct usbnet *dev, struct sk_buff *skb)skb_pull (skb,3 ); skb->len = len;skb_set_tail_pointer (skb, len); - skb->truesize = len +sizeof (struct sk_buff );return 2 ; } -/* skb_clone is used for address align */ - sr_skb =skb_clone (skb,GFP_ATOMIC ); + sr_skb =netdev_alloc_skb_ip_align (dev->net, len);if (!sr_skb)return 0 ; - sr_skb->len = len; - sr_skb->data = skb->data +3 ; -skb_set_tail_pointer (sr_skb, len); - sr_skb->truesize = len +sizeof (struct sk_buff ); +skb_put (sr_skb, len); +memcpy (sr_skb->data, skb->data +3 , len);usbnet_skb_return (dev, sr_skb);skb_pull (skb, len +SR_RX_OVERHEAD );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 59/202 m68k: Fix spinlock race in kernel thread creation
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Schmitz <[email protected]>
[ Upstream commit da89ce46f02470ef08f0f580755d14d547da59ed ]
Context switching does take care to retain the correct lock owner across the switch from 'prev' to 'next' tasks. This does rely on interrupts remaining disabled for the entire duration of the switch.
This condition is guaranteed for normal process creation and context switching between already running processes, because both 'prev' and 'next' already have interrupts disabled in their saved copies of the status register.
The situation is different for newly created kernel threads. The status register is set to PS_S in copy_thread(), which does leave the IPL at 0. Upon restoring the 'next' thread's status register in switch_to() aka resume(), interrupts then become enabled prematurely. resume() then returns via ret_from_kernel_thread() and schedule_tail() where run queue lock is released (see finish_task_switch() and finish_lock_switch()).
A timer interrupt calling scheduler_tick() before the lock is released in finish_task_switch() will find the lock already taken, with the current task as lock owner. This causes a spinlock recursion warning as reported by Guenter Roeck.
As far as I can ascertain, this race has been opened in commit 533e6903bea0 ("m68k: split ret_from_fork(), simplify kernel_thread()") but I haven't done a detailed study of kernel history so it may well predate that commit.
Interrupts cannot be disabled in the saved status register copy for kernel threads (init will complain about interrupts disabled when finally starting user space). Disable interrupts temporarily when switching the tasks' register sets in resume().
Note that a simple oriw 0x700,%sr after restoring sr is not enough here
- this leaves enough of a race for the 'spinlock recursion' warning to still be observed.
Tested on ARAnyM and qemu (Quadra 800 emulation).
--- arch/m68k/kernel/entry.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/m68k/kernel/entry.S +3 -1
@@ -425,7 +425,9 @@ resume: movec %a0,%dfc /* restore status register */ - movew %a1@(TASK_THREAD+THREAD_SR),%sr + movew %a1@(TASK_THREAD+THREAD_SR),%d0 + oriw #0x0700,%d0 + movew %d0,%sr rts
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 60/202 m68k: mac: Fix reboot hang on Mac IIci
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 265a3b322df9a973ff1fc63da70af456ab6ae1d6 ]
Calling mac_reset() on a Mac IIci does reset the system, but what follows is a POST failure that requires a manual reset to resolve. Avoid that by using the 68030 asm implementation instead of the C implementation.
Apparently the SE/30 has a similar problem as it has used the asm implementation since before git. This patch extends that solution to other systems with a similar ROM.
After this patch, the only systems still using the C implementation are 68040 systems where adb_type is either MAC_ADB_IOP or MAC_ADB_II. This implies a 1 MiB Quadra ROM.
This now includes the Quadra 900/950, which previously fell through to the "should never get here" catch-all.
--- arch/m68k/mac/misc.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
arch/m68k/mac/misc.c +18 -18
@@ -452,30 +452,18 @@ void mac_poweroff(void)void mac_reset (void ) { -if (macintosh_config->adb_type ==MAC_ADB_II && - macintosh_config->ident !=MAC_MODEL_SE30 ) { -/* need ROMBASE in booter */ -/* indeed, plus need to MAP THE ROM !! */ - -if (mac_bi_data.rombase ==0 ) - mac_bi_data.rombase =0x40800000 ; - -/* works on some */ - rom_reset = (void *) (mac_bi_data.rombase +0xa ); - -local_irq_disable (); -rom_reset ();#ifdef CONFIG_ADB_CUDA - }else if (macintosh_config->adb_type ==MAC_ADB_EGRET || - macintosh_config->adb_type ==MAC_ADB_CUDA ) { +if (macintosh_config->adb_type ==MAC_ADB_EGRET || + macintosh_config->adb_type ==MAC_ADB_CUDA ) {cuda_restart (); + } else#endif #ifdef CONFIG_ADB_PMU - }else if (macintosh_config->adb_type ==MAC_ADB_PB2 ) { +if (macintosh_config->adb_type ==MAC_ADB_PB2 ) {pmu_restart (); + } else#endif - }else if (CPU_IS_030 ) { - +if (CPU_IS_030 ) {/* 030-specific reset routine. The idea is general, but the * specific registers to reset are '030-specific. Until I * have a non-030 machine, I can't test anything else.
@@ -523,6 +511,18 @@ void mac_reset(void) "jmp %/a0@\n\t" /* jump to the reset vector */ ".chip 68k" : : "r" (offset), "a" (rombase) : "a0"); + }else { +/* need ROMBASE in booter */ +/* indeed, plus need to MAP THE ROM !! */ + +if (mac_bi_data.rombase ==0 ) + mac_bi_data.rombase =0x40800000 ; + +/* works on some */ + rom_reset = (void *)(mac_bi_data.rombase +0xa ); + +local_irq_disable (); +rom_reset (); }/* should never get here */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 51/202 sh: kprobes: Merge arch_copy_kprobe() into arch_prepare_kprobe()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 1422ae080b66134fe192082d9b721ab7bd93fcc5 ]
arch/sh/kernel/kprobes.c:52:16: warning: no previous prototype for 'arch_copy_kprobe' [-Wmissing-prototypes]
Although SH kprobes support was only merged in v2.6.28, it missed the earlier removal of the arch_copy_kprobe() callback in v2.6.15.
Based on the powerpc part of commit 49a2a1b83ba6fa40 ("[PATCH] kprobes:
changed from using spinlock to mutex").
--- arch/sh/kernel/kprobes.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
arch/sh/kernel/kprobes.c +1 -6
@@ -44,17 +44,12 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)if (OPCODE_RTE (opcode))return -EFAULT ;/* Bad breakpoint */ +memcpy (p->ainsn.insn, p->addr,MAX_INSN_SIZE *sizeof (kprobe_opcode_t)); p->opcode = opcode;return 0 ; } -void __kprobes arch_copy_kprobe (struct kprobe *p) -{ -memcpy (p->ainsn.insn, p->addr,MAX_INSN_SIZE *sizeof (kprobe_opcode_t)); - p->opcode = *p->addr; -} -void __kprobes arch_arm_kprobe (struct kprobe *p) { *p->addr =BREAKPOINT_INSTRUCTION ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 86/202 selftests/kcmp: Make the test output consistent and clear
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gautam Menghani <[email protected]>
[ Upstream commit ff682226a353d88ffa5db9c2a9b945066776311e ]
Make the output format of this test consistent. Currently the output is as follows:
+TAP version 13
+1..1
+# selftests: kcmp: kcmp_test
+# pid1: 45814 pid2: 45815 FD: 1 FILES: 1 VM: 2 FS: 1 SIGHAND: 2
+ IO: 0 SYSVSEM: 0 INV: -1
+# PASS: 0 returned as expected
+# PASS: 0 returned as expected
+# PASS: 0 returned as expected
+# # Planned tests != run tests (0 != 3)
+# # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
+# # Planned tests != run tests (0 != 3)
+# # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
+# # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0 +ok 1 selftests: kcmp: kcmp_test
With this patch applied the output is as follows:
+TAP version 13
+1..1
+# selftests: kcmp: kcmp_test
+# TAP version 13
+# 1..3
+# pid1: 46330 pid2: 46331 FD: 1 FILES: 2 VM: 2 FS: 2 SIGHAND: 1
+ IO: 0 SYSVSEM: 0 INV: -1
+# PASS: 0 returned as expected
+# PASS: 0 returned as expected
+# PASS: 0 returned as expected
+# # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0 +ok 1 selftests: kcmp: kcmp_test
Stable-dep-of: eb59a5811371 ("selftests/kcmp: remove unused open mode")
--- tools/testing/selftests/kcmp/kcmp_test.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tools/testing/selftests/kcmp/kcmp_test.c +4 -2
@@ -88,6 +88,9 @@ int main(int argc, char **argv)int pid2 =getpid ();int ret; +ksft_print_header (); +ksft_set_plan (3 ); + fd2 =open (kpath,O_RDWR ,0644 );if (fd2 <0 ) {perror ("Can't open file" );
@@ -152,7 +155,6 @@ int main(int argc, char **argv)ksft_inc_pass_cnt (); } -ksft_print_cnts ();if (ret)ksft_exit_fail ();
@@ -162,5 +164,5 @@ int main(int argc, char **argv)waitpid (pid2, &status,P_ALL ); -return ksft_exit_pass (); +return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 95/202 perf annotate: Add --demangle and --demangle-kernel
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Liška <[email protected]>
[ Upstream commit 3406ac5347dbf64ab9f7b137ed25a18493f5ea2d ]
'perf annotate' supports --symbol but it's impossible to filter a C++ symbol. With --no-demangle one can filter easily by mangled function name.
Stable-dep-of: 374af9f1f06b ("perf annotate: Get rid of duplicate --group option item")
--- tools/perf/Documentation/perf-annotate.txt | 7 +++++++ tools/perf/builtin-annotate.c | 4 ++++ 2 files changed, 11 insertions(+)
tools/perf/Documentation/perf-annotate.txt +7 -0
@@ -118,6 +118,13 @@ OPTIONS --group:: Show event group information together +--demangle:: + Demangle symbol names to human readable form. It's enabled by default, + disable with --no-demangle. + +--demangle-kernel:: + Demangle kernel symbol names to human readable form (for C++ kernels). + --percent-type:: Set annotation percent type from following choices: global-period, local-period, global-hits, local-hits
tools/perf/builtin-annotate.c +4 -0
@@ -537,6 +537,10 @@ int cmd_annotate(int argc, const char **argv) "Specify disassembler style (e.g. -M intel for intel syntax)"),OPT_STRING (0 ,"objdump" , &annotate.opts.objdump_path,"path" ,"objdump binary to use for disassembly and annotations" ), +OPT_BOOLEAN (0 ,"demangle" , &symbol_conf.demangle, +"Enable symbol demangling" ), +OPT_BOOLEAN (0 ,"demangle-kernel" , &symbol_conf.demangle_kernel, +"Enable kernel symbol demangling" ),OPT_BOOLEAN (0 ,"group" , &symbol_conf.event_group,"Show event group information together" ), OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 96/202 perf annotate: Get rid of duplicate --group option item
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit 374af9f1f06b5e991c810d2e4983d6f58df32136 ]
The options array in cmd_annotate() has duplicate --group options. It only needs one and let's get rid of the other.
$ perf annotate -h 2>&1 | grep group
--group Show event group information together
--group Show event group information together--- tools/perf/builtin-annotate.c | 2 -- 1 file changed, 2 deletions(-)
tools/perf/builtin-annotate.c +0 -2
@@ -541,8 +541,6 @@ int cmd_annotate(int argc, const char **argv) "Enable symbol demangling"),OPT_BOOLEAN (0 ,"demangle-kernel" , &symbol_conf.demangle_kernel,"Enable kernel symbol demangling" ), -OPT_BOOLEAN (0 ,"group" , &symbol_conf.event_group, -"Show event group information together" ),OPT_BOOLEAN (0 ,"show-total-period" , &symbol_conf.show_total_period,"Show a column with the sum of periods" ), OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 97/202 soundwire: cadence/intel: simplify PDI/port mapping
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 57a34790cd2cab02c3336fe96cfa33b9b65ed2ee ]
The existing Linux code uses a 1:1 mapping between ports and PDIs, but still has an independent allocation of ports and PDIs.
Let's simplify the code and remove the port layer by only using PDIs.
This patch does not change any functionality, just removes unnecessary code.
This will also allow for further simplifications where the PDIs are not dynamically allocated but instead described in a topology file.
Stable-dep-of: 8ee1b439b154 ("soundwire: cadence: fix invalid PDI offset")
--- drivers/soundwire/cadence_master.c | 110 ++++-------------------- drivers/soundwire/cadence_master.h | 32 ++----- drivers/soundwire/intel.c | 133 ++++++----------------------- 3 files changed, 51 insertions(+), 224 deletions(-)
drivers/soundwire/cadence_master.c +16 -94
@@ -869,7 +869,8 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns, struct sdw_cdns_stream_config config) {struct sdw_cdns_streams *stream; -int offset, i, ret; +int offset; +int ret; cdns->pcm.num_bd = config.pcm_bd; cdns->pcm.num_in = config.pcm_in;
@@ -936,18 +937,6 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns, stream->num_pdi = stream->num_bd + stream->num_in + stream->num_out; cdns->num_ports += stream->num_pdi; - cdns->ports =devm_kcalloc (cdns->dev, cdns->num_ports, -sizeof (*cdns->ports),GFP_KERNEL ); -if (!cdns->ports) { - ret = -ENOMEM ; -return ret; - } - -for (i =0 ; i < cdns->num_ports; i++) { - cdns->ports[i].assigned = false; - cdns->ports[i].num = i +1 ;/* Port 0 reserved for bulk */ - } -return 0 ; }EXPORT_SYMBOL (sdw_cdns_pdi_init);
@@ -1239,13 +1228,11 @@ static struct sdw_cdns_pdi *cdns_find_pdi(struct sdw_cdns *cdns,* sdw_cdns_config_stream: Configure a stream * * @cdns: Cadence instance -* @port: Cadence data port * @ch: Channel count * @dir: Data direction * @pdi: PDI to be used */ void sdw_cdns_config_stream (struct sdw_cdns *cdns, -struct sdw_cdns_port *port,u32 ch,u32 dir,struct sdw_cdns_pdi *pdi) {u32 offset, val =0 ;
@@ -1253,89 +1240,26 @@ void sdw_cdns_config_stream(struct sdw_cdns *cdns,if (dir ==SDW_DATA_DIR_RX ) val =CDNS_PORTCTRL_DIRN ; - offset =CDNS_PORTCTRL + port->num *CDNS_PORT_OFFSET ; + offset =CDNS_PORTCTRL + pdi->num *CDNS_PORT_OFFSET ;cdns_updatel (cdns, offset,CDNS_PORTCTRL_DIRN , val); - val = port->num; + val = pdi->num; val |= ((1 << ch) -1 ) <<SDW_REG_SHIFT (CDNS_PDI_CONFIG_CHANNEL );cdns_writel (cdns,CDNS_PDI_CONFIG (pdi->num), val); }EXPORT_SYMBOL (sdw_cdns_config_stream);/** -* cdns_get_num_pdi() - Get number of PDIs required -* -* @cdns: Cadence instance -* @pdi: PDI to be used -* @num: Number of PDIs -* @ch_count: Channel count -*/ -static int cdns_get_num_pdi (struct sdw_cdns *cdns, -struct sdw_cdns_pdi *pdi, -unsigned int num,u32 ch_count) -{ -int i, pdis =0 ; - -for (i =0 ; i < num; i++) { -if (pdi[i].assigned) -continue ; - -if (pdi[i].ch_count < ch_count) - ch_count -= pdi[i].ch_count; -else - ch_count =0 ; - - pdis++; - -if (!ch_count) -break ; - } - -if (ch_count) -return 0 ; - -return pdis; -} - -/** -* sdw_cdns_get_stream() - Get stream information -* -* @cdns: Cadence instance -* @stream: Stream to be allocated -* @ch: Channel count -* @dir: Data direction -*/ -int sdw_cdns_get_stream (struct sdw_cdns *cdns, -struct sdw_cdns_streams *stream, -u32 ch,u32 dir) -{ -int pdis =0 ; - -if (dir ==SDW_DATA_DIR_RX ) - pdis =cdns_get_num_pdi (cdns, stream->in, stream->num_in, ch); -else - pdis =cdns_get_num_pdi (cdns, stream->out, stream->num_out, ch); - -/* check if we found PDI, else find in bi-directional */ -if (!pdis) - pdis =cdns_get_num_pdi (cdns, stream->bd, stream->num_bd, ch); - -return pdis; -} -EXPORT_SYMBOL (sdw_cdns_get_stream); - -/** -* sdw_cdns_alloc_stream() - Allocate a stream +* sdw_cdns_alloc_pdi() - Allocate a PDI * * @cdns: Cadence instance * @stream: Stream to be allocated -* @port: Cadence data port * @ch: Channel count * @dir: Data direction */ -int sdw_cdns_alloc_stream (struct sdw_cdns *cdns, -struct sdw_cdns_streams *stream, -struct sdw_cdns_port *port,u32 ch,u32 dir) +struct sdw_cdns_pdi *sdw_cdns_alloc_pdi (struct sdw_cdns *cdns, +struct sdw_cdns_streams *stream, +u32 ch,u32 dir) {struct sdw_cdns_pdi *pdi =NULL ;
@@ -1348,18 +1272,16 @@ int sdw_cdns_alloc_stream(struct sdw_cdns *cdns,if (!pdi) pdi =cdns_find_pdi (cdns, stream->num_bd, stream->bd); -if (!pdi) -return -EIO ; - - port->pdi = pdi; - pdi->l_ch_num =0 ; - pdi->h_ch_num = ch -1 ; - pdi->dir = dir; - pdi->ch_count = ch; +if (pdi) { + pdi->l_ch_num =0 ; + pdi->h_ch_num = ch -1 ; + pdi->dir = dir; + pdi->ch_count = ch; + } -return 0 ; +return pdi; } -EXPORT_SYMBOL (sdw_cdns_alloc_stream); +EXPORT_SYMBOL (sdw_cdns_alloc_pdi);MODULE_LICENSE ("Dual BSD/GPL" );MODULE_DESCRIPTION ("Cadence Soundwire Library" );
drivers/soundwire/cadence_master.h +7 -25
@@ -28,23 +28,6 @@ struct sdw_cdns_pdi {enum sdw_stream_type type; }; -/** -* struct sdw_cdns_port: Cadence port structure -* -* @num: port number -* @assigned: port assigned -* @ch: channel count -* @direction: data port direction -* @pdi: pdi for this port -*/ -struct sdw_cdns_port { -unsigned int num; -bool assigned; -unsigned int ch; -enum sdw_data_direction direction; -struct sdw_cdns_pdi *pdi; -}; -/** * struct sdw_cdns_streams: Cadence stream data structure *
@@ -95,8 +78,8 @@ struct sdw_cdns_stream_config {* struct sdw_cdns_dma_data: Cadence DMA data * * @name: SoundWire stream name -* @nr_ports: Number of ports -* @port: Ports +* @stream: stream runtime +* @pdi: PDI used for this dai * @bus: Bus handle * @stream_type: Stream type * @link_id: Master link id
@@ -104,8 +87,7 @@ struct sdw_cdns_stream_config {struct sdw_cdns_dma_data {char *name;struct sdw_stream_runtime *stream; -int nr_ports; -struct sdw_cdns_port **port; +struct sdw_cdns_pdi *pdi;struct sdw_bus *bus;enum sdw_stream_type stream_type;int link_id;
@@ -171,10 +153,10 @@ void sdw_cdns_debugfs_init(struct sdw_cdns *cdns, struct dentry *root);int sdw_cdns_get_stream (struct sdw_cdns *cdns,struct sdw_cdns_streams *stream,u32 ch,u32 dir); -int sdw_cdns_alloc_stream (struct sdw_cdns *cdns, -struct sdw_cdns_streams *stream, -struct sdw_cdns_port *port,u32 ch,u32 dir); -void sdw_cdns_config_stream (struct sdw_cdns *cdns,struct sdw_cdns_port *port, +struct sdw_cdns_pdi *sdw_cdns_alloc_pdi (struct sdw_cdns *cdns, +struct sdw_cdns_streams *stream, +u32 ch,u32 dir); +void sdw_cdns_config_stream (struct sdw_cdns *cdns,u32 ch,u32 dir,struct sdw_cdns_pdi *pdi); int sdw_cdns_pcm_set_stream(struct snd_soc_dai *dai,
drivers/soundwire/intel.c +28 -105
181 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 98/202 soundwire: intel: dont filter out PDI0/1
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 807c15bc77871c695e254423f5e3839b2175db03 ]
PDI0/1 are reserved for Bulk and filtered out in the existing code. That leads to endless confusions on whether the index is the raw or corrected one. In addition we will need support for Bulk at some point so it's just simpler to expose those PDIs and not use it for now than try to be smart unless we have to remove the smarts.
This patch requires a topology change to use PDIs starting at offset 2 explicitly.
Note that there is a known discrepancy between hardware documentation and what ALH stream works in practice, future fixes are likely.
Stable-dep-of: 8ee1b439b154 ("soundwire: cadence: fix invalid PDI offset")
--- drivers/soundwire/cadence_master.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-)
drivers/soundwire/cadence_master.c +11 -18
@@ -183,9 +183,6 @@ MODULE_PARM_DESC(cdns_mcp_int_mask, "Cadence MCP IntMask");#define CDNS_DEFAULT_SSP_INTERVAL 0x18#define CDNS_TX_TIMEOUT 2000 -#define CDNS_PCM_PDI_OFFSET 0x2 -#define CDNS_PDM_PDI_OFFSET 0x6 -#define CDNS_SCP_RX_FIFOLEVEL 0x2/*
@@ -295,11 +292,7 @@ static int cdns_reg_show(struct seq_file *s, void *data) ret +=scnprintf (buf + ret,RD_BUF - ret,"\nDPn B0 Registers\n" ); -/* -* in sdw_cdns_pdi_init() we filter out the Bulk PDIs, -* so the indices need to be corrected again -*/ - num_ports = cdns->num_ports +CDNS_PCM_PDI_OFFSET ; + num_ports = cdns->num_ports;for (i =0 ; i < num_ports; i++) { ret += scnprintf(buf + ret, RD_BUF - ret,
@@ -882,11 +875,8 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns,/* Allocate PDIs for PCMs */ stream = &cdns->pcm; -/* First two PDIs are reserved for bulk transfers */ -if (stream->num_bd <CDNS_PCM_PDI_OFFSET ) -return -EINVAL ; - stream->num_bd -=CDNS_PCM_PDI_OFFSET ; - offset =CDNS_PCM_PDI_OFFSET ; +/* we allocate PDI0 and PDI1 which are used for Bulk */ + offset =0 ; ret =cdns_allocate_pdi (cdns, &stream->bd, stream->num_bd, offset);
@@ -913,7 +903,6 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns,/* Allocate PDIs for PDMs */ stream = &cdns->pdm; - offset =CDNS_PDM_PDI_OFFSET ; ret =cdns_allocate_pdi (cdns, &stream->bd, stream->num_bd, offset);if (ret)
@@ -930,6 +919,9 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns, ret =cdns_allocate_pdi (cdns, &stream->out, stream->num_out, offset); + + offset += stream->num_out; +if (ret)return ret;
@@ -1209,12 +1201,13 @@ EXPORT_SYMBOL(cdns_set_sdw_stream);* Find and return a free PDI for a given PDI array */ static struct sdw_cdns_pdi *cdns_find_pdi (struct sdw_cdns *cdns, +unsigned int offset,unsigned int num,struct sdw_cdns_pdi *pdi) {int i; -for (i =0 ; i < num; i++) { +for (i = offset; i < num; i++) {if (pdi[i].assigned)continue ; pdi[i].assigned = true;
@@ -1264,13 +1257,13 @@ struct sdw_cdns_pdi *sdw_cdns_alloc_pdi(struct sdw_cdns *cdns,struct sdw_cdns_pdi *pdi =NULL ;if (dir ==SDW_DATA_DIR_RX ) - pdi =cdns_find_pdi (cdns, stream->num_in, stream->in); + pdi =cdns_find_pdi (cdns,0 , stream->num_in, stream->in);else - pdi =cdns_find_pdi (cdns, stream->num_out, stream->out); + pdi =cdns_find_pdi (cdns,0 , stream->num_out, stream->out);/* check if we found a PDI, else find in bi-directional */ if (!pdi) - pdi =cdns_find_pdi (cdns, stream->num_bd, stream->bd); + pdi =cdns_find_pdi (cdns,2 , stream->num_bd, stream->bd);if (pdi) { pdi->l_ch_num =0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 99/202 soundwire: cadence_master: improve PDI allocation
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bard Liao <[email protected]>
[ Upstream commit 1b53385e7938d5a093e92044f9c89e4e76106f1b ]
PDI number should match dai->id, there is no need to track if a PDI is allocated or not.
Stable-dep-of: 8ee1b439b154 ("soundwire: cadence: fix invalid PDI offset")
--- drivers/soundwire/cadence_master.c | 27 ++++++++++++++------------- drivers/soundwire/cadence_master.h | 4 +--- drivers/soundwire/intel.c | 5 ++--- 3 files changed, 17 insertions(+), 19 deletions(-)
drivers/soundwire/cadence_master.c +14 -13
@@ -845,7 +845,6 @@ static int cdns_allocate_pdi(struct sdw_cdns *cdns,for (i =0 ; i < num; i++) { pdi[i].num = i + pdi_offset; - pdi[i].assigned = false; } *stream = pdi;
@@ -1198,21 +1197,20 @@ EXPORT_SYMBOL(cdns_set_sdw_stream);* @num: Number of PDIs * @pdi: PDI instances * -* Find and return a free PDI for a given PDI array +* Find a PDI for a given PDI array. The PDI num and dai_id are +* expected to match, return NULL otherwise. */ static struct sdw_cdns_pdi *cdns_find_pdi (struct sdw_cdns *cdns,unsigned int offset,unsigned int num, -struct sdw_cdns_pdi *pdi) +struct sdw_cdns_pdi *pdi, +int dai_id) {int i; -for (i = offset; i < num; i++) { -if (pdi[i].assigned) -continue ; - pdi[i].assigned = true; -return &pdi[i]; - } +for (i = offset; i < offset + num; i++) +if (pdi[i].num == dai_id) +return &pdi[i];return NULL ; }
@@ -1252,18 +1250,21 @@ EXPORT_SYMBOL(sdw_cdns_config_stream);*/ struct sdw_cdns_pdi *sdw_cdns_alloc_pdi (struct sdw_cdns *cdns,struct sdw_cdns_streams *stream, -u32 ch,u32 dir) +u32 ch,u32 dir,int dai_id) {struct sdw_cdns_pdi *pdi =NULL ;if (dir ==SDW_DATA_DIR_RX ) - pdi =cdns_find_pdi (cdns,0 , stream->num_in, stream->in); + pdi =cdns_find_pdi (cdns,0 , stream->num_in, stream->in, + dai_id);else - pdi =cdns_find_pdi (cdns,0 , stream->num_out, stream->out); + pdi =cdns_find_pdi (cdns,0 , stream->num_out, stream->out, + dai_id);/* check if we found a PDI, else find in bi-directional */ if (!pdi) - pdi =cdns_find_pdi (cdns,2 , stream->num_bd, stream->bd); + pdi =cdns_find_pdi (cdns,2 , stream->num_bd, stream->bd, + dai_id);if (pdi) { pdi->l_ch_num =0 ;
drivers/soundwire/cadence_master.h +1 -3
@@ -8,7 +8,6 @@/** * struct sdw_cdns_pdi: PDI (Physical Data Interface) instance * -* @assigned: pdi assigned * @num: pdi number * @intel_alh_id: link identifier * @l_ch_num: low channel for PDI
@@ -18,7 +17,6 @@* @type: stream type, PDM or PCM */ struct sdw_cdns_pdi { -bool assigned;int num;int intel_alh_id;int l_ch_num;
@@ -155,7 +153,7 @@ int sdw_cdns_get_stream(struct sdw_cdns *cdns, u32 ch, u32 dir);struct sdw_cdns_pdi *sdw_cdns_alloc_pdi (struct sdw_cdns *cdns,struct sdw_cdns_streams *stream, -u32 ch,u32 dir); +u32 ch,u32 dir,int dai_id);void sdw_cdns_config_stream (struct sdw_cdns *cdns,u32 ch,u32 dir,struct sdw_cdns_pdi *pdi);
drivers/soundwire/intel.c +2 -3
@@ -636,11 +636,10 @@ static int intel_hw_params(struct snd_pcm_substream *substream,if (dma->stream_type ==SDW_STREAM_PDM ) pcm = false; -/* FIXME: We would need to get PDI info from topology */ if (pcm) - pdi =sdw_cdns_alloc_pdi (cdns, &cdns->pcm, ch, dir); + pdi =sdw_cdns_alloc_pdi (cdns, &cdns->pcm, ch, dir, dai->id);else - pdi =sdw_cdns_alloc_pdi (cdns, &cdns->pdm, ch, dir); + pdi =sdw_cdns_alloc_pdi (cdns, &cdns->pdm, ch, dir, dai->id);if (!pdi) { ret = -EINVAL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 100/202 soundwire: cadence: fix invalid PDI offset
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 8ee1b439b1540ae543149b15a2a61b9dff937d91 ]
For some reason, we add an offset to the PDI, presumably to skip the PDI0 and PDI1 which are reserved for BPT.
This code is however completely wrong and leads to an out-of-bounds access. We were just lucky so far since we used only a couple of PDIs and remained within the PDI array bounds.
A Fixes: tag is not provided since there are no known platforms where the out-of-bounds would be accessed, and the initial code had problems as well.
A follow-up patch completely removes this useless offset.
--- drivers/soundwire/cadence_master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soundwire/cadence_master.c +1 -1
@@ -1263,7 +1263,7 @@ struct sdw_cdns_pdi *sdw_cdns_alloc_pdi(struct sdw_cdns *cdns,/* check if we found a PDI, else find in bi-directional */ if (!pdi) - pdi =cdns_find_pdi (cdns,2 , stream->num_bd, stream->bd, + pdi =cdns_find_pdi (cdns,0 , stream->num_bd, stream->bd, dai_id);if (pdi) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 101/202 dmaengine: idma64: Add check for dma_set_max_seg_size
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ni <[email protected]>
[ Upstream commit 2b1c1cf08a0addb6df42f16b37133dc7a351de29 ]
As the possible failure of the dma_set_max_seg_size(), it should be better to check the return value of the dma_set_max_seg_size().
--- drivers/dma/idma64.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/dma/idma64.c +3 -1
@@ -594,7 +594,9 @@ static int idma64_probe(struct idma64_chip *chip) idma64->dma.dev = chip->sysdev; -dma_set_max_seg_size (idma64->dma.dev,IDMA64C_CTLH_BLOCK_TS_MASK ); + ret =dma_set_max_seg_size (idma64->dma.dev,IDMA64C_CTLH_BLOCK_TS_MASK ); +if (ret) +return ret; ret =dma_async_device_register (&idma64->dma);if (ret)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 102/202 firmware: dmi-id: add a release callback function
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit cf770af5645a41a753c55a053fa1237105b0964a ]
dmi_class uses kfree() as the .release function, but that now causes a warning with clang-16 as it violates control flow integrity (KCFI) rules:
drivers/firmware/dmi-id.c:174:17: error: cast from 'void (*)(const void *)' to 'void (*)(struct device *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
174 | .dev_release = (void(*)(struct device *)) kfree,
Add an explicit function to call kfree() instead.
--- drivers/firmware/dmi-id.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/firmware/dmi-id.c +6 -1
@@ -160,9 +160,14 @@ static int dmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env)return 0 ; } +static void dmi_dev_release (struct device *dev) +{ +kfree (dev); +} +static struct class dmi_class = { .name ="dmi" , - .dev_release = (void (*)(struct device *)) kfree, + .dev_release = dmi_dev_release, .dev_uevent = dmi_dev_uevent, };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 103/202 serial: max3100: Lock port->lock when calling uart_handle_cts_change()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 77ab53371a2066fdf9b895246505f5ef5a4b5d47 ]
uart_handle_cts_change() has to be called with port lock taken, Since we run it in a separate work, the lock may not be taken at the time of running. Make sure that it's taken by explicitly doing that. Without it we got a splat:
WARNING: CPU: 0 PID: 10 at drivers/tty/serial/serial_core.c:3491 uart_handle_cts_change+0xa6/0xb0 ... Workqueue: max3100-0 max3100_work [max3100] RIP: 0010:uart_handle_cts_change+0xa6/0xb0 ... max3100_handlerx+0xc5/0x110 [max3100] max3100_work+0x12a/0x340 [max3100]
--- drivers/tty/serial/max3100.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/tty/serial/max3100.c +12 -1
@@ -213,7 +213,7 @@ static int max3100_sr(struct max3100_port *s, u16 tx, u16 *rx)return 0 ; } -static int max3100_handlerx (struct max3100_port *s,u16 rx) +static int max3100_handlerx_unlocked (struct max3100_port *s,u16 rx) {unsigned int ch, flg, status =0 ;int ret =0 , cts;
@@ -253,6 +253,17 @@ static int max3100_handlerx(struct max3100_port *s, u16 rx)return ret; } +static int max3100_handlerx (struct max3100_port *s,u16 rx) +{ +unsigned long flags; +int ret; + +uart_port_lock_irqsave (&s->port, &flags); + ret =max3100_handlerx_unlocked (s, rx); +uart_port_unlock_irqrestore (&s->port, flags); +return ret; +} +static void max3100_work (struct work_struct *w) { struct max3100_port *s = container_of(w, struct max3100_port, work);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 104/202 serial: max3100: Update uart_driver_registered on driver removal
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 712a1fcb38dc7cac6da63ee79a88708fbf9c45ec ]
The removal of the last MAX3100 device triggers the removal of the driver. However, code doesn't update the respective global variable and after insmod — rmmod — insmod cycle the kernel oopses:
max3100 spi-PRP0001:01: max3100_probe: adding port 0
BUG: kernel NULL pointer dereference, address: 0000000000000408 ... RIP: 0010:serial_core_register_port+0xa0/0x840 ... max3100_probe+0x1b6/0x280 [max3100] spi_probe+0x8d/0xb0
Update the actual state so next time UART driver will be registered again.
Hugo also noticed, that the error path in the probe also affected by having the variable set, and not cleared. Instead of clearing it move the assignment after the successfull uart_register_driver() call.
--- drivers/tty/serial/max3100.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/tty/serial/max3100.c +3 -1
@@ -754,13 +754,14 @@ static int max3100_probe(struct spi_device *spi)mutex_lock (&max3100s_lock);if (!uart_driver_registered) { - uart_driver_registered =1 ; retval =uart_register_driver (&max3100_uart_driver);if (retval) {printk (KERN_ERR "Couldn't register max3100 uart driver\n" );mutex_unlock (&max3100s_lock);return retval; } + + uart_driver_registered =1 ; }for (i =0 ; i <MAX_MAX3100 ; i++)
@@ -846,6 +847,7 @@ static int max3100_remove(struct spi_device *spi) }pr_debug ("removing max3100 driver\n" );uart_unregister_driver (&max3100_uart_driver); + uart_driver_registered =0 ;mutex_unlock (&max3100s_lock);return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 87/202 selftests/kcmp: remove unused open mode
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Liaw <[email protected]>
[ Upstream commit eb59a58113717df04b8a8229befd8ab1e5dbf86e ]
Android bionic warns that open modes are ignored if O_CREAT or O_TMPFILE aren't specified. The permissions for the file are set above:
fd1 = open(kpath, O_RDWR | O_CREAT | O_TRUNC, 0644);
--- tools/testing/selftests/kcmp/kcmp_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/kcmp/kcmp_test.c +1 -1
@@ -91,7 +91,7 @@ int main(int argc, char **argv)ksft_print_header ();ksft_set_plan (3 ); - fd2 =open (kpath,O_RDWR ,0644 ); + fd2 =open (kpath,O_RDWR );if (fd2 <0 ) {perror ("Can't open file" );ksft_exit_fail ();
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 105/202 serial: max3100: Fix bitwise types
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit e60955dbecb97f080848a57524827e2db29c70fd ]
Sparse is not happy about misuse of bitwise types:
.../max3100.c:194:13: warning: incorrect type in assignment (different base types)
.../max3100.c:194:13: expected unsigned short [addressable] [usertype] etx
.../max3100.c:194:13: got restricted __be16 [usertype]
.../max3100.c:202:15: warning: cast to restricted __be16
Fix this by choosing proper types for the respective variables.
--- drivers/tty/serial/max3100.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/tty/serial/max3100.c +4 -1
@@ -45,6 +45,9 @@#include <linux/freezer.h> #include <linux/tty.h> #include <linux/tty_flip.h> +#include <linux/types.h> + +#include <asm/unaligned.h> #include <linux/serial_max3100.h>
@@ -191,7 +194,7 @@ static void max3100_timeout(struct timer_list *t)static int max3100_sr (struct max3100_port *s,u16 tx,u16 *rx) {struct spi_message message; -u16 etx, erx; +__be16 etx, erx;int status;struct spi_transfer tran = { .tx_buf = &etx,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 106/202 greybus: arche-ctrl: move device table to its right location
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 6a0b8c0da8d8d418cde6894a104cf74e6098ddfa ]
The arche-ctrl has two platform drivers and three of_device_id tables, but one table is only used for the the module loader, while the other two seem to be associated with their drivers.
This leads to a W=1 warning when the driver is built-in:
drivers/staging/greybus/arche-platform.c:623:34: error: 'arche_combined_id' defined but not used [-Werror=unused-const-variable=]
623 | static const struct of_device_id arche_combined_id[] = {
Drop the extra table and register both tables that are actually used as the ones for the module loader instead.
--- drivers/staging/greybus/arche-apb-ctrl.c | 1 + drivers/staging/greybus/arche-platform.c | 9 +-------- 2 files changed, 2 insertions(+), 8 deletions(-)
drivers/staging/greybus/arche-apb-ctrl.c +1 -0
@@ -468,6 +468,7 @@ static const struct of_device_id arche_apb_ctrl_of_match[] = { { .compatible = "usbffff,2", }, { }, }; +MODULE_DEVICE_TABLE (of, arche_apb_ctrl_of_match);static struct platform_driver arche_apb_ctrl_device_driver = { .probe = arche_apb_ctrl_probe,
drivers/staging/greybus/arche-platform.c +1 -8
@@ -622,14 +622,7 @@ static const struct of_device_id arche_platform_of_match[] = { { .compatible = "google,arche-platform", }, { }, }; - -static const struct of_device_id arche_combined_id[] = { -/* Use PID/VID of SVC device */ - { .compatible ="google,arche-platform" , }, - { .compatible ="usbffff,2" , }, - { }, -}; -MODULE_DEVICE_TABLE (of, arche_combined_id); +MODULE_DEVICE_TABLE (of, arche_platform_of_match);static struct platform_driver arche_platform_device_driver = { .probe = arche_platform_probe,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 107/202 iio: pressure: dps310: support negative temperature values
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Haemmerle <[email protected]>
[ Upstream commit 9dd6b32e76ff714308964cd9ec91466a343dcb8b ]
The current implementation interprets negative values returned from dps310_calculate_temp as error codes.
This has a side effect that when negative temperature values are calculated, they are interpreted as error.
Fix this by using the return value only for error handling and passing a pointer for the value.
--- drivers/iio/pressure/dps310.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/iio/pressure/dps310.c +6 -5
@@ -730,7 +730,7 @@ static int dps310_read_pressure(struct dps310_data *data, int *val, int *val2, } } -static int dps310_calculate_temp (struct dps310_data *data) +static int dps310_calculate_temp (struct dps310_data *data,int *val) {s64 c0;s64 t;
@@ -746,7 +746,9 @@ static int dps310_calculate_temp(struct dps310_data *data) t = c0 + ((s64 )data->temp_raw * (s64 )data->c1);/* Convert to milliCelsius and scale the temperature */ -return (int )div_s64 (t *1000LL , kt); + *val = (int )div_s64 (t *1000LL , kt); + +return 0 ; } static int dps310_read_temp(struct dps310_data *data, int *val, int *val2,
@@ -768,11 +770,10 @@ static int dps310_read_temp(struct dps310_data *data, int *val, int *val2,if (rc)return rc; - rc =dps310_calculate_temp (data); -if (rc <0 ) + rc =dps310_calculate_temp (data, val); +if (rc)return rc; - *val = rc;return IIO_VAL_INT ;case IIO_CHAN_INFO_OVERSAMPLING_RATIO :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 108/202 microblaze: Remove gcc flag for non existing early_printk.c file
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Simek <[email protected]>
[ Upstream commit edc66cf0c4164aa3daf6cc55e970bb94383a6a57 ]
early_printk support for removed long time ago but compilation flag for ftrace still points to already removed file that's why remove that line too.
--- arch/microblaze/kernel/Makefile | 1 - 1 file changed, 1 deletion(-)
arch/microblaze/kernel/Makefile +0 -1
@@ -7,7 +7,6 @@ ifdef CONFIG_FUNCTION_TRACER # Do not trace early boot code and low level code CFLAGS_REMOVE_timer.o = -pg CFLAGS_REMOVE_intc.o = -pg -CFLAGS_REMOVE_early_printk.o = -pg CFLAGS_REMOVE_ftrace.o = -pg CFLAGS_REMOVE_process.o = -pg endif
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 109/202 microblaze: Remove early printk call from cpuinfo-static.c
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Simek <[email protected]>
[ Upstream commit 58d647506c92ccd3cfa0c453c68ddd14f40bf06f ]
Early printk has been removed already that's why also remove calling it. Similar change has been done in cpuinfo-pvr-full.c by commit cfbd8d1979af ("microblaze: Remove early printk setup").
--- arch/microblaze/kernel/cpu/cpuinfo-static.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/microblaze/kernel/cpu/cpuinfo-static.c +1 -1
@@ -18,7 +18,7 @@ static const char family_string[] = CONFIG_XILINX_MICROBLAZE0_FAMILY;static const char cpu_ver_string[] =CONFIG_XILINX_MICROBLAZE0_HW_VER ;#define err_printk (x) \ - early_printk("ERROR: Microblaze " x "-different for kernel and DTS\n"); + pr_err("ERROR: Microblaze " x "-different for kernel and DTS\n");void __init set_cpuinfo_static (struct cpuinfo *ci,struct device_node *cpu) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 110/202 ovl: remove upper umask handling from ovl_create_upper()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
[ Upstream commit 096802748ea1dea8b476938e0a8dc16f4bd2f1ad ]
This is already done by vfs_prepare_mode() when creating the upper object by vfs_create(), vfs_mkdir() and vfs_mknod().
No regressions have been observed in xfstests run with posix acls turned off for the upper filesystem.
--- fs/overlayfs/dir.c | 3 --- 1 file changed, 3 deletions(-)
fs/overlayfs/dir.c +0 -3
@@ -295,9 +295,6 @@ static int ovl_create_upper(struct dentry *dentry, struct inode *inode,struct dentry *newdentry;int err; -if (!attr->hardlink && !IS_POSIXACL (udir)) - attr->mode &= ~current_umask (); -inode_lock_nested (udir,I_MUTEX_PARENT ); newdentry = ovl_create_real(udir, lookup_one_len(dentry->d_name.name,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 111/202 usb: gadget: u_audio: Clear uac pointer when freed.
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wulff <[email protected]>
[ Upstream commit a2cf936ebef291ef7395172b9e2f624779fb6dc0 ]
This prevents use of a stale pointer if functions are called after g_cleanup that shouldn't be. This doesn't fix any races, but converts a possibly silent kernel memory corruption into an obvious NULL pointer dereference report.
--- drivers/usb/gadget/function/u_audio.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/gadget/function/u_audio.c +2 -0
@@ -624,6 +624,8 @@ void g_audio_cleanup(struct g_audio *g_audio)return ; uac = g_audio->uac; + g_audio->uac =NULL ; + card = uac->card;if (card)snd_card_free_when_closed (card);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 112/202 stm class: Fix a double free in stm_register_device()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 3df463865ba42b8f88a590326f4c9ea17a1ce459 ]
The put_device(&stm->dev) call will trigger stm_device_release() which frees "stm" so the vfree(stm) on the next line is a double free.
--- drivers/hwtracing/stm/core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/hwtracing/stm/core.c +6 -5
@@ -878,8 +878,11 @@ int stm_register_device(struct device *parent, struct stm_data *stm_data,return -ENOMEM ; stm->major =register_chrdev (0 , stm_data->name, &stm_fops); -if (stm->major <0 ) - goto err_free; +if (stm->major <0 ) { + err = stm->major; +vfree (stm); +return err; + }device_initialize (&stm->dev); stm->dev.devt =MKDEV (stm->major,0 );
@@ -923,10 +926,8 @@ int stm_register_device(struct device *parent, struct stm_data *stm_data, err_device:unregister_chrdev (stm->major, stm_data->name); -/* matches device_initialize() above */ +/* calls stm_device_release() */ put_device (&stm->dev); -err_free: -vfree (stm);return err; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 113/202 ppdev: Remove usage of the deprecated ida_simple_xx() API
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit d8407f71ebeaeb6f50bd89791837873e44609708 ]
ida_alloc() and ida_free() should be preferred to the deprecated ida_simple_get() and ida_simple_remove().
This is less verbose.
Stable-dep-of: fbf740aeb86a ("ppdev: Add an error check in register_device")
--- drivers/char/ppdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/char/ppdev.c +3 -3
@@ -299,7 +299,7 @@ static int register_device(int minor, struct pp_struct *pp) goto err; } - index =ida_simple_get (&ida_index,0 ,0 ,GFP_KERNEL ); + index =ida_alloc (&ida_index,GFP_KERNEL );memset (&ppdev_cb,0 ,sizeof (ppdev_cb)); ppdev_cb.irq_func = pp_irq; ppdev_cb.flags = (pp->flags &PP_EXCL ) ?PARPORT_FLAG_EXCL :0 ;
@@ -310,7 +310,7 @@ static int register_device(int minor, struct pp_struct *pp)if (!pdev) {pr_warn ("%s: failed to register device!\n" , name); rc = -ENXIO ; -ida_simple_remove (&ida_index, index); +ida_free (&ida_index, index); goto err; }
@@ -762,7 +762,7 @@ static int pp_release(struct inode *inode, struct file *file)if (pp->pdev) {parport_unregister_device (pp->pdev); -ida_simple_remove (&ida_index, pp->index); +ida_free (&ida_index, pp->index); pp->pdev =NULL ;pr_debug (CHRDEV "%x: unregistered pardevice\n" , minor); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 114/202 ppdev: Add an error check in register_device
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huai-Yuan Liu <[email protected]>
[ Upstream commit fbf740aeb86a4fe82ad158d26d711f2f3be79b3e ]
In register_device, the return value of ida_simple_get is unchecked, in witch ida_simple_get will use an invalid index value.
To address this issue, index should be checked after ida_simple_get. When the index value is abnormal, a warning message should be printed, the port should be dropped, and the value should be recorded.
--- drivers/char/ppdev.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/char/ppdev.c +11 -4
@@ -296,28 +296,35 @@ static int register_device(int minor, struct pp_struct *pp)if (!port) {pr_warn ("%s: no associated port!\n" , name); rc = -ENXIO ; - goto err; + goto err_free_name; } index =ida_alloc (&ida_index,GFP_KERNEL ); +if (index <0 ) { +pr_warn ("%s: failed to get index!\n" , name); + rc = index; + goto err_put_port; + } +memset (&ppdev_cb,0 ,sizeof (ppdev_cb)); ppdev_cb.irq_func = pp_irq; ppdev_cb.flags = (pp->flags &PP_EXCL ) ?PARPORT_FLAG_EXCL :0 ; ppdev_cb.private = pp; pdev =parport_register_dev_model (port, name, &ppdev_cb, index); -parport_put_port (port);if (!pdev) {pr_warn ("%s: failed to register device!\n" , name); rc = -ENXIO ;ida_free (&ida_index, index); - goto err; + goto err_put_port; } pp->pdev = pdev; pp->index = index;dev_dbg (&pdev->dev,"registered pardevice\n" ); -err: +err_put_port: +parport_put_port (port); +err_free_name:kfree (name);return rc; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 88/202 RDMA/IPoIB: Fix format truncation compilation errors
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
[ Upstream commit 49ca2b2ef3d003402584c68ae7b3055ba72e750a ]
Truncate the device name to store IPoIB VLAN name.
[leonro@5b4e8fba4ddd kernel]$ make -s -j 20 allmodconfig [leonro@5b4e8fba4ddd kernel]$ make -s -j 20 W=1 drivers/infiniband/ulp/ipoib/ drivers/infiniband/ulp/ipoib/ipoib_vlan.c: In function ‘ipoib_vlan_add’:drivers/infiniband/ulp/ipoib/ipoib_vlan.c:187:52: error: ‘%04x’ directive output may be truncated writing 4 bytes into a region of size between 0 and 15 [-Werror=format-truncation=]
187 | snprintf(intf_name, sizeof(intf_name), "%s.%04x",
| ^~~~drivers/infiniband/ulp/ipoib/ipoib_vlan.c:187:48: note: directive argument in the range [0, 65535]
187 | snprintf(intf_name, sizeof(intf_name), "%s.%04x",
| ^~~~~~~~~drivers/infiniband/ulp/ipoib/ipoib_vlan.c:187:9: note: ‘snprintf’ output between 6 and 21 bytes into a destination of size 16
187 | snprintf(intf_name, sizeof(intf_name), "%s.%04x",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
188 | ppriv->dev->name, pkey);
| ~~~~~~~~~~~~~~~~~~~~~~~cc1: all warnings being treated as errors
make[6]: *** [scripts/Makefile.build:244: drivers/infiniband/ulp/ipoib/ipoib_vlan.o] Error 1 make[6]: *** Waiting for unfinished jobs....
--- drivers/infiniband/ulp/ipoib/ipoib_vlan.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib_vlan.c +6 -2
@@ -182,8 +182,12 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey) ppriv =ipoib_priv (pdev); -snprintf (intf_name,sizeof (intf_name),"%s.%04x" , - ppriv->dev->name, pkey); +/* If you increase IFNAMSIZ, update snprintf below +* to allow longer names. +*/ +BUILD_BUG_ON (IFNAMSIZ !=16 ); +snprintf (intf_name,sizeof (intf_name),"%.10s.%04x" , ppriv->dev->name, + pkey); ndev =ipoib_intf_alloc (ppriv->ca, ppriv->port, intf_name);if (IS_ERR (ndev)) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 115/202 perf top: Fix TUI exit screen refresh race condition
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: yaowenbin <[email protected]>
[ Upstream commit 64f18d2d043015b3f835ce4c9f3beb97cfd19b6e ]
When the following command is executed several times, a coredump file is generated.
$ timeout -k 9 5 perf top -e task-clock ******* ******* ******* 0.01% [kernel] [k] __do_softirq 0.01% libpthread-2.28.so [.] __pthread_mutex_lock 0.01% [kernel] [k] __ll_sc_atomic64_sub_return double free or corruption (!prev) perf top --sort comm,dso timeout: the monitored command dumped core
When we terminate "perf top" using sending signal method, SLsmg_reset_smg() called. SLsmg_reset_smg() resets the SLsmg screen management routines by freeing all memory allocated while it was active.
However SLsmg_reinit_smg() maybe be called by another thread.
SLsmg_reinit_smg() will free the same memory accessed by SLsmg_reset_smg(), thus it results in a double free.
SLsmg_reinit_smg() is called already protected by ui__lock, so we fix the problem by adding pthread_mutex_trylock of ui__lock when calling SLsmg_reset_smg().
Stable-dep-of: 769e6a1e15bd ("perf ui browser: Don't save pointer to stack memory")
--- tools/perf/ui/tui/setup.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
tools/perf/ui/tui/setup.c +5 -3
@@ -170,9 +170,11 @@ void ui__exit(bool wait_for_ok) "Press any key...", 0);SLtt_set_cursor_visibility (1 ); -SLsmg_refresh (); -SLsmg_reset_smg (); +if (!pthread_mutex_trylock (&ui__lock)) { +SLsmg_refresh (); +SLsmg_reset_smg (); +pthread_mutex_unlock (&ui__lock); + }SLang_reset_tty (); -perf_error__unregister (&perf_tui_eops); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 116/202 perf ui: Update use of pthread mutex
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit 82aff6cc070417f26f9b02b26e63c17ff43b4044 ]
Switch to the use of mutex wrappers that provide better error checking.
Stable-dep-of: 769e6a1e15bd ("perf ui browser: Don't save pointer to stack memory")
--- tools/perf/ui/browser.c | 20 ++++++++++---------- tools/perf/ui/browsers/annotate.c | 2 +- tools/perf/ui/setup.c | 5 +++-- tools/perf/ui/tui/helpline.c | 5 ++--- tools/perf/ui/tui/progress.c | 8 ++++---- tools/perf/ui/tui/setup.c | 8 ++++---- tools/perf/ui/tui/util.c | 18 +++++++++--------- tools/perf/ui/ui.h | 4 ++-- 8 files changed, 35 insertions(+), 35 deletions(-)
tools/perf/ui/browser.c +10 -10
@@ -268,9 +268,9 @@ void __ui_browser__show_title(struct ui_browser *browser, const char *title)void ui_browser__show_title (struct ui_browser *browser,const char *title) { -pthread_mutex_lock (&ui__lock); +mutex_lock (&ui__lock);__ui_browser__show_title (browser, title); -pthread_mutex_unlock (&ui__lock); +mutex_unlock (&ui__lock); } int ui_browser__show(struct ui_browser *browser, const char *title,
@@ -284,7 +284,7 @@ int ui_browser__show(struct ui_browser *browser, const char *title, browser->refresh_dimensions (browser); -pthread_mutex_lock (&ui__lock); +mutex_lock (&ui__lock);__ui_browser__show_title (browser, title); browser->title = title;
@@ -295,16 +295,16 @@ int ui_browser__show(struct ui_browser *browser, const char *title,va_end (ap);if (err >0 )ui_helpline__push (browser->helpline); -pthread_mutex_unlock (&ui__lock); +mutex_unlock (&ui__lock);return err ?0 :-1 ; }void ui_browser__hide (struct ui_browser *browser) { -pthread_mutex_lock (&ui__lock); +mutex_lock (&ui__lock);ui_helpline__pop ();zfree (&browser->helpline); -pthread_mutex_unlock (&ui__lock); +mutex_unlock (&ui__lock); }static void ui_browser__scrollbar_set (struct ui_browser *browser)
@@ -352,9 +352,9 @@ static int __ui_browser__refresh(struct ui_browser *browser)int ui_browser__refresh (struct ui_browser *browser) { -pthread_mutex_lock (&ui__lock); +mutex_lock (&ui__lock);__ui_browser__refresh (browser); -pthread_mutex_unlock (&ui__lock); +mutex_unlock (&ui__lock);return 0 ; }
@@ -390,10 +390,10 @@ int ui_browser__run(struct ui_browser *browser, int delay_secs)while (1 ) {off_t offset; -pthread_mutex_lock (&ui__lock); +mutex_lock (&ui__lock); err =__ui_browser__refresh (browser);SLsmg_refresh (); -pthread_mutex_unlock (&ui__lock); +mutex_unlock (&ui__lock);if (err <0 )break ;
tools/perf/ui/browsers/annotate.c +1 -1
@@ -8,11 +8,11 @@#include "../../util/hist.h" #include "../../util/sort.h" #include "../../util/map.h" +#include "../../util/mutex.h" #include "../../util/symbol.h" #include "../../util/evsel.h" #include "../../util/evlist.h" #include <inttypes.h> -#include <pthread.h> #include <linux/kernel.h> #include <linux/string.h> #include <linux/zalloc.h>
tools/perf/ui/setup.c +3 -2
@@ -1,5 +1,4 @@// SPDX-License-Identifier: GPL-2.0 -#include <pthread.h> #include <dlfcn.h> #include <unistd.h>
@@ -8,7 +7,7 @@#include "../util/hist.h" #include "ui.h" -pthread_mutex_t ui__lock =PTHREAD_MUTEX_INITIALIZER ; +struct mutex ui__lock;void *perf_gtk_handle;int use_browser =-1 ;
@@ -76,6 +75,7 @@ int stdio__config_color(const struct option *opt __maybe_unused,void setup_browser (bool fallback_to_pager) { +mutex_init (&ui__lock);if (use_browser <2 && (!isatty (1 ) || dump_trace)) use_browser =0 ;
@@ -118,4 +118,5 @@ void exit_browser(bool wait_for_ok)default :break ; } +mutex_destroy (&ui__lock); }
tools/perf/ui/tui/helpline.c +2 -3
@@ -2,7 +2,6 @@#include <stdio.h> #include <stdlib.h> #include <string.h> -#include <pthread.h> #include <linux/kernel.h> #include <linux/string.h>
@@ -33,7 +32,7 @@ static int tui_helpline__show(const char *format, va_list ap)int ret;static int backlog; -pthread_mutex_lock (&ui__lock); +mutex_lock (&ui__lock); ret =vscnprintf (ui_helpline__last_msg + backlog,sizeof (ui_helpline__last_msg) - backlog, format, ap); backlog += ret;
@@ -45,7 +44,7 @@ static int tui_helpline__show(const char *format, va_list ap)SLsmg_refresh (); backlog =0 ; } -pthread_mutex_unlock (&ui__lock); +mutex_unlock (&ui__lock);return ret; }
tools/perf/ui/tui/progress.c +4 -4
@@ -45,7 +45,7 @@ static void tui_progress__update(struct ui_progress *p) }ui__refresh_dimensions (false); -pthread_mutex_lock (&ui__lock); +mutex_lock (&ui__lock); y = SLtt_Screen_Rows /2 -2 ;SLsmg_set_color (0 );SLsmg_draw_box (y,0 ,3 , SLtt_Screen_Cols);
@@ -56,7 +56,7 @@ static void tui_progress__update(struct ui_progress *p) bar = ((SLtt_Screen_Cols -2 ) * p->curr) / p->total;SLsmg_fill_region (y,1 ,1 , bar,' ' );SLsmg_refresh (); -pthread_mutex_unlock (&ui__lock); +mutex_unlock (&ui__lock); }static void tui_progress__finish (void )
@@ -67,12 +67,12 @@ static void tui_progress__finish(void)return ;ui__refresh_dimensions (false); -pthread_mutex_lock (&ui__lock); +mutex_lock (&ui__lock); y = SLtt_Screen_Rows /2 -2 ;SLsmg_set_color (0 );SLsmg_fill_region (y,0 ,3 , SLtt_Screen_Cols,' ' );SLsmg_refresh (); -pthread_mutex_unlock (&ui__lock); +mutex_unlock (&ui__lock); }static struct ui_progress_ops tui_progress__ops = {
tools/perf/ui/tui/setup.c +4 -4
@@ -29,10 +29,10 @@ void ui__refresh_dimensions(bool force) {if (force || ui__need_resize) { ui__need_resize =0 ; -pthread_mutex_lock (&ui__lock); +mutex_lock (&ui__lock);SLtt_get_screen_size ();SLsmg_reinit_smg (); -pthread_mutex_unlock (&ui__lock); +mutex_unlock (&ui__lock); } }
@@ -170,10 +170,10 @@ void ui__exit(bool wait_for_ok) "Press any key...", 0);SLtt_set_cursor_visibility (1 ); -if (!pthread_mutex_trylock (&ui__lock)) { +if (mutex_trylock (&ui__lock)) {SLsmg_refresh ();SLsmg_reset_smg (); -pthread_mutex_unlock (&ui__lock); +mutex_unlock (&ui__lock); }SLang_reset_tty ();perf_error__unregister (&perf_tui_eops);
tools/perf/ui/tui/util.c +9 -9
@@ -91,7 +91,7 @@ int ui_browser__input_window(const char *title, const char *text, char *input, t = sep +1 ; } -pthread_mutex_lock (&ui__lock); +mutex_lock (&ui__lock); max_len +=2 ; nr_lines +=8 ;
@@ -121,17 +121,17 @@ int ui_browser__input_window(const char *title, const char *text, char *input,SLsmg_write_nstring ((char *)exit_msg, max_len);SLsmg_refresh (); -pthread_mutex_unlock (&ui__lock); +mutex_unlock (&ui__lock); x +=2 ; len =0 ; key =ui__getch (delay_secs);while (key !=K_TIMER && key !=K_ENTER && key !=K_ESC ) { -pthread_mutex_lock (&ui__lock); +mutex_lock (&ui__lock);if (key ==K_BKSPC ) {if (len ==0 ) { -pthread_mutex_unlock (&ui__lock); +mutex_unlock (&ui__lock); goto next_key; }SLsmg_gotorc (y, x + --len);
@@ -143,7 +143,7 @@ int ui_browser__input_window(const char *title, const char *text, char *input, }SLsmg_refresh (); -pthread_mutex_unlock (&ui__lock); +mutex_unlock (&ui__lock);/* XXX more graceful overflow handling needed */ if (len ==sizeof (buf) -1 ) {
@@ -211,19 +211,19 @@ void __ui__info_window(const char *title, const char *text, const char *exit_msgvoid ui__info_window (const char *title,const char *text) { -pthread_mutex_lock (&ui__lock); +mutex_lock (&ui__lock);__ui__info_window (title, text,NULL );SLsmg_refresh (); -pthread_mutex_unlock (&ui__lock); +mutex_unlock (&ui__lock); }int ui__question_window (const char *title,const char *text,const char *exit_msg,int delay_secs) { -pthread_mutex_lock (&ui__lock); +mutex_lock (&ui__lock);__ui__info_window (title, text, exit_msg);SLsmg_refresh (); -pthread_mutex_unlock (&ui__lock); +mutex_unlock (&ui__lock);return ui__getch (delay_secs); }
tools/perf/ui/ui.h +2 -2
@@ -2,11 +2,11 @@#ifndef _PERF_UI_H_#define _PERF_UI_H_ 1 -#include <pthread.h> +#include "../util/mutex.h" #include <stdbool.h> #include <linux/compiler.h> -extern pthread_mutex_t ui__lock; +extern struct mutex ui__lock;extern void *perf_gtk_handle;extern int use_browser;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 117/202 perf ui browser: Dont save pointer to stack memory
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit 769e6a1e15bdbbaf2b0d2f37c24f2c53268bd21f ]
ui_browser__show() is capturing the input title that is stack allocated memory in hist_browser__run().
Avoid a use after return by strdup-ing the string.
Committer notes:
Further explanation from Ian Rogers:
My command line using tui is:
$ sudo bash -c 'rm /tmp/asan.log*; export
ASAN_OPTIONS="log_path=/tmp/asan.log"; /tmp/perf/perf mem record -a
sleep 1; /tmp/perf/perf mem report'
I then go to the perf annotate view and quit. This triggers the asan
error (from the log file):
```
==1254591==ERROR: AddressSanitizer: stack-use-after-return on address
0x7f2813331920 at pc 0x7f28180
65991 bp 0x7fff0a21c750 sp 0x7fff0a21bf10
READ of size 80 at 0x7f2813331920 thread T0
#0 0x7f2818065990 in __interceptor_strlen
../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:461
#1 0x7f2817698251 in SLsmg_write_wrapped_string
(/lib/x86_64-linux-gnu/libslang.so.2+0x98251)
#2 0x7f28176984b9 in SLsmg_write_nstring
(/lib/x86_64-linux-gnu/libslang.so.2+0x984b9)
#3 0x55c94045b365 in ui_browser__write_nstring ui/browser.c:60
#4 0x55c94045c558 in __ui_browser__show_title ui/browser.c:266
#5 0x55c94045c776 in ui_browser__show ui/browser.c:288
#6 0x55c94045c06d in ui_browser__handle_resize ui/browser.c:206
#7 0x55c94047979b in do_annotate ui/browsers/hists.c:2458
#8 0x55c94047fb17 in evsel__hists_browse ui/browsers/hists.c:3412
#9 0x55c940480a0c in perf_evsel_menu__run ui/browsers/hists.c:3527
#10 0x55c940481108 in __evlist__tui_browse_hists ui/browsers/hists.c:3613
#11 0x55c9404813f7 in evlist__tui_browse_hists ui/browsers/hists.c:3661
#12 0x55c93ffa253f in report__browse_hists tools/perf/builtin-report.c:671
#13 0x55c93ffa58ca in __cmd_report tools/perf/builtin-report.c:1141
#14 0x55c93ffaf159 in cmd_report tools/perf/builtin-report.c:1805
#15 0x55c94000c05c in report_events tools/perf/builtin-mem.c:374
#16 0x55c94000d96d in cmd_mem tools/perf/builtin-mem.c:516
#17 0x55c9400e44ee in run_builtin tools/perf/perf.c:350
#18 0x55c9400e4a5a in handle_internal_command tools/perf/perf.c:403
#19 0x55c9400e4e22 in run_argv tools/perf/perf.c:447
#20 0x55c9400e53ad in main tools/perf/perf.c:561
#21 0x7f28170456c9 in __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
#22 0x7f2817045784 in __libc_start_main_impl ../csu/libc-start.c:360
#23 0x55c93ff544c0 in _start (/tmp/perf/perf+0x19a4c0) (BuildId:
84899b0e8c7d3a3eaa67b2eb35e3d8b2f8cd4c93)Address 0x7f2813331920 is located in stack of thread T0 at offset 32 in frame
#0 0x55c94046e85e in hist_browser__run ui/browsers/hists.c:746
This frame has 1 object(s):
[32, 192) 'title' (line 747) <== Memory access at offset 32 is
inside this variable
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
```hist_browser__run isn't on the stack so the asan error looks legit. There's no clean init/exit on struct ui_browser so I may be trading a use-after-return for a memory leak, but that seems look a good trade anyway.
--- tools/perf/ui/browser.c | 4 +++- tools/perf/ui/browser.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-)
tools/perf/ui/browser.c +3 -1
@@ -287,7 +287,8 @@ int ui_browser__show(struct ui_browser *browser, const char *title,mutex_lock (&ui__lock);__ui_browser__show_title (browser, title); - browser->title = title; +free (browser->title); + browser->title =strdup (title);zfree (&browser->helpline);va_start (ap, helpline);
@@ -304,6 +305,7 @@ void ui_browser__hide(struct ui_browser *browser)mutex_lock (&ui__lock);ui_helpline__pop ();zfree (&browser->helpline); +zfree (&browser->title);mutex_unlock (&ui__lock); }
tools/perf/ui/browser.h +1 -1
@@ -21,7 +21,7 @@ struct ui_browser {u8 extra_title_lines;int current_color;void *priv; -const char *title; +char *title;char *helpline;const char *no_samples_msg;void (*refresh_dimensions)(struct ui_browser *browser);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 89/202 netrom: fix possible dead-lock in nr_rt_ioctl()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit e03e7f20ebf7e1611d40d1fdc1bde900fd3335f6 ]
syzbot loves netrom, and found a possible deadlock in nr_rt_ioctl [1]
Make sure we always acquire nr_node_list_lock before nr_node_lock(nr_node)
[1]
WARNING: possible circular locking dependency detected 6.9.0-rc7-syzkaller-02147-g654de42f3fc6 #0 Not tainted
------------------------------------------------------
syz-executor350/5129 is trying to acquire lock:
ffff8880186e2070 (&nr_node->node_lock){+...}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:356 [inline] ffff8880186e2070 (&nr_node->node_lock){+...}-{2:2}, at: nr_node_lock include/net/netrom.h:152 [inline] ffff8880186e2070 (&nr_node->node_lock){+...}-{2:2}, at: nr_dec_obs net/netrom/nr_route.c:464 [inline] ffff8880186e2070 (&nr_node->node_lock){+...}-{2:2}, at: nr_rt_ioctl+0x1bb/0x1090 net/netrom/nr_route.c:697
but task is already holding lock:
ffffffff8f7053b8 (nr_node_list_lock){+...}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:356 [inline] ffffffff8f7053b8 (nr_node_list_lock){+...}-{2:2}, at: nr_dec_obs net/netrom/nr_route.c:462 [inline] ffffffff8f7053b8 (nr_node_list_lock){+...}-{2:2}, at: nr_rt_ioctl+0x10a/0x1090 net/netrom/nr_route.c:697
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (nr_node_list_lock){+...}-{2:2}:
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
__raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline]
_raw_spin_lock_bh+0x35/0x50 kernel/locking/spinlock.c:178
spin_lock_bh include/linux/spinlock.h:356 [inline]
nr_remove_node net/netrom/nr_route.c:299 [inline]
nr_del_node+0x4b4/0x820 net/netrom/nr_route.c:355
nr_rt_ioctl+0xa95/0x1090 net/netrom/nr_route.c:683
sock_do_ioctl+0x158/0x460 net/socket.c:1222
sock_ioctl+0x629/0x8e0 net/socket.c:1341
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:904 [inline]
__se_sys_ioctl+0xfc/0x170 fs/ioctl.c:890
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f-> #0 (&nr_node->node_lock){+...}-{2:2}:
check_prev_add kernel/locking/lockdep.c:3134 [inline]
check_prevs_add kernel/locking/lockdep.c:3253 [inline]
validate_chain+0x18cb/0x58e0 kernel/locking/lockdep.c:3869
__lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
__raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline]
_raw_spin_lock_bh+0x35/0x50 kernel/locking/spinlock.c:178
spin_lock_bh include/linux/spinlock.h:356 [inline]
nr_node_lock include/net/netrom.h:152 [inline]
nr_dec_obs net/netrom/nr_route.c:464 [inline]
nr_rt_ioctl+0x1bb/0x1090 net/netrom/nr_route.c:697
sock_do_ioctl+0x158/0x460 net/socket.c:1222
sock_ioctl+0x629/0x8e0 net/socket.c:1341
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:904 [inline]
__se_sys_ioctl+0xfc/0x170 fs/ioctl.c:890
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7fother info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(nr_node_list_lock);
lock(&nr_node->node_lock);
lock(nr_node_list_lock); lock(&nr_node->node_lock);
*** DEADLOCK ***
1 lock held by syz-executor350/5129:
#0: ffffffff8f7053b8 (nr_node_list_lock){+...}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:356 [inline] #0: ffffffff8f7053b8 (nr_node_list_lock){+...}-{2:2}, at: nr_dec_obs net/netrom/nr_route.c:462 [inline] #0: ffffffff8f7053b8 (nr_node_list_lock){+...}-{2:2}, at: nr_rt_ioctl+0x10a/0x1090 net/netrom/nr_route.c:697
stack backtrace: CPU: 0 PID: 5129 Comm: syz-executor350 Not tainted 6.9.0-rc7-syzkaller-02147-g654de42f3fc6 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2187 check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain+0x18cb/0x58e0 kernel/locking/lockdep.c:3869 __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline] _raw_spin_lock_bh+0x35/0x50 kernel/locking/spinlock.c:178 spin_lock_bh include/linux/spinlock.h:356 [inline] nr_node_lock include/net/netrom.h:152 [inline] nr_dec_obs net/netrom/nr_route.c:464 [inline] nr_rt_ioctl+0x1bb/0x1090 net/netrom/nr_route.c:697 sock_do_ioctl+0x158/0x460 net/socket.c:1222 sock_ioctl+0x629/0x8e0 net/socket.c:1341 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:904 [inline] __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:890 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- net/netrom/nr_route.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)
net/netrom/nr_route.c +7 -12
@@ -284,22 +284,14 @@ static int __must_check nr_add_node(ax25_address *nr, const char *mnemonic,return 0 ; } -static inline void __nr_remove_node (struct nr_node *nr_node) +static void nr_remove_node_locked (struct nr_node *nr_node) { +lockdep_assert_held (&nr_node_list_lock); +hlist_del_init (&nr_node->node_node);nr_node_put (nr_node); } -#define nr_remove_node_locked (__node) \ - __nr_remove_node(__node) - -static void nr_remove_node (struct nr_node *nr_node) -{ -spin_lock_bh (&nr_node_list_lock); -__nr_remove_node (nr_node); -spin_unlock_bh (&nr_node_list_lock); -} -static inline void __nr_remove_neigh (struct nr_neigh *nr_neigh) {hlist_del_init (&nr_neigh->neigh_node);
@@ -338,6 +330,7 @@ static int nr_del_node(ax25_address *callsign, ax25_address *neighbour, struct nreturn -EINVAL ; } +spin_lock_bh (&nr_node_list_lock);nr_node_lock (nr_node);for (i =0 ; i < nr_node->count; i++) {if (nr_node->routes[i].neighbour == nr_neigh) {
@@ -351,7 +344,7 @@ static int nr_del_node(ax25_address *callsign, ax25_address *neighbour, struct n nr_node->count--;if (nr_node->count ==0 ) { -nr_remove_node (nr_node); +nr_remove_node_locked (nr_node); }else {switch (i) {case 0 :
@@ -365,12 +358,14 @@ static int nr_del_node(ax25_address *callsign, ax25_address *neighbour, struct nnr_node_put (nr_node); }nr_node_unlock (nr_node); +spin_unlock_bh (&nr_node_list_lock);return 0 ; } }nr_neigh_put (nr_neigh);nr_node_unlock (nr_node); +spin_unlock_bh (&nr_node_list_lock);nr_node_put (nr_node);return -EINVAL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 90/202 af_packet: do not call packet_read_pending() from tpacket_destruct_skb()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 581073f626e387d3e7eed55c48c8495584ead7ba ]
trafgen performance considerably sank on hosts with many cores after the blamed commit.
packet_read_pending() is very expensive, and calling it in af_packet fast path defeats Daniel intent in commit b013840810c2 ("packet: use percpu mmap tx frame pending refcount")
tpacket_destruct_skb() makes room for one packet, we can immediately wakeup a producer, no need to completely drain the tx ring.
--- net/packet/af_packet.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/packet/af_packet.c +1 -2
@@ -2461,8 +2461,7 @@ static void tpacket_destruct_skb(struct sk_buff *skb) ts =__packet_set_timestamp (po, ph, skb);__packet_set_status (po, ph,TP_STATUS_AVAILABLE | ts); -if (!packet_read_pending (&po->tx_ring)) -complete (&po->skb_completion); +complete (&po->skb_completion); }sock_wfree (skb);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 91/202 sched/topology: Dont set SD_BALANCE_WAKE on cpuset domain relax
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Valentin Schneider <[email protected]>
[ Upstream commit 9ae7ab20b4835dbea0e5fc6a5c70171dc354a72e ]
As pointed out in commit
182a85f8a119 ("sched: Disable wakeup balancing")
SD_BALANCE_WAKE is a tad too aggressive, and is usually left unset.
However, it turns out cpuset domain relaxation will unconditionally set it on domains below the relaxation level. This made sense back when SD_BALANCE_WAKE was set unconditionally, but it no longer is the case.
We can improve things slightly by noticing that set_domain_attribute() is always called after sd_init(), so rather than setting flags we can rely on whatever sd_init() is doing and only clear certain flags when above the relaxation level.
While at it, slightly clean up the function and flip the relax level check to be more human readable.
Stable-dep-of: a1fd0b9d751f ("sched/fair: Allow disabling sched_balance_newidle with sched_relax_domain_level")
--- kernel/sched/topology.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
kernel/sched/topology.c +3 -6
@@ -1201,16 +1201,13 @@ static void set_domain_attribute(struct sched_domain *sd,if (!attr || attr->relax_domain_level <0 ) {if (default_relax_domain_level <0 )return ; -else - request = default_relax_domain_level; + request = default_relax_domain_level; }else request = attr->relax_domain_level; -if (request < sd->level) { + +if (sd->level > request) {/* Turn off idle balance on this domain: */ sd->flags &= ~(SD_BALANCE_WAKE |SD_BALANCE_NEWIDLE ); - }else { -/* Turn on idle balance on this domain: */ - sd->flags |= (SD_BALANCE_WAKE |SD_BALANCE_NEWIDLE ); } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 92/202 sched/fair: Allow disabling sched_balance_newidle with sched_relax_domain_level
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitalii Bursov <[email protected]>
[ Upstream commit a1fd0b9d751f840df23ef0e75b691fc00cfd4743 ]
Change relax_domain_level checks so that it would be possible to include or exclude all domains from newidle balancing.
This matches the behavior described in the documentation:
-1 no request. use system default or follow request of others. 0 no search. 1 search siblings (hyperthreads in a core).
"2" enables levels 0 and 1, level_max excludes the last (level_max) level, and level_max+1 includes all levels.
--- kernel/cgroup/cpuset.c | 2 +- kernel/sched/topology.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
kernel/cgroup/cpuset.c +1 -1
@@ -1868,7 +1868,7 @@ bool current_cpuset_is_being_rebound(void)static int update_relax_domain_level (struct cpuset *cs,s64 val) {#ifdef CONFIG_SMP -if (val <-1 || val >= sched_domain_level_max) +if (val <-1 || val > sched_domain_level_max +1 )return -EINVAL ;#endif
kernel/sched/topology.c +1 -1
@@ -1205,7 +1205,7 @@ static void set_domain_attribute(struct sched_domain *sd, }else request = attr->relax_domain_level; -if (sd->level > request) { +if (sd->level >= request) {/* Turn off idle balance on this domain: */ sd->flags &= ~(SD_BALANCE_WAKE |SD_BALANCE_NEWIDLE ); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 93/202 perf probe: Add missing libgen.h header needed for using basename()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 581037151910126a7934e369e4b6ac70eda9a703 ]
This prototype is obtained indirectly, by luck, from some other header in probe-event.c in most systems, but recently exploded on alpine:edge:
8 13.39 alpine:edge : FAIL gcc version 13.2.1 20240309 (Alpine 13.2.1_git20240309)
util/probe-event.c: In function 'convert_exec_to_group':
util/probe-event.c:225:16: error: implicit declaration of function 'basename' [-Werror=implicit-function-declaration]
225 | ptr1 = basename(exec_copy);
| ^~~~~~~~
util/probe-event.c:225:14: error: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Werror=int-conversion]
225 | ptr1 = basename(exec_copy);
| ^
cc1: all warnings being treated as errors
make[3]: *** [/git/perf-6.8.0/tools/build/Makefile.build:158: util] Error 2
Fix it by adding the libgen.h header where basename() is prototyped.
--- tools/perf/util/probe-event.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/probe-event.c +1 -0
@@ -11,6 +11,7 @@#include <sys/stat.h> #include <fcntl.h> #include <errno.h> +#include <libgen.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h>
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 94/202 greybus: lights: check return of get_channel_from_mode
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rui Miguel Silva <[email protected]>
[ Upstream commit a1ba19a1ae7cd1e324685ded4ab563e78fe68648 ]
If channel for the given node is not found we return null from get_channel_from_mode. Make sure we validate the return pointer before using it in two of the missing places.
This was originally reported in [0]:
Found by Linux Verification Center (linuxtesting.org) with SVACE.
[0] https://lore.kernel.org/all/[email protected]
--- drivers/staging/greybus/light.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/staging/greybus/light.c +7 -1
@@ -147,6 +147,9 @@ static int __gb_lights_flash_brightness_set(struct gb_channel *channel) channel =get_channel_from_mode (channel->light,GB_CHANNEL_MODE_TORCH ); +if (!channel) +return -EINVAL ; +/* For not flash we need to convert brightness to intensity */ intensity = channel->intensity_uA.min + (channel->intensity_uA.step * channel->led->brightness);
@@ -550,7 +553,10 @@ static int gb_lights_light_v4l2_register(struct gb_light *light) } channel_flash =get_channel_from_mode (light,GB_CHANNEL_MODE_FLASH ); -WARN_ON (!channel_flash); +if (!channel_flash) { +dev_err (dev,"failed to get flash channel from mode\n" ); +return -EINVAL ; + } fled = &channel_flash->fled;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 85/202 SUNRPC: Fix gss_free_in_token_pages()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit bafa6b4d95d97877baa61883ff90f7e374427fae ]
Dan Carpenter says:
Quoted 19 lines
Commit
5866efa8cbfb("SUNRPC: Fixsvcauth_gss_proxy_init()") from Oct 24, 2019 (linux-next), leads to the following Smatch static checker warning:net/sunrpc/auth_gss/svcauth_gss.c:1039 gss_free_in_token_pages() warn: iterator 'i' not incremented
net/sunrpc/auth_gss/svcauth_gss.c1034 static void gss_free_in_token_pages(struct gssp_in_token *in_token) 1035 { 1036 u32 inlen; 1037 int i; 1038 --> 1039 i = 0; 1040 inlen = in_token->page_len; 1041 while (inlen) { 1042 if (in_token->pages[i]) 1043 put_page(in_token->pages[i]); ^
Quoted 8 lines
This puts page zero over and over.
1044 inlen -= inlen > PAGE_SIZE ? PAGE_SIZE : inlen; 1045 } 1046 1047 kfree(in_token->pages); 1048 in_token->pages = NULL; 1049 }
Based on the way that the ->pages[] array is constructed in gss_read_proxy_verf(), we know that once the loop encounters a NULL page pointer, the remaining array elements must also be NULL.
--- net/sunrpc/auth_gss/svcauth_gss.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
net/sunrpc/auth_gss/svcauth_gss.c +2 -8
@@ -1074,17 +1074,11 @@ gss_read_verf(struct rpc_gss_wire_cred *gc,static void gss_free_in_token_pages (struct gssp_in_token *in_token) { -u32 inlen;int i; i =0 ; - inlen = in_token->page_len; -while (inlen) { -if (in_token->pages[i]) -put_page (in_token->pages[i]); - inlen -= inlen >PAGE_SIZE ?PAGE_SIZE : inlen; - } - +while (in_token->pages[i]) +put_page (in_token->pages[i++]);kfree (in_token->pages); in_token->pages =NULL ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 119/202 perf ui browser: Avoid SEGV on title
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit 90f01afb0dfafbc9b094bb61e61a4ac297d9d0d2 ]
If the title is NULL then it can lead to a SEGV.
--- tools/perf/ui/browser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/ui/browser.c +1 -1
@@ -203,7 +203,7 @@ void ui_browser__refresh_dimensions(struct ui_browser *browser)void ui_browser__handle_resize (struct ui_browser *browser) {ui__refresh_dimensions (false); -ui_browser__show (browser, browser->title, ui_helpline__current); +ui_browser__show (browser, browser->title ?:"" , ui_helpline__current);ui_browser__refresh (browser); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 128/202 um: Add winch to winch_handlers before registering winch IRQ
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roberto Sassu <[email protected]>
[ Upstream commit a0fbbd36c156b9f7b2276871d499c9943dfe5101 ]
Registering a winch IRQ is racy, an interrupt may occur before the winch is added to the winch_handlers list.
If that happens, register_winch_irq() adds to that list a winch that is scheduled to be (or has already been) freed, causing a panic later in winch_cleanup().
Avoid the race by adding the winch to the winch_handlers list before registering the IRQ, and rolling back if um_request_irq() fails.
--- arch/um/drivers/line.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
arch/um/drivers/line.c +8 -6
@@ -673,24 +673,26 @@ void register_winch_irq(int fd, int tty_fd, int pid, struct tty_port *port, goto cleanup; } - *winch = ((struct winch ) { .list =LIST_HEAD_INIT (winch->list), - .fd = fd, + *winch = ((struct winch ) { .fd = fd, .tty_fd = tty_fd, .pid = pid, .port = port, .stack = stack }); +spin_lock (&winch_handler_lock); +list_add (&winch->list, &winch_handlers); +spin_unlock (&winch_handler_lock); +if (um_request_irq (WINCH_IRQ , fd,IRQ_READ , winch_interrupt,IRQF_SHARED ,"winch" , winch) <0 ) {printk (KERN_ERR "register_winch_irq - failed to register " "IRQ\n" ); +spin_lock (&winch_handler_lock); +list_del (&winch->list); +spin_unlock (&winch_handler_lock); goto out_free; } -spin_lock (&winch_handler_lock); -list_add (&winch->list, &winch_handlers); -spin_unlock (&winch_handler_lock); -return ; out_free:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 129/202 media: stk1160: fix bounds checking in stk1160_copy_video()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit faa4364bef2ec0060de381ff028d1d836600a381 ]
The subtract in this condition is reversed. The ->length is the length of the buffer. The ->bytesused is how many bytes we have copied thus far. When the condition is reversed that means the result of the subtraction is always negative but since it's unsigned then the result is a very high positive value. That means the overflow check is never true.
Additionally, the ->bytesused doesn't actually work for this purpose because we're not writing to "buf->mem + buf->bytesused". Instead, the math to calculate the destination where we are writing is a bit involved. You calculate the number of full lines already written, multiply by two, skip a line if necessary so that we start on an odd numbered line, and add the offset into the line.
To fix this buffer overflow, just take the actual destination where we are writing, if the offset is already out of bounds print an error and return. Otherwise, write up to buf->length bytes.
--- drivers/media/usb/stk1160/stk1160-video.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/media/usb/stk1160/stk1160-video.c +15 -5
@@ -99,7 +99,7 @@ void stk1160_buffer_done(struct stk1160 *dev)static inline void stk1160_copy_video (struct stk1160 *dev,u8 *src,int len) { -int linesdone, lineoff, lencopy; +int linesdone, lineoff, lencopy, offset;int bytesperline = dev->width *2 ;struct stk1160_buffer *buf = dev->isoc_ctl.buf;u8 *dst = buf->mem;
@@ -139,8 +139,13 @@ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len)* Check if we have enough space left in the buffer. * In that case, we force loop exit after copy. */ -if (lencopy > buf->bytesused - buf->length) { - lencopy = buf->bytesused - buf->length; + offset = dst - (u8 *)buf->mem; +if (offset > buf->length) { +dev_warn_ratelimited (dev->dev,"out of bounds offset\n" ); +return ; + } +if (lencopy > buf->length - offset) { + lencopy = buf->length - offset; remain = lencopy; }
@@ -182,8 +187,13 @@ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len)* Check if we have enough space left in the buffer. * In that case, we force loop exit after copy. */ -if (lencopy > buf->bytesused - buf->length) { - lencopy = buf->bytesused - buf->length; + offset = dst - (u8 *)buf->mem; +if (offset > buf->length) { +dev_warn_ratelimited (dev->dev,"offset out of bounds\n" ); +return ; + } +if (lencopy > buf->length - offset) { + lencopy = buf->length - offset; remain = lencopy; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 130/202 scsi: qla2xxx: Replace all non-returning strlcpy() with strscpy()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Azeem Shaikh <[email protected]>
[ Upstream commit 37f1663c91934f664fb850306708094a324c227c ]
strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated [1]. In an effort to remove strlcpy() completely [2], replace strlcpy() here with strscpy(). No return values were used, so direct replacement is safe.
[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
[2] https://github.com/KSPP/linux/issues/89
Stable-dep-of: c3408c4ae041 ("scsi: qla2xxx: Avoid possible run-time warning with long model_num")
--- drivers/scsi/qla2xxx/qla_init.c | 8 ++++---- drivers/scsi/qla2xxx/qla_mr.c | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +4 -4
@@ -4479,7 +4479,7 @@ qla2x00_set_model_info(scsi_qla_host_t *vha, uint8_t *model, size_t len,if (use_tbl && ha->pdev->subsystem_vendor ==PCI_VENDOR_ID_QLOGIC && index <QLA_MODEL_NAMES ) -strlcpy (ha->model_desc, +strscpy (ha->model_desc, qla2x00_model_name[index *2 +1 ],sizeof (ha->model_desc)); }else {
@@ -4487,14 +4487,14 @@ qla2x00_set_model_info(scsi_qla_host_t *vha, uint8_t *model, size_t len,if (use_tbl && ha->pdev->subsystem_vendor ==PCI_VENDOR_ID_QLOGIC && index <QLA_MODEL_NAMES ) { -strlcpy (ha->model_number, +strscpy (ha->model_number, qla2x00_model_name[index *2 ],sizeof (ha->model_number)); -strlcpy (ha->model_desc, +strscpy (ha->model_desc, qla2x00_model_name[index *2 +1 ],sizeof (ha->model_desc)); }else { -strlcpy (ha->model_number, def, +strscpy (ha->model_number, def,sizeof (ha->model_number)); } }
drivers/scsi/qla2xxx/qla_mr.c +10 -10
@@ -693,7 +693,7 @@ qlafx00_pci_info_str(struct scsi_qla_host *vha, char *str, size_t str_len)struct qla_hw_data *ha = vha->hw;if (pci_is_pcie (ha->pdev)) -strlcpy (str,"PCIe iSA" , str_len); +strscpy (str,"PCIe iSA" , str_len);return str; }
@@ -1854,21 +1854,21 @@ qlafx00_fx_disc(scsi_qla_host_t *vha, fc_port_t *fcport, uint16_t fx_type) phost_info = &preg_hsi->hsi;memset (preg_hsi,0 ,sizeof (struct register_host_info )); phost_info->os_type =OS_TYPE_LINUX ; -strlcpy (phost_info->sysname, p_sysid->sysname, +strscpy (phost_info->sysname, p_sysid->sysname,sizeof (phost_info->sysname)); -strlcpy (phost_info->nodename, p_sysid->nodename, +strscpy (phost_info->nodename, p_sysid->nodename,sizeof (phost_info->nodename));if (!strcmp (phost_info->nodename,"(none)" )) ha->mr.host_info_resend = true; -strlcpy (phost_info->release, p_sysid->release, +strscpy (phost_info->release, p_sysid->release,sizeof (phost_info->release)); -strlcpy (phost_info->version, p_sysid->version, +strscpy (phost_info->version, p_sysid->version,sizeof (phost_info->version)); -strlcpy (phost_info->machine, p_sysid->machine, +strscpy (phost_info->machine, p_sysid->machine,sizeof (phost_info->machine)); -strlcpy (phost_info->domainname, p_sysid->domainname, +strscpy (phost_info->domainname, p_sysid->domainname,sizeof (phost_info->domainname)); -strlcpy (phost_info->hostdriver,QLA2XXX_VERSION , +strscpy (phost_info->hostdriver,QLA2XXX_VERSION ,sizeof (phost_info->hostdriver)); preg_hsi->utc = (uint64_t )ktime_get_real_seconds (); ql_dbg(ql_dbg_init, vha, 0x0149,
@@ -1914,9 +1914,9 @@ qlafx00_fx_disc(scsi_qla_host_t *vha, fc_port_t *fcport, uint16_t fx_type)if (fx_type ==FXDISC_GET_CONFIG_INFO ) {struct config_info_data *pinfo = (struct config_info_data *) fdisc->u.fxiocb.rsp_addr; -strlcpy (vha->hw->model_number, pinfo->model_num, +strscpy (vha->hw->model_number, pinfo->model_num,ARRAY_SIZE (vha->hw->model_number)); -strlcpy (vha->hw->model_desc, pinfo->model_description, +strscpy (vha->hw->model_desc, pinfo->model_description,ARRAY_SIZE (vha->hw->model_desc));memcpy (&vha->hw->mr.symbolic_name, pinfo->symbolic_name,sizeof (vha->hw->mr.symbolic_name));
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 131/202 powerpc/pseries: Add failure related checks for h_get_mpp and h_get_ppp
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shrikanth Hegde <[email protected]>
[ Upstream commit 6d4341638516bf97b9a34947e0bd95035a8230a5 ]
Couple of Minor fixes:
- hcall return values are long. Fix that for h_get_mpp, h_get_ppp and parse_ppp_data
- If hcall fails, values set should be at-least zero. It shouldn't be uninitialized values. Fix that for h_get_mpp and h_get_ppp
--- arch/powerpc/include/asm/hvcall.h | 2 +- arch/powerpc/platforms/pseries/lpar.c | 6 +++--- arch/powerpc/platforms/pseries/lparcfg.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-)
arch/powerpc/include/asm/hvcall.h +1 -1
@@ -444,7 +444,7 @@ struct hvcall_mpp_data {unsigned long backing_mem; }; -int h_get_mpp (struct hvcall_mpp_data *); +long h_get_mpp (struct hvcall_mpp_data *mpp_data);struct hvcall_mpp_x_data {unsigned long coalesced_bytes;
arch/powerpc/platforms/pseries/lpar.c +3 -3
@@ -1871,10 +1871,10 @@ void __trace_hcall_exit(long opcode, long retval, unsigned long *retbuf)* h_get_mpp * H_GET_MPP hcall returns info in 7 parms */ -int h_get_mpp (struct hvcall_mpp_data *mpp_data) +long h_get_mpp (struct hvcall_mpp_data *mpp_data) { -int rc; -unsigned long retbuf[PLPAR_HCALL9_BUFSIZE ]; +unsigned long retbuf[PLPAR_HCALL9_BUFSIZE ] = {0 }; +long rc; rc =plpar_hcall9 (H_GET_MPP , retbuf);
arch/powerpc/platforms/pseries/lparcfg.c +3 -3
@@ -112,8 +112,8 @@ struct hvcall_ppp_data {*/ static unsigned int h_get_ppp (struct hvcall_ppp_data *ppp_data) { -unsigned long rc; -unsigned long retbuf[PLPAR_HCALL9_BUFSIZE ]; +unsigned long retbuf[PLPAR_HCALL9_BUFSIZE ] = {0 }; +long rc; rc =plpar_hcall9 (H_GET_PPP , retbuf);
@@ -159,7 +159,7 @@ static void parse_ppp_data(struct seq_file *m)struct hvcall_ppp_data ppp_data;struct device_node *root;const __be32 *perf_level; -int rc; +long rc; rc =h_get_ppp (&ppp_data);if (rc)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 132/202 um: Fix the -Wmissing-prototypes warning for __switch_mm
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiwei Bie <[email protected]>
[ Upstream commit 2cbade17b18c0f0fd9963f26c9fc9b057eb1cb3a ]
The __switch_mm function is defined in the user code, and is called by the kernel code. It should be declared in a shared header.
--- arch/um/include/asm/mmu.h | 2 -- arch/um/include/shared/skas/mm_id.h | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-)
arch/um/include/asm/mmu.h +0 -2
@@ -15,8 +15,6 @@ typedef struct mm_context {struct page *stub_pages[2 ]; } mm_context_t; -extern void __switch_mm (struct mm_id * mm_idp); -/* Avoid tangled inclusion with asm/ldt.h */ extern long init_new_ldt (struct mm_context *to_mm,struct mm_context *from_mm);extern void free_ldt (struct mm_context *mm);
arch/um/include/shared/skas/mm_id.h +2 -0
@@ -14,4 +14,6 @@ struct mm_id { unsigned long stack; }; +void __switch_mm (struct mm_id *mm_idp); +#endif
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 133/202 media: cec: cec-adap: always cancel work in cec_transmit_msg_fh
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
[ Upstream commit 9fe2816816a3c765dff3b88af5b5c3d9bbb911ce ]
Do not check for !data->completed, just always call cancel_delayed_work_sync(). This fixes a small race condition.
--- drivers/media/cec/cec-adap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/cec/cec-adap.c +1 -2
@@ -908,8 +908,7 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg,*/ mutex_unlock (&adap->lock);wait_for_completion_killable (&data->c); -if (!data->completed) -cancel_delayed_work_sync (&data->work); +cancel_delayed_work_sync (&data->work);mutex_lock (&adap->lock);/* Cancel the transmit if it was interrupted */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 134/202 media: cec: cec-api: add locking in cec_release()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
[ Upstream commit 42bcaacae924bf18ae387c3f78c202df0b739292 ]
When cec_release() uses fh->msgs it has to take fh->lock, otherwise the list can get corrupted.
--- drivers/media/cec/cec-api.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/cec/cec-api.c +3 -0
@@ -652,6 +652,8 @@ static int cec_release(struct inode *inode, struct file *filp)list_del (&data->xfer_list); }mutex_unlock (&adap->lock); + +mutex_lock (&fh->lock);while (!list_empty (&fh->msgs)) {struct cec_msg_entry *entry = list_first_entry(&fh->msgs, struct cec_msg_entry, list);
@@ -669,6 +671,7 @@ static int cec_release(struct inode *inode, struct file *filp)kfree (entry); } } +mutex_unlock (&fh->lock);kfree (fh);cec_put_device (devnode);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 135/202 null_blk: Fix the WARNING: modpost: missing MODULE_DESCRIPTION()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Yanjun <[email protected]>
[ Upstream commit 9e6727f824edcdb8fdd3e6e8a0862eb49546e1cd ]
No functional changes intended.
--- drivers/block/null_blk_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/block/null_blk_main.c +1 -0
@@ -1876,4 +1876,5 @@ module_init(null_init);module_exit (null_exit);MODULE_AUTHOR ("Jens Axboe <[email protected]>" ); +MODULE_DESCRIPTION ("multi queue aware block test driver" );MODULE_LICENSE ("GPL" );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 136/202 x86/kconfig: Select ARCH_WANT_FRAME_POINTERS again when UNWINDER_FRAME_POINTER=y
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit 66ee3636eddcc82ab82b539d08b85fb5ac1dff9b ]
It took me some time to understand the purpose of the tricky code at the end of arch/x86/Kconfig.debug.
Without it, the following would be shown:
WARNING: unmet direct dependencies detected for FRAME_POINTER
because
81d387190039 ("x86/kconfig: Consolidate unwinders into multiple choice selection")
removed 'select ARCH_WANT_FRAME_POINTERS'.
The correct and more straightforward approach should have been to move it where 'select FRAME_POINTER' is located.
Several architectures properly handle the conditional selection of ARCH_WANT_FRAME_POINTERS. For example, 'config UNWINDER_FRAME_POINTER' in arch/arm/Kconfig.debug.
--- arch/x86/Kconfig.debug | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/x86/Kconfig.debug +1 -4
@@ -307,6 +307,7 @@ config UNWINDER_ORC config UNWINDER_FRAME_POINTER bool "Frame pointer unwinder" + select ARCH_WANT_FRAME_POINTERS select FRAME_POINTER ---help--- This option enables the frame pointer unwinder for unwinding kernel
@@ -334,7 +335,3 @@ config UNWINDER_GUESS overhead. endchoice - -config FRAME_POINTER - depends on !UNWINDER_ORC && !UNWINDER_GUESS - bool
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 137/202 nfc: nci: Fix uninit-value in nci_rx_work
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryosuke Yasuoka <[email protected]>
[ Upstream commit e4a87abf588536d1cdfb128595e6e680af5cf3ed ]
syzbot reported the following uninit-value access issue [1]
nci_rx_work() parses received packet from ndev->rx_q. It should be validated header size, payload size and total packet size before processing the packet. If an invalid packet is detected, it should be silently discarded.
--- net/nfc/nci/core.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
net/nfc/nci/core.c +14 -1
@@ -1449,6 +1449,19 @@ int nci_core_ntf_packet(struct nci_dev *ndev, __u16 opcode, ndev->ops->n_core_ops); } +static bool nci_valid_size (struct sk_buff *skb) +{ +BUILD_BUG_ON (NCI_CTRL_HDR_SIZE !=NCI_DATA_HDR_SIZE ); +unsigned int hdr_size =NCI_CTRL_HDR_SIZE ; + +if (skb->len < hdr_size || + !nci_plen (skb->data) || + skb->len < hdr_size +nci_plen (skb->data)) { +return false; + } +return true; +} +/* ---- NCI TX Data worker thread ---- */ static void nci_tx_work (struct work_struct *work)
@@ -1499,7 +1512,7 @@ static void nci_rx_work(struct work_struct *work)nfc_send_to_raw_sock (ndev->nfc_dev, skb,RAW_PAYLOAD_NCI ,NFC_DIRECTION_RX ); -if (!nci_plen (skb->data)) { +if (!nci_valid_size (skb)) {kfree_skb (skb);break ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 120/202 f2fs: fix to release node block count in error path of f2fs_new_node_page()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 0fa4e57c1db263effd72d2149d4e21da0055c316 ]
It missed to call dec_valid_node_count() to release node block count in error path, fix it.
--- fs/f2fs/node.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/node.c +1 -1
@@ -1244,6 +1244,7 @@ struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs) }if (unlikely (new_ni.blk_addr !=NULL_ADDR )) { err = -EFSCORRUPTED ; +dec_valid_node_count (sbi, dn->inode, !ofs);set_sbi_flag (sbi,SBI_NEED_FSCK ); goto fail; }
@@ -1269,7 +1270,6 @@ struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs)if (ofs ==0 )inc_valid_inode_count (sbi);return page; - fail:clear_node_page_dirty (page);f2fs_put_page (page,1 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 138/202 sunrpc: fix NFSACL RPC retry on soft mount
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Aloni <[email protected]>
[ Upstream commit 0dc9f430027b8bd9073fdafdfcdeb1a073ab5594 ]
It used to be quite awhile ago since 1b63a75180c6 ('SUNRPC: Refactor rpc_clone_client()'), in 2012, that cl_timeout was copied in so that all mount parameters propagate to NFSACL clients. However since that change, if mount options as follows are given:
soft,timeo=50,retrans=16,vers=3
The resultant NFSACL client receives:
cl_softrtry: 1
cl_timeout: to_initval=60000, to_maxval=60000, to_increment=0, to_retries=2, to_exponential=0These values lead to NFSACL operations not being retried under the condition of transient network outages with soft mount. Instead, getacl call fails after 60 seconds with EIO.
The simple fix is to pass the existing client's cl_timeout as the new client timeout.
--- net/sunrpc/clnt.c | 1 + 1 file changed, 1 insertion(+)
net/sunrpc/clnt.c +1 -0
@@ -964,6 +964,7 @@ struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *old, .authflavor = old->cl_auth->au_flavor, .cred = old->cl_cred, .stats = old->cl_stats, + .timeout = old->cl_timeout, };struct rpc_clnt *clnt;int err;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 139/202 ipv6: sr: fix memleak in seg6_hmac_init_algo
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
[ Upstream commit efb9f4f19f8e37fde43dfecebc80292d179f56c6 ]
seg6_hmac_init_algo returns without cleaning up the previous allocations if one fails, so it's going to leak all that memory and the crypto tfms.
Update seg6_hmac_exit to only free the memory when allocated, so we can reuse the code directly.
--- net/ipv6/seg6_hmac.c | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-)
net/ipv6/seg6_hmac.c +28 -14
@@ -356,6 +356,7 @@ static int seg6_hmac_init_algo(void)struct crypto_shash *tfm;struct shash_desc *shash;int i, alg_count, cpu; +int ret = -ENOMEM ; alg_count =ARRAY_SIZE (hmac_algos);
@@ -366,12 +367,14 @@ static int seg6_hmac_init_algo(void) algo = &hmac_algos[i]; algo->tfms = alloc_percpu(struct crypto_shash *);if (!algo->tfms) -return -ENOMEM ; + goto error_out;for_each_possible_cpu (cpu) { tfm =crypto_alloc_shash (algo->name,0 ,0 ); -if (IS_ERR (tfm)) -return PTR_ERR (tfm); +if (IS_ERR (tfm)) { + ret =PTR_ERR (tfm); + goto error_out; + } p_tfm =per_cpu_ptr (algo->tfms, cpu); *p_tfm = tfm; }
@@ -383,18 +386,22 @@ static int seg6_hmac_init_algo(void) algo->shashs = alloc_percpu(struct shash_desc *);if (!algo->shashs) -return -ENOMEM ; + goto error_out;for_each_possible_cpu (cpu) { shash =kzalloc_node (shsize,GFP_KERNEL ,cpu_to_node (cpu));if (!shash) -return -ENOMEM ; + goto error_out; *per_cpu_ptr (algo->shashs, cpu) = shash; } }return 0 ; + +error_out: +seg6_hmac_exit (); +return ret; }int __init seg6_hmac_init (void )
@@ -414,22 +421,29 @@ int __net_init seg6_hmac_net_init(struct net *net)void seg6_hmac_exit (void ) {struct seg6_hmac_algo *algo =NULL ; +struct crypto_shash *tfm; +struct shash_desc *shash;int i, alg_count, cpu; alg_count =ARRAY_SIZE (hmac_algos);for (i =0 ; i < alg_count; i++) { algo = &hmac_algos[i]; -for_each_possible_cpu (cpu) { -struct crypto_shash *tfm; -struct shash_desc *shash; - shash = *per_cpu_ptr (algo->shashs, cpu); -kfree (shash); - tfm = *per_cpu_ptr (algo->tfms, cpu); -crypto_free_shash (tfm); +if (algo->shashs) { +for_each_possible_cpu (cpu) { + shash = *per_cpu_ptr (algo->shashs, cpu); +kfree (shash); + } +free_percpu (algo->shashs); + } + +if (algo->tfms) { +for_each_possible_cpu (cpu) { + tfm = *per_cpu_ptr (algo->tfms, cpu); +crypto_free_shash (tfm); + } +free_percpu (algo->tfms); } -free_percpu (algo->tfms); -free_percpu (algo->shashs); } }EXPORT_SYMBOL (seg6_hmac_exit);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 140/202 params: lift param_set_uint_minmax to common code
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sagi Grimberg <[email protected]>
[ Upstream commit 2a14c9ae15a38148484a128b84bff7e9ffd90d68 ]
It is a useful helper hence move it to common code so others can enjoy it.
Stable-dep-of: 3ebc46ca8675 ("tcp: Fix shift-out-of-bounds in dctcp_update_alpha().")
--- include/linux/moduleparam.h | 2 ++ kernel/params.c | 18 ++++++++++++++++++ net/sunrpc/xprtsock.c | 18 ------------------ 3 files changed, 20 insertions(+), 18 deletions(-)
include/linux/moduleparam.h +2 -0
@@ -359,6 +359,8 @@ extern int param_get_int(char *buffer, const struct kernel_param *kp);extern const struct kernel_param_ops param_ops_uint;extern int param_set_uint (const char *val,const struct kernel_param *kp);extern int param_get_uint (char *buffer,const struct kernel_param *kp); +int param_set_uint_minmax (const char *val,const struct kernel_param *kp, +unsigned int min,unsigned int max);#define param_check_uint (name, p) __param_check(name, p, unsigned int)extern const struct kernel_param_ops param_ops_long;
kernel/params.c +18 -0
@@ -242,6 +242,24 @@ STANDARD_PARAM_DEF(long, long, "%li", kstrtol); STANDARD_PARAM_DEF(ulong, unsigned long, "%lu", kstrtoul); STANDARD_PARAM_DEF(ullong, unsigned long long, "%llu", kstrtoull); +int param_set_uint_minmax (const char *val,const struct kernel_param *kp, +unsigned int min,unsigned int max) +{ +unsigned int num; +int ret; + +if (!val) +return -EINVAL ; + ret =kstrtouint (val,0 , &num); +if (ret) +return ret; +if (num < min || num > max) +return -EINVAL ; + *((unsigned int *)kp->arg) = num; +return 0 ; +} +EXPORT_SYMBOL_GPL (param_set_uint_minmax); +int param_set_charp (const char *val,const struct kernel_param *kp) {if (strlen (val) >1024 ) {
net/sunrpc/xprtsock.c +0 -18
@@ -3302,24 +3302,6 @@ void cleanup_socket_xprt(void)xprt_unregister_transport (&xs_bc_tcp_transport); } -static int param_set_uint_minmax (const char *val, -const struct kernel_param *kp, -unsigned int min,unsigned int max) -{ -unsigned int num; -int ret; - -if (!val) -return -EINVAL ; - ret =kstrtouint (val,0 , &num); -if (ret) -return ret; -if (num < min || num > max) -return -EINVAL ; - *((unsigned int *)kp->arg) = num; -return 0 ; -} -static int param_set_portnr (const char *val,const struct kernel_param *kp) { return param_set_uint_minmax(val, kp,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 141/202 tcp: Fix shift-out-of-bounds in dctcp_update_alpha().
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 3ebc46ca8675de6378e3f8f40768e180bb8afa66 ]
In dctcp_update_alpha(), we use a module parameter dctcp_shift_g as follows:
alpha -= min_not_zero(alpha, alpha >> dctcp_shift_g); ... delivered_ce <<= (10 - dctcp_shift_g);
It seems syzkaller started fuzzing module parameters and triggered shift-out-of-bounds [0] by setting 100 to dctcp_shift_g:
memcpy((void*)0x20000080,
"/sys/module/tcp_dctcp/parameters/dctcp_shift_g\000", 47);
res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000080ul,
/*flags=*/2ul, /*mode=*/0ul);
memcpy((void*)0x20000000, "100\000", 4);
syscall(__NR_write, /*fd=*/r[0], /*val=*/0x20000000ul, /*len=*/4ul);Let's limit the max value of dctcp_shift_g by param_set_uint_minmax().
With this patch:
# echo 10 > /sys/module/tcp_dctcp/parameters/dctcp_shift_g # cat /sys/module/tcp_dctcp/parameters/dctcp_shift_g 10 # echo 11 > /sys/module/tcp_dctcp/parameters/dctcp_shift_g -bash: echo: write error: Invalid argument
[0]:
UBSAN: shift-out-of-bounds in net/ipv4/tcp_dctcp.c:143:12 shift exponent 100 is too large for 32-bit type 'u32' (aka 'unsigned int') CPU: 0 PID: 8083 Comm: syz-executor345 Not tainted 6.9.0-05151-g1b294a1f3561 #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x201/0x300 lib/dump_stack.c:114 ubsan_epilogue lib/ubsan.c:231 [inline] __ubsan_handle_shift_out_of_bounds+0x346/0x3a0 lib/ubsan.c:468 dctcp_update_alpha+0x540/0x570 net/ipv4/tcp_dctcp.c:143 tcp_in_ack_event net/ipv4/tcp_input.c:3802 [inline] tcp_ack+0x17b1/0x3bc0 net/ipv4/tcp_input.c:3948 tcp_rcv_state_process+0x57a/0x2290 net/ipv4/tcp_input.c:6711 tcp_v4_do_rcv+0x764/0xc40 net/ipv4/tcp_ipv4.c:1937 sk_backlog_rcv include/net/sock.h:1106 [inline] __release_sock+0x20f/0x350 net/core/sock.c:2983 release_sock+0x61/0x1f0 net/core/sock.c:3549 mptcp_subflow_shutdown+0x3d0/0x620 net/mptcp/protocol.c:2907 mptcp_check_send_data_fin+0x225/0x410 net/mptcp/protocol.c:2976 __mptcp_close+0x238/0xad0 net/mptcp/protocol.c:3072 mptcp_close+0x2a/0x1a0 net/mptcp/protocol.c:3127 inet_release+0x190/0x1f0 net/ipv4/af_inet.c:437 __sock_release net/socket.c:659 [inline] sock_close+0xc0/0x240 net/socket.c:1421 __fput+0x41b/0x890 fs/file_table.c:422 task_work_run+0x23b/0x300 kernel/task_work.c:180 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0x9c8/0x2540 kernel/exit.c:878 do_group_exit+0x201/0x2b0 kernel/exit.c:1027 __do_sys_exit_group kernel/exit.c:1038 [inline] __se_sys_exit_group kernel/exit.c:1036 [inline] __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1036 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xe4/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x67/0x6f RIP: 0033:0x7f6c2b5005b6 Code: Unable to access opcode bytes at 0x7f6c2b50058c. RSP: 002b:00007ffe883eb948 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 00007f6c2b5862f0 RCX: 00007f6c2b5005b6 RDX: 0000000000000001 RSI: 000000000000003c RDI: 0000000000000001 RBP: 0000000000000001 R08: 00000000000000e7 R09: ffffffffffffffc0 R10: 0000000000000006 R11: 0000000000000246 R12: 00007f6c2b5862f0 R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000001 </TASK>
--- net/ipv4/tcp_dctcp.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
net/ipv4/tcp_dctcp.c +12 -1
@@ -55,7 +55,18 @@ struct dctcp { };static unsigned int dctcp_shift_g__read_mostly =4 ;/* g = 1/2^4 */ -module_param (dctcp_shift_g, uint,0644 ); + +static int dctcp_shift_g_set (const char *val,const struct kernel_param *kp) +{ +return param_set_uint_minmax (val, kp,0 ,10 ); +} + +static const struct kernel_param_ops dctcp_shift_g_ops = { + .set = dctcp_shift_g_set, + .get = param_get_uint, +}; + +module_param_cb (dctcp_shift_g, &dctcp_shift_g_ops, &dctcp_shift_g,0644 );MODULE_PARM_DESC (dctcp_shift_g,"parameter g for updating dctcp_alpha" );static unsigned int dctcp_alpha_on_init__read_mostly =DCTCP_MAX_ALPHA ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 142/202 openvswitch: Set the skbuff pkt_type for proper pmtud support.
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Conole <[email protected]>
[ Upstream commit 30a92c9e3d6b073932762bef2ac66f4ee784c657 ]
Open vSwitch is originally intended to switch at layer 2, only dealing with Ethernet frames. With the introduction of l3 tunnels support, it crossed into the realm of needing to care a bit about some routing details when making forwarding decisions. If an oversized packet would need to be fragmented during this forwarding decision, there is a chance for pmtu to get involved and generate a routing exception. This is gated by the skbuff->pkt_type field.
When a flow is already loaded into the openvswitch module this field is set up and transitioned properly as a packet moves from one port to another. In the case that a packet execute is invoked after a flow is newly installed this field is not properly initialized. This causes the pmtud mechanism to omit sending the required exception messages across the tunnel boundary and a second attempt needs to be made to make sure that the routing exception is properly setup. To fix this, we set the outgoing packet's pkt_type to PACKET_OUTGOING, since it can only get to the openvswitch module via a port device or packet command.
Even for bridge ports as users, the pkt_type needs to be reset when doing the transmit as the packet is truly outgoing and routing needs to get involved post packet transformations, in the case of VXLAN/GENEVE/udp-tunnel packets. In general, the pkt_type on output gets ignored, since we go straight to the driver, but in the case of tunnel ports they go through IP routing layer.
This issue is periodically encountered in complex setups, such as large openshift deployments, where multiple sets of tunnel traversal occurs. A way to recreate this is with the ovn-heater project that can setup a networking environment which mimics such large deployments. We need larger environments for this because we need to ensure that flow misses occur. In these environment, without this patch, we can see:
./ovn_cluster.sh start
podman exec ovn-chassis-1 ip r a 170.168.0.5/32 dev eth1 mtu 1200 podman exec ovn-chassis-1 ip netns exec sw01p1 ip r flush cache podman exec ovn-chassis-1 ip netns exec sw01p1 \
ping 21.0.0.3 -M do -s 1300 -c2
PING 21.0.0.3 (21.0.0.3) 1300(1328) bytes of data. From 21.0.0.3 icmp_seq=2 Frag needed and DF set (mtu = 1142)
--- 21.0.0.3 ping statistics ---
...
Using tcpdump, we can also see the expected ICMP FRAG_NEEDED message is not sent into the server.
With this patch, setting the pkt_type, we see the following:
podman exec ovn-chassis-1 ip netns exec sw01p1 \
ping 21.0.0.3 -M do -s 1300 -c2
PING 21.0.0.3 (21.0.0.3) 1300(1328) bytes of data. From 21.0.0.3 icmp_seq=1 Frag needed and DF set (mtu = 1222)
ping: local error: message too long, mtu=1222
--- 21.0.0.3 ping statistics ---
...
In this case, the first ping request receives the FRAG_NEEDED message and a local routing exception is created.
Reported-at: https://issues.redhat.com/browse/FDP-164
--- net/openvswitch/actions.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/openvswitch/actions.c +6 -0
@@ -931,6 +931,12 @@ static void do_output(struct datapath *dp, struct sk_buff *skb, int out_port,pskb_trim (skb,ovs_mac_header_len (key)); } +/* Need to set the pkt_type to involve the routing layer. The +* packet movement through the OVS datapath doesn't generally +* use routing, but this is needed for tunnel cases. +*/ + skb->pkt_type =PACKET_OUTGOING ; +if (likely (!mru || (skb->len <= mru + vport->dev->hard_header_len))) {ovs_vport_send (vport, skb,ovs_key_mac_proto (key));
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 143/202 arm64: asm-bug: Add .align 2 to the end of __BUG_ENTRY
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiangfeng Xiao <[email protected]>
[ Upstream commit ffbf4fb9b5c12ff878a10ea17997147ea4ebea6f ]
When CONFIG_DEBUG_BUGVERBOSE=n, we fail to add necessary padding bytes to bug_table entries, and as a result the last entry in a bug table will be ignored, potentially leading to an unexpected panic(). All prior entries in the table will be handled correctly.
The arm64 ABI requires that struct fields of up to 8 bytes are naturally-aligned, with padding added within a struct such that struct are suitably aligned within arrays.
When CONFIG_DEBUG_BUGVERPOSE=y, the layout of a bug_entry is:
struct bug_entry {
signed int bug_addr_disp; // 4 bytes
signed int file_disp; // 4 bytes
unsigned short line; // 2 bytes
unsigned short flags; // 2 bytes
}
... with 12 bytes total, requiring 4-byte alignment.
When CONFIG_DEBUG_BUGVERBOSE=n, the layout of a bug_entry is:
struct bug_entry {
signed int bug_addr_disp; // 4 bytes
unsigned short flags; // 2 bytes
< implicit padding > // 2 bytes
}
... with 8 bytes total, with 6 bytes of data and 2 bytes of trailing padding, requiring 4-byte alginment.
When we create a bug_entry in assembly, we align the start of the entry to 4 bytes, which implicitly handles padding for any prior entries. However, we do not align the end of the entry, and so when CONFIG_DEBUG_BUGVERBOSE=n, the final entry lacks the trailing padding bytes.
For the main kernel image this is not a problem as find_bug() doesn't depend on the trailing padding bytes when searching for entries:
for (bug = __start___bug_table; bug < __stop___bug_table; ++bug) if (bugaddr == bug_addr(bug)) return bug;
However for modules, module_bug_finalize() depends on the trailing bytes when calculating the number of entries:
mod->num_bugs = sechdrs[i].sh_size / sizeof(struct bug_entry);
... and as the last bug_entry lacks the necessary padding bytes, this entry will not be counted, e.g. in the case of a single entry:
sechdrs[i].sh_size == 6 sizeof(struct bug_entry) == 8; sechdrs[i].sh_size / sizeof(struct bug_entry) == 0;
Consequently module_find_bug() will miss the last bug_entry when it does:
for (i = 0; i < mod->num_bugs; ++i, ++bug) if (bugaddr == bug_addr(bug)) goto out;
... which can lead to a kenrel panic due to an unhandled bug.
This can be demonstrated with the following module:
static int __init buginit(void)
{
WARN(1, "hello\n");
return 0;
}
static void __exit bugexit(void)
{
}
module_init(buginit);
module_exit(bugexit);
MODULE_LICENSE("GPL");... which will trigger a kernel panic when loaded:
------------[ cut here ]------------ hello Unexpected kernel BRK exception at EL1 Internal error: BRK handler: 00000000f2000800 [#1] PREEMPT SMP Modules linked in: hello(O+) CPU: 0 PID: 50 Comm: insmod Tainted: G O 6.9.1 #8 Hardware name: linux,dummy-virt (DT) pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : buginit+0x18/0x1000 [hello] lr : buginit+0x18/0x1000 [hello] sp : ffff800080533ae0 x29: ffff800080533ae0 x28: 0000000000000000 x27: 0000000000000000 x26: ffffaba8c4e70510 x25: ffff800080533c30 x24: ffffaba8c4a28a58 x23: 0000000000000000 x22: 0000000000000000 x21: ffff3947c0eab3c0 x20: ffffaba8c4e3f000 x19: ffffaba846464000 x18: 0000000000000006 x17: 0000000000000000 x16: ffffaba8c2492834 x15: 0720072007200720 x14: 0720072007200720 x13: ffffaba8c49b27c8 x12: 0000000000000312 x11: 0000000000000106 x10: ffffaba8c4a0a7c8 x9 : ffffaba8c49b27c8 x8 : 00000000ffffefff x7 : ffffaba8c4a0a7c8 x6 : 80000000fffff000 x5 : 0000000000000107 x4 : 0000000000000000 x3 : 0000000000000000 x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff3947c0eab3c0 Call trace: buginit+0x18/0x1000 [hello] do_one_initcall+0x80/0x1c8 do_init_module+0x60/0x218 load_module+0x1ba4/0x1d70 __do_sys_init_module+0x198/0x1d0 __arm64_sys_init_module+0x1c/0x28 invoke_syscall+0x48/0x114 el0_svc_common.constprop.0+0x40/0xe0 do_el0_svc+0x1c/0x28 el0_svc+0x34/0xd8 el0t_64_sync_handler+0x120/0x12c el0t_64_sync+0x190/0x194 Code: d0ffffe0 910003fd 91000000 9400000b (d4210000) ---[ end trace 0000000000000000 ]--- Kernel panic - not syncing: BRK handler: Fatal exception
Fix this by always aligning the end of a bug_entry to 4 bytes, which is correct regardless of CONFIG_DEBUG_BUGVERBOSE.
--- arch/arm64/include/asm/asm-bug.h | 1 + 1 file changed, 1 insertion(+)
arch/arm64/include/asm/asm-bug.h +1 -0
@@ -28,6 +28,7 @@ 14470: .long 14471f - 14470b; \_BUGVERBOSE_LOCATION (__FILE__, __LINE__) \ .short flags; \ + .align 2; \ .popsection; \ 14471:#else
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 144/202 virtio: delete vq in vp_find_vqs_msix() when request_irq() fails
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Pirko <[email protected]>
[ Upstream commit 89875151fccdd024d571aa884ea97a0128b968b6 ]
When request_irq() fails, error path calls vp_del_vqs(). There, as vq is present in the list, free_irq() is called for the same vector. That causes following splat:
[ 0.414355] Trying to free already-free IRQ 27 [ 0.414403] WARNING: CPU: 1 PID: 1 at kernel/irq/manage.c:1899 free_irq+0x1a1/0x2d0 [ 0.414510] Modules linked in: [ 0.414540] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 6.9.0-rc4+ #27 [ 0.414540] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-1.fc39 04/01/2014 [ 0.414540] RIP: 0010:free_irq+0x1a1/0x2d0 [ 0.414540] Code: 1e 00 48 83 c4 08 48 89 e8 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc cc cc 90 8b 74 24 04 48 c7 c7 98 80 6c b1 e8 00 c9 f7 ff 90 <0f> 0b 90 90 48 89 ee 4c 89 ef e8 e0 20 b8 00 49 8b 47 40 48 8b 40 [ 0.414540] RSP: 0000:ffffb71480013ae0 EFLAGS: 00010086 [ 0.414540] RAX: 0000000000000000 RBX: ffffa099c2722000 RCX: 0000000000000000 [ 0.414540] RDX: 0000000000000000 RSI: ffffb71480013998 RDI: 0000000000000001 [ 0.414540] RBP: 0000000000000246 R08: 00000000ffffdfff R09: 0000000000000001 [ 0.414540] R10: 00000000ffffdfff R11: ffffffffb18729c0 R12: ffffa099c1c91760 [ 0.414540] R13: ffffa099c1c916a4 R14: ffffa099c1d2f200 R15: ffffa099c1c91600 [ 0.414540] FS: 0000000000000000(0000) GS:ffffa099fec40000(0000) knlGS:0000000000000000 [ 0.414540] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 0.414540] CR2: 0000000000000000 CR3: 0000000008e3e001 CR4: 0000000000370ef0 [ 0.414540] Call Trace: [ 0.414540] <TASK> [ 0.414540] ? __warn+0x80/0x120 [ 0.414540] ? free_irq+0x1a1/0x2d0 [ 0.414540] ? report_bug+0x164/0x190 [ 0.414540] ? handle_bug+0x3b/0x70 [ 0.414540] ? exc_invalid_op+0x17/0x70 [ 0.414540] ? asm_exc_invalid_op+0x1a/0x20 [ 0.414540] ? free_irq+0x1a1/0x2d0 [ 0.414540] vp_del_vqs+0xc1/0x220 [ 0.414540] vp_find_vqs_msix+0x305/0x470 [ 0.414540] vp_find_vqs+0x3e/0x1a0 [ 0.414540] vp_modern_find_vqs+0x1b/0x70 [ 0.414540] init_vqs+0x387/0x600 [ 0.414540] virtnet_probe+0x50a/0xc80 [ 0.414540] virtio_dev_probe+0x1e0/0x2b0 [ 0.414540] really_probe+0xc0/0x2c0 [ 0.414540] ? __pfx___driver_attach+0x10/0x10 [ 0.414540] __driver_probe_device+0x73/0x120 [ 0.414540] driver_probe_device+0x1f/0xe0 [ 0.414540] __driver_attach+0x88/0x180 [ 0.414540] bus_for_each_dev+0x85/0xd0 [ 0.414540] bus_add_driver+0xec/0x1f0 [ 0.414540] driver_register+0x59/0x100 [ 0.414540] ? __pfx_virtio_net_driver_init+0x10/0x10 [ 0.414540] virtio_net_driver_init+0x90/0xb0 [ 0.414540] do_one_initcall+0x58/0x230 [ 0.414540] kernel_init_freeable+0x1a3/0x2d0 [ 0.414540] ? __pfx_kernel_init+0x10/0x10 [ 0.414540] kernel_init+0x1a/0x1c0 [ 0.414540] ret_from_fork+0x31/0x50 [ 0.414540] ? __pfx_kernel_init+0x10/0x10 [ 0.414540] ret_from_fork_asm+0x1a/0x30 [ 0.414540] </TASK>
Fix this by calling deleting the current vq when request_irq() fails.
Message-Id: <[email protected]>
--- drivers/virtio/virtio_pci_common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/virtio/virtio_pci_common.c +3 -1
@@ -339,8 +339,10 @@ static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned nvqs, vring_interrupt,0 , vp_dev->msix_names[msix_vec], vqs[i]); -if (err) +if (err) { +vp_del_vq (vqs[i]); goto error_find; + } }return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 145/202 net: fec: avoid lock evasion when reading pps_enable
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
[ Upstream commit 3b1c92f8e5371700fada307cc8fd2c51fa7bc8c1 ]
The assignment of pps_enable is protected by tmreg_lock, but the read operation of pps_enable is not. So the Coverity tool reports a lock evasion warning which may cause data race to occur when running in a multithread environment. Although this issue is almost impossible to occur, we'd better fix it, at least it seems more logically reasonable, and it also prevents Coverity from continuing to issue warnings.
--- drivers/net/ethernet/freescale/fec_ptp.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/net/ethernet/freescale/fec_ptp.c +8 -6
@@ -108,14 +108,13 @@ static int fec_ptp_enable_pps(struct fec_enet_private *fep, uint enable)return -EINVAL ; } -if (fep->pps_enable == enable) -return 0 ; - - fep->pps_channel =DEFAULT_PPS_CHANNEL ; - fep->reload_period =PPS_OUPUT_RELOAD_PERIOD ; -spin_lock_irqsave (&fep->tmreg_lock, flags); +if (fep->pps_enable == enable) { +spin_unlock_irqrestore (&fep->tmreg_lock, flags); +return 0 ; + } +if (enable) {/* clear capture or output compare interrupt status if have. */
@@ -446,6 +445,9 @@ static int fec_ptp_enable(struct ptp_clock_info *ptp,int ret =0 ;if (rq->type ==PTP_CLK_REQ_PPS ) { + fep->pps_channel =DEFAULT_PPS_CHANNEL ; + fep->reload_period =PPS_OUPUT_RELOAD_PERIOD ; + ret =fec_ptp_enable_pps (fep, on);return ret;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 146/202 nfc: nci: Fix kcov check in nci_rx_work()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
[ Upstream commit 19e35f24750ddf860c51e51c68cf07ea181b4881 ]
Commit 7e8cdc97148c ("nfc: Add KCOV annotations") added kcov_remote_start_common()/kcov_remote_stop() pair into nci_rx_work(), with an assumption that kcov_remote_stop() is called upon continue of the for loop. But commit d24b03535e5e ("nfc: nci: Fix uninit-value in nci_dev_up and nci_ntf_packet") forgot to call kcov_remote_stop() before break of the for loop.
Stable-dep-of: 6671e352497c ("nfc: nci: Fix handling of zero-length payload packets in nci_rx_work()")
--- net/nfc/nci/core.c | 1 + 1 file changed, 1 insertion(+)
net/nfc/nci/core.c +1 -0
@@ -1514,6 +1514,7 @@ static void nci_rx_work(struct work_struct *work)if (!nci_valid_size (skb)) {kfree_skb (skb); +kcov_remote_stop ();break ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 147/202 nfc: nci: Fix handling of zero-length payload packets in nci_rx_work()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryosuke Yasuoka <[email protected]>
[ Upstream commit 6671e352497ca4bb07a96c48e03907065ff77d8a ]
When nci_rx_work() receives a zero-length payload packet, it should not discard the packet and exit the loop. Instead, it should continue processing subsequent packets.
--- net/nfc/nci/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/nfc/nci/core.c +1 -2
@@ -1514,8 +1514,7 @@ static void nci_rx_work(struct work_struct *work)if (!nci_valid_size (skb)) {kfree_skb (skb); -kcov_remote_stop (); -break ; +continue ; }/* Process frame */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 121/202 serial: sh-sci: protect invalidating RXDMA on shutdown
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
[ Upstream commit aae20f6e34cd0cbd67a1d0e5877561c40109a81b ]
The to-be-fixed commit removed locking when invalidating the DMA RX descriptors on shutdown. It overlooked that there is still a rx_timer running which may still access the protected data. So, re-add the locking.
--- drivers/tty/serial/sh-sci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/tty/serial/sh-sci.c +5 -0
@@ -1259,9 +1259,14 @@ static void sci_dma_rx_chan_invalidate(struct sci_port *s)static void sci_dma_rx_release (struct sci_port *s) {struct dma_chan *chan = s->chan_rx_saved; +struct uart_port *port = &s->port; +unsigned long flags; +uart_port_lock_irqsave (port, &flags); s->chan_rx_saved =NULL ;sci_dma_rx_chan_invalidate (s); +uart_port_unlock_irqrestore (port, flags); +dmaengine_terminate_sync (chan);dma_free_coherent (chan->device->dev, s->buf_len_rx *2 , s->rx_buf[0 ],sg_dma_address (&s->sg_rx[0 ]));
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 148/202 netfilter: nfnetlink_queue: acquire rcu_read_lock() in instance_destroy_rcu()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit dc21c6cc3d6986d938efbf95de62473982c98dec ]
syzbot reported that nf_reinject() could be called without rcu_read_lock() :
WARNING: suspicious RCU usage 6.9.0-rc7-syzkaller-02060-g5c1672705a1a #0 Not tainted
net/netfilter/nfnetlink_queue.c:263 suspicious rcu_dereference_check() usage!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
2 locks held by syz-executor.4/13427:
#0: ffffffff8e334f60 (rcu_callback){....}-{0:0}, at: rcu_lock_acquire include/linux/rcupdate.h:329 [inline] #0: ffffffff8e334f60 (rcu_callback){....}-{0:0}, at: rcu_do_batch kernel/rcu/tree.c:2190 [inline] #0: ffffffff8e334f60 (rcu_callback){....}-{0:0}, at: rcu_core+0xa86/0x1830 kernel/rcu/tree.c:2471 #1: ffff88801ca92958 (&inst->lock){+.-.}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:356 [inline] #1: ffff88801ca92958 (&inst->lock){+.-.}-{2:2}, at: nfqnl_flush net/netfilter/nfnetlink_queue.c:405 [inline] #1: ffff88801ca92958 (&inst->lock){+.-.}-{2:2}, at: instance_destroy_rcu+0x30/0x220 net/netfilter/nfnetlink_queue.c:172
stack backtrace: CPU: 0 PID: 13427 Comm: syz-executor.4 Not tainted 6.9.0-rc7-syzkaller-02060-g5c1672705a1a #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 Call Trace: <IRQ> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114 lockdep_rcu_suspicious+0x221/0x340 kernel/locking/lockdep.c:6712 nf_reinject net/netfilter/nfnetlink_queue.c:323 [inline] nfqnl_reinject+0x6ec/0x1120 net/netfilter/nfnetlink_queue.c:397 nfqnl_flush net/netfilter/nfnetlink_queue.c:410 [inline] instance_destroy_rcu+0x1ae/0x220 net/netfilter/nfnetlink_queue.c:172 rcu_do_batch kernel/rcu/tree.c:2196 [inline] rcu_core+0xafd/0x1830 kernel/rcu/tree.c:2471 handle_softirqs+0x2d6/0x990 kernel/softirq.c:554 __do_softirq kernel/softirq.c:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637 irq_exit_rcu+0x9/0x30 kernel/softirq.c:649 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline] sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1043 </IRQ> <TASK>
--- net/netfilter/nfnetlink_queue.c | 2 ++ 1 file changed, 2 insertions(+)
net/netfilter/nfnetlink_queue.c +2 -0
@@ -167,7 +167,9 @@ instance_destroy_rcu(struct rcu_head *head) struct nfqnl_instance *inst = container_of(head, struct nfqnl_instance, rcu); +rcu_read_lock ();nfqnl_flush (inst,NULL ,0 ); +rcu_read_unlock ();kfree (inst);module_put (THIS_MODULE ); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 149/202 spi: Dont mark message DMA mapped when no transfer in it is
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 9f788ba457b45b0ce422943fcec9fa35c4587764 ]
There is no need to set the DMA mapped flag of the message if it has no mapped transfers. Moreover, it may give the code a chance to take the wrong paths, i.e. to exercise DMA related APIs on unmapped data. Make __spi_map_msg() to bail earlier on the above mentioned cases.
--- drivers/spi/spi.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/spi/spi.c +4 -0
@@ -931,6 +931,7 @@ static int __spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg)else rx_dev = ctlr->dev.parent; + ret = -ENOMSG ;list_for_each_entry (xfer, &msg->transfers, transfer_list) {if (!ctlr->can_dma (ctlr, msg->spi, xfer))continue ;
@@ -954,6 +955,9 @@ static int __spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg) } } } +/* No transfer has been mapped, bail out with success */ +if (ret) +return 0 ; ctlr->cur_msg_mapped = true;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 150/202 nvmet: fix ns enable/disable possible hang
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sagi Grimberg <[email protected]>
[ Upstream commit f97914e35fd98b2b18fb8a092e0a0799f73afdfe ]
When disabling an nvmet namespace, there is a period where the subsys->lock is released, as the ns disable waits for backend IO to complete, and the ns percpu ref to be properly killed. The original intent was to avoid taking the subsystem lock for a prolong period as other processes may need to acquire it (for example new incoming connections).
However, it opens up a window where another process may come in and enable the ns, (re)intiailizing the ns percpu_ref, causing the disable sequence to hang.
Solve this by taking the global nvmet_config_sem over the entire configfs enable/disable sequence.
--- drivers/nvme/target/configfs.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/nvme/target/configfs.c +8 -0
@@ -507,10 +507,18 @@ static ssize_t nvmet_ns_enable_store(struct config_item *item,if (strtobool (page, &enable))return -EINVAL ; +/* +* take a global nvmet_config_sem because the disable routine has a +* window where it releases the subsys-lock, giving a chance to +* a parallel enable to concurrently execute causing the disable to +* have a misaccounting of the ns percpu_ref. +*/ +down_write (&nvmet_config_sem);if (enable) ret =nvmet_ns_enable (ns);else nvmet_ns_disable (ns); +up_write (&nvmet_config_sem);return ret ? ret : count; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 122/202 libsubcmd: Fix parse-options memory leak
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit 230a7a71f92212e723fa435d4ca5922de33ec88a ]
If a usage string is built in parse_options_subcommand, also free it.
--- tools/lib/subcmd/parse-options.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
tools/lib/subcmd/parse-options.c +5 -3
@@ -630,11 +630,10 @@ int parse_options_subcommand(int argc, const char **argv, const struct option *o const char *const subcommands[], const char *usagestr[], int flags) { struct parse_opt_ctx_t ctx; +char *buf =NULL ;/* build usage string if it's not provided */ if (subcommands && !usagestr[0 ]) { -char *buf =NULL ; -astrcatf (&buf,"%s %s [<options>] {" , subcmd_config.exec_name, argv[0 ]);for (int i =0 ; subcommands[i]; i++) {
@@ -676,7 +675,10 @@ int parse_options_subcommand(int argc, const char **argv, const struct option *oastrcatf (&error_buf,"unknown switch `%c'" , *ctx.opt);usage_with_options (usagestr, options); } - +if (buf) { + usagestr[0 ] =NULL ; +free (buf); + }return parse_options_end (&ctx); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 123/202 perf stat: Dont display metric header for non-leader uncore events
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit 193a9e30207f54777ff42d0d8be8389edc522277 ]
On an Intel tigerlake laptop a metric like:
{
"BriefDescription": "Test",
"MetricExpr": "imc_free_running@data_read@ + imc_free_running@data_write@",
"MetricGroup": "Test",
"MetricName": "Test",
"ScaleUnit": "6.103515625e-5MiB"
},Will have 4 events:
uncore_imc_free_running_0/data_read/
uncore_imc_free_running_0/data_write/
uncore_imc_free_running_1/data_read/
uncore_imc_free_running_1/data_write/
If aggregration is disabled with metric-only 2 column headers are needed:
$ perf stat -M test --metric-only -A -a sleep 1
Performance counter stats for 'system wide':
MiB Test MiB Test
CPU0 1821.0 1820.5
But when not, the counts aggregated in the metric leader and only 1 column should be shown:
$ perf stat -M test --metric-only -a sleep 1 Performance counter stats for 'system wide':
MiB Test
5909.4
1.001258915 seconds time elapsedAchieve this by skipping events that aren't metric leaders when printing column headers and aggregation isn't disabled.
The bug is long standing, the fixes tag is set to a refactor as that is as far back as is reasonable to backport.
--- tools/perf/util/stat-display.c | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/util/stat-display.c +3 -0
@@ -931,6 +931,9 @@ static void print_metric_headers(struct perf_stat_config *config,/* Print metrics headers only */ evlist__for_each_entry (evlist, counter) { +if (config->aggr_mode !=AGGR_NONE && counter->metric_leader != counter) +continue ; + os.evsel = counter; out.ctx = &os; out.print_metric = print_metric_header;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 124/202 Input: ims-pcu - fix printf string overflow
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit bf32bceedd0453c70d9d022e2e29f98e446d7161 ]
clang warns about a string overflow in this driver
drivers/input/misc/ims-pcu.c:1802:2: error: 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 12 [-Werror,-Wformat-truncation] drivers/input/misc/ims-pcu.c:1814:2: error: 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 12 [-Werror,-Wformat-truncation]
Make the buffer a little longer to ensure it always fits.
--- drivers/input/misc/ims-pcu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/misc/ims-pcu.c +2 -2
@@ -42,8 +42,8 @@ struct ims_pcu_backlight {#define IMS_PCU_PART_NUMBER_LEN 15#define IMS_PCU_SERIAL_NUMBER_LEN 8#define IMS_PCU_DOM_LEN 8 -#define IMS_PCU_FW_VERSION_LEN (9 + 1) -#define IMS_PCU_BL_VERSION_LEN (9 + 1) +#define IMS_PCU_FW_VERSION_LEN 16 +#define IMS_PCU_BL_VERSION_LEN 16#define IMS_PCU_BL_RESET_REASON_LEN (2 + 1)#define IMS_PCU_PCU_B_DEVICE_ID 5
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 125/202 Input: pm8xxx-vibrator - correct VIB_MAX_LEVELS calculation
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fenglin Wu <[email protected]>
[ Upstream commit 48c0687a322d54ac7e7a685c0b6db78d78f593af ]
The output voltage is inclusive hence the max level calculation is off-by-one-step. Correct it.
iWhile we are at it also add a define for the step size instead of using the magic value.
--- drivers/input/misc/pm8xxx-vibrator.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/input/misc/pm8xxx-vibrator.c +4 -3
@@ -14,7 +14,8 @@#define VIB_MAX_LEVEL_mV (3100)#define VIB_MIN_LEVEL_mV (1200) -#define VIB_MAX_LEVELS (VIB_MAX_LEVEL_mV - VIB_MIN_LEVEL_mV) +#define VIB_PER_STEP_mV (100) +#define VIB_MAX_LEVELS (VIB_MAX_LEVEL_mV - VIB_MIN_LEVEL_mV + VIB_PER_STEP_mV)#define MAX_FF_SPEED 0xff
@@ -118,10 +119,10 @@ static void pm8xxx_work_handler(struct work_struct *work) vib->active = true; vib->level = ((VIB_MAX_LEVELS * vib->speed) /MAX_FF_SPEED ) + VIB_MIN_LEVEL_mV; - vib->level /=100 ; + vib->level /= VIB_PER_STEP_mV; }else { vib->active = false; - vib->level = VIB_MIN_LEVEL_mV /100 ; + vib->level = VIB_MIN_LEVEL_mV / VIB_PER_STEP_mV; }pm8xxx_vib_set (vib, vib->active);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 126/202 drm/msm/dpu: Always flush the slave INTF on the CTL
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marijn Suijten <[email protected]>
[ Upstream commit 2b938c3ab0a69ec6ea587bbf6fc2aec3db4a8736 ]
As we can clearly see in a downstream kernel [1], flushing the slave INTF is skipped /only if/ the PPSPLIT topology is active.
However, when DPU was originally submitted to mainline PPSPLIT was no longer part of it (seems to have been ripped out before submission), but this clause was incorrectly ported from the original SDE driver. Given that there is no support for PPSPLIT (currently), flushing the slave INTF should /never/ be skipped (as the if (ppsplit && !master) goto skip; clause downstream never becomes true).
Patchwork: https://patchwork.freedesktop.org/patch/589901/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0 -3
@@ -479,9 +479,6 @@ static void dpu_encoder_phys_cmd_enable_helper(_dpu_encoder_phys_cmd_pingpong_config (phys_enc); -if (!dpu_encoder_phys_cmd_is_master (phys_enc)) -return ; - ctl = phys_enc->hw_ctl; ctl->ops.get_bitmask_intf (ctl, &flush_mask, phys_enc->intf_idx); ctl->ops.update_pending_flush (ctl, flush_mask);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 127/202 um: Fix return value in ubd_init()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Duoming Zhou <[email protected]>
[ Upstream commit 31a5990ed253a66712d7ddc29c92d297a991fdf2 ]
When kmalloc_array() fails to allocate memory, the ubd_init() should return -ENOMEM instead of -1. So, fix it.
--- arch/um/drivers/ubd_kern.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/um/drivers/ubd_kern.c +2 -2
@@ -1157,7 +1157,7 @@ static int __init ubd_init(void)if (irq_req_buffer ==NULL ) {printk (KERN_ERR "Failed to initialize ubd buffering\n" ); -return -1 ; +return -ENOMEM ; } io_req_buffer = kmalloc_array(UBD_REQ_BUFFER_SIZE, sizeof(struct io_thread_req *),
@@ -1168,7 +1168,7 @@ static int __init ubd_init(void)if (io_req_buffer ==NULL ) {printk (KERN_ERR "Failed to initialize ubd buffering\n" ); -return -1 ; +return -ENOMEM ; }platform_driver_register (&ubd_driver);mutex_lock (&ubd_lock);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 118/202 extcon: max8997: select IRQ_DOMAIN instead of depending on it
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit b1781d0a1458070d40134e4f3412ec9d70099bec ]
IRQ_DOMAIN is a hidden (not user visible) symbol. Users cannot set it directly thru "make *config", so drivers should select it instead of depending on it if they need it.
Relying on it being set for a dependency is risky.
Consistently using "select" or "depends on" can also help reduce Kconfig circular dependency issues.
Therefore, change EXTCON_MAX8997's use of "depends on" for IRQ_DOMAIN to "select".
--- drivers/extcon/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/extcon/Kconfig +2 -1
@@ -121,7 +121,8 @@ config EXTCON_MAX77843 config EXTCON_MAX8997 tristate "Maxim MAX8997 EXTCON Support" - depends on MFD_MAX8997 && IRQ_DOMAIN + depends on MFD_MAX8997 + select IRQ_DOMAIN help If you say yes here you get support for the MUIC device of Maxim MAX8997 PMIC. The MAX8997 MUIC is a USB port accessory
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 152/202 dma-buf/sw-sync: dont enable IRQ from sync_print_obj()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
[ Upstream commit b794918961516f667b0c745aebdfebbb8a98df39 ]
Since commit a6aa8fca4d79 ("dma-buf/sw-sync: Reduce irqsave/irqrestore from known context") by error replaced spin_unlock_irqrestore() with spin_unlock_irq() for both sync_debugfs_show() and sync_print_obj() despite sync_print_obj() is called from sync_debugfs_show(), lockdep complains inconsistent lock state warning.
Use plain spin_{lock,unlock}() for sync_print_obj(), for sync_debugfs_show() is already using spin_{lock,unlock}_irq().
--- drivers/dma-buf/sync_debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma-buf/sync_debug.c +2 -2
@@ -110,12 +110,12 @@ static void sync_print_obj(struct seq_file *s, struct sync_timeline *obj)seq_printf (s,"%s: %d\n" , obj->name, obj->value); -spin_lock_irq (&obj->lock); +spin_lock (&obj->lock);/* Caller already disabled IRQ. */ list_for_each (pos, &obj->pt_list) { struct sync_pt *pt = container_of(pos, struct sync_pt, link);sync_print_fence (s, &pt->base, false); } -spin_unlock_irq (&obj->lock); +spin_unlock (&obj->lock); } static void sync_print_sync_file(struct seq_file *s,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 161/202 ipvlan: Dont Use skb->sk in ipvlan_process_v{4,6}_outbound
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yue Haibing <[email protected]>
[ Upstream commit b3dc6e8003b500861fa307e9a3400c52e78e4d3a ]
Raw packet from PF_PACKET socket ontop of an IPv6-backed ipvlan device will hit WARN_ON_ONCE() in sk_mc_loop() through sch_direct_xmit() path.
WARNING: CPU: 2 PID: 0 at net/core/sock.c:775 sk_mc_loop+0x2d/0x70 Modules linked in: sch_netem ipvlan rfkill cirrus drm_shmem_helper sg drm_kms_helper CPU: 2 PID: 0 Comm: swapper/2 Kdump: loaded Not tainted 6.9.0+ #279 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 RIP: 0010:sk_mc_loop+0x2d/0x70 Code: fa 0f 1f 44 00 00 65 0f b7 15 f7 96 a3 4f 31 c0 66 85 d2 75 26 48 85 ff 74 1c RSP: 0018:ffffa9584015cd78 EFLAGS: 00010212 RAX: 0000000000000011 RBX: ffff91e585793e00 RCX: 0000000002c6a001 RDX: 0000000000000000 RSI: 0000000000000040 RDI: ffff91e589c0f000 RBP: ffff91e5855bd100 R08: 0000000000000000 R09: 3d00545216f43d00 R10: ffff91e584fdcc50 R11: 00000060dd8616f4 R12: ffff91e58132d000 R13: ffff91e584fdcc68 R14: ffff91e5869ce800 R15: ffff91e589c0f000 FS: 0000000000000000(0000) GS:ffff91e898100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f788f7c44c0 CR3: 0000000008e1a000 CR4: 00000000000006f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <IRQ> ? __warn (kernel/panic.c:693) ? sk_mc_loop (net/core/sock.c:760) ? report_bug (lib/bug.c:201 lib/bug.c:219) ? handle_bug (arch/x86/kernel/traps.c:239) ? exc_invalid_op (arch/x86/kernel/traps.c:260 (discriminator 1)) ? asm_exc_invalid_op (./arch/x86/include/asm/idtentry.h:621) ? sk_mc_loop (net/core/sock.c:760) ip6_finish_output2 (net/ipv6/ip6_output.c:83 (discriminator 1)) ? nf_hook_slow (net/netfilter/core.c:626) ip6_finish_output (net/ipv6/ip6_output.c:222) ? __pfx_ip6_finish_output (net/ipv6/ip6_output.c:215) ipvlan_xmit_mode_l3 (drivers/net/ipvlan/ipvlan_core.c:602) ipvlan ipvlan_start_xmit (drivers/net/ipvlan/ipvlan_main.c:226) ipvlan dev_hard_start_xmit (net/core/dev.c:3594) sch_direct_xmit (net/sched/sch_generic.c:343) __qdisc_run (net/sched/sch_generic.c:416) net_tx_action (net/core/dev.c:5286) handle_softirqs (kernel/softirq.c:555) __irq_exit_rcu (kernel/softirq.c:589) sysvec_apic_timer_interrupt (arch/x86/kernel/apic/apic.c:1043)
The warning triggers as this:packet_sendmsg
packet_snd //skb->sk is packet sk
__dev_queue_xmit
__dev_xmit_skb //q->enqueue is not NULL
__qdisc_run
sch_direct_xmit
dev_hard_start_xmit
ipvlan_start_xmit
ipvlan_xmit_mode_l3 //l3 mode
ipvlan_process_outbound //vepa flag
ipvlan_process_v6_outbound
ip6_local_out
__ip6_finish_output
ip6_finish_output2 //multicast packet
sk_mc_loop //sk->sk_family is AF_PACKETCall ip{6}_local_out() with NULL sk in ipvlan as other tunnels to fix this.
--- drivers/net/ipvlan/ipvlan_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ipvlan/ipvlan_core.c +2 -2
@@ -440,7 +440,7 @@ static noinline_for_stack int ipvlan_process_v4_outbound(struct sk_buff *skb)memset (IPCB (skb),0 ,sizeof (*IPCB (skb))); - err =ip_local_out (net, skb->sk, skb); + err =ip_local_out (net,NULL , skb);if (unlikely (net_xmit_eval (err)))DEV_STATS_INC (dev, tx_errors);else
@@ -495,7 +495,7 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb)memset (IP6CB (skb),0 ,sizeof (*IP6CB (skb))); - err =ip6_local_out (dev_net (dev), skb->sk, skb); + err =ip6_local_out (dev_net (dev),NULL , skb);if (unlikely (net_xmit_eval (err)))DEV_STATS_INC (dev, tx_errors);else
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 162/202 ALSA: timer: Set lower bound of start tick time
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 4a63bd179fa8d3fcc44a0d9d71d941ddd62f0c4e upstream.
Currently ALSA timer doesn't have the lower limit of the start tick time, and it allows a very small size, e.g. 1 tick with 1ns resolution for hrtimer. Such a situation may lead to an unexpected RCU stall, where the callback repeatedly queuing the expire update, as reported by fuzzer.
This patch introduces a sanity check of the timer start tick time, so that the system returns an error when a too small start size is set. As of this patch, the lower limit is hard-coded to 100us, which is small enough but can still work somehow.
[ backport note: the error handling is changed, as the original commit
is based on the recent cleanup with guard() in commit beb45974dd49 -- tiwai ]
--- sound/core/timer.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
sound/core/timer.c +10 -0
@@ -524,6 +524,16 @@ static int snd_timer_start1(struct snd_t goto unlock; } +/* check the actual time for the start tick; +* bail out as error if it's way too low (< 100us) +*/ +if (start) { +if ((u64 )snd_timer_hw_resolution (timer) * ticks <100000 ) { + result = -EINVAL ; + goto unlock; + } + } +if (start) timeri->ticks = timeri->cticks = ticks;else if (!timeri->cticks)
Greg Kroah-Hartman
maintainerPATCH 163/202 genirq/cpuhotplug, x86/vector: Prevent vector leak during CPU offline
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dongli Zhang <[email protected]>
commit a6c11c0a5235fb144a65e0cb2ffd360ddc1f6c32 upstream.
The absence of IRQD_MOVE_PCNTXT prevents immediate effectiveness of interrupt affinity reconfiguration via procfs. Instead, the change is deferred until the next instance of the interrupt being triggered on the original CPU.
When the interrupt next triggers on the original CPU, the new affinity is enforced within __irq_move_irq(). A vector is allocated from the new CPU, but the old vector on the original CPU remains and is not immediately reclaimed. Instead, apicd->move_in_progress is flagged, and the reclaiming process is delayed until the next trigger of the interrupt on the new CPU.
Upon the subsequent triggering of the interrupt on the new CPU, irq_complete_move() adds a task to the old CPU's vector_cleanup list if it remains online. Subsequently, the timer on the old CPU iterates over its vector_cleanup list, reclaiming old vectors.
However, a rare scenario arises if the old CPU is outgoing before the interrupt triggers again on the new CPU.
In that case irq_force_complete_move() is not invoked on the outgoing CPU to reclaim the old apicd->prev_vector because the interrupt isn't currently affine to the outgoing CPU, and irq_needs_fixup() returns false. Even though __vector_schedule_cleanup() is later called on the new CPU, it doesn't reclaim apicd->prev_vector; instead, it simply resets both apicd->move_in_progress and apicd->prev_vector to 0.
As a result, the vector remains unreclaimed in vector_matrix, leading to a CPU vector leak.
To address this issue, move the invocation of irq_force_complete_move() before the irq_needs_fixup() call to reclaim apicd->prev_vector, if the interrupt is currently or used to be affine to the outgoing CPU.
Additionally, reclaim the vector in __vector_schedule_cleanup() as well, following a warning message, although theoretically it should never see apicd->move_in_progress with apicd->prev_cpu pointing to an offline CPU.
--- arch/x86/kernel/apic/vector.c | 9 ++++++--- kernel/irq/cpuhotplug.c | 16 ++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-)
arch/x86/kernel/apic/vector.c +6 -3
@@ -913,7 +913,8 @@ static void __send_cleanup_vector(structhlist_add_head (&apicd->clist,per_cpu_ptr (&cleanup_list, cpu)); apic->send_IPI (cpu,IRQ_MOVE_CLEANUP_VECTOR ); }else { - apicd->prev_vector =0 ; +pr_warn ("IRQ %u schedule cleanup for offline CPU %u\n" , apicd->irq, cpu); +free_moved_vector (apicd); }raw_spin_unlock (&vector_lock); }
@@ -949,6 +950,7 @@ void irq_complete_move(struct irq_cfg *c*/ void irq_force_complete_move (struct irq_desc *desc) { +unsigned int cpu =smp_processor_id ();struct apic_chip_data *apicd;struct irq_data *irqd;unsigned int vector;
@@ -973,10 +975,11 @@ void irq_force_complete_move(struct irq_ goto unlock;/* -* If prev_vector is empty, no action required. +* If prev_vector is empty or the descriptor is neither currently +* nor previously on the outgoing CPU no action required. */ vector = apicd->prev_vector; -if (!vector) +if (!vector || (apicd->cpu != cpu && apicd->prev_cpu != cpu)) goto unlock;/*
kernel/irq/cpuhotplug.c +8 -8
@@ -69,6 +69,14 @@ static bool migrate_one_irq(struct irq_d }/* +* Complete an eventually pending irq move cleanup. If this +* interrupt was moved in hard irq context, then the vectors need +* to be cleaned up. It can't wait until this interrupt actually +* happens and this CPU was involved. +*/ +irq_force_complete_move (desc); + +/* * No move required, if: * - Interrupt is per cpu * - Interrupt is not started
@@ -87,14 +95,6 @@ static bool migrate_one_irq(struct irq_d }/* -* Complete an eventually pending irq move cleanup. If this -* interrupt was moved in hard irq context, then the vectors need -* to be cleaned up. It can't wait until this interrupt actually -* happens and this CPU was involved. -*/ -irq_force_complete_move (desc); - -/* * If there is a setaffinity pending, then try to reuse the pending * mask, so the last change of the affinity does not get lost. If * there is no move pending or the pending mask does not contain
Greg Kroah-Hartman
maintainerPATCH 164/202 SUNRPC: Fix loop termination condition in gss_free_in_token_pages()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
commit 4a77c3dead97339478c7422eb07bf4bf63577008 upstream.
The in_token->pages[] array is not NULL terminated. This results in the following KASAN splat:
KASAN: maybe wild-memory-access in range [0x04a2013400000008-0x04a201340000000f]
--- net/sunrpc/auth_gss/svcauth_gss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/auth_gss/svcauth_gss.c +1 -1
@@ -1104,7 +1104,7 @@ static int gss_read_proxy_verf(struct sv } pages =DIV_ROUND_UP (inlen,PAGE_SIZE ); - in_token->pages =kcalloc (pages,sizeof (struct page *),GFP_KERNEL ); + in_token->pages =kcalloc (pages +1 ,sizeof (struct page *),GFP_KERNEL );if (!in_token->pages) {kfree (in_handle->data);return SVC_DENIED ;
Greg Kroah-Hartman
maintainerPATCH 165/202 binder: fix max_thread type inconsistency
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Carlos Llamas <[email protected]>
commit 42316941335644a98335f209daafa4c122f28983 upstream.
The type defined for the BINDER_SET_MAX_THREADS ioctl was changed from size_t to __u32 in order to avoid incompatibility issues between 32 and 64-bit kernels. However, the internal types used to copy from user and store the value were never updated. Use u32 to fix the inconsistency.
--- drivers/android/binder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/android/binder.c +2 -2
@@ -480,7 +480,7 @@ struct binder_proc {struct list_head todo;struct binder_stats stats;struct list_head delivered_death; -int max_threads; +u32 max_threads;int requested_threads;int requested_threads_started;int tmp_ref;
@@ -5412,7 +5412,7 @@ static long binder_ioctl(struct file *fi goto err;break ;case BINDER_SET_MAX_THREADS : { -int max_threads; +u32 max_threads;if (copy_from_user (&max_threads, ubuf,sizeof (max_threads))) {
Greg Kroah-Hartman
maintainerPATCH 166/202 mmc: core: Do not force a retune before RPMB switch
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jorge Ramirez-Ortiz <[email protected]>
commit 67380251e8bbd3302c64fea07f95c31971b91c22 upstream.
Requesting a retune before switching to the RPMB partition has been observed to cause CRC errors on the RPMB reads (-EILSEQ).
Since RPMB reads can not be retried, the clients would be directly affected by the errors.
This commit disables the retune request prior to switching to the RPMB
partition: mmc_retune_pause() no longer triggers a retune before the pause period begins.
This was verified with the sdhci-of-arasan driver (ZynqMP) configured for HS200 using two separate eMMC cards (DG4064 and 064GB2). In both cases, the error was easy to reproduce triggering every few tenths of reads.
With this commit, systems that were utilizing OP-TEE to access RPMB variables will experience an enhanced performance. Specifically, when OP-TEE is configured to employ RPMB as a secure storage solution, it not only writes the data but also the secure filesystem within the partition. As a result, retrieving any variable involves multiple RPMB reads, typically around five.
For context, on ZynqMP, each retune request consumed approximately 8ms. Consequently, reading any RPMB variable used to take at the very minimum 40ms.
After droping the need to retune before switching to the RPMB partition, this is no longer the case.
--- drivers/mmc/core/host.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mmc/core/host.c +1 -2
@@ -111,13 +111,12 @@ void mmc_retune_enable(struct mmc_host */* * Pause re-tuning for a small set of operations. The pause begins after the -* next command and after first doing re-tuning. +* next command. */ void mmc_retune_pause (struct mmc_host *host) {if (!host->retune_paused) { host->retune_paused =1 ; -mmc_retune_needed (host);mmc_retune_hold (host); } }
Greg Kroah-Hartman
maintainerPATCH 167/202 io_uring: fail NOP if non-zero op flags is passed in
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Lei <[email protected]>
commit 3d8f874bd620ce03f75a5512847586828ab86544 upstream.
The NOP op flags should have been checked from beginning like any other opcode, otherwise NOP may not be extended with the op flags.
Given both liburing and Rust io-uring crate always zeros SQE op flags, just ignore users which play raw NOP uring interface without zeroing SQE, because NOP is just for test purpose. Then we can save one NOP2 opcode.
--- fs/io_uring.c | 2 ++ 1 file changed, 2 insertions(+)
fs/io_uring.c +2 -0
@@ -2112,6 +2112,8 @@ static int __io_submit_sqe(struct io_rinswitch (req->submit.opcode) {case IORING_OP_NOP : +if (READ_ONCE (s->sqe->rw_flags)) +return -EINVAL ; ret =io_nop (req, req->user_data);break ;case IORING_OP_READV :
Greg Kroah-Hartman
maintainerPATCH 168/202 afs: Dont cross .backup mountpoint from backup volume
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Dionne <[email protected]>
commit 29be9100aca2915fab54b5693309bc42956542e5 upstream.
Don't cross a mountpoint that explicitly specifies a backup volume (target is <vol>.backup) when starting from a backup volume.
It it not uncommon to mount a volume's backup directly in the volume itself. This can cause tools that are not paying attention to get into a loop mounting the volume onto itself as they attempt to traverse the tree, leading to a variety of problems.
This doesn't prevent the general case of loops in a sequence of mountpoints, but addresses a common special case in the same way as other afs clients.
--- fs/afs/mntpt.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/afs/mntpt.c +5 -0
@@ -146,6 +146,11 @@ static int afs_mntpt_set_params(struct fput_page (page);if (ret <0 )return ret; + +/* Don't cross a backup volume mountpoint from a backup volume */ +if (src_as->volume && src_as->volume->type ==AFSVL_BACKVOL && + ctx->type ==AFSVL_BACKVOL ) +return -ENODEV ; }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 169/202 nilfs2: fix use-after-free of timer for log writer thread
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit f5d4e04634c9cf68bdf23de08ada0bb92e8befe7 upstream.
Patch series "nilfs2: fix log writer related issues".
This bug fix series covers three nilfs2 log writer-related issues, including a timer use-after-free issue and potential deadlock issue on unmount, and a potential freeze issue in event synchronization found during their analysis. Details are described in each commit log.
This patch (of 3):
A use-after-free issue has been reported regarding the timer sc_timer on the nilfs_sc_info structure.
The problem is that even though it is used to wake up a sleeping log writer thread, sc_timer is not shut down until the nilfs_sc_info structure is about to be freed, and is used regardless of the thread's lifetime.
Fix this issue by limiting the use of sc_timer only while the log writer thread is alive.
--- fs/nilfs2/segment.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
fs/nilfs2/segment.c +19 -6
@@ -2159,8 +2159,10 @@ static void nilfs_segctor_start_timer(st {spin_lock (&sci->sc_state_lock);if (!(sci->sc_state &NILFS_SEGCTOR_COMMIT )) { - sci->sc_timer.expires = jiffies + sci->sc_interval; -add_timer (&sci->sc_timer); +if (sci->sc_task) { + sci->sc_timer.expires = jiffies + sci->sc_interval; +add_timer (&sci->sc_timer); + } sci->sc_state |=NILFS_SEGCTOR_COMMIT ; }spin_unlock (&sci->sc_state_lock);
@@ -2380,10 +2382,21 @@ int nilfs_construct_dsync_segment(struct*/ static void nilfs_segctor_accept (struct nilfs_sc_info *sci) { +bool thread_is_alive; +spin_lock (&sci->sc_state_lock); sci->sc_seq_accepted = sci->sc_seq_request; + thread_is_alive = (bool )sci->sc_task;spin_unlock (&sci->sc_state_lock); -del_timer_sync (&sci->sc_timer); + +/* +* This function does not race with the log writer thread's +* termination. Therefore, deleting sc_timer, which should not be +* done after the log writer thread exits, can be done safely outside +* the area protected by sc_state_lock. +*/ +if (thread_is_alive) +del_timer_sync (&sci->sc_timer); }/**
@@ -2409,7 +2422,7 @@ static void nilfs_segctor_notify(struct sci->sc_flush_request &= ~FLUSH_DAT_BIT ;/* re-enable timer if checkpoint creation was not done */ -if ((sci->sc_state &NILFS_SEGCTOR_COMMIT ) && +if ((sci->sc_state &NILFS_SEGCTOR_COMMIT ) && sci->sc_task &&time_before (jiffies, sci->sc_timer.expires))add_timer (&sci->sc_timer); }
@@ -2599,6 +2612,7 @@ static int nilfs_segctor_thread(void *arint timeout =0 ; sci->sc_timer_task = current; +timer_setup (&sci->sc_timer, nilfs_construction_timeout,0 );/* start sync. */ sci->sc_task = current;
@@ -2665,6 +2679,7 @@ static int nilfs_segctor_thread(void *ar end_thread:/* end sync. */ sci->sc_task =NULL ; +del_timer_sync (&sci->sc_timer);wake_up (&sci->sc_wait_task);/* for nilfs_segctor_kill_thread() */ spin_unlock (&sci->sc_state_lock);return 0 ;
@@ -2728,7 +2743,6 @@ static struct nilfs_sc_info *nilfs_segctINIT_LIST_HEAD (&sci->sc_gc_inodes);INIT_LIST_HEAD (&sci->sc_iput_queue);INIT_WORK (&sci->sc_iput_work, nilfs_iput_work_func); -timer_setup (&sci->sc_timer, nilfs_construction_timeout,0 ); sci->sc_interval =HZ *NILFS_SC_DEFAULT_TIMEOUT ; sci->sc_mjcp_freq =HZ *NILFS_SC_DEFAULT_SR_FREQ ;
@@ -2814,7 +2828,6 @@ static void nilfs_segctor_destroy(structdown_write (&nilfs->ns_segctor_sem); -del_timer_sync (&sci->sc_timer);kfree (sci); }
Greg Kroah-Hartman
maintainerPATCH 170/202 vxlan: Fix regression when dropping packets due to invalid src addresses
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
commit 1cd4bc987abb2823836cbb8f887026011ccddc8a upstream.
Commit f58f45c1e5b9 ("vxlan: drop packets from invalid src-address") has recently been added to vxlan mainly in the context of source address snooping/learning so that when it is enabled, an entry in the FDB is not being created for an invalid address for the corresponding tunnel endpoint.
Before commit f58f45c1e5b9 vxlan was similarly behaving as geneve in that it passed through whichever macs were set in the L2 header. It turns out that this change in behavior breaks setups, for example, Cilium with netkit in L3 mode for Pods as well as tunnel mode has been passing before the change in f58f45c1e5b9 for both vxlan and geneve. After mentioned change it is only passing for geneve as in case of vxlan packets are dropped due to vxlan_set_mac() returning false as source and destination macs are zero which for E/W traffic via tunnel is totally fine.
Fix it by only opting into the is_valid_ether_addr() check in vxlan_set_mac() when in fact source address snooping/learning is actually enabled in vxlan. This is done by moving the check into vxlan_snoop(). With this change, the Cilium connectivity test suite passes again for both tunnel flavors.
[ Backport note: vxlan snooping/learning not supported in 6.8 or older,
so commit is simply a revert. ]
--- drivers/net/vxlan.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/net/vxlan.c +0 -4
@@ -1605,10 +1605,6 @@ static bool vxlan_set_mac(struct vxlan_dif (ether_addr_equal (eth_hdr (skb)->h_source, vxlan->dev->dev_addr))return false; -/* Ignore packets from invalid src-address */ -if (!is_valid_ether_addr (eth_hdr (skb)->h_source)) -return false; -/* Get address from the outer IP header */ if (vxlan_get_sk_family (vs) ==AF_INET ) { saddr.sin.sin_addr.s_addr =ip_hdr (skb)->saddr;